]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
authorJiaxin Wu <jiaxin.wu@intel.com>
Mon, 17 Apr 2017 08:06:04 +0000 (16:06 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Fri, 21 Apr 2017 05:06:54 +0000 (13:06 +0800)
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
according the different MAC value. So, the string value shouldn't be treated
as a constant string (Network Device). Otherwise, the display will be
incorrect.

Reproduce: Device Manager->Network Device List, select to enter MAC, then to
press ESC back to previous page, then re-enter, found each enter/ESC operation,
the MAC address display +1.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni

index 5098b70e97b1ec98b0b9edf82b5ac7e13ff6583a..23ae6c5392e44f0af615f433c77f2a9c1c7b00db 100644 (file)
@@ -540,12 +540,15 @@ CreateDeviceManagerForm(
   // Update the network device form titile.\r
   //\r
   if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {\r
-    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);\r
-    NewStringLen = StrLen(mSelectedMacAddrString) * 2;\r
-    NewStringLen += (StrLen(String) + 2) * 2;\r
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD), NULL);\r
+    if (String == NULL) {\r
+      return;\r
+    }\r
+    NewStringLen = StrLen (mSelectedMacAddrString) * 2;\r
+    NewStringLen += (StrLen (String) + 2) * 2;\r
     NewStringTitle = AllocatePool (NewStringLen);\r
     UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);\r
-    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    \r
+    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);\r
     FreePool (String);\r
     FreePool (NewStringTitle);\r
   }\r
index 061e4be434c90ac4ecef9b592d0ed6663182dacf..55d03d623962a5cbbf7f1bbc07b4a511c6914fc3 100644 (file)
@@ -2,7 +2,7 @@
 //\r
 //  String definitions for the Device Manager.\r
 //\r
-//  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+//  Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 //  This program and the accompanying materials\r
 //  are licensed and made available under the terms and conditions of the BSD License\r
 //  which accompanies this distribution.  The full text of the license may be found at\r
@@ -42,7 +42,8 @@
                                        #language fr-FR  ""\r
 #string STR_EXIT_STRING                #language en-US  "Press ESC to exit."\r
                                        #language fr-FR  "Press ESC to exit."\r
-#string STR_FORM_NETWORK_DEVICE_TITLE  #language en-US  "Network Device"\r
+#string STR_FORM_NETWORK_DEVICE_TITLE_HEAD  #language en-US  "Network Device"\r
+#string STR_FORM_NETWORK_DEVICE_TITLE       #language en-US  "Network Device"\r
                                        #language fr-FR  "Network Device"\r
 #string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."\r
                                        #language fr-FR  "Network Device Help..."\r