]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools
authorBi, Dandan <dandan.bi@intel.com>
Tue, 12 Sep 2017 08:56:14 +0000 (16:56 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 12 Sep 2017 09:22:05 +0000 (17:22 +0800)
V3: Remove one unnecessay type cast in patch 1.
Codes:
if (FilePosition + ExtentLength > ReadFileInfo->FilePosition) {
  Offset = ReadFileInfo->FilePosition - FilePosition;
  if (Offset < 0) {
    Offset = -(Offset)
  }
...
}
Offset is UINT64 can not < 0, so the code logic may have some issue.
and Offset = -(Offset) may build failure in some circumstance.
Previously type cast Offset to INT64 to fix build break. Now remove
the type cast. Then can to check the code logic later.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c

index 7d7f722188c5be79623282e5ea0ff6ee7fcacc71..5c5b5e3765af95444f37ade204e2bf1910e6a76c 100644 (file)
@@ -472,7 +472,7 @@ DuplicateFid (
 {\r
   *NewFileIdentifierDesc =\r
     (UDF_FILE_IDENTIFIER_DESCRIPTOR *)AllocateCopyPool (\r
-      GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc);\r
+      (UINTN) GetFidDescriptorLength (FileIdentifierDesc), FileIdentifierDesc);\r
 }\r
 \r
 //\r
@@ -809,7 +809,7 @@ GetAedAdsData (
   //\r
   // Allocate buffer to read in AED's data.\r
   //\r
-  *Data = AllocatePool (*Length);\r
+  *Data = AllocatePool ((UINTN) (*Length));\r
   if (*Data == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -818,7 +818,7 @@ GetAedAdsData (
     DiskIo,\r
     BlockIo->Media->MediaId,\r
     Offset,\r
-    *Length,\r
+    (UINTN) (*Length),\r
     *Data\r
     );\r
 }\r
@@ -844,7 +844,7 @@ GrowUpBufferToNextAd (
       return EFI_OUT_OF_RESOURCES;\r
     }\r
   } else {\r
-    *Buffer = ReallocatePool (Length, Length + ExtentLength, *Buffer);\r
+    *Buffer = ReallocatePool ((UINTN) Length, (UINTN) (Length + ExtentLength), *Buffer);\r
     if (*Buffer == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
@@ -933,7 +933,7 @@ ReadFile (
       //\r
       // Allocate buffer for starting read data.\r
       //\r
-      ReadFileInfo->FileData = AllocatePool (Length);\r
+      ReadFileInfo->FileData = AllocatePool ((UINTN) Length);\r
       if (ReadFileInfo->FileData == NULL) {\r
         return EFI_OUT_OF_RESOURCES;\r
       }\r
@@ -941,7 +941,7 @@ ReadFile (
       //\r
       // Read all inline data into ReadFileInfo->FileData\r
       //\r
-      CopyMem (ReadFileInfo->FileData, Data, Length);\r
+      CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length);\r
       ReadFileInfo->ReadLength = Length;\r
     } else if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ) {\r
       //\r
@@ -951,7 +951,7 @@ ReadFile (
       CopyMem (\r
         ReadFileInfo->FileData,\r
         (VOID *)((UINT8 *)Data + ReadFileInfo->FilePosition),\r
-        ReadFileInfo->FileDataSize\r
+        (UINTN) ReadFileInfo->FileDataSize\r
         );\r
 \r
       ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;\r
@@ -1099,7 +1099,7 @@ ReadFile (
           DiskIo,\r
           BlockIo->Media->MediaId,\r
           Offset + MultU64x32 (Lsn, LogicalBlockSize),\r
-          DataLength,\r
+          (UINTN) DataLength,\r
           (VOID *)((UINT8 *)ReadFileInfo->FileData +\r
                    DataOffset)\r
           );\r