[edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue

Jiaxin Wu posted 1 patch 6 years, 12 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c       | 11 +++++++----
.../Library/DeviceManagerUiLib/DeviceManagerStrings.uni       |  5 +++--
2 files changed, 10 insertions(+), 6 deletions(-)
[edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
Posted by Jiaxin Wu 6 years, 12 months ago
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>
---
 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/MdeModulePkg/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(
 
   //
   // Update the network device form titile.
   //
   if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
-    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
-    NewStringLen = StrLen(mSelectedMacAddrString) * 2;
-    NewStringLen += (StrLen(String) + 2) * 2;
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD), NULL);
+    if (String == NULL) {
+      return;
+    }
+    NewStringLen = StrLen (mSelectedMacAddrString) * 2;
+    NewStringLen += (StrLen (String) + 2) * 2;
     NewStringTitle = AllocatePool (NewStringLen);
     UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
-    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    
+    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
     FreePool (String);
     FreePool (NewStringTitle);
   }
 
   //
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni 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.<BR>
+//  Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
 //  This program and the accompanying materials
 //  are licensed and made available under the terms and conditions of the BSD License
 //  which accompanies 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 Device"
+#string STR_FORM_NETWORK_DEVICE_TITLE       #language en-US  "Network Device"
                                        #language fr-FR  "Network Device"
 #string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."
                                        #language fr-FR  "Network Device Help..."
 #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
Re: [edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
Posted by Dong, Eric 6 years, 12 months ago
Reviewed-by: Eric Dong <eric.dong@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin 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 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>
---
 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/MdeModulePkg/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(
 
   //
   // Update the network device form titile.
   //
   if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
-    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
-    NewStringLen = StrLen(mSelectedMacAddrString) * 2;
-    NewStringLen += (StrLen(String) + 2) * 2;
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD), NULL);
+    if (String == NULL) {
+      return;
+    }
+    NewStringLen = StrLen (mSelectedMacAddrString) * 2;
+    NewStringLen += (StrLen (String) + 2) * 2;
     NewStringTitle = AllocatePool (NewStringLen);
     UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
-    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    
+    HiiSetString (HiiHandle, STRING_TOKEN 
+ (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
     FreePool (String);
     FreePool (NewStringTitle);
   }
 
   //
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni 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.<BR>
+//  Copyright (c) 2004 - 2017, Intel Corporation. All rights 
+reserved.<BR>
 //  This program and the accompanying materials  //  are licensed and made available under the terms and conditions of the BSD License  //  which accompanies 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 Device"
+#string STR_FORM_NETWORK_DEVICE_TITLE       #language en-US  "Network Device"
                                        #language fr-FR  "Network Device"
 #string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."
                                        #language fr-FR  "Network Device Help..."
 #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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
Posted by Ye, Ting 6 years, 12 months ago
Reviewed-by: Ye Ting <ting.ye@intel.com> 

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Friday, April 21, 2017 11:01 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Dong, Eric <eric.dong@intel.com>
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 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>
---
 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/MdeModulePkg/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(
 
   //
   // Update the network device form titile.
   //
   if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
-    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
-    NewStringLen = StrLen(mSelectedMacAddrString) * 2;
-    NewStringLen += (StrLen(String) + 2) * 2;
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD), NULL);
+    if (String == NULL) {
+      return;
+    }
+    NewStringLen = StrLen (mSelectedMacAddrString) * 2;
+    NewStringLen += (StrLen (String) + 2) * 2;
     NewStringTitle = AllocatePool (NewStringLen);
     UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
-    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    
+    HiiSetString (HiiHandle, STRING_TOKEN 
+ (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
     FreePool (String);
     FreePool (NewStringTitle);
   }
 
   //
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni 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.<BR>
+//  Copyright (c) 2004 - 2017, Intel Corporation. All rights 
+reserved.<BR>
 //  This program and the accompanying materials  //  are licensed and made available under the terms and conditions of the BSD License  //  which accompanies 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 Device"
+#string STR_FORM_NETWORK_DEVICE_TITLE       #language en-US  "Network Device"
                                        #language fr-FR  "Network Device"
 #string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."
                                        #language fr-FR  "Network Device Help..."
 #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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v3] MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
Posted by Fu, Siyuan 6 years, 12 months ago
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: 2017年4月21日 11:01
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Dong, Eric <eric.dong@intel.com>
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 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>
---
 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/MdeModulePkg/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(
 
   //
   // Update the network device form titile.
   //
   if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
-    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL);
-    NewStringLen = StrLen(mSelectedMacAddrString) * 2;
-    NewStringLen += (StrLen(String) + 2) * 2;
+    String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD), NULL);
+    if (String == NULL) {
+      return;
+    }
+    NewStringLen = StrLen (mSelectedMacAddrString) * 2;
+    NewStringLen += (StrLen (String) + 2) * 2;
     NewStringTitle = AllocatePool (NewStringLen);
     UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
-    HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);    
+    HiiSetString (HiiHandle, STRING_TOKEN 
+ (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);
     FreePool (String);
     FreePool (NewStringTitle);
   }
 
   //
diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerStrings.uni 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.<BR>
+//  Copyright (c) 2004 - 2017, Intel Corporation. All rights 
+reserved.<BR>
 //  This program and the accompanying materials  //  are licensed and made available under the terms and conditions of the BSD License  //  which accompanies 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 Device"
+#string STR_FORM_NETWORK_DEVICE_TITLE       #language en-US  "Network Device"
                                        #language fr-FR  "Network Device"
 #string STR_FORM_NETWORK_DEVICE_HELP   #language en-US  "Network Device Help..."
                                        #language fr-FR  "Network Device Help..."
 #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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel