MdePkg: Refine the device path text format for Bluetooth to follow spec.
authorQiu Shumin <shumin.qiu@intel.com>
Fri, 28 Aug 2015 02:59:20 +0000 (02:59 +0000)
committershenshushi <shenshushi@Edk2>
Fri, 28 Aug 2015 02:59:20 +0000 (02:59 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18346 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
MdePkg/Library/UefiDevicePathLib/DevicePathToText.c

index b896685..e5f6a1f 100644 (file)
@@ -2795,17 +2795,18 @@ DevPathFromTextBluetooth (
                                    );\r
 \r
   Index = sizeof (BLUETOOTH_ADDRESS) - 1;\r
                                    );\r
 \r
   Index = sizeof (BLUETOOTH_ADDRESS) - 1;\r
-  while (!IS_NULL(BluetoothStr) && Index >= 0) {\r
-    Walker = SplitStr (&BluetoothStr, L':');\r
-    TempBufferSize = StrSize (Walker) + StrLen (L"0x") * sizeof (CHAR16);\r
+  Walker = BluetoothStr;\r
+  while (!IS_NULL(*Walker) && Index >= 0) {\r
+    TempBufferSize = 2 * sizeof(CHAR16) + StrSize(L"0x");\r
     TempNumBuffer = AllocateZeroPool (TempBufferSize);\r
     if (TempNumBuffer == NULL) {\r
       break;\r
     }\r
     StrCpyS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), L"0x");\r
     TempNumBuffer = AllocateZeroPool (TempBufferSize);\r
     if (TempNumBuffer == NULL) {\r
       break;\r
     }\r
     StrCpyS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), L"0x");\r
-    StrCatS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), Walker);\r
+    StrnCatS (TempNumBuffer, TempBufferSize / sizeof (CHAR16), Walker, 2);\r
     BluetoothDp->BD_ADDR.Address[Index] = (UINT8)Strtoi (TempNumBuffer);\r
     FreePool (TempNumBuffer);\r
     BluetoothDp->BD_ADDR.Address[Index] = (UINT8)Strtoi (TempNumBuffer);\r
     FreePool (TempNumBuffer);\r
+    Walker += 2;\r
     Index--;\r
   }\r
   \r
     Index--;\r
   }\r
   \r
index be4619a..627308c 100644 (file)
@@ -1584,7 +1584,7 @@ DevPathToTextBluetooth (
   Bluetooth = DevPath;\r
   UefiDevicePathLibCatPrint (\r
     Str,\r
   Bluetooth = DevPath;\r
   UefiDevicePathLibCatPrint (\r
     Str,\r
-    L"Bluetooth(%02x:%02x:%02x:%02x:%02x:%02x)",\r
+    L"Bluetooth(%02x%02x%02x%02x%02x%02x)",\r
     Bluetooth->BD_ADDR.Address[5],\r
     Bluetooth->BD_ADDR.Address[4],\r
     Bluetooth->BD_ADDR.Address[3],\r
     Bluetooth->BD_ADDR.Address[5],\r
     Bluetooth->BD_ADDR.Address[4],\r
     Bluetooth->BD_ADDR.Address[3],\r