summaryrefslogtreecommitdiff
path: root/MdePkg/Library/HiiLib
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-18 12:11:37 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-18 12:11:37 +0000
commitb911d09f5525e5bb27d5c9dffcfd6120e095ac84 (patch)
tree657ff1575c56b81d968d90f29238313fae127816 /MdePkg/Library/HiiLib
parentd1a44d08c1b221669e88f27801b3e4ae26d7fd96 (diff)
downloadedk2-platforms-b911d09f5525e5bb27d5c9dffcfd6120e095ac84.tar.xz
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
Diffstat (limited to 'MdePkg/Library/HiiLib')
-rw-r--r--MdePkg/Library/HiiLib/HiiLanguage.c4
-rw-r--r--MdePkg/Library/HiiLib/HiiLib.c18
-rw-r--r--MdePkg/Library/HiiLib/HiiLib.inf9
-rw-r--r--MdePkg/Library/HiiLib/InternalHiiLib.h2
4 files changed, 17 insertions, 16 deletions
diff --git a/MdePkg/Library/HiiLib/HiiLanguage.c b/MdePkg/Library/HiiLib/HiiLanguage.c
index 6948b2c331..8c03bb993a 100644
--- a/MdePkg/Library/HiiLib/HiiLanguage.c
+++ b/MdePkg/Library/HiiLib/HiiLanguage.c
@@ -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);
diff --git a/MdePkg/Library/HiiLib/HiiLib.c b/MdePkg/Library/HiiLib/HiiLib.c
index efae6780bc..81a7241cc9 100644
--- a/MdePkg/Library/HiiLib/HiiLib.c
+++ b/MdePkg/Library/HiiLib/HiiLib.c
@@ -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);
diff --git a/MdePkg/Library/HiiLib/HiiLib.inf b/MdePkg/Library/HiiLib/HiiLib.inf
index f9ff028942..f9f62645a5 100644
--- a/MdePkg/Library/HiiLib/HiiLib.inf
+++ b/MdePkg/Library/HiiLib/HiiLib.inf
@@ -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 \ No newline at end of file
+ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
diff --git a/MdePkg/Library/HiiLib/InternalHiiLib.h b/MdePkg/Library/HiiLib/InternalHiiLib.h
index c01e5b020a..d80db675a2 100644
--- a/MdePkg/Library/HiiLib/InternalHiiLib.h
+++ b/MdePkg/Library/HiiLib/InternalHiiLib.h
@@ -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