Update to add the ASSERT()s in the right place.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7325 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2009-01-21 05:37:27 +00:00
parent 4a1102c9ae
commit a833f286fb

View File

@ -270,11 +270,14 @@ BdsLibRegisterNewOption (
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
&TempOptionSize &TempOptionSize
); );
ASSERT (TempOptionPtr != NULL);
// //
// Compare with current option variable // Compare with current option variable if the previous option is set in global variable.
// //
for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) { for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {
//
// TempOptionPtr must not be NULL if we have non-zero TempOptionSize.
//
ASSERT (TempOptionPtr != NULL);
if (*VariableName == 'B') { if (*VariableName == 'B') {
UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]); UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);
@ -336,8 +339,10 @@ BdsLibRegisterNewOption (
if (UpdateDescription) { if (UpdateDescription) {
// //
// The number in option#### to be updated // The number in option#### to be updated.
// In this case, we must have non-NULL TempOptionPtr.
// //
ASSERT (TempOptionPtr != NULL);
RegisterOptionNumber = TempOptionPtr[Index]; RegisterOptionNumber = TempOptionPtr[Index];
} else { } else {
// //
@ -393,14 +398,17 @@ BdsLibRegisterNewOption (
} }
return Status; return Status;
} }
//
// TempOptionPtr must not be NULL if TempOptionSize is not zero.
//
ASSERT (TempOptionPtr != NULL);
// //
// Append the new option number to the original option order // Append the new option number to the original option order
// //
OrderItemNum = (TempOptionSize / sizeof (UINT16)) + 1 ; OrderItemNum = (TempOptionSize / sizeof (UINT16)) + 1 ;
OptionOrderPtr = AllocateZeroPool ( OrderItemNum * sizeof (UINT16)); OptionOrderPtr = AllocateZeroPool ( OrderItemNum * sizeof (UINT16));
ASSERT (OptionOrderPtr!= NULL); ASSERT (OptionOrderPtr!= NULL);
CopyMem (OptionOrderPtr, TempOptionPtr, (OrderItemNum - 1) * sizeof (UINT16)); CopyMem (OptionOrderPtr, TempOptionPtr, (OrderItemNum - 1) * sizeof (UINT16));
OptionOrderPtr[Index] = RegisterOptionNumber; OptionOrderPtr[Index] = RegisterOptionNumber;