From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 053BC2195406F for ; Thu, 20 Apr 2017 20:11:20 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2017 20:11:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,228,1488873600"; d="scan'208";a="1121979710" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 20 Apr 2017 20:11:19 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 20 Apr 2017 20:11:19 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.193]) with mapi id 14.03.0319.002; Fri, 21 Apr 2017 11:11:17 +0800 From: "Dong, Eric" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Fu, Siyuan" , "Wu, Jiaxin" Thread-Topic: [edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue Thread-Index: AQHSukuWJWap8W1NDUeeh8kUGTSMVKHPJTSA Date: Fri, 21 Apr 2017 03:11:16 +0000 Message-ID: References: <1492743661-18012-1-git-send-email-jiaxin.wu@intel.com> In-Reply-To: <1492743661-18012-1-git-send-email-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Apr 2017 03:11:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiax= in Wu Sent: Friday, April 21, 2017 11:01 AM To: edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan; Wu, Jiaxin; Dong, Eric Subject: [edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network= device MAC display issue v3: * Add NULL string check. v2: * Define new STR_FORM_NETWORK_DEVICE_TITLE_HEAD for L" Network Device " instead of hard code in the code. Network device tile (STR_FORM_NETWORK_DEVICE_TITLE) is dynamic adjusted acc= ording the different MAC value. So, the string value shouldn't be treated a= s a constant string (Network Device). Otherwise, the display will be incorr= ect. Reproduce: Device Manager->Network Device List, select to enter MAC, then t= o press ESC back to previous page, then re-enter, found each enter/ESC oper= ation, the MAC address display +1. Cc: Eric Dong Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c | 11 +++++++= ---- .../Library/DeviceManagerUiLib/DeviceManagerStrings.uni | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c b/MdeM= odulePkg/Library/DeviceManagerUiLib/DeviceManager.c index 5098b70..23ae6c5 100644 --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c @@ -538,16 +538,19 @@ CreateDeviceManagerForm( =20 // // Update the network device form titile. // if (NextShowFormId =3D=3D NETWORK_DEVICE_FORM_ID) { - String =3D HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEV= ICE_TITLE), NULL); - NewStringLen =3D StrLen(mSelectedMacAddrString) * 2; - NewStringLen +=3D (StrLen(String) + 2) * 2; + String =3D HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEV= ICE_TITLE_HEAD), NULL); + if (String =3D=3D NULL) { + return; + } + NewStringLen =3D StrLen (mSelectedMacAddrString) * 2; + NewStringLen +=3D (StrLen (String) + 2) * 2; NewStringTitle =3D AllocatePool (NewStringLen); UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelect= edMacAddrString); - HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE),= NewStringTitle, NULL); =20 + HiiSetString (HiiHandle, STRING_TOKEN=20 + (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL); FreePool (String); FreePool (NewStringTitle); } =20 // diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.u= ni b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni index 061e4be..55d03d6 100644 --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni @@ -1,10 +1,10 @@ ///** @file // // String definitions for the Device Manager. // -// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+// Copyright (c) 2004 - 2017, Intel Corporation. All rights=20 +reserved.
// This program and the accompanying materials // are licensed and made= available under the terms and conditions of the BSD License // which acc= ompanies this distribution. The full text of the license may be found at = // http://opensource.org/licenses/bsd-license.php // @@ -40,11 +40,12 @@ #language fr-FR "Missing String" #string STR_EMPTY_STRING #language en-US "" #language fr-FR "" #string STR_EXIT_STRING #language en-US "Press ESC to exit= ." #language fr-FR "Press ESC to exit= ." -#string STR_FORM_NETWORK_DEVICE_TITLE #language en-US "Network Device" +#string STR_FORM_NETWORK_DEVICE_TITLE_HEAD #language en-US "Network Devi= ce" +#string STR_FORM_NETWORK_DEVICE_TITLE #language en-US "Network Devi= ce" #language fr-FR "Network Device" #string STR_FORM_NETWORK_DEVICE_HELP #language en-US "Network Device He= lp..." #language fr-FR "Network Device He= lp..." #string STR_NETWORK_DEVICE_STRING #language en-US "Network Device" #language fr-FR "Network Device" -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel