MdeModulePkg/UdfDxe: Add type cast to fix build failure in VS tools

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>
This commit is contained in:
Bi, Dandan 2017-09-12 16:56:14 +08:00 committed by Star Zeng
parent 1f48070740
commit 0b4c8f003a
1 changed files with 8 additions and 8 deletions

View File

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