mirror of https://github.com/acidanthera/audk.git
Refine some code to make code run safely.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10873 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0a16169be8
commit
52fb4d3d13
|
@ -717,7 +717,7 @@ F2UCreateNumericOpCode (
|
|||
// We need to create a default value.
|
||||
//
|
||||
ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));
|
||||
UOpcodeDefault.Header.Length = sizeof (UOpcodeDefault);
|
||||
UOpcodeDefault.Header.Length = (UINT8) sizeof (UOpcodeDefault);
|
||||
UOpcodeDefault.Header.OpCode = EFI_IFR_DEFAULT_OP;
|
||||
|
||||
UOpcodeDefault.DefaultId = 0;
|
||||
|
|
|
@ -813,7 +813,7 @@ ParseOpCodes (
|
|||
CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue, sizeof (UINT16));
|
||||
CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
|
||||
CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step, sizeof (UINT16));
|
||||
CurrentStatement->StorageWidth = sizeof (UINT16);
|
||||
CurrentStatement->StorageWidth = (UINT16) sizeof (UINT16);
|
||||
Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
|
||||
break;
|
||||
|
||||
|
@ -821,7 +821,7 @@ ParseOpCodes (
|
|||
CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue, sizeof (UINT32));
|
||||
CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
|
||||
CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step, sizeof (UINT32));
|
||||
CurrentStatement->StorageWidth = sizeof (UINT32);
|
||||
CurrentStatement->StorageWidth = (UINT16) sizeof (UINT32);
|
||||
Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
|
||||
break;
|
||||
|
||||
|
@ -829,7 +829,7 @@ ParseOpCodes (
|
|||
CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MinValue, sizeof (UINT64));
|
||||
CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
|
||||
CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.Step, sizeof (UINT64));
|
||||
CurrentStatement->StorageWidth = sizeof (UINT64);
|
||||
CurrentStatement->StorageWidth = (UINT16) sizeof (UINT64);
|
||||
Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
|
||||
break;
|
||||
|
||||
|
@ -866,7 +866,7 @@ ParseOpCodes (
|
|||
ASSERT (CurrentStatement != NULL);
|
||||
|
||||
CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags;
|
||||
CurrentStatement->StorageWidth = sizeof (BOOLEAN);
|
||||
CurrentStatement->StorageWidth = (UINT16) sizeof (BOOLEAN);
|
||||
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
|
||||
|
||||
break;
|
||||
|
|
|
@ -243,7 +243,7 @@ Returns:
|
|||
|
||||
for (Index = 0; Index < OptionCount; Index++) {
|
||||
OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
|
||||
OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||
OneOfOption.Header.Length = (UINT8) sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||
|
||||
OneOfOption.Option = OptionsList[Index].StringToken;
|
||||
OneOfOption.Value = OptionsList[Index].Value;
|
||||
|
@ -255,7 +255,7 @@ Returns:
|
|||
LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF_OPTION));
|
||||
}
|
||||
|
||||
EndOneOf.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
|
||||
EndOneOf.Header.Length = (UINT8) sizeof (EFI_IFR_END_ONE_OF);
|
||||
EndOneOf.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
|
||||
|
||||
EfiCopyMem (LocalBuffer, &EndOneOf, sizeof (EFI_IFR_END_ONE_OF));
|
||||
|
@ -331,7 +331,7 @@ Returns:
|
|||
|
||||
for (Index = 0; Index < OptionCount; Index++) {
|
||||
OrderedListOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
|
||||
OrderedListOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||
OrderedListOption.Header.Length = (UINT8) sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||
|
||||
OrderedListOption.Option = OptionsList[Index].StringToken;
|
||||
OrderedListOption.Value = OptionsList[Index].Value;
|
||||
|
@ -343,7 +343,7 @@ Returns:
|
|||
LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF_OPTION));
|
||||
}
|
||||
|
||||
EndOrderedList.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
|
||||
EndOrderedList.Header.Length = (UINT8) sizeof (EFI_IFR_END_ONE_OF);
|
||||
EndOrderedList.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
|
||||
|
||||
EfiCopyMem (LocalBuffer, &EndOrderedList, sizeof (EFI_IFR_END_ONE_OF));
|
||||
|
|
|
@ -45,5 +45,5 @@ GetPowerOfTwo64 (
|
|||
return 0;
|
||||
}
|
||||
|
||||
return LShiftU64 (1, HighBitSet64 (Operand));
|
||||
return LShiftU64 (1, (UINTN) HighBitSet64 (Operand));
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ BasePrintLibVSPrint (
|
|||
ArgumentString = StatusString [Index + WARNING_STATUS_NUMBER];
|
||||
}
|
||||
} else {
|
||||
Index = Status;
|
||||
Index = (UINTN) Status;
|
||||
if (Index <= WARNING_STATUS_NUMBER) {
|
||||
ArgumentString = StatusString [Index];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue