Code Clean up for IfrSupportLib, HiiLib, PeiExtractGuidedSectionLib and DxeExtractGuidedSectionLib,

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5687 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2008-08-18 12:11:37 +00:00
parent d1a44d08c1
commit b911d09f55
12 changed files with 165 additions and 200 deletions

View File

@@ -1,7 +1,7 @@
/** @file
Language related HII Library implementation.
Copyright (c) 2006, Intel Corporation<BR>
Copyright (c) 2006 - 2008, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -128,6 +128,7 @@ HiiLibGetSupportedLanguages (
ASSERT (IsHiiHandleRegistered (HiiHandle));
//
// Collect current supported Languages for given HII handle
// First try allocate 4K buffer to store the current supported languages.
//
BufferSize = 0x1000;
LanguageString = AllocateZeroPool (BufferSize);
@@ -223,6 +224,7 @@ HiiLibGetSupportedSecondaryLanguages (
ASSERT (IsHiiHandleRegistered (HiiHandle));
//
// Collect current supported 2nd Languages for given HII handle
// First try allocate 4K buffer to store the current supported 2nd languages.
//
BufferSize = 0x1000;
LanguageString = AllocateZeroPool (BufferSize);

View File

@@ -1,7 +1,7 @@
/** @file
HII Library implementation that uses DXE protocols and services.
Copyright (c) 2006, Intel Corporation<BR>
Copyright (c) 2006 - 2008, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -14,10 +14,8 @@
#include "InternalHiiLib.h"
CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
BOOLEAN mHiiProtocolsInitialized = FALSE;
CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt = NULL;
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt = NULL;
/**
@@ -31,7 +29,7 @@ LocateHiiProtocols (
{
EFI_STATUS Status;
if (mHiiProtocolsInitialized) {
if (mHiiStringProt != NULL && mHiiDatabaseProt != NULL) {
//
// Only need to initialize the protocol instance once.
//
@@ -43,8 +41,6 @@ LocateHiiProtocols (
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &mHiiStringProt);
ASSERT_EFI_ERROR (Status);
mHiiProtocolsInitialized = TRUE;
}
@@ -112,7 +108,7 @@ InternalHiiLibPreparePackages (
PackageListHeader = AllocateZeroPool (PackageListLength);
ASSERT (PackageListHeader != NULL);
CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
CopyGuid (&PackageListHeader->PackageListGuid, GuidId);
PackageListHeader->PackageLength = PackageListLength;
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
@@ -304,6 +300,7 @@ HiiLibGetHiiHandles (
if (Status == EFI_BUFFER_TOO_SMALL) {
*HiiHandleBuffer = AllocateZeroPool (BufferLength);
ASSERT (*HiiHandleBuffer != NULL);
Status = mHiiDatabaseProt->ListPackageLists (
mHiiDatabaseProt,
EFI_HII_PACKAGE_TYPE_ALL,
@@ -366,13 +363,14 @@ HiiLibExtractGuidFromHiiHandle (
Status = mHiiDatabaseProt->ExportPackageLists (mHiiDatabaseProt, Handle, &BufferSize, HiiPackageList);
}
if (EFI_ERROR (Status)) {
FreePool (HiiPackageList);
return Status;
}
//
// Extract GUID
//
CopyMem (Guid, &HiiPackageList->PackageListGuid, sizeof (EFI_GUID));
CopyGuid (Guid, &HiiPackageList->PackageListGuid);
FreePool (HiiPackageList);

View File

@@ -22,7 +22,7 @@
VERSION_STRING = 1.0
LIBRARY_CLASS = HiiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A
EFI_SPECIFICATION_VERSION = 0x00020000
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
@@ -32,16 +32,19 @@
HiiLib.c
HiiString.c
HiiLanguage.c
InternalHiiLib.h
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
MemoryAllocationLib
BaseMemoryLib
BaseLib
DebugLib
PcdLib
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
DevicePathLib
[Protocols]
@@ -53,4 +56,4 @@
gEfiGlobalVariableGuid
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang

View File

@@ -38,8 +38,6 @@
extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
extern BOOLEAN mHiiProtocolsInitialized;
/**
This function check if the Hii Handle is a valid handle registered