mirror of https://github.com/acidanthera/audk.git
ShellPkg: Move UnicodeCollation2 Protcol locate out of UefiShellLib constructor
Move gEfiUnicodeCollation2ProtocolGuid protocol outside of UefiShellLib constructor function. Locate gEfiUnicodeCollation2ProtocolGuid protocol in ShellOpenFileByName() which consumes this protocol API. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
parent
c0b7e2b2bf
commit
2cf9ecd226
|
@ -292,18 +292,12 @@ ShellLibConstructor (
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
mEfiShellEnvironment2 = NULL;
|
mEfiShellEnvironment2 = NULL;
|
||||||
gEfiShellProtocol = NULL;
|
gEfiShellProtocol = NULL;
|
||||||
gEfiShellParametersProtocol = NULL;
|
gEfiShellParametersProtocol = NULL;
|
||||||
mEfiShellInterface = NULL;
|
mEfiShellInterface = NULL;
|
||||||
mEfiShellEnvironment2Handle = NULL;
|
mEfiShellEnvironment2Handle = NULL;
|
||||||
|
mUnicodeCollationProtocol = NULL;
|
||||||
if (mUnicodeCollationProtocol == NULL) {
|
|
||||||
Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// verify that auto initialize is not set false
|
// verify that auto initialize is not set false
|
||||||
|
@ -730,6 +724,14 @@ ShellOpenFileByName(
|
||||||
FileHandle,
|
FileHandle,
|
||||||
OpenMode);
|
OpenMode);
|
||||||
|
|
||||||
|
if (mUnicodeCollationProtocol == NULL) {
|
||||||
|
Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
gEfiShellProtocol->CloseFile (*FileHandle);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NUL") != 0) &&
|
if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NUL") != 0) &&
|
||||||
(mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NULL") != 0) &&
|
(mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, (CHAR16*)FileName, L"NULL") != 0) &&
|
||||||
!EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){
|
!EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) != 0)){
|
||||||
|
|
Loading…
Reference in New Issue