]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Eliminate two shift-negative-value in FvLib.c
authorZenith432 <zenith432@users.sourceforge.net>
Mon, 16 May 2016 15:52:21 +0000 (23:52 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 18 May 2016 01:50:44 +0000 (09:50 +0800)
clang 3.8 flags -Wshift-negative-value warning, which turns fatal due to
use of -Werror.

Fixes: https://github.com/tianocore/edk2/issues/49
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/Common/FvLib.c

index 938aa098f5642cda2b2281853d4e2a8350fc1b89..f97a7f21ce63875d612c4100a7043ee2e0adfab6 100644 (file)
@@ -194,7 +194,7 @@ Returns:
   //\r
   // Get next file, compensate for 8 byte alignment if necessary.\r
   //\r
-  *NextFile = (EFI_FFS_FILE_HEADER *) ((((UINTN) CurrentFile - (UINTN) mFvHeader + GetFfsFileLength(CurrentFile) + 0x07) & (-1 << 3)) + (UINT8 *) mFvHeader);\r
+  *NextFile = (EFI_FFS_FILE_HEADER *) ((((UINTN) CurrentFile - (UINTN) mFvHeader + GetFfsFileLength(CurrentFile) + 0x07) & (~(UINTN) 7)) + (UINT8 *) mFvHeader);\r
 \r
   //\r
   // Verify file is in this FV.\r
@@ -479,7 +479,7 @@ Returns:
     //\r
     // Find next section (including compensating for alignment issues.\r
     //\r
-    CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetSectionFileLength(CurrentSection.CommonHeader) + 0x03) & (-1 << 2));\r
+    CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetSectionFileLength(CurrentSection.CommonHeader) + 0x03) & (~(UINTN) 3));\r
   }\r
 \r
   return EFI_NOT_FOUND;\r