Replace some CopyMem() for GUID copy with CopyGuid().

Replace some gBS->FreePool() with FreePool().
Add EFIAPI modifier.
Removed inconsistent OPTIONAL modifier.
Coding style issue fix.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7176 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
gdong1 2009-01-04 08:06:07 +00:00
parent 3a306c1006
commit 409f118c84
11 changed files with 244 additions and 252 deletions

View File

@ -36,9 +36,9 @@
@param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID.
@Param ... The variable argument list of package pointers.
@param ... The variable argument list of package pointers.
@return The allocated and initialized packages.
@return The allocated and initialized packages.
**/
EFI_HII_PACKAGES *
EFIAPI

View File

@ -39,11 +39,12 @@ typedef struct {
language variable, then use default setting that 'eng' as current
language setting.
@param Lang Pointer of system language
@param Lang Pointer of system language
@return whether sucess to get setting from variable
@return whether success to get setting from variable
**/
EFI_STATUS
EFIAPI
GetCurrentLanguage (
OUT CHAR16 *Lang
);
@ -60,6 +61,7 @@ GetCurrentLanguage (
@retval EFI_SUCCESS String successfully added to the incoming buffer
**/
EFI_STATUS
EFIAPI
AddString (
IN VOID *StringBuffer,
IN CHAR16 *Language,
@ -77,6 +79,7 @@ AddString (
@retval EFI_SUCCESS Op-code data successfully inserted
**/
EFI_STATUS
EFIAPI
AddOpCode (
IN VOID *FormBuffer,
IN OUT VOID *OpCodeData
@ -99,6 +102,7 @@ AddOpCode (
@retval EFI_SUCCESS Formset successfully created
**/
EFI_STATUS
EFIAPI
CreateFormSet (
IN CHAR16 *FormSetTitle,
IN EFI_GUID *Guid,
@ -122,6 +126,7 @@ CreateFormSet (
@retval EFI_SUCCESS Form successfully created
**/
EFI_STATUS
EFIAPI
CreateForm (
IN CHAR16 *FormTitle,
IN UINT16 FormId,
@ -142,6 +147,7 @@ CreateForm (
@retval EFI_SUCCESS Subtitle successfully created
**/
EFI_STATUS
EFIAPI
CreateSubTitle (
IN CHAR16 *SubTitle,
IN OUT VOID *FormBuffer,
@ -164,6 +170,7 @@ CreateSubTitle (
@retval EFI_SUCCESS Text successfully created
**/
EFI_STATUS
EFIAPI
CreateText (
IN CHAR16 *String,
IN CHAR16 *String2,
@ -185,6 +192,7 @@ CreateText (
@retval EFI_SUCCESS Hyperlink successfully created
**/
EFI_STATUS
EFIAPI
CreateGoto (
IN UINT16 FormId,
IN CHAR16 *Prompt,
@ -209,6 +217,7 @@ CreateGoto (
@retval EFI_SUCCESS One-Of box successfully created.
**/
EFI_STATUS
EFIAPI
CreateOneOf (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -236,6 +245,7 @@ CreateOneOf (
@retval EFI_SUCCESS Ordered list successfully created.
**/
EFI_STATUS
EFIAPI
CreateOrderedList (
IN UINT16 QuestionId,
IN UINT8 MaxEntries,
@ -262,6 +272,7 @@ CreateOrderedList (
@retval EFI_SUCCESS Check box successfully created
**/
EFI_STATUS
EFIAPI
CreateCheckBox (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -292,6 +303,7 @@ CreateCheckBox (
@retval EFI_SUCCESS Numeric is successfully created
**/
EFI_STATUS
EFIAPI
CreateNumeric (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -323,6 +335,7 @@ CreateNumeric (
@retval EFI_SUCCESS String successfully created.
**/
EFI_STATUS
EFIAPI
CreateString (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -350,6 +363,7 @@ CreateString (
@retval EFI_SUCCESS Successfully extract data from Hii database.
**/
EFI_STATUS
EFIAPI
ExtractDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
IN OUT UINT16 *ImageLength,
@ -368,7 +382,8 @@ ExtractDataFromHiiHandle (
@return Handle to the HII pack previously registered by the memory driver.
**/
FRAMEWORK_EFI_HII_HANDLE
FRAMEWORK_EFI_HII_HANDLE
EFIAPI
FindHiiHandle (
IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
IN EFI_GUID *Guid
@ -386,6 +401,7 @@ FindHiiHandle (
@retval EFI_SUCCESS Subtitle created to be a form
**/
EFI_STATUS
EFIAPI
CreateSubTitleOpCode (
IN STRING_REF StringToken,
IN OUT VOID *FormBuffer
@ -408,6 +424,7 @@ CreateSubTitleOpCode (
@retval EFI_SUCCESS Text created to be a form
**/
EFI_STATUS
EFIAPI
CreateTextOpCode (
IN STRING_REF StringToken,
IN STRING_REF StringTokenTwo,
@ -434,6 +451,7 @@ CreateTextOpCode (
@retval EFI_SUCCESS Hyperlink created to be a form
**/
EFI_STATUS
EFIAPI
CreateGotoOpCode (
IN UINT16 FormId,
IN STRING_REF StringToken,
@ -465,6 +483,7 @@ CreateGotoOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2
**/
EFI_STATUS
EFIAPI
CreateOneOfOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -495,6 +514,7 @@ CreateOneOfOpCode (
@retval EFI_SUCCESS Ordered list created to be a form
**/
EFI_STATUS
EFIAPI
CreateOrderedListOpCode (
IN UINT16 QuestionId,
IN UINT8 MaxEntries,
@ -523,6 +543,7 @@ CreateOrderedListOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 1
**/
EFI_STATUS
EFIAPI
CreateCheckBoxOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -556,6 +577,7 @@ CreateCheckBoxOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2
**/
EFI_STATUS
EFIAPI
CreateNumericOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -589,6 +611,7 @@ CreateNumericOpCode (
@retval EFI_SUCCESS String created to be a form.
**/
EFI_STATUS
EFIAPI
CreateStringOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -615,6 +638,7 @@ CreateStringOpCode (
@retval EFI_SUCCESS Data successfully validated
**/
EFI_STATUS
EFIAPI
ValidateDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
OUT BOOLEAN *Results
@ -631,6 +655,7 @@ ValidateDataFromHiiHandle (
@retval EFI_SUCCESS Banner created to be a form.
**/
EFI_STATUS
EFIAPI
CreateBannerOpCode (
IN UINT16 Title,
IN UINT16 LineNumber,
@ -649,6 +674,7 @@ CreateBannerOpCode (
@param Size Size of the variable/map in bytes
**/
VOID
EFIAPI
EfiLibHiiVariablePackGetMap (
IN EFI_HII_VARIABLE_PACK *Pack,
OUT CHAR16 **Name, OPTIONAL
@ -666,6 +692,7 @@ EfiLibHiiVariablePackGetMap (
@return The number of map count.
**/
UINTN
EFIAPI
EfiLibHiiVariablePackListGetMapCnt (
IN EFI_HII_VARIABLE_PACK_LIST *List
);
@ -696,6 +723,7 @@ typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (
@param Callback Routine to be called for each iterated variable.
**/
VOID
EFIAPI
EfiLibHiiVariablePackListForEachVar (
IN EFI_HII_VARIABLE_PACK_LIST *List,
IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
@ -717,6 +745,7 @@ EfiLibHiiVariablePackListForEachVar (
@return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapByIdx (
IN UINTN Idx,
IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -742,6 +771,7 @@ EfiLibHiiVariablePackListGetMapByIdx (
@retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapById (
IN UINT16 Id,
IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -765,6 +795,7 @@ EfiLibHiiVariablePackListGetMapById (
@retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMap (
IN EFI_HII_VARIABLE_PACK_LIST *List,
IN CHAR16 *Name,
@ -789,6 +820,7 @@ EfiLibHiiVariablePackListGetMap (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariableRetrieveFromNv (
IN CHAR16 *Name,
IN EFI_GUID *Guid,
@ -805,8 +837,8 @@ EfiLibHiiVariableRetrieveFromNv (
@param Suffix Suffix the Name should end with.
@param Name Name of the variable to retrieve.
@Param Guid Guid of the variable to retrieve.
@Param Size Parameters of the variable to retrieve.
@param Guid Guid of the variable to retrieve.
@param Size Parameters of the variable to retrieve.
@param Var Variable will be retrieved into this buffer.
Caller is responsible for providing storage of exactly Size size in bytes.
@ -816,6 +848,7 @@ EfiLibHiiVariableRetrieveFromNv (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideIfSuffix (
IN CHAR16 *Suffix,
IN CHAR16 *Name,
@ -843,6 +876,7 @@ EfiLibHiiVariableOverrideIfSuffix (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideBySuffix (
IN CHAR16 *Suffix,
IN CHAR16 *Name,

View File

@ -86,12 +86,15 @@ typedef UINT16 FRAMEWORK_EFI_HII_HANDLE;
//
// The following types are currently defined:
// EFI_FROM_ID has been defined in UEFI spec.
// EFI_FORM_ID has been defined in UEFI spec.
//
typedef UINT16 EFI_FORM_LABEL;
#pragma pack(1)
//
// The header found at the start of each package.
//
typedef struct {
UINT32 Length;
UINT16 Type;

View File

@ -32,25 +32,25 @@ EFI_HII_PROTOCOL *mHii = NULL;
instance.
If protocol of gEfiHiiProtocolGuid is not installed, then ASSERT().
@param ImageHandle The image handle of driver module who use this library
instance.
@param ImageHandle The image handle of driver module who use this library instance.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS library constuctor always success.
**/
EFI_STATUS
EFIAPI
FrameworkHiiLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiHiiProtocolGuid,
NULL,
(VOID **) &mHii
);
&gEfiHiiProtocolGuid,
NULL,
(VOID **) &mHii
);
ASSERT_EFI_ERROR (Status);
ASSERT (mHii != NULL);
@ -67,22 +67,22 @@ FrameworkHiiLibConstructor (
@param Guid Given GUID of a HII package list.
@param Marker Package's content list.
@return pointer to new created HII package list.
@return pointer to new created HII package list.
**/
EFI_HII_PACKAGES *
InternalPreparePackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
IN VA_LIST Marker
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
IN VA_LIST Marker
)
{
EFI_HII_PACKAGES *HiiPackages;
VOID **Package;
UINTN Index;
EFI_HII_PACKAGES *HiiPackages;
VOID **Package;
UINTN Index;
ASSERT (NumberOfPackages > 0);
HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));
HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));
ASSERT (HiiPackages != NULL);
HiiPackages->GuidId = (EFI_GUID *) Guid;
@ -95,7 +95,6 @@ InternalPreparePackages (
}
return HiiPackages;
}
/**
@ -106,22 +105,21 @@ InternalPreparePackages (
@param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID.
@Param ... The variable argument list of package pointers.
@param ... The variable argument list of package pointers.
@return The allocated and initialized packages.
@return The allocated and initialized packages.
**/
EFI_HII_PACKAGES *
EFIAPI
PreparePackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
...
)
{
VA_LIST Args;
VA_LIST Args;
VA_START (Args, Guid);
return InternalPreparePackages (NumberOfPackages, Guid, Args);
}
@ -135,35 +133,33 @@ PreparePackages (
Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The
Handle to the newly registered Package List is returned throught HiiHandle.
@param NumberOfPackages The number of HII packages to register.
@param GuidId Package List GUID ID.
@param DriverHandle The pointer of driver handle
@param HiiHandle The ID used to retrieve the Package List later.
@param ... The variable argument list describing all HII Package.
@param NumberOfPackages The number of HII packages to register.
@param GuidId Package List GUID ID.
@param DriverHandle The pointer of driver handle
@param HiiHandle The ID used to retrieve the Package List later.
@param ... The variable argument list describing all HII Package.
@return
The allocated and initialized packages.
@return The allocated and initialized packages.
**/
EFI_STATUS
EFIAPI
HiiLibAddPackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId,
IN EFI_HANDLE DriverHandle, OPTIONAL
OUT EFI_HII_HANDLE *HiiHandle, OPTIONAL
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *GuidId,
IN EFI_HANDLE DriverHandle, OPTIONAL
OUT EFI_HII_HANDLE *HiiHandle,
...
)
{
VA_LIST Args;
EFI_HII_PACKAGES *FrameworkHiiPacages;
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_STATUS Status;
VA_LIST Args;
EFI_HII_PACKAGES *FrameworkHiiPacages;
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_STATUS Status;
VA_START (Args, HiiHandle);
FrameworkHiiPacages = InternalPreparePackages (NumberOfPackages, GuidId, Args);
Status = mHii->NewPack (mHii, FrameworkHiiPacages, &FrameworkHiiHandle);
FrameworkHiiPacages = InternalPreparePackages (NumberOfPackages, GuidId, Args);
Status = mHii->NewPack (mHii, FrameworkHiiPacages, &FrameworkHiiHandle);
if (HiiHandle != NULL) {
if (EFI_ERROR (Status)) {
*HiiHandle = NULL;
@ -183,24 +179,22 @@ HiiLibAddPackages (
If HiiHandle is NULL, then ASSERT.
If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.
@param HiiHandle The handle that was previously registered to the data base that is requested for removal.
List later.
@param HiiHandle The handle that was previously registered to the data base that is requested for removal.
@return VOID
@return VOID
**/
VOID
EFIAPI
HiiLibRemovePackages (
IN EFI_HII_HANDLE HiiHandle
IN EFI_HII_HANDLE HiiHandle
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = mHii->RemovePack (mHii, (FRAMEWORK_EFI_HII_HANDLE) (UINTN) HiiHandle);
ASSERT_EFI_ERROR (Status);
}
/**
This function adds the string into String Package of each language.
@ -220,22 +214,22 @@ HiiLibRemovePackages (
EFI_STATUS
EFIAPI
HiiLibNewString (
IN EFI_HII_HANDLE PackageList,
OUT EFI_STRING_ID *StringId,
IN CONST EFI_STRING String
IN EFI_HII_HANDLE PackageList,
OUT EFI_STRING_ID *StringId,
IN CONST EFI_STRING String
)
{
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_STATUS Status;
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_STATUS Status;
FrameworkHiiHandle = (FRAMEWORK_EFI_HII_HANDLE) (UINTN) PackageList;
Status = mHii->NewString (
mHii,
NULL,
FrameworkHiiHandle,
StringId,
String
);
mHii,
NULL,
FrameworkHiiHandle,
StringId,
String
);
return Status;
}
@ -254,14 +248,13 @@ HiiLibNewString (
@retval EFI_SUCCESS Operation is successful.
@retval EFI_OUT_OF_RESOURCES There is not enought memory in the system.
**/
EFI_STATUS
EFIAPI
HiiLibGetStringFromToken (
IN EFI_GUID *ProducerGuid,
IN EFI_STRING_ID StringId,
OUT EFI_STRING *String
IN EFI_GUID *ProducerGuid,
IN EFI_STRING_ID StringId,
OUT EFI_STRING *String
)
{
return EFI_SUCCESS;
@ -287,9 +280,9 @@ HiiLibGetStringFromToken (
EFI_STATUS
EFIAPI
HiiLibGetStringFromHandle (
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
OUT EFI_STRING *String
IN EFI_HII_HANDLE PackageList,
IN EFI_STRING_ID StringId,
OUT EFI_STRING *String
)
{
return EFI_SUCCESS;
@ -302,13 +295,14 @@ HiiLibGetStringFromHandle (
The implement set DriverHandle to NULL simpliy to let
handle manager create a default new handle.
@param[out] DriverHandle the pointer of driver handle
@return always successful.
@param DriverHandle The pointer of driver handle
@return Always success.
**/
EFI_STATUS
EFIAPI
HiiLibCreateHiiDriverHandle (
OUT EFI_HANDLE *DriverHandle
OUT EFI_HANDLE *DriverHandle
)
{
//

View File

@ -26,6 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@return whether sucess to get setting from variable
**/
EFI_STATUS
EFIAPI
GetCurrentLanguage (
OUT CHAR16 *Lang
)
@ -39,7 +40,6 @@ GetCurrentLanguage (
// Getting the system language and placing it into our Global Data
//
Size = sizeof (Language);
Status = gRT->GetVariable (
(CHAR16 *) L"Lang",
&gEfiGlobalVariableGuid,
@ -47,7 +47,6 @@ GetCurrentLanguage (
&Size,
Language
);
if (EFI_ERROR (Status)) {
AsciiStrCpy (Language, "eng");
}
@ -80,6 +79,7 @@ GetCurrentLanguage (
@retval EFI_SUCCESS String successfully added to the incoming buffer
**/
EFI_STATUS
EFIAPI
AddString (
IN VOID *StringBuffer,
IN CHAR16 *Language,
@ -146,8 +146,8 @@ AddString (
//
// Add a new stringpointer in the new buffer since we are adding a string. Null terminate it
//
PackDestination[Index] = (UINT16)(PackDestination[Index-1] +
StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index-1])));
PackDestination[Index] = (UINT16)(PackDestination[Index - 1] +
StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index - 1])));
PackDestination[Index + 1] = (UINT16) 0;
//
@ -274,7 +274,7 @@ AddString (
//
// Free the newly created buffer since we don't need it anymore
//
gBS->FreePool (NewBuffer);
FreePool (NewBuffer);
return EFI_SUCCESS;
}
@ -288,6 +288,7 @@ AddString (
@retval EFI_SUCCESS Op-code data successfully inserted
**/
EFI_STATUS
EFIAPI
AddOpCode (
IN VOID *FormBuffer,
IN OUT VOID *OpCodeData
@ -307,12 +308,11 @@ AddOpCode (
return EFI_OUT_OF_RESOURCES;
}
Source = (UINT8 *) FormBuffer;
Destination = (UINT8 *) NewBuffer;
//
// Copy the IFR Package header to the new buffer
//
Source = (UINT8 *) FormBuffer;
Destination = (UINT8 *) NewBuffer;
CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER));
//
@ -326,7 +326,7 @@ AddOpCode (
//
for (; ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->OpCode != FRAMEWORK_EFI_IFR_END_FORM_OP;) {
//
// If the this opcode is an end_form_set we better be creating and endform
// If the opcode is an end_form_set we better be creating and endform
// Nonetheless, we will add data before the end_form_set. This also provides
// for interesting behavior in the code we will run, but has no bad side-effects
// since we will possibly do a 0 byte copy in this particular end-case.
@ -351,8 +351,8 @@ AddOpCode (
// Prior to the end_form is where we insert the new op-code data
//
CopyMem (Destination, OpCodeData, ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length);
Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length;
Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length;
NewBuffer->Length = (UINT32) (NewBuffer->Length + (UINT32) (((FRAMEWORK_EFI_IFR_OP_HEADER *) OpCodeData)->Length));
//
@ -361,14 +361,10 @@ AddOpCode (
CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length);
//
// Adjust Source/Destination to next op-code location
// Copy end-formset data to new buffer
//
Destination = Destination + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length;
Source = Source + (UINTN) ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length;
//
// Copy end-formset data to new buffer
//
CopyMem (Destination, Source, ((FRAMEWORK_EFI_IFR_OP_HEADER *) Source)->Length);
//
@ -380,7 +376,7 @@ AddOpCode (
//
// Free the newly created buffer since we don't need it anymore
//
gBS->FreePool (NewBuffer);
FreePool (NewBuffer);
return EFI_SUCCESS;
}
@ -392,6 +388,7 @@ AddOpCode (
@return the statue of locating HII protocol
**/
EFI_STATUS
EFIAPI
GetHiiInterface (
OUT EFI_HII_PROTOCOL **Hii
)
@ -424,6 +421,7 @@ GetHiiInterface (
@retval EFI_SUCCESS Successfully extract data from Hii database.
**/
EFI_STATUS
EFIAPI
ExtractDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
IN OUT UINT16 *ImageLength,
@ -463,7 +461,7 @@ ExtractDataFromHiiHandle (
//
Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);
if (EFI_ERROR (Status)) {
gBS->FreePool (RawData);
FreePool (RawData);
//
// Allocate space for retrieval of IFR data
@ -493,7 +491,7 @@ ExtractDataFromHiiHandle (
//
// Copy the GUID information from this handle
//
CopyMem (Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
CopyGuid (Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid);
break;
case FRAMEWORK_EFI_IFR_ONE_OF_OP:
@ -523,7 +521,7 @@ ExtractDataFromHiiHandle (
// Return an error if buffer is too small
//
if (SizeOfNvStore > *ImageLength) {
gBS->FreePool (OldData);
FreePool (OldData);
*ImageLength = (UINT16) SizeOfNvStore;
return EFI_BUFFER_TOO_SMALL;
}
@ -570,7 +568,7 @@ ExtractDataFromHiiHandle (
//
// Free our temporary repository of form data
//
gBS->FreePool (OldData);
FreePool (OldData);
return EFI_SUCCESS;
}
@ -586,7 +584,8 @@ ExtractDataFromHiiHandle (
@return Handle to the HII pack previously registered by the memory driver.
**/
FRAMEWORK_EFI_HII_HANDLE
FRAMEWORK_EFI_HII_HANDLE
EFIAPI
FindHiiHandle (
IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
IN EFI_GUID *Guid
@ -646,7 +645,7 @@ FindHiiHandle (
//
if (Status == EFI_BUFFER_TOO_SMALL) {
gBS->FreePool (HiiHandleBuffer);
FreePool (HiiHandleBuffer);
HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);
ASSERT (HiiHandleBuffer != NULL);
@ -679,7 +678,7 @@ FindHiiHandle (
}
lbl_exit:
gBS->FreePool (HiiHandleBuffer);
FreePool (HiiHandleBuffer);
return HiiHandle;
}
@ -697,6 +696,7 @@ lbl_exit:
@retval EFI_SUCCESS Data successfully validated
**/
EFI_STATUS
EFIAPI
ValidateDataFromHiiHandle (
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
OUT BOOLEAN *Results
@ -739,7 +739,7 @@ ValidateDataFromHiiHandle (
//
Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);
if (EFI_ERROR (Status)) {
gBS->FreePool (RawData);
FreePool (RawData);
//
// Allocate space for retrieval of IFR data
@ -764,10 +764,9 @@ ValidateDataFromHiiHandle (
for (Index = 0; RawData[Index] != FRAMEWORK_EFI_IFR_END_FORM_SET_OP;) {
if (RawData[Index] == FRAMEWORK_EFI_IFR_FORM_SET_OP) {
CopyMem (&Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
CopyGuid (&Guid, &((FRAMEWORK_EFI_IFR_FORM_SET *) &RawData[Index])->Guid);
break;
}
Index = RawData[Index + 1] + Index;
}
@ -829,7 +828,7 @@ ValidateDataFromHiiHandle (
//
// Free the buffer that was allocated that was too small
//
gBS->FreePool (VariableData);
FreePool (VariableData);
VariableData = AllocatePool (SizeOfNvStore);
if (VariableData == NULL) {

View File

@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "IfrSupportLibInternal.h"
/**
Create a formset
Create a formset.
The form package is a collection of forms that are intended to describe the pages that will be
displayed to the user.
@ -31,6 +31,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@retval EFI_SUCCESS Formset successfully created
**/
EFI_STATUS
EFIAPI
CreateFormSet (
IN CHAR16 *FormSetTitle,
IN EFI_GUID *Guid,
@ -61,20 +62,15 @@ CreateFormSet (
//
StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);
if (StringBuffer == NULL) {
gBS->FreePool (FormBuffer);
FreePool (FormBuffer);
return EFI_OUT_OF_RESOURCES;
}
//
// Obtain current language value
// Add FormSetTitle to the StringBuffer, get FormSetTitle's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add the FormSetTitle to the string buffer and get the StringToken
//
Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -93,28 +89,26 @@ CreateFormSet (
FormSet.FormSetTitle = StringToken;
FormSet.Class = Class;
FormSet.SubClass = SubClass;
CopyMem (&FormSet.Guid, Guid, sizeof (EFI_GUID));
CopyGuid (&FormSet.Guid, Guid);
//
// Initialize the end formset data
//
EndFormSet.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET);
EndFormSet.Header.OpCode = FRAMEWORK_EFI_IFR_END_FORM_SET_OP;
Destination = (UINT8 *) *FormBuffer;
//
// Copy the formset/endformset data to the form buffer
//
Destination = (UINT8 *) *FormBuffer;
CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER));
Destination = Destination + sizeof (EFI_HII_PACK_HEADER);
CopyMem (Destination, &FormSet, sizeof (FRAMEWORK_EFI_IFR_FORM_SET));
Destination = Destination + sizeof (FRAMEWORK_EFI_IFR_FORM_SET);
CopyMem (Destination, &EndFormSet, sizeof (FRAMEWORK_EFI_IFR_END_FORM_SET));
return EFI_SUCCESS;
}
@ -132,6 +126,7 @@ CreateFormSet (
@retval EFI_SUCCESS Form successfully created
**/
EFI_STATUS
EFIAPI
CreateForm (
IN CHAR16 *FormTitle,
IN UINT16 FormId,
@ -146,12 +141,10 @@ CreateForm (
STRING_REF StringToken;
//
// Obtain current language value
// Add FormTitle to the StringBuffer, get FormTitle's token
//
GetCurrentLanguage (CurrentLanguage);
Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -161,8 +154,7 @@ CreateForm (
Form.FormId = FormId;
Form.FormTitle = StringToken;
Status = AddOpCode (FormBuffer, &Form);
Status = AddOpCode (FormBuffer, &Form);
if (EFI_ERROR (Status)) {
return Status;
}
@ -171,12 +163,12 @@ CreateForm (
EndForm.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_FORM);
Status = AddOpCode (FormBuffer, &EndForm);
return Status;
}
/**
Create a SubTitle
Create a SubTitle.
Subtitle strings are intended to be used by authors to separate sections of questions into semantic
groups.
@ -188,6 +180,7 @@ CreateForm (
@retval EFI_SUCCESS Subtitle successfully created
**/
EFI_STATUS
EFIAPI
CreateSubTitle (
IN CHAR16 *SubTitle,
IN OUT VOID *FormBuffer,
@ -200,12 +193,10 @@ CreateSubTitle (
STRING_REF StringToken;
//
// Obtain current language value
// Add SubTitle to the StringBuffer, get SubTitle's token
//
GetCurrentLanguage (CurrentLanguage);
Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -220,7 +211,7 @@ CreateSubTitle (
}
/**
Create a line of text
Create a line of text.
Unlike HTML, text is simply another tag.
This tag type enables IFR to be more easily localized.
@ -235,6 +226,7 @@ CreateSubTitle (
@retval EFI_SUCCESS Text successfully created
**/
EFI_STATUS
EFIAPI
CreateText (
IN CHAR16 *String,
IN CHAR16 *String2,
@ -251,15 +243,10 @@ CreateText (
STRING_REF StringToken;
//
// Obtain current language value
// Add first string to the StringBuffer, get first string's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -272,13 +259,11 @@ CreateText (
// Add second string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
Text.TextTwo = StringToken;
Text.Flags = (UINT8) (Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED);
Text.Key = Key;
@ -286,7 +271,6 @@ CreateText (
// Add second string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -309,6 +293,7 @@ CreateText (
@retval EFI_SUCCESS Hyperlink successfully created
**/
EFI_STATUS
EFIAPI
CreateGoto (
IN UINT16 FormId,
IN CHAR16 *Prompt,
@ -322,12 +307,10 @@ CreateGoto (
STRING_REF StringToken;
//
// Obtain current language value
// Add Prompt string to the StringBuffer, get Prompt string's token
//
GetCurrentLanguage (CurrentLanguage);
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -359,6 +342,7 @@ CreateGoto (
@retval EFI_SUCCESS One-Of box successfully created.
**/
EFI_STATUS
EFIAPI
CreateOneOf (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -386,15 +370,10 @@ CreateOneOf (
}
//
// Obtain current language value
// Add Prompt string to the StringBuffer, get Prompt string's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -406,18 +385,16 @@ CreateOneOf (
OneOf.Prompt = StringToken;
//
// Add second string, get first string's token
// Add Help string to the StringBuffer, get Help string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
OneOf.Help = StringToken;
Status = AddOpCode (FormBuffer, &OneOf);
Status = AddOpCode (FormBuffer, &OneOf);
if (EFI_ERROR (Status)) {
return Status;
}
@ -427,17 +404,16 @@ CreateOneOf (
OneOfOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION);
//
// Add string and get token back
// Add OptionString string to the StringBuffer, get OptionString string's token
//
Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
OneOfOption.Option = StringToken;
OneOfOption.Value = OptionsList[Index].Value;
OneOfOption.Flags = (UINT8) (OptionsList[Index].Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED);
OneOfOption.Key = OptionsList[Index].Key;
Status = AddOpCode (FormBuffer, &OneOfOption);
Status = AddOpCode (FormBuffer, &OneOfOption);
if (EFI_ERROR (Status)) {
return Status;
}
@ -446,8 +422,7 @@ CreateOneOf (
EndOneOf.Header.Length = sizeof (FRAMEWORK_EFI_IFR_END_ONE_OF);
EndOneOf.Header.OpCode = FRAMEWORK_EFI_IFR_END_ONE_OF_OP;
Status = AddOpCode (FormBuffer, &EndOneOf);
Status = AddOpCode (FormBuffer, &EndOneOf);
if (EFI_ERROR (Status)) {
return Status;
}
@ -471,6 +446,7 @@ CreateOneOf (
@retval EFI_SUCCESS Ordered list successfully created.
**/
EFI_STATUS
EFIAPI
CreateOrderedList (
IN UINT16 QuestionId,
IN UINT8 MaxEntries,
@ -491,15 +467,10 @@ CreateOrderedList (
STRING_REF StringToken;
//
// Obtain current language value
// Add Prompt string to the StringBuffer, get Prompt string's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -511,18 +482,16 @@ CreateOrderedList (
OrderedList.Prompt = StringToken;
//
// Add second string, get first string's token
// Add Help string to the StringBuffer, get Help string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
OrderedList.Help = StringToken;
Status = AddOpCode (FormBuffer, &OrderedList);
Status = AddOpCode (FormBuffer, &OrderedList);
if (EFI_ERROR (Status)) {
return Status;
}
@ -532,17 +501,16 @@ CreateOrderedList (
OrderedListOption.Header.Length = sizeof (FRAMEWORK_EFI_IFR_ONE_OF_OPTION);
//
// Add string and get token back
// Add OptionString string to the StringBuffer, get OptionString string's token
//
Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
OrderedListOption.Option = StringToken;
OrderedListOption.Value = OptionsList[Index].Value;
OrderedListOption.Flags = (UINT8) (OptionsList[Index].Flags | FRAMEWORK_EFI_IFR_FLAG_CREATED);
OrderedListOption.Key = OptionsList[Index].Key;
Status = AddOpCode (FormBuffer, &OrderedListOption);
Status = AddOpCode (FormBuffer, &OrderedListOption);
if (EFI_ERROR (Status)) {
return Status;
}
@ -571,6 +539,7 @@ CreateOrderedList (
@retval EFI_SUCCESS Check box successfully created
**/
EFI_STATUS
EFIAPI
CreateCheckBox (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -594,15 +563,10 @@ CreateCheckBox (
}
//
// Obtain current language value
// Add Prompt string to the StringBuffer, get Prompt string's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -614,10 +578,9 @@ CreateCheckBox (
CheckBox.Prompt = StringToken;
//
// Add second string, get first string's token
// Add Help string to the StringBuffer, get Help string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -631,7 +594,7 @@ CreateCheckBox (
}
/**
Create a numeric
Create a numeric.
@param QuestionId Question ID of the numeric
@param DataWidth DataWidth of the numeric
@ -650,6 +613,7 @@ CreateCheckBox (
@retval EFI_SUCCESS Numeric is successfully created
**/
EFI_STATUS
EFIAPI
CreateNumeric (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -678,15 +642,10 @@ CreateNumeric (
}
//
// Obtain current language value
// Add Prompt string to the StringBuffer, get Prompt string's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -698,10 +657,9 @@ CreateNumeric (
Numeric.Prompt = StringToken;
//
// Add second string, get first string's token
// Add Help string to the StringBuffer, get Help string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -736,6 +694,7 @@ CreateNumeric (
@retval EFI_SUCCESS String successfully created.
**/
EFI_STATUS
EFIAPI
CreateString (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -755,15 +714,10 @@ CreateString (
STRING_REF StringToken;
//
// Obtain current language value
// Add Prompt string to the StringBuffer, get Prompt string's token
//
GetCurrentLanguage (CurrentLanguage);
//
// Add first string, get first string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}
@ -775,10 +729,9 @@ CreateString (
String.Prompt = StringToken;
//
// Add second string, get first string's token
// Add Help string to the StringBuffer, get Help string's token
//
Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
if (EFI_ERROR (Status)) {
return Status;
}

View File

@ -27,6 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@retval EFI_SUCCESS Subtitle created to be a form
**/
EFI_STATUS
EFIAPI
CreateSubTitleOpCode (
IN STRING_REF StringToken,
IN OUT VOID *FormBuffer
@ -39,6 +40,7 @@ CreateSubTitleOpCode (
Subtitle.SubTitle = StringToken;
CopyMem (FormBuffer, &Subtitle, sizeof (FRAMEWORK_EFI_IFR_SUBTITLE));
return EFI_SUCCESS;
}
@ -59,6 +61,7 @@ CreateSubTitleOpCode (
@retval EFI_SUCCESS Text created to be a form
**/
EFI_STATUS
EFIAPI
CreateTextOpCode (
IN STRING_REF StringToken,
IN STRING_REF StringTokenTwo,
@ -101,6 +104,7 @@ CreateTextOpCode (
@retval EFI_SUCCESS Hyperlink created to be a form
**/
EFI_STATUS
EFIAPI
CreateGotoOpCode (
IN UINT16 FormId,
IN STRING_REF StringToken,
@ -147,6 +151,7 @@ CreateGotoOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2
**/
EFI_STATUS
EFIAPI
CreateOneOfOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -226,6 +231,7 @@ CreateOneOfOpCode (
@retval EFI_SUCCESS Ordered list created to be a form
**/
EFI_STATUS
EFIAPI
CreateOrderedListOpCode (
IN UINT16 QuestionId,
IN UINT8 MaxEntries,
@ -296,6 +302,7 @@ CreateOrderedListOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 1
**/
EFI_STATUS
EFIAPI
CreateCheckBoxOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -352,6 +359,7 @@ CreateCheckBoxOpCode (
@retval EFI_DEVICE_ERROR DataWidth > 2
**/
EFI_STATUS
EFIAPI
CreateNumericOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -412,6 +420,7 @@ CreateNumericOpCode (
@retval EFI_SUCCESS String created to be a form.
**/
EFI_STATUS
EFIAPI
CreateStringOpCode (
IN UINT16 QuestionId,
IN UINT8 DataWidth,
@ -453,6 +462,7 @@ CreateStringOpCode (
@retval EFI_SUCCESS Banner created to be a form.
**/
EFI_STATUS
EFIAPI
CreateBannerOpCode (
IN UINT16 Title,
IN UINT16 LineNumber,

View File

@ -25,6 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@param Size Size of the variable/map in bytes
**/
VOID
EFIAPI
EfiLibHiiVariablePackGetMap (
IN EFI_HII_VARIABLE_PACK *Pack,
OUT CHAR16 **Name, OPTIONAL
@ -64,6 +65,7 @@ EfiLibHiiVariablePackGetMap (
@return The number of map count.
**/
UINTN
EFIAPI
EfiLibHiiVariablePackListGetMapCnt (
IN EFI_HII_VARIABLE_PACK_LIST *List
)
@ -86,6 +88,7 @@ EfiLibHiiVariablePackListGetMapCnt (
@param Callback Routine to be called for each iterated variable.
**/
VOID
EFIAPI
EfiLibHiiVariablePackListForEachVar (
IN EFI_HII_VARIABLE_PACK_LIST *List,
IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
@ -123,6 +126,7 @@ EfiLibHiiVariablePackListForEachVar (
@return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapByIdx (
IN UINTN Idx,
IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -156,8 +160,10 @@ EfiLibHiiVariablePackListGetMapByIdx (
if (NULL != Id) {
*Id = MapId;
}
return EFI_SUCCESS; // Map found
//
// Map found
//
return EFI_SUCCESS;
}
List = List->NextVariablePack;
}
@ -182,6 +188,7 @@ EfiLibHiiVariablePackListGetMapByIdx (
@retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMapById (
IN UINT16 Id,
IN EFI_HII_VARIABLE_PACK_LIST *List,
@ -235,6 +242,7 @@ EfiLibHiiVariablePackListGetMapById (
@retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariablePackListGetMap (
IN EFI_HII_VARIABLE_PACK_LIST *List,
IN CHAR16 *Name,
@ -282,6 +290,7 @@ EfiLibHiiVariablePackListGetMap (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariableRetrieveFromNv (
IN CHAR16 *Name,
IN EFI_GUID *Guid,
@ -334,8 +343,8 @@ EfiLibHiiVariableRetrieveFromNv (
@param Suffix Suffix the Name should end with.
@param Name Name of the variable to retrieve.
@Param Guid Guid of the variable to retrieve.
@Param Size Parameters of the variable to retrieve.
@param Guid Guid of the variable to retrieve.
@param Size Parameters of the variable to retrieve.
@param Var Variable will be retrieved into this buffer.
Caller is responsible for providing storage of exactly Size size in bytes.
@ -345,6 +354,7 @@ EfiLibHiiVariableRetrieveFromNv (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideIfSuffix (
IN CHAR16 *Suffix,
IN CHAR16 *Name,
@ -386,6 +396,7 @@ EfiLibHiiVariableOverrideIfSuffix (
@retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
**/
EFI_STATUS
EFIAPI
EfiLibHiiVariableOverrideBySuffix (
IN CHAR16 *Suffix,
IN CHAR16 *Name,
@ -410,7 +421,7 @@ EfiLibHiiVariableOverrideBySuffix (
StrCat (NameSuffixed, Suffix);
Status = EfiLibHiiVariableRetrieveFromNv (NameSuffixed, Guid, Size, &Var);
gBS->FreePool (NameSuffixed);
FreePool (NameSuffixed);
return Status;
}

View File

@ -12,9 +12,6 @@
**/
#include "UefiLibInternal.h"
typedef struct {
@ -199,30 +196,29 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
@retval 0 The width if UnicodeChar could not be determined.
@retval 1 UnicodeChar is a narrow glyph.
@retval 2 UnicodeChar is a wide glyph.
**/
UINTN
EFIAPI
GetGlyphWidth (
IN CHAR16 UnicodeChar
IN CHAR16 UnicodeChar
)
{
UINTN Index;
UINTN Low;
UINTN High;
CONST UNICODE_WIDTH_ENTRY *Item;
UINTN Index;
UINTN Low;
UINTN High;
CONST UNICODE_WIDTH_ENTRY *Item;
Item = NULL;
Low = 0;
High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
while (Low <= High) {
while (Low <= High) {
Index = (Low + High) >> 1;
Item = &(mUnicodeWidthTable[Index]);
if (Index == 0) {
if (UnicodeChar <= Item->WChar) {
break;
}
return 0;
}
@ -256,19 +252,18 @@ GetGlyphWidth (
characters that are width glyphs have a width of 2.
If String is not aligned on a 16-bit boundary, then ASSERT().
@param String A pointer to a Null-terminated Unicode string.
@param String A pointer to a Null-terminated Unicode string.
@return The display length of the Null-terminated Unicode string specified by String.
@return The display length of the Null-terminated Unicode string specified by String.
**/
UINTN
EFIAPI
UnicodeStringDisplayLength (
IN CONST CHAR16 *String
IN CONST CHAR16 *String
)
{
UINTN Length;
UINTN Width;
UINTN Length;
UINTN Width;
if (String == NULL) {
return 0;

View File

@ -13,7 +13,6 @@
**/
#include "UefiLibInternal.h"
/**
@ -36,18 +35,17 @@
@retval EFI_SUCCESS The protocol installation is completed successfully.
@retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
@retval Others Status from gBS->InstallMultipleProtocolInterfaces().
**/
EFI_STATUS
EFIAPI
EfiLibInstallDriverBinding (
IN CONST EFI_HANDLE ImageHandle,
IN CONST EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle
IN CONST EFI_HANDLE ImageHandle,
IN CONST EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle
)
{
EFI_STATUS Status;
EFI_STATUS Status;
ASSERT (DriverBinding != NULL);
@ -56,9 +54,6 @@ EfiLibInstallDriverBinding (
&gEfiDriverBindingProtocolGuid, DriverBinding,
NULL
);
//
// ASSERT if the call to InstallMultipleProtocolInterfaces() failed
//
ASSERT_EFI_ERROR (Status);
//
@ -70,7 +65,6 @@ EfiLibInstallDriverBinding (
return Status;
}
/**
Installs and completes the initialization of a Driver Binding Protocol instance and
optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
@ -109,9 +103,11 @@ EfiLibInstallAllDriverProtocols (
IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
ASSERT (DriverBinding != NULL);
if (DriverBinding == NULL) {
return EFI_INVALID_PARAMETER;
}
if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
if (DriverConfiguration == NULL) {
@ -229,15 +225,15 @@ EfiLibInstallAllDriverProtocols (
EFI_STATUS
EFIAPI
EfiLibInstallDriverBindingComponentName2 (
IN CONST EFI_HANDLE ImageHandle,
IN CONST EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
IN CONST EFI_HANDLE ImageHandle,
IN CONST EFI_SYSTEM_TABLE *SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
ASSERT (DriverBinding != NULL);

View File

@ -15,7 +15,6 @@
#include <FrameworkDxe.h>
#include <Protocol/FrameworkHii.h>
#include <Library/HiiLib.h>
@ -44,7 +43,7 @@ HiiLibFrameworkConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiHiiProtocolGuid,
@ -53,8 +52,7 @@ HiiLibFrameworkConstructor (
);
ASSERT_EFI_ERROR (Status);
return Status;
return Status;
}
/**
@ -67,23 +65,23 @@ HiiLibFrameworkConstructor (
@param Guid Package GUID.
@param Args Package contents
@return The allocated and initialized packages.
@return The allocated and initialized packages.
**/
EFI_HII_PACKAGES *
InternalPreparePackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
IN VA_LIST Args
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
IN VA_LIST Args
)
{
EFI_HII_PACKAGES *HiiPackages;
VOID **Package;
UINTN Index;
EFI_HII_PACKAGES *HiiPackages;
VOID **Package;
UINTN Index;
ASSERT (NumberOfPackages > 0);
HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));
HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));
ASSERT (HiiPackages != NULL);
HiiPackages->GuidId = (EFI_GUID *) Guid;
@ -96,7 +94,6 @@ InternalPreparePackages (
}
return HiiPackages;
}