From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.3651.1612497126964464947 for ; Thu, 04 Feb 2021 19:52:08 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 05 Feb 2021 11:51:54 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , Cc: "'Dong, Eric'" , "'Wang, Nickle \(HPS SW\)'" References: <20210201030542.22997-1-abner.chang@hpe.com> ,<006401d6fac5$3d48f0a0$b7dad1e0$@byosoft.com.cn> <16607E7DFB87792F.10090@groups.io> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYzXSBNZGVNb2R1bGVQa2cvTGlicmFyeTogQWRkIEhpaUdldFN0cmluZ0V4IHRvIFVlZmlIaWlMaWIgZm9yIEVESzIgUmVkZmlzaA==?= Date: Fri, 5 Feb 2021 11:52:02 +0800 Message-ID: <003901d6fb72$438dac50$caa904f0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQG8in9zZ5ZnrwuB6oGj3upFoC2IJAHNSfN4AoIuQroChXLp2wDfL+xbAcGnyAmqMiDlUA== Content-Type: multipart/alternative; boundary="----=_NextPart_000_003A_01D6FBB5.51B495D0" Content-Language: zh-cn ------=_NextPart_000_003A_01D6FBB5.51B495D0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable I am OK for any option. Reviewed-by: Liming Gao =20 Thanks LIming =B7=A2=BC=FE=C8=CB: bounce+27952+71277+4905953+8761045@groups.io =B4=FA=B1=ED Abner Chang =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA2=D4=C25=C8=D5 9:51 =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technolo= gist) ; dandan.bi@intel.com =B3=AD=CB=CD: 'Dong, Eric' ; Wang, Nickle (HPS SW) =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v3] MdeModulePkg/Library: Add HiiGet= StringEx to UefiHiiLib for EDK2 Redfish =20 Hi Liming, Do you agree to keep the one Dandan suggested?=20 =20 Regards, Abner =20 From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Abner Chang Sent: Thursday, February 4, 2021 4:36 PM To: devel@edk2.groups.io ; dandan.bi@intel.c= om =20 Cc: 'Dong, Eric' >; Wang= , Nickle (HPS SW) > Subject: Re: [edk2-devel] [PATCH v3] MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 Redfish =20 This looks to me not quite intuitional. !(!TryBestLanguage && Language =3D=3D NULL) seems more straightforward an= d exactly what we would like to catch. =20 Abner=20 =20 Get Outlook for Android =20 =20 _____ From: devel@edk2.groups.io > on behalf of gaolimi= ng > Sent: Thursday, February 4, 2021, 3:13 PM To: devel@edk2.groups.io ; Chang, Abner (HPS SW/FW Technologist); dandan.bi@intel.com =20 Cc: 'Dong, Eric'; Wang, Nickle (HPS SW) Subject: =BB=D8=B8=B4: [edk2-devel] [PATCH v3] MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 Redfish =20 If TryBestLanguage is FALE and Language is NULL, then ASSERT(). So, ASSERT statement should be ASSERT (TryBestLanguage || (Language !=3D NULL));=20 Is this clear? Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: bounce+27952+71110+4905953+8761045@groups.io =20 > > =B4=FA=B1=ED Abner= Chang > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA2=D4=C23=C8=D5 23:21 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io ; dandan.bi@intel.com =20 > =B3=AD=CB=CD: Dong, Eric >; Wang, Nickle (HPS SW) > > > =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v3] MdeModulePkg/Library: Add > HiiGetStringEx to UefiHiiLib for EDK2 Redfish >=20 > Yes Dandan, yours follow coding standard. I will handle that. > Also, I will help to push the patch to upstream with your review tag. >=20 > Thanks > Abner >=20 > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > > Dandan Bi > > Sent: Wednesday, February 3, 2021 7:34 PM > > To: Chang, Abner (HPS SW/FW Technologist) >; > > devel@edk2.groups.io =20 > > Cc: Dong, Eric >; Wang, Nickle (HPS SW) > > > > > Subject: Re: [edk2-devel] [PATCH v3] MdeModulePkg/Library: Add > > HiiGetStringEx to UefiHiiLib for EDK2 Redfish > > > > One minor comment inline below. > > Reviewed-by: Dandan Bi > with this is handled. > > > > Thanks, > > Dandan > > > -----Original Message----- > > > From: Abner Chang = > > > > Sent: Monday, February 1, 2021 11:06 AM > > > To: devel@edk2.groups.io =20 > > > Cc: Bi, Dandan >; Dong, Eric > > > >; Nickle Wang > > > > Subject: [PATCH v3] MdeModulePkg/Library: Add HiiGetStringEx to > > > UefiHiiLib for EDK2 Redfish > > > > > > Add HiiGetStringEx and leveraged by HiiGetString function to support > > > getting string with the best language in optionally. This avoids the > > > string in x-uefi language is misled to the language defined by > > > "PlatformLang" or the "Supported Languages". This change is introduc= ed > > > to support x-uefi keyword language for configuring BIOS setting. > > > > > > Signed-off-by: Jiaxin Wu > > > > Signed-off-by: Siyuan Fu > > > > Signed-off-by: Fan Wang > > > > Signed-off-by: Abner Chang > > > > Cc: Dandan Bi > > > > Cc: Eric Dong > > > > Cc: Nickle Wang > > > > --- > > > MdeModulePkg/Include/Library/HiiLib.h | 60 ++++++++++--- > > > MdeModulePkg/Library/UefiHiiLib/HiiString.c | 98 > > > +++++++++++++++------ > > > 2 files changed, 119 insertions(+), 39 deletions(-) > > > > > > diff --git a/MdeModulePkg/Include/Library/HiiLib.h > > > b/MdeModulePkg/Include/Library/HiiLib.h > > > index c475cb74a1..cd9027fefd 100644 > > > --- a/MdeModulePkg/Include/Library/HiiLib.h > > > +++ b/MdeModulePkg/Include/Library/HiiLib.h > > > @@ -1,7 +1,8 @@ > > > /** @file > > > Public include file for the HII Library > > > > > > -Copyright (c) 2007 - 2018, Intel Corporation. All rights > > > reserved.
> > > +Copyright (c) 2007 - 2021, Intel Corporation. All rights > > > +reserved.
> > > +(C) Copyright 2021 Hewlett Packard Enterprise Development LP
> > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > **/ > > > @@ -123,16 +124,8 @@ HiiSetString ( > > > ; > > > > > > /** > > > - Retrieves a string from a string package in a specific language. > > > If the language > > > - is not specified, then a string from a string package in the > > > current platform > > > - language is retrieved. If the string cannot be retrieved using t= he > > > specified > > > - language or the current platform language, then the string is > > > retrieved from > > > - the string package in the first language the string package > > > supports. The > > > - returned string is allocated using AllocatePool(). The caller is > > > responsible > > > - for freeing the allocated buffer using FreePool(). > > > - > > > - If HiiHandle is NULL, then ASSERT(). > > > - If StringId is 0, then ASSERT(). > > > + Retrieves a string from a string package in a specific language > > > + specified in Language or in the best lanaguage. See HiiGetStringE= x > > > + () for > > > the details. > > > > > > @param[in] HiiHandle A handle that was previously registered in > > > the HII Database. > > > @param[in] StringId The identifier of the string to retrieved from > the > > > string > > > @@ -152,8 +145,49 @@ HiiGetString ( > > > IN EFI_HII_HANDLE HiiHandle, > > > IN EFI_STRING_ID StringId, > > > IN CONST CHAR8 *Language OPTIONAL > > > - ) > > > -; > > > + ); > > > + > > > +/** > > > + Retrieves a string from a string package in a specific language o= r > > > +in the best > > > + language at discretion of this function according to the priority of > > languages. > > > + TryBestLanguage is used to get the string in the best language or > > > +in the language > > > + specified in Language parameter. The behavior is, > > > + If TryBestLanguage is TRUE, this function looks for the best > > > +language for > > > the string. > > > + - If the string can not be retrieved using the specified languag= e > > > + or the > > > current > > > + platform language, then the string is retrieved from the strin= g > > > + package in > > > the > > > + first language the string package supports. > > > + If TryBestLanguage is FALSE, Language must be specified for > > > + retrieving the > > > string. > > > + > > > + The returned string is allocated using AllocatePool(). The calle= r > > > + is responsible for freeing the allocated buffer using FreePool(). > > > + > > > + If HiiHandle is NULL, then ASSERT(). > > > + If StringId is 0, then ASSET. > > > + If TryBestLanguage is FALE and Language is NULL, then ASSERT(). > > > + > > > + @param[in] HiiHandle A handle that was previously > registered in the > > > HII Database. > > > + @param[in] StringId The identifier of the string to > retrieved from > > the > > > string > > > + package associated with > HiiHandle. > > > + @param[in] Language The language of the string to > retrieve. If this > > > parameter > > > + is NULL, then the current > platform language is used. The > > > + format of Language must follow > the > > > + language format > > > assumed > > > + the HII Database. > > > + @param[in] TryBestLanguage If TRUE, try to get the best > matching > > > language from all > > > + supported languages.If FALSE, > the > > > + Language must be > > > assigned > > > + for the StringID. > > > + > > > + @retval NULL The string specified by StringId is not present in the > string > > > package. > > > + @retval Other The string was returned. > > > + > > > +**/ > > > +EFI_STRING > > > +EFIAPI > > > +HiiGetStringEx ( > > > + IN EFI_HII_HANDLE HiiHandle, > > > + IN EFI_STRING_ID StringId, > > > + IN CONST CHAR8 *Language OPTIONAL, > > > + IN BOOLEAN TryBestLanguage > > > + ); > > > > > > /** > > > Retrieves a string from a string package named by GUID, in the > > > specified language. > > > diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c > > > b/MdeModulePkg/Library/UefiHiiLib/HiiString.c > > > index 95229f8a8c..a9a11aef98 100644 > > > --- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c > > > +++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c > > > @@ -1,7 +1,8 @@ > > > /** @file > > > HII Library implementation that uses DXE protocols and services. > > > > > > - Copyright (c) 2006 - 2018, Intel Corporation. All rights > > > reserved.
> > > + Copyright (c) 2006 - 2021, Intel Corporation. All rights > > > + reserved.
> > > + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > **/ > > > @@ -190,16 +191,8 @@ HiiGetPackageString ( } > > > > > > /** > > > - Retrieves a string from a string package in a specific language. > > > If the language > > > - is not specified, then a string from a string package in the > > > current platform > > > - language is retrieved. If the string can not be retrieved using > > > the specified > > > - language or the current platform language, then the string is > > > retrieved from > > > - the string package in the first language the string package > > > supports. The > > > - returned string is allocated using AllocatePool(). The caller is > > > responsible > > > - for freeing the allocated buffer using FreePool(). > > > - > > > - If HiiHandle is NULL, then ASSERT(). > > > - If StringId is 0, then ASSET. > > > + Retrieves a string from a string package in a specific language > > > + specified in Language or in the best lanaguage. See HiiGetStringE= x > > > + () for > > > the details. > > > > > > @param[in] HiiHandle A handle that was previously registered in > > > the HII Database. > > > @param[in] StringId The identifier of the string to retrieved from > the > > > string > > > @@ -220,6 +213,51 @@ HiiGetString ( > > > IN EFI_STRING_ID StringId, > > > IN CONST CHAR8 *Language OPTIONAL > > > ) > > > +{ > > > + return HiiGetStringEx (HiiHandle, StringId, Language, TRUE); } > > > + > > > +/** > > > + Retrieves a string from a string package in a specific language o= r > > > +in the best > > > + language at discretion of this function according to the priority of > > languages. > > > + TryBestLanguage is used to get the string in the best language or > > > +in the language > > > + specified in Language parameter. The behavior is, > > > + If TryBestLanguage is TRUE, this function looks for the best > > > +language for > > > the string. > > > + - If the string can not be retrieved using the specified languag= e > > > + or the > > > current > > > + platform language, then the string is retrieved from the strin= g > > > + package in > > > the > > > + first language the string package supports. > > > + If TryBestLanguage is FALSE, Language must be specified for > > > + retrieving the > > > string. > > > + > > > + The returned string is allocated using AllocatePool(). The calle= r > > > + is responsible for freeing the allocated buffer using FreePool(). > > > + > > > + If HiiHandle is NULL, then ASSERT(). > > > + If StringId is 0, then ASSET. > > > + If TryBestLanguage is FALE and Language is NULL, then ASSERT(). > > > + > > > + @param[in] HiiHandle A handle that was previously > registered in the > > > HII Database. > > > + @param[in] StringId The identifier of the string to > retrieved from > > the > > > string > > > + package associated with > HiiHandle. > > > + @param[in] Language The language of the string to > retrieve. If this > > > parameter > > > + is NULL, then the current > platform language is used. The > > > + format of Language must follow > the > > > + language format > > > assumed > > > + the HII Database. > > > + @param[in] TryBestLanguage If TRUE, try to get the best > matching > > > language from all > > > + supported languages.If FALSE, > the > > > + Language must be > > > assigned > > > + for the StringID. > > > + > > > + @retval NULL The string specified by StringId is not present in the > string > > > package. > > > + @retval Other The string was returned. > > > + > > > +**/ > > > +EFI_STRING > > > +EFIAPI > > > +HiiGetStringEx ( > > > + IN EFI_HII_HANDLE HiiHandle, > > > + IN EFI_STRING_ID StringId, > > > + IN CONST CHAR8 *Language OPTIONAL, > > > + IN BOOLEAN TryBestLanguage > > > + ) > > > { > > > EFI_STATUS Status; > > > UINTN StringSize; > > > @@ -231,7 +269,10 @@ HiiGetString ( > > > > > > ASSERT (HiiHandle !=3D NULL); > > > ASSERT (StringId !=3D 0); > > > - > > > + // > > > + // Language must be specified if TryBestLanguage =3D FALSE. > > > + // > > > + ASSERT (!(TryBestLanguage =3D=3D FALSE && Language =3D=3D NULL)); > > One minor here, in order to following the coding style, this seems should be > > ASSERT (!(!TryBestLanguage && Language =3D=3D NULL)); Please help doub= le > > check. > > > > > // > > > // Initialize all allocated buffers to NULL > > > // > > > @@ -261,21 +302,26 @@ HiiGetString ( > > > Language =3D ""; > > > } > > > > > > - // > > > - // Get the best matching language from SupportedLanguages > > > - // > > > - BestLanguage =3D GetBestLanguage ( > > > - SupportedLanguages, > > > - FALSE, > // RFC 4646 mode > > > - Language, > // Highest priority > > > - PlatformLanguage !=3D NULL ? PlatformLanguage : > "", // Next > > > highest priority > > > - SupportedLanguages, > // Lowest priority > > > - NULL > > > - ); > > > - if (BestLanguage =3D=3D NULL) { > > > - goto Error; > > > + if (TryBestLanguage) { > > > + // > > > + // Get the best matching language from SupportedLanguages > > > + // > > > + BestLanguage =3D GetBestLanguage ( > > > + SupportedLanguages, > > > + FALSE, > // RFC 4646 mode > > > + Language, > // Highest priority > > > + PlatformLanguage !=3D NULL ? > PlatformLanguage : > > > + "", // Next > > > highest priority > > > + SupportedLanguages, > // Lowest priority > > > + NULL > > > + ); > > > + if (BestLanguage =3D=3D NULL) { > > > + goto Error; > > > + } > > > + } else { > > > + BestLanguage =3D (CHAR8 *) Language; > > > } > > > > > > + > > > // > > > // Retrieve the size of the string in the string package for the > > BestLanguage > > > // > > > @@ -337,7 +383,7 @@ Error: > > > if (PlatformLanguage !=3D NULL) { > > > FreePool (PlatformLanguage); > > > } > > > - if (BestLanguage !=3D NULL) { > > > + if (TryBestLanguage && BestLanguage !=3D NULL) { > > > FreePool (BestLanguage); > > > } > > > > > > -- > > > 2.17.1 > > > > > > > > > > >=20 >=20 >=20 >=20 >=20 =20 ------=_NextPart_000_003A_01D6FBB5.51B495D0 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

I am OK for any option. Reviewed-by: Liming Gao <gaolimin= g@byosoft.com.cn>

 

Thanks

LIming

=B7=A2=BC=FE=C8=CB: bounce+27952+71277+4905953+8761045@groups.io &= lt;bounce+27952+71277+4905953+8761045@groups.io> =B4=FA=B1=ED Abner C= hang
=B7=A2=CB=CD=CA=B1=BC=E4: 2021<= span style=3D'font-size:11.0pt;font-family:=B5=C8=CF=DF'>=C4=EA2=D4=C25=C8=D5 9:51
=CA=D5=BC=FE=C8=CB: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) &= lt;abner.chang@hpe.com>; dandan.bi@intel.com
=B3=AD=CB=CD: 'Dong, Eric' <eric.dong= @intel.com>; Wang, Nickle (HPS SW) <nickle.wang@hpe.com>
=D6=F7=CC=E2: Re: [edk= 2-devel] [PATCH v3] MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib = for EDK2 Redfish

 

Hi Liming,

Do you agre= e to keep the one Dandan suggested?

 

Regards= ,

Abner

 

 

This looks to me not quite intuitional.

 !(!TryBestLanguage && Language =3D=3D N= ULL) seems more straightforward and exactly what we would like to catch.

Abner <= o:p>

 

Get Outlook for Android

 <= /o:p>


<= /span>

 

If TryBestLanguage= is FALE and Language is NULL, then ASSERT().

So, ASSERT statement s= hould be ASSERT (TryBestLanguage || (Language !=3D
NULL));

Is th= is clear?

Thanks
Liming
> -----
=D3=CA=BC=FE=D4=AD=BC=FE-----
> =B7=A2=BC=FE=C8=CB:
bounce+27952+71110+4905953+8761045@groups.io
> <
bounce+27952+71110+4905953+8761045@groups.io> =B4=FA=B1= =ED Abner Chang
>
=B7=A2=CB=CD=CA=B1=BC=E4= : 2021=C4=EA2=D4=C23=C8=D5 23:21
>
=CA= =D5=BC=FE=C8=CB: devel@edk2.groups.io; dandan.b= i@intel.com
>
=B3=AD=CB=CD: Dong, Eric = <eric.dong@intel.com>; Wan= g, Nickle (HPS SW)
> <nickl= e.wang@hpe.com>
>
=D6=F7=CC=E2: Re: = [edk2-devel] [PATCH v3] MdeModulePkg/Library: Add
> HiiGetStringEx to= UefiHiiLib for EDK2 Redfish
>
> Yes Dandan, yours follow codi= ng standard. I will handle that.
> Also, I will help to push the patc= h to upstream with your review tag.
>
> Thanks
> Abner>
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
&= gt; > Dandan Bi
> > Sent: Wednesday, February 3, 2021 7:34 PM> > To: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>;
> > devel@edk2.groups.io
> > Cc: Dong= , Eric <eric.dong@intel.com&g= t;; Wang, Nickle (HPS SW)
> > <nickle.wang@hpe.com>
> > Subject: Re: [edk2-devel] [= PATCH v3] MdeModulePkg/Library: Add
> > HiiGetStringEx to UefiHiiL= ib for EDK2 Redfish
> >
> > One minor comment inline belo= w.
> > Reviewed-by: Dandan Bi <dandan.bi@intel.com> with this is handled.
> >
&g= t; > Thanks,
> > Dandan
> > > -----Original Message= -----
> > > From: Abner Chang <abner.chang@hpe.com>
> > > Sent: Monday, Febru= ary 1, 2021 11:06 AM
> > > To: devel@edk2.groups.io
> > > Cc: Bi, Dandan <dandan.bi@intel.com>; Dong, Eric> > > <eric.dong@intel= .com>; Nickle Wang <nickle= .wang@hpe.com>
> > > Subject: [PATCH v3] MdeModulePkg/Li= brary: Add HiiGetStringEx to
> > > UefiHiiLib for EDK2 Redfish<= br>> > >
> > > Add HiiGetStringEx and leveraged by Hii= GetString function to support
> > > getting string with the bes= t language in optionally. This avoids the
> > > string in x-uef= i language is misled to the language defined by
> > > "Pla= tformLang" or the "Supported Languages". This change is intr= oduced
> > > to support x-uefi keyword language for configuring= BIOS setting.
> > >
> > > Signed-off-by: Jiaxin Wu= <jiaxin.wu@intel.com>
= > > > Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
> > > Signed-off-by: Fan Wa= ng <fan.wang@intel.com>
= > > > Signed-off-by: Abner Chang <abner.chang@hpe.com>
> > > Cc: Dandan Bi <<= a href=3D"mailto:dandan.bi@intel.com">dandan.bi@intel.com>
> &= gt; > Cc: Eric Dong <eric.dong= @intel.com>
> > > Cc: Nickle Wang <nickle.wang@hpe.com>
> > > ---
&= gt; > >  MdeModulePkg/Include/Library/HiiLib.h   =     | 60 ++++++++++---
> > >  MdeModulePkg/= Library/UefiHiiLib/HiiString.c | 98
> > > +++++++++++++++------=
> > >  2 files changed, 119 insertions(+), 39 deletions(-= )
> > >
> > > diff --git a/MdeModulePkg/Include/Lib= rary/HiiLib.h
> > > b/MdeModulePkg/Include/Library/HiiLib.h
= > > > index c475cb74a1..cd9027fefd 100644
> > > --- a/= MdeModulePkg/Include/Library/HiiLib.h
> > > +++ b/MdeModulePkg/= Include/Library/HiiLib.h
> > > @@ -1,7 +1,8 @@
> > >= ;  /** @file
> > >    Public include file f= or the HII Library
> > >
> > > -Copyright (c) 2007 = - 2018, Intel Corporation. All rights
> > > reserved.<BR>=
> > > +Copyright (c) 2007 - 2021, Intel Corporation. All right= s
> > > +reserved.<BR>
> > > +(C) Copyright 2= 021 Hewlett Packard Enterprise Development LP<BR>
> > >&n= bsp; SPDX-License-Identifier: BSD-2-Clause-Patent
> > >
>= > >  **/
> > > @@ -123,16 +124,8 @@ HiiSetString (<= br>> > >  ;
> > >
> > >  /**
= > > > -  Retrieves a string from a string package in a specif= ic language.
> > > If the language
> > > -  is= not specified, then a string from a string package in the
> > >= ; current platform
> > > -  language is retrieved.  I= f the string cannot be retrieved using the
> > > specified
&= gt; > > -  language or the current platform language, then the s= tring is
> > > retrieved from
> > > -  the str= ing package in the first language the string package
> > > supp= orts.  The
> > > -  returned string is allocated usin= g AllocatePool().  The caller is
> > > responsible
>= > > -  for freeing the allocated buffer using FreePool().
&g= t; > > -
> > > -  If HiiHandle is NULL, then ASSERT(= ).
> > > -  If StringId is 0, then ASSERT().
> > = > +  Retrieves a string from a string package in a specific languag= e
> > > + specified in Language  or in the best lanaguage.= See HiiGetStringEx
> > > + () for
> > > the detail= s.
> > >
> > >    @param[in]  H= iiHandle  A handle that was previously registered in
> > >= the HII Database.
> > >    @param[in]  Str= ingId   The identifier of the string to retrieved
from
>= the
> > > string
> > > @@ -152,8 +145,49 @@ HiiGet= String (
> > >    IN EFI_HII_HANDLE  HiiHan= dle,
> > >    IN EFI_STRING_ID   Strin= gId,
> > >    IN CONST CHAR8   &n= bsp; *Language  OPTIONAL
> > > -  )
> > >= -;
> > > +  );
> > > +
> > > +/**=
> > > +  Retrieves a string from a string package in a sp= ecific language or
> > > +in the best
> > > + = language at discretion of this function according to the priority
of> > languages.
> > > +  TryBestLanguage is used to = get the string in the best language or
> > > +in the language> > > +  specified in Language parameter. The behavior is,<= br>> > > +  If TryBestLanguage is TRUE, this function looks f= or the best
> > > +language for
> > > the string.> > > +   - If the string can not be retrieved using t= he specified language
> > > + or the
> > > current<= br>> > > +     platform language, then the str= ing is retrieved from the string
> > > + package in
> >= ; > the
> > > +     first language the s= tring package supports.
> > > +  If TryBestLanguage is FAL= SE, Language must be specified for
> > > + retrieving the
&g= t; > > string.
> > > +
> > > +  The retu= rned string is allocated using AllocatePool().  The caller
> >= ; > + is responsible  for freeing the allocated buffer using FreePo= ol().
> > > +
> > > +  If HiiHandle is NULL, t= hen ASSERT().
> > > +  If StringId is 0, then ASSET.
&g= t; > > +  If TryBestLanguage is FALE and Language is NULL, then = ASSERT().
> > > +
> > > +  @param[in]  Hi= iHandle         A handle that was p= reviously
> registered in the
> > > HII Database.
>= > > +  @param[in]  StringId     &= nbsp;    The identifier of the string to
> retrieved f= rom
> > the
> > > string
> > > + &nbs= p;            &= nbsp;           &nbs= p;     package associated with
> HiiHandle.
&g= t; > > +  @param[in]  Language     = ;     The language of the string to
> retrieve.&n= bsp; If this
> > > parameter
> > > +  &nb= sp;            =             &nb= sp;    is NULL, then the current
> platform language i= s used.  The
> > > +      &n= bsp;            = ;             f= ormat of Language must follow
> the
> > > + language form= at
> > > assumed
> > > +    &nb= sp;            =             &nb= sp;  the HII Database.
> > > +  @param[in]  TryB= estLanguage   If TRUE, try to get the best
> matching
&g= t; > > language from all
> > > +    &= nbsp;           &nbs= p;            &= nbsp;  supported languages.If FALSE,
> the
> > > + L= anguage must be
> > > assigned
> > > +  &= nbsp;           &nbs= p;            &= nbsp;    for the StringID.
> > > +
> > = > +  @retval NULL   The string specified by StringId is n= ot present in
the
> string
> > > package.
> >= > +  @retval Other  The string was returned.
> > >= ; +
> > > +**/
> > > +EFI_STRING
> > > = +EFIAPI
> > > +HiiGetStringEx (
> > > +  IN EF= I_HII_HANDLE  HiiHandle,
> > > +  IN EFI_STRING_ID&nb= sp;  StringId,
> > > +  IN CONST CHAR8  &nb= sp;  *Language  OPTIONAL,
> > > +  IN BOOLEAN&nb= sp;        TryBestLanguage
> > = > +  );
> > >
> > >  /**
> > = >    Retrieves a string from a string package named by GU= ID, in the
> > > specified language.
> > > diff --g= it a/MdeModulePkg/Library/UefiHiiLib/HiiString.c
> > > b/MdeMod= ulePkg/Library/UefiHiiLib/HiiString.c
> > > index 95229f8a8c..a= 9a11aef98 100644
> > > --- a/MdeModulePkg/Library/UefiHiiLib/Hi= iString.c
> > > +++ b/MdeModulePkg/Library/UefiHiiLib/HiiString= .c
> > > @@ -1,7 +1,8 @@
> > >  /** @file
&= gt; > >    HII Library implementation that uses DXE pr= otocols and services.
> > >
> > > -  Copyright= (c) 2006 - 2018, Intel Corporation. All rights
> > > reserved.= <BR>
> > > +  Copyright (c) 2006 - 2021, Intel Corpo= ration. All rights
> > > + reserved.<BR>
> > >= ; + (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR><= br>> > >    SPDX-License-Identifier: BSD-2-Clause-P= atent
> > >
> > >  **/
> > > @@ -1= 90,16 +191,8 @@ HiiGetPackageString (  }
> > >
> >= ; >  /**
> > > -  Retrieves a string from a string= package in a specific language.
> > > If the language
> = > > -  is not specified, then a string from a string package in = the
> > > current platform
> > > -  language i= s retrieved.  If the string can not be retrieved using
> > &g= t; the specified
> > > -  language or the current platform= language, then the string is
> > > retrieved from
> >= > -  the string package in the first language the string package> > > supports.  The
> > > -  returned str= ing is allocated using AllocatePool().  The caller is
> > >= ; responsible
> > > -  for freeing the allocated buffer us= ing FreePool().
> > > -
> > > -  If HiiHandle = is NULL, then ASSERT().
> > > -  If StringId is 0, then AS= SET.
> > > +  Retrieves a string from a string package in = a specific language
> > > + specified in Language  or in t= he best lanaguage. See HiiGetStringEx
> > > + () for
> &g= t; > the details.
> > >
> > >    = @param[in]  HiiHandle  A handle that was previously registered in=
> > > the HII Database.
> > >    @p= aram[in]  StringId   The identifier of the string to retriev= ed
from
> the
> > > string
> > > @@ -220,6= +213,51 @@ HiiGetString (
> > >    IN EFI_STRIN= G_ID   StringId,
> > >    IN CONST CHA= R8     *Language  OPTIONAL
> > > =    )
> > > +{
> > > +  return HiiGet= StringEx (HiiHandle, StringId, Language, TRUE); }
> > > +
&g= t; > > +/**
> > > +  Retrieves a string from a strin= g package in a specific language or
> > > +in the best
> = > > +  language at discretion of this function according to the = priority
of
> > languages.
> > > +  TryBestLan= guage is used to get the string in the best language or
> > > += in the language
> > > +  specified in Language parameter. = The behavior is,
> > > +  If TryBestLanguage is TRUE, this= function looks for the best
> > > +language for
> > &= gt; the string.
> > > +   - If the string can not be = retrieved using the specified language
> > > + or the
> &= gt; > current
> > > +     platform langu= age, then the string is retrieved from the string
> > > + packa= ge in
> > > the
> > > +     fir= st language the string package supports.
> > > +  If TryBe= stLanguage is FALSE, Language must be specified for
> > > + ret= rieving the
> > > string.
> > > +
> > >= +  The returned string is allocated using AllocatePool().  The c= aller
> > > + is responsible  for freeing the allocated bu= ffer using FreePool().
> > > +
> > > +  If Hii= Handle is NULL, then ASSERT().
> > > +  If StringId is 0, = then ASSET.
> > > +  If TryBestLanguage is FALE and Langua= ge is NULL, then ASSERT().
> > > +
> > > +  @p= aram[in]  HiiHandle         A = handle that was previously
> registered in the
> > > HII = Database.
> > > +  @param[in]  StringId  &n= bsp;       The identifier of the string to> retrieved from
> > the
> > > string
> >= > +           &n= bsp;            = ;        package associated with
>= HiiHandle.
> > > +  @param[in]  Language  =         The language of the string to> retrieve.  If this
> > > parameter
> > >= +            &= nbsp;           &nbs= p;       is NULL, then the current
> pl= atform language is used.  The
> > > +   &nb= sp;            =             &nb= sp;   format of Language must follow
> the
> > >= ; + language format
> > > assumed
> > > + &nbs= p;            &= nbsp;           &nbs= p;     the HII Database.
> > > +  @par= am[in]  TryBestLanguage   If TRUE, try to get the best
&g= t; matching
> > > language from all
> > > + &n= bsp;            = ;            &n= bsp;     supported languages.If FALSE,
> the
&= gt; > > + Language must be
> > > assigned
> > &g= t; +            = ;            &n= bsp;       for the StringID.
> > >= ; +
> > > +  @retval NULL   The string specified= by StringId is not present in
the
> string
> > > pack= age.
> > > +  @retval Other  The string was returned.=
> > > +
> > > +**/
> > > +EFI_STRING> > > +EFIAPI
> > > +HiiGetStringEx (
> > &= gt; +  IN EFI_HII_HANDLE  HiiHandle,
> > > +  IN= EFI_STRING_ID   StringId,
> > > +  IN CONST CHA= R8     *Language  OPTIONAL,
> > > +&nb= sp; IN BOOLEAN         TryBestLangu= age
> > > +  )
> > >  {
> > >=     EFI_STATUS  Status;
> > >  &n= bsp; UINTN       StringSize;
> > >= ; @@ -231,7 +269,10 @@ HiiGetString (
> > >
> > >&n= bsp;   ASSERT (HiiHandle !=3D NULL);
> > >  = ;  ASSERT (StringId !=3D 0);
> > > -
> > > +&n= bsp; //
> > > +  // Language must be specified if TryBestL= anguage =3D FALSE.
> > > +  //
> > > +  A= SSERT (!(TryBestLanguage =3D=3D FALSE && Language =3D=3D NULL));> > One minor here, in order to following the coding style, this see= ms
should be
> > ASSERT (!(!TryBestLanguage && Language= =3D=3D NULL)); Please help double
> > check.
> >
>= > >    //
> > >    // Init= ialize all allocated buffers to NULL
> > >    //=
> > > @@ -261,21 +302,26 @@ HiiGetString (
> > >&n= bsp;     Language =3D "";
> > >&n= bsp;   }
> > >
> > > -  //
> &= gt; > -  // Get the best matching language from SupportedLanguages<= br>> > > -  //
> > > -  BestLanguage =3D Get= BestLanguage (
> > > -       = ;            Support= edLanguages,
> > > -       &= nbsp;           FALSE,> // RFC 4646 mode
> > > -     &nb= sp;            = Language,
> // Highest priority
> > > -   = ;            &n= bsp;   PlatformLanguage !=3D NULL ? PlatformLanguage :
> &q= uot;",  // Next
> > > highest priority
> > &= gt; -           &nbs= p;       SupportedLanguages,
> // Lowes= t priority
> > > -       &nb= sp;           NULL
>= ; > > -          &n= bsp;        );
> > > - = if (BestLanguage =3D=3D NULL) {
> > > -    goto= Error;
> > > +  if (TryBestLanguage) {
> > > = +    //
> > > +    // Get the bes= t matching language from SupportedLanguages
> > > +  =   //
> > > +    BestLanguage =3D GetBestLan= guage (
> > > +        =              Su= pportedLanguages,
> > > +      &n= bsp;            = ;  FALSE,
> // RFC 4646 mode
> > > +  &nbs= p;            &= nbsp;     Language,
> // Highest priority
>= > > +          &nb= sp;          PlatformLanguage = !=3D NULL ?
> PlatformLanguage :
> > > + "",&nb= sp; // Next
> > > highest priority
> > > + &nb= sp;            =        SupportedLanguages,
> // Lowest = priority
> > > +        = ;             N= ULL
> > > +        &nbs= p;            );
= > > > +    if (BestLanguage =3D=3D NULL) {
> = > > +      goto Error;
> > > +&n= bsp;   }
> > > +  } else {
> > > +&n= bsp;   BestLanguage =3D (CHAR8 *) Language;
> > >&nbs= p;   }
> > >
> > > +
> > >&nb= sp;   //
> > >    // Retrieve the size= of the string in the string package for the
> > BestLanguage
&= gt; > >    //
> > > @@ -337,7 +383,7 @@ Er= ror:
> > >    if (PlatformLanguage !=3D NULL) {<= br>> > >      FreePool (PlatformLanguage)= ;
> > >    }
> > > -  if (BestL= anguage !=3D NULL) {
> > > +  if (TryBestLanguage &&am= p; BestLanguage !=3D NULL) {
> > >     = ; FreePool (BestLanguage);
> > >    }
> &g= t; >
> > > --
> > > 2.17.1
> >
> = >
> >
> >
> >
>
>
>
&= gt;
>






 

=

------=_NextPart_000_003A_01D6FBB5.51B495D0--