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 <EfiBind.h> 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
This commit is contained in:
jljusten
2008-04-24 16:21:53 +00:00
parent 8067d3032c
commit 4cb43192bd
23 changed files with 93 additions and 46 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -167,7 +167,7 @@ Returns:
Operand >>= 1;
Bitpos++;
}
return (Bitpos - 1);
return (UINT8)(Bitpos - 1);
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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') {

View File

@@ -762,8 +762,6 @@ Returns: (VOID)
}
}
}
return ;
}
EFI_STATUS