From f760c0ca744804f0c0d47fe8a50a2c36dfbd4d0f Mon Sep 17 00:00:00 2001 From: Download-Fritz Date: Sun, 24 Mar 2019 13:17:29 +0100 Subject: [PATCH] OcMachoLib and OcAppleKernelLib: Silence warnings. --- Library/OcAppleKernelLib/Link.c | 2 +- Library/OcMachoLib/Header.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Library/OcAppleKernelLib/Link.c b/Library/OcAppleKernelLib/Link.c index 5ff14869..367cd6df 100644 --- a/Library/OcAppleKernelLib/Link.c +++ b/Library/OcAppleKernelLib/Link.c @@ -653,7 +653,7 @@ InternalRelocateRelocationIntel64 ( (RelocationBase + Address), &MaxSize ); - if ((InstructionPtr == NULL) || (MaxSize < ((Length != 3) ? 4 : 8))) { + if ((InstructionPtr == NULL) || (MaxSize < ((Length != 3) ? 4U : 8U))) { return MAX_UINTN; } diff --git a/Library/OcMachoLib/Header.c b/Library/OcMachoLib/Header.c index 28c7717b..9d266619 100644 --- a/Library/OcMachoLib/Header.c +++ b/Library/OcMachoLib/Header.c @@ -1031,7 +1031,7 @@ MachoGetFilePointerByAddress64 ( ) { CONST MACH_SEGMENT_COMMAND_64 *Segment; - UINT32 Offset; + UINT64 Offset; Segment = NULL; while ((Segment = MachoGetNextSegment64 (Context, Segment)) != NULL) { @@ -1040,11 +1040,11 @@ MachoGetFilePointerByAddress64 ( Offset = (Address - Segment->VirtualAddress); if (MaxSize != NULL) { - *MaxSize = (Segment->Size - Offset); + *MaxSize = (UINT32)(Segment->Size - Offset); } Offset += Segment->FileOffset; - return (VOID *)((UINTN)Context->MachHeader + Offset); + return (VOID *)((UINTN)Context->MachHeader + (UINTN)Offset); } } @@ -1275,11 +1275,11 @@ MachoExpandImage64 ( // for (Index = 0; Index < DstSegment->NumSections; ++Index) { if (DstSegment->Sections[Index].Offset == 0) { - DstSegment->Sections[Index].Offset = CopyFileOffset + CurrentDelta; - CurrentDelta += DstSegment->Sections[Index].Size; + DstSegment->Sections[Index].Offset = (UINT32)CopyFileOffset + CurrentDelta; + CurrentDelta += (UINT32)DstSegment->Sections[Index].Size; } else { DstSegment->Sections[Index].Offset += CurrentDelta; - OriginalDelta = CopyFileOffset + DstSegment->Sections[Index].Size; + OriginalDelta = (UINT32)(CopyFileOffset + DstSegment->Sections[Index].Size); CopyFileOffset = DstSegment->Sections[Index].Offset + DstSegment->Sections[Index].Size; } } @@ -1288,7 +1288,7 @@ MachoExpandImage64 ( // The following is true for all valid data, and invalid data will be caught by fits check. // CopyFileOffset + CurrentDelta <= DstSegment->FileOffset + DstSegment->FileSize // - OriginalDelta = DstSegment->FileOffset + DstSegment->FileSize - CopyFileOffset - CurrentDelta; + OriginalDelta = (UINT32)(DstSegment->FileOffset + DstSegment->FileSize - CopyFileOffset - CurrentDelta); CurrentDelta -= MIN (OriginalDelta, CurrentDelta); }