From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5EC9F81F52 for ; Sun, 26 Feb 2017 23:36:30 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 26 Feb 2017 23:36:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,213,1484035200"; d="scan'208";a="69938880" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 26 Feb 2017 23:36:29 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 26 Feb 2017 23:36:29 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 26 Feb 2017 23:36:29 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Mon, 27 Feb 2017 15:36:27 +0800 From: "Fan, Jeff" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" Thread-Topic: [PATCH 1/7] IntelFrameworkModulePkg: Replace [Ascii|Unicode]ValueToString Thread-Index: AQHSjDayoFyCQDGjqEqEeReEjjL9TaF8f+Ug Date: Mon, 27 Feb 2017 07:36:26 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4C54A0DD@shsmsx102.ccr.corp.intel.com> References: <1487676934-12984-1-git-send-email-hao.a.wu@intel.com> <1487676934-12984-2-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1487676934-12984-2-git-send-email-hao.a.wu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjM0ZGY5YTItNjEzYi00ZmY4LWI5ZjAtMWUzMzg3Y2I1ZTIwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImpmWHlJXC8rNFh6cDRWQStiOWdVNlwvZ0RPcnJKUnRSRVlQXC9XN3lUMTBBb2c9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 1/7] IntelFrameworkModulePkg: Replace [Ascii|Unicode]ValueToString 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: Mon, 27 Feb 2017 07:36:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jeff Fan -----Original Message----- From: Wu, Hao A=20 Sent: Tuesday, February 21, 2017 7:35 PM To: edk2-devel@lists.01.org Cc: Wu, Hao A; Yao, Jiewen; Fan, Jeff Subject: [PATCH 1/7] IntelFrameworkModulePkg: Replace [Ascii|Unicode]ValueT= oString It is the follow up of commits 51f0ceb..9e32e97 to replace AsciiValueToStri= ng/UnicodeValueToString with AsciiValueToStringS/UnicodeValueToStringS. Cc: Jiewen Yao Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c | 12 += ++++++++--- IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c | 20 += ++++++++++++++++--- IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c | 15 += ++++++++++---- IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c | 6 += ++--- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.= c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c index a2e38d2..bdf2614 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c @@ -1,7 +1,7 @@ /** @file Dynamically update the pages. =20 -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -844,11 +8= 44,17 @@ UpdateConModePage ( // // Build mode string Column x Row // - UnicodeValueToString (ModeString, 0, Col, 0); + UnicodeValueToStringS (ModeString, sizeof (ModeString), 0, Col, 0); PStr =3D &ModeString[0]; StrCatS (PStr, ARRAY_SIZE (ModeString), L" x "); PStr =3D PStr + StrLen (PStr); - UnicodeValueToString (PStr , 0, Row, 0); + UnicodeValueToStringS ( + PStr, + sizeof (ModeString) - ((UINTN)PStr - (UINTN)&ModeString[0]), + 0, + Row, + 0 + ); =20 ModeToken[Index] =3D HiiSetString (CallbackData->BmmHiiHandle, 0, Mode= String, NULL); =20 diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceMana= ger.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c index af2b18a..125c49d 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager. +++ c @@ -1,7 +1,7 @@ /** @file The platform device manager reference implementation =20 -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -388,7 +38= 8,14 @@ GetMacAddressString( // HwAddress =3D &MacAddressNode->MacAddress.Addr[0]; for (Index =3D 0; Index < HwAddressSize; Index++) { - String +=3D UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, *(H= wAddress++), 2); + UnicodeValueToStringS ( + String, + BufferLen - ((UINTN)String - (UINTN)*PBuffer), + PREFIX_ZERO | RADIX_HEX, + *(HwAddress++), + 2 + ); + String +=3D StrnLenS (String, (BufferLen - ((UINTN)String -=20 + (UINTN)*PBuffer)) / sizeof (CHAR16)); if (Index < HwAddressSize - 1) { *String++ =3D L':'; } @@ -408,7 +415,14 @@ GetMacAddressString( =20 if (VlanId !=3D 0) { *String++ =3D L'\\'; - String +=3D UnicodeValueToString (String, PREFIX_ZERO | RADIX_HEX, Vla= nId, 4); + UnicodeValueToStringS ( + String, + BufferLen - ((UINTN)String - (UINTN)*PBuffer), + PREFIX_ZERO | RADIX_HEX, + VlanId, + 4 + ); + String +=3D StrnLenS (String, (BufferLen - ((UINTN)String -=20 + (UINTN)*PBuffer)) / sizeof (CHAR16)); } =20 // diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFr= ameworkModulePkg/Universal/BdsDxe/FrontPage.c index c771974..ec91422 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -1,7 +1,7 @@ /** @file FrontPage routines to handle the callbacks and browser calls =20 -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -629,9 +62= 9,16 @@ ConvertProcessorToString ( =20 StringBuffer =3D AllocateZeroPool (0x20); ASSERT (StringBuffer !=3D NULL); - Index =3D UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 10= 00, 3); + UnicodeValueToStringS (StringBuffer, 0x20, LEFT_JUSTIFY, FreqMhz /=20 + 1000, 3); Index =3D StrnLenS (StringBuffer, 0x20 / sizeof (CHAR16)); StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L"."); - UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % = 1000) / 10, 2); + UnicodeValueToStringS ( + StringBuffer + Index + 1, + 0x20 - sizeof (CHAR16) * (Index + 1), + PREFIX_ZERO, + (FreqMhz % 1000) / 10, + 2 + ); StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" GHz"); *String =3D (CHAR16 *) StringBuffer; return ; @@ -655,7 +662,7 @@ ConvertMemorySizeToString ( =20 StringBuffer =3D AllocateZeroPool (0x20); ASSERT (StringBuffer !=3D NULL); - UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6); + UnicodeValueToStringS (StringBuffer, 0x20, LEFT_JUSTIFY, MemorySize,=20 + 6); StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" MB RAM"); =20 *String =3D (CHAR16 *) StringBuffer; diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c b/IntelF= rameworkModulePkg/Universal/BdsDxe/MemoryTest.c index 700e3e6..1188082 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c @@ -1,7 +1,7 @@ /** @file Perform the platform memory test =20 -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -318,7 +31= 8,7 @@ BdsMemoryTest ( TempData ); if (TestPercent !=3D PreviousValue) { - UnicodeValueToString (StrPercent, 0, TestPercent, 0); + UnicodeValueToStringS (StrPercent, sizeof (StrPercent), 0,=20 + TestPercent, 0); TmpStr =3D GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT)); if (TmpStr !=3D NULL) { // @@ -386,7 +386,7 @@ BdsMemoryTest ( =20 Done: if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { - UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0); + UnicodeValueToStringS (StrTotalMemory, StrTotalMemorySize,=20 + COMMA_TYPE, TotalMemorySize, 0); if (StrTotalMemory[0] =3D=3D L',') { StrTotalMemory++; StrTotalMemorySize -=3D sizeof (CHAR16); -- 1.9.5.msysgit.0