From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 04C611A1E43 for ; Wed, 5 Oct 2016 16:27:37 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP; 05 Oct 2016 15:20:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,451,1473145200"; d="scan'208";a="16697958" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 05 Oct 2016 15:20:27 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 5 Oct 2016 15:20:27 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.167]) by FMSMSX113.amr.corp.intel.com ([169.254.13.12]) with mapi id 14.03.0248.002; Wed, 5 Oct 2016 15:20:27 -0700 From: "Carsey, Jaben" To: Tapan Shah , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg: Move UnicodeCollation2 Protcol locate out of UefiShellLib constructor Thread-Index: AQHSH0s3vLn/Dp7OY0OAONtz1w0SwaCabrBQ Date: Wed, 5 Oct 2016 22:20:26 +0000 Message-ID: References: <1475701085-11860-1-git-send-email-tapandshah@hpe.com> In-Reply-To: <1475701085-11860-1-git-send-email-tapandshah@hpe.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWFjYmQxZGQtM2MwNC00NWMwLWJiMjEtNmYwZmQ5YWQxYzg0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjJGUWtsMnV2bjhlSElJS1cxamk0UkhTZ3hvdzBRTDRlWFF6ZFwvOVBNY21jPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg: Move UnicodeCollation2 Protcol locate out of UefiShellLib constructor X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Oct 2016 23:27:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable And pushed. Reviewed-by: Jaben Carsey > -----Original Message----- > From: Tapan Shah [mailto:tapandshah@hpe.com] > Sent: Wednesday, October 05, 2016 1:58 PM > To: edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Tapan Shah > > Subject: [PATCH] ShellPkg: Move UnicodeCollation2 Protcol locate out of > UefiShellLib constructor > Importance: High >=20 > Move gEfiUnicodeCollation2ProtocolGuid protocol outside of UefiShellLib > constructor > function. > Locate gEfiUnicodeCollation2ProtocolGuid protocol in > ShellOpenFileByName() which > consumes this protocol API. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Tapan Shah > --- > ShellPkg/Library/UefiShellLib/UefiShellLib.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > index e47d535..53f54e1 100644 > --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > @@ -292,18 +292,12 @@ ShellLibConstructor ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - EFI_STATUS Status; > - > mEfiShellEnvironment2 =3D NULL; > gEfiShellProtocol =3D NULL; > gEfiShellParametersProtocol =3D NULL; > mEfiShellInterface =3D NULL; > mEfiShellEnvironment2Handle =3D NULL; > - > - if (mUnicodeCollationProtocol =3D=3D NULL) { > - Status =3D gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, = NULL, > (VOID**)&mUnicodeCollationProtocol); > - ASSERT_EFI_ERROR (Status); > - } > + mUnicodeCollationProtocol =3D NULL; >=20 > // > // verify that auto initialize is not set false > @@ -730,6 +724,14 @@ ShellOpenFileByName( > FileHandle, > OpenMode); >=20 > + if (mUnicodeCollationProtocol =3D=3D NULL) { > + Status =3D gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid= , > NULL, (VOID**)&mUnicodeCollationProtocol); > + if (EFI_ERROR (Status)) { > + gEfiShellProtocol->CloseFile (*FileHandle); > + return Status; > + } > + } > + > if ((mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, > (CHAR16*)FileName, L"NUL") !=3D 0) && > (mUnicodeCollationProtocol->StriColl (mUnicodeCollationProtocol, > (CHAR16*)FileName, L"NULL") !=3D 0) && > !EFI_ERROR(Status) && ((OpenMode & EFI_FILE_MODE_CREATE) !=3D 0= )){ > -- > 1.9.5.msysgit.0