From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: liming.gao@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Sun, 01 Sep 2019 20:13:34 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Sep 2019 20:13:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,457,1559545200"; d="scan'208";a="186895525" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 01 Sep 2019 20:13:33 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 1 Sep 2019 20:13:33 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 1 Sep 2019 20:13:33 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.89]) with mapi id 14.03.0439.000; Mon, 2 Sep 2019 11:13:31 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "tzhao@solarflare.com" CC: "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH v2 1/1] MdePkg: UefiLib: Add a function to check if a language is supported Thread-Topic: [edk2-devel] [PATCH v2 1/1] MdePkg: UefiLib: Add a function to check if a language is supported Thread-Index: AQHVXybdKM1wahm9ZUSNWPo0Cd8nK6cXt8/g Date: Mon, 2 Sep 2019 03:13:30 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4F01CC@SHSMSX104.ccr.corp.intel.com> References: <7fd22bc9-2a47-6e04-8541-fb73577f0cc0@solarflare.com> In-Reply-To: <7fd22bc9-2a47-6e04-8541-fb73577f0cc0@solarflare.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjZlZjM4NWMtMThiMC00NmE4LTllODItYzNkNWQzNDJiNGUzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoib3d6TWN3d2NBYTJIb2NXclwvQWFTUTRCeUh6UXJJVUcxM1ZEV08yRSsrR3BGUEdsTWd0TDFLS3ZSeTJrK3lmdmkifQ== dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Tom: New API IsLanguageSupported() only supports RFC 4646 language code for t= he Unicode string.=20 If you think ISO 639-2 language code is obsolete, and don't plan to supp= ort it any longer. Please=20 update IsLanguageSupported() function description to clarify this API fo= r RFC 4646 language code.=20 And, I still want to know what other usage model for this new API IsLang= uageSupported(). For example,=20 how UEFI HII driver consumes this API? If this API is only used in UefiL= ib, it can be the internal function=20 in UefiLib library instance.=20 Thanks Liming > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of To= m Zhao > Sent: Friday, August 30, 2019 7:34 PM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Kinney, Michael D > Subject: [edk2-devel] [PATCH v2 1/1] MdePkg: UefiLib: Add a function to = check if a language is supported >=20 > BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2100 >=20 > Add a function that checks if a target language is in the supported > languages list. Refactor UefiLib to use this function where appropriate > internally. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Signed-off-by: Tom Zhao > --- > MdePkg/Include/Library/UefiLib.h | 16 ++++++ > MdePkg/Library/UefiLib/UefiLib.c | 59 +++++++++++++------- > 2 files changed, 54 insertions(+), 21 deletions(-) >=20 > diff --git a/MdePkg/Include/Library/UefiLib.h > b/MdePkg/Include/Library/UefiLib.h > index 1650f30ddbc6..9dd170cbe2bf 100644 > --- a/MdePkg/Include/Library/UefiLib.h > +++ b/MdePkg/Include/Library/UefiLib.h > @@ -461,6 +461,22 @@ EfiTestChildHandle ( > IN CONST EFI_GUID *ProtocolGuid > ); > +/** > + * This function checks the supported languages list for a target langu= age > + * > + * @param SupportedLanguages The supported languages > + * @param TargetLanguage The target language > + * > + * @return Returns EFI_SUCCESS if the language is supported, > + * EFI_UNSUPPORTED otherwise > + */ > +EFI_STATUS > +EFIAPI > +IsLanguageSupported ( > + IN CONST CHAR8 *SupportedLanguages, > + IN CONST CHAR8 *TargetLanguage > + ); > + > /** > This function looks up a Unicode string in UnicodeStringTable. > diff --git a/MdePkg/Library/UefiLib/UefiLib.c > b/MdePkg/Library/UefiLib/UefiLib.c > index daa4af762e62..56281d25fd99 100644 > --- a/MdePkg/Library/UefiLib/UefiLib.c > +++ b/MdePkg/Library/UefiLib/UefiLib.c > @@ -640,6 +640,35 @@ EfiTestChildHandle ( > return Status; > } > +/** > + * This function checks the supported languages list for a target langu= age > + * > + * @param SupportedLanguages The supported languages > + * @param TargetLanguage The target language > + * > + * @return Returns EFI_SUCCESS if the language is supported, > + * EFI_UNSUPPORTED otherwise > + */ > +EFI_STATUS > +EFIAPI > +IsLanguageSupported ( > + IN CONST CHAR8 *SupportedLanguages, > + IN CONST CHAR8 *TargetLanguage > + ) > +{ > + UINTN Index; > + while (*SupportedLanguages !=3D 0) { > + for (Index =3D 0; SupportedLanguages[Index] !=3D 0 && > SupportedLanguages[Index] !=3D ';'; Index++); > + if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) =3D=3D= 0) > && (TargetLanguage[Index] =3D=3D 0)) { > + return EFI_SUCCESS; > + } > + SupportedLanguages +=3D Index; > + for (; *SupportedLanguages !=3D 0 && *SupportedLanguages =3D=3D ';'= ; > SupportedLanguages++); > + } > + > + return EFI_UNSUPPORTED; > +} > + > /** > This function looks up a Unicode string in UnicodeStringTable. > @@ -800,24 +829,19 @@ LookupUnicodeString2 ( > // Make sure Language is in the set of Supported Languages > // > Found =3D FALSE; > - while (*SupportedLanguages !=3D 0) { > - if (Iso639Language) { > + if (Iso639Language) { > + while (*SupportedLanguages !=3D 0) { > if (CompareIso639LanguageCode (Language, SupportedLanguages)) { > Found =3D TRUE; > break; > } > SupportedLanguages +=3D 3; > - } else { > - for (Index =3D 0; SupportedLanguages[Index] !=3D 0 && > SupportedLanguages[Index] !=3D ';'; Index++); > - if ((AsciiStrnCmp(SupportedLanguages, Language, Index) =3D=3D 0) = && > (Language[Index] =3D=3D 0)) { > - Found =3D TRUE; > - break; > - } > - SupportedLanguages +=3D Index; > - for (; *SupportedLanguages !=3D 0 && *SupportedLanguages =3D=3D '= ;'; > SupportedLanguages++); > } > + } else { > + Found =3D !IsLanguageSupported(Language, SupportedLanguages); > } > + > // > // If Language is not a member of SupportedLanguages, then return > EFI_UNSUPPORTED > // > @@ -1099,24 +1123,17 @@ AddUnicodeString2 ( > // Make sure Language is a member of SupportedLanguages > // > Found =3D FALSE; > - while (*SupportedLanguages !=3D 0) { > - if (Iso639Language) { > + if (Iso639Language) { > + while (*SupportedLanguages !=3D 0) { > if (CompareIso639LanguageCode (Language, SupportedLanguages)) { > Found =3D TRUE; > break; > } > SupportedLanguages +=3D 3; > - } else { > - for (Index =3D 0; SupportedLanguages[Index] !=3D 0 && > SupportedLanguages[Index] !=3D ';'; Index++); > - if (AsciiStrnCmp(SupportedLanguages, Language, Index) =3D=3D 0) { > - Found =3D TRUE; > - break; > - } > - SupportedLanguages +=3D Index; > - for (; *SupportedLanguages !=3D 0 && *SupportedLanguages =3D=3D '= ;'; > SupportedLanguages++); > } > + } else { > + Found =3D !IsLanguageSupported(Language, SupportedLanguages); > } > - > // > // If Language is not a member of SupportedLanguages, then return > EFI_UNSUPPORTED > // > -- > 2.21.0 >=20 >=20 >=20