From 4cb43192bd4a7b7eee05f5c33233459843636edb Mon Sep 17 00:00:00 2001 From: jljusten Date: Thu, 24 Apr 2008 16:21:53 +0000 Subject: Fix various warnings with the Intel C compiler. EfiBind.h: * Adding ignores for certain warnings with the Intel C compiler. (Partially merged from MdePkg.) EfiPxe.h: * Make sure PXE_NO_UINT64_SUPPORT is defined Decompress.c: * Removed 'unreachable' return statement. EdkCompatibilityPkg/**: (all other files) * Remove trailing comma from last value in enum. * Include instead of "EfiBind.h", or for some reason __STDC_VERSION__ is not defined. * Introduce more explicit function call ordering by storing results in local variables before using in a calculation. * Add some additional casting for BOOLEAN & UINT8 following calculations which change the type to 'int'. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5123 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c | 8 ++++++-- .../Foundation/Library/Dxe/EfiIfrSupportLib/IfrVariable.c | 6 +++++- .../Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c | 2 +- .../Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c | 12 ++++++------ EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Math.c | 2 +- .../Foundation/Library/EfiCommonLib/PostCode.c | 2 +- .../Foundation/Library/EfiCommonLib/ReportStatusCode.c | 3 ++- EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c | 10 +++++++--- .../Foundation/Library/Pei/PeiLib/Decompress.c | 2 -- 9 files changed, 29 insertions(+), 18 deletions(-) (limited to 'EdkCompatibilityPkg/Foundation/Library') diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c index 44370a5e1c..996421d039 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c @@ -119,6 +119,8 @@ Returns: UINT8 *Destination; UINTN Index; BOOLEAN Finished; + UINTN SizeofLanguage; + UINTN SizeofString; StringPack = (EFI_HII_STRING_PACK *) StringBuffer; Finished = FALSE; @@ -239,14 +241,16 @@ Returns: // // Pointing to a new string pack location // + SizeofLanguage = EfiStrSize (Language); + SizeofString = EfiStrSize (String); StringPackBuffer->Header.Length = (UINT32) ( sizeof (EFI_HII_STRING_PACK) - sizeof (EFI_STRING) + sizeof (RELOFST) + sizeof (RELOFST) + - EfiStrSize (Language) + - EfiStrSize (String) + SizeofLanguage + + SizeofString ); StringPackBuffer->Header.Type = EFI_HII_STRING; StringPackBuffer->LanguageNameString = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer); diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrVariable.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrVariable.c index 1340daf044..ef23d6fcc3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrVariable.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrVariable.c @@ -471,11 +471,15 @@ Returns: { EFI_STATUS Status; CHAR16 *NameSuffixed; + UINTN NameLength; + UINTN SuffixLength; // // enough to concatenate both strings. // - NameSuffixed = EfiLibAllocateZeroPool ((EfiStrLen (Name) + EfiStrLen (Suffix) + 1) * sizeof (CHAR16)); + NameLength = EfiStrLen (Name); + SuffixLength = EfiStrLen (Suffix); + NameSuffixed = EfiLibAllocateZeroPool ((NameLength + SuffixLength + 1) * sizeof (CHAR16)); EfiStrCpy (NameSuffixed, Name); EfiStrCat (NameSuffixed, Suffix); diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c index abee5318d8..222ca27763 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c @@ -118,7 +118,7 @@ UpdateFormPackageData ( EfiCopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); IfrOpHdr = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + sizeof (EFI_HII_PACKAGE_HEADER)); Offset = sizeof (EFI_HII_PACKAGE_HEADER); - GetFormSet = (FormSetGuid == NULL) ? TRUE : FALSE; + GetFormSet = (BOOLEAN)((FormSetGuid == NULL) ? TRUE : FALSE); GetForm = FALSE; Updated = FALSE; diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c index 3729fa216f..56463266d1 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c @@ -32,7 +32,7 @@ IsValidQuestionFlags ( IN UINT8 Flags ) { - return (Flags & (~QUESTION_FLAGS)) ? FALSE : TRUE; + return (BOOLEAN)((Flags & (~QUESTION_FLAGS)) ? FALSE : TRUE); } STATIC @@ -41,7 +41,7 @@ IsValidValueType ( IN UINT8 Type ) { - return (Type <= EFI_IFR_TYPE_OTHER) ? TRUE : FALSE; + return (BOOLEAN)((Type <= EFI_IFR_TYPE_OTHER) ? TRUE : FALSE); } STATIC @@ -67,7 +67,7 @@ IsValidCheckboxFlags ( IN UINT8 Flags ) { - return (Flags <= EFI_IFR_CHECKBOX_DEFAULT_MFG) ? TRUE : FALSE; + return (BOOLEAN)((Flags <= EFI_IFR_CHECKBOX_DEFAULT_MFG) ? TRUE : FALSE); } EFI_STATUS @@ -302,7 +302,7 @@ CreateOneOfOptionOpCode ( OneOfOption.Option = OptionsList[Index].StringToken; OneOfOption.Value = OptionsList[Index].Value; - OneOfOption.Flags = OptionsList[Index].Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG); + OneOfOption.Flags = (UINT8)(OptionsList[Index].Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG)); OneOfOption.Type = Type; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; @@ -360,7 +360,7 @@ CreateOneOfOpCode ( EfiCopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF)); Data->Offset += sizeof (EFI_IFR_ONE_OF); - CreateOneOfOptionOpCode (OptionCount, OptionsList, (OneOfFlags & EFI_IFR_NUMERIC_SIZE), Data); + CreateOneOfOptionOpCode (OptionCount, OptionsList, (UINT8)(OneOfFlags & EFI_IFR_NUMERIC_SIZE), Data); CreateEndOpCode (Data); @@ -549,7 +549,7 @@ CreateNumericOpCode ( Data->Offset += sizeof (EFI_IFR_NUMERIC); DefaultValue.u64 = Default; - Status = CreateDefaultOpCode (&DefaultValue, (NumericFlags & EFI_IFR_NUMERIC_SIZE), Data); + Status = CreateDefaultOpCode (&DefaultValue, (UINT8)(NumericFlags & EFI_IFR_NUMERIC_SIZE), Data); if (EFI_ERROR(Status)) { return Status; } diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Math.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Math.c index 64e683ec89..ba00c8bb3d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Math.c +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Math.c @@ -167,7 +167,7 @@ Returns: Operand >>= 1; Bitpos++; } - return (Bitpos - 1); + return (UINT8)(Bitpos - 1); } diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/PostCode.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/PostCode.c index 31232bebdc..69171eaeae 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/PostCode.c +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/PostCode.c @@ -54,7 +54,7 @@ Returns: if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) || ((CodeType & EFI_STATUS_CODE_TYPE_MASK)== EFI_ERROR_CODE)) { *PostCode = (UINT8) (((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5); - *PostCode |= (UINT8) (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f); + *PostCode = (UINT8)(*PostCode | (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f)); return TRUE; } diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c index 4a9fca82bc..49328e6ca2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c @@ -196,7 +196,8 @@ Returns: // Make sure it will all fit in the passed in buffer // TotalSize = sizeof (EFI_STATUS_CODE_DATA) + sizeof (EFI_DEBUG_ASSERT_DATA); - TotalSize += EfiAsciiStrLen (Filename) + EfiAsciiStrLen (Description); + TotalSize += EfiAsciiStrLen (Filename); + TotalSize += EfiAsciiStrLen (Description); if (TotalSize > BufferSize) { return EFI_BUFFER_TOO_SMALL; } diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c index 150f650598..54523b2417 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/String.c @@ -593,7 +593,7 @@ HexStringToBuf ( } else { Byte = Buf[Idx / 2]; Byte &= 0x0F; - Byte |= Digit << 4; + Byte = (UINT8)(Byte | (Digit << 4)); } Buf[Idx / 2] = Byte; @@ -749,9 +749,11 @@ Returns: Sub = StrCharSet; while ((*String != L'\0') && (*StrCharSet != L'\0')) { - if (*String++ != *StrCharSet++) { + if (*String++ != *StrCharSet) { String = ++Src; StrCharSet = Sub; + } else { + StrCharSet++; } } if (*StrCharSet == L'\0') { @@ -788,9 +790,11 @@ Returns: Sub = StrCharSet; while ((*String != '\0') && (*StrCharSet != '\0')) { - if (*String++ != *StrCharSet++) { + if (*String++ != *StrCharSet) { String = ++Src; StrCharSet = Sub; + } else { + StrCharSet++; } } if (*StrCharSet == '\0') { diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Decompress.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Decompress.c index d35d946d63..efcda80334 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Decompress.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Decompress.c @@ -762,8 +762,6 @@ Returns: (VOID) } } } - - return ; } EFI_STATUS -- cgit v1.2.3