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 ++++++------ 4 files changed, 18 insertions(+), 10 deletions(-) (limited to 'EdkCompatibilityPkg/Foundation/Library/Dxe') 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; } -- cgit v1.2.3