]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/XenBusDxe: eliminate AsciiStrCat() calls
authorLaszlo Ersek <lersek@redhat.com>
Fri, 21 Oct 2016 09:46:09 +0000 (11:46 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Tue, 25 Oct 2016 08:46:14 +0000 (10:46 +0200)
AsciiStrCat() is deprecated / disabled under the
DISABLE_NEW_DEPRECATED_INTERFACES feature test macro.

Replace AsciiStrCat() with AsciiSPrint(). Spell out the (already existent)
PrintLib dependency in the INF file. Add an explicit ASSERT() to document
that XenStoreJoin() assumes that the pool allocation always succeeds.

Cc: Anthony PERARD <anthony.perard@citrix.com>
Cc: Gary Lin <glin@suse.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=166
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Gary Lin <glin@suse.com>
Tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/XenBusDxe/XenBusDxe.inf
OvmfPkg/XenBusDxe/XenStore.c

index f0c5db98b1f437e26d8c83ca28a6db6cd492b22e..5ff1cd04840c48a853c7a37726fad83a263a0255 100644 (file)
@@ -56,6 +56,7 @@
   DebugLib\r
   XenHypercallLib\r
   SynchronizationLib\r
+  PrintLib\r
 \r
 [Protocols]\r
   gEfiDriverBindingProtocolGuid\r
index aa3ff7d3017b7a6b048c8e4d82da2c726b002686..b7ae1d04863d8941e5b56b79796a77cd30317ded 100644 (file)
@@ -303,14 +303,17 @@ XenStoreJoin (
   )\r
 {\r
   CHAR8 *Buf;\r
+  UINTN BufSize;\r
 \r
   /* +1 for '/' and +1 for '\0' */\r
-  Buf = AllocateZeroPool (\r
-          AsciiStrLen (DirectoryPath) + AsciiStrLen (Node) + 2);\r
-  AsciiStrCat (Buf, DirectoryPath);\r
-  if (Node[0] != '\0') {\r
-    AsciiStrCat (Buf, "/");\r
-    AsciiStrCat (Buf, Node);\r
+  BufSize = AsciiStrLen (DirectoryPath) + AsciiStrLen (Node) + 2;\r
+  Buf = AllocatePool (BufSize);\r
+  ASSERT (Buf != NULL);\r
+\r
+  if (Node[0] == '\0') {\r
+    AsciiSPrint (Buf, BufSize, "%a", DirectoryPath);\r
+  } else {\r
+    AsciiSPrint (Buf, BufSize, "%a/%a", DirectoryPath, Node);\r
   }\r
 \r
   return Buf;\r