]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update FrameworkUefiLib library instance to implement the missing CatSPrint() and...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 29 Feb 2012 04:57:44 +0000 (04:57 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 29 Feb 2012 04:57:44 +0000 (04:57 +0000)
Signed-off-by: lgao4
Reviewed-by: rsun3
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13070 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c

index a4d1f0271828c799fe6a0e710109fe456322b6a0..63b077542f114413404865ef625c8432b987e17d 100644 (file)
@@ -710,3 +710,104 @@ AsciiPrintXY (
   return ReturnNum;\r
 }\r
 \r
+/** \r
+  Appends a formatted Unicode string to a Null-terminated Unicode string\r
\r
+  This function appends a formatted Unicode string to the Null-terminated \r
+  Unicode string specified by String.   String is optional and may be NULL.\r
+  Storage for the formatted Unicode string returned is allocated using \r
+  AllocatePool().  The pointer to the appended string is returned.  The caller\r
+  is responsible for freeing the returned string.\r
\r
+  If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
+  If FormatString is NULL, then ASSERT().\r
+  If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
\r
+  @param[in] String         A Null-terminated Unicode string.\r
+  @param[in] FormatString   A Null-terminated Unicode format string.\r
+  @param[in]  Marker        VA_LIST marker for the variable argument list.\r
+\r
+  @retval NULL    There was not enough available memory.\r
+  @return         Null-terminated Unicode string is that is the formatted \r
+                  string appended to String.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+CatVSPrint (\r
+  IN  CHAR16  *String, OPTIONAL\r
+  IN  CONST CHAR16  *FormatString,\r
+  IN  VA_LIST       Marker\r
+  )\r
+{\r
+  UINTN   CharactersRequired;\r
+  UINTN   SizeRequired;\r
+  CHAR16  *BufferToReturn;\r
+  VA_LIST ExtraMarker;\r
+\r
+  VA_COPY (ExtraMarker, Marker);\r
+  CharactersRequired = SPrintLength(FormatString, ExtraMarker);\r
+  VA_END (ExtraMarker);\r
+\r
+  if (String != NULL) {\r
+    SizeRequired = StrSize(String) + (CharactersRequired * sizeof(CHAR16));\r
+  } else {\r
+    SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));\r
+  }\r
+\r
+  BufferToReturn = AllocateZeroPool(SizeRequired);\r
+\r
+  if (BufferToReturn == NULL) {\r
+    return NULL;\r
+  }\r
+\r
+  if (String != NULL) {\r
+    StrCpy(BufferToReturn, String);\r
+  }\r
+\r
+  UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);\r
+\r
+  ASSERT(StrSize(BufferToReturn)==SizeRequired);\r
+\r
+  return (BufferToReturn);\r
+}\r
+\r
+/** \r
+  Appends a formatted Unicode string to a Null-terminated Unicode string\r
\r
+  This function appends a formatted Unicode string to the Null-terminated \r
+  Unicode string specified by String.   String is optional and may be NULL.\r
+  Storage for the formatted Unicode string returned is allocated using \r
+  AllocatePool().  The pointer to the appended string is returned.  The caller\r
+  is responsible for freeing the returned string.\r
\r
+  If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r
+  If FormatString is NULL, then ASSERT().\r
+  If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
\r
+  @param[in] String         A Null-terminated Unicode string.\r
+  @param[in] FormatString   A Null-terminated Unicode format string.\r
+  @param[in] ...            The variable argument list whose contents are \r
+                            accessed based on the format string specified by \r
+                            FormatString.\r
+\r
+  @retval NULL    There was not enough available memory.\r
+  @return         Null-terminated Unicode string is that is the formatted \r
+                  string appended to String.\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+CatSPrint (\r
+  IN  CHAR16  *String, OPTIONAL\r
+  IN  CONST CHAR16  *FormatString,\r
+  ...\r
+  )\r
+{\r
+  VA_LIST   Marker;\r
+  CHAR16    *NewString;\r
+\r
+  VA_START (Marker, FormatString);\r
+  NewString = CatVSPrint(String, FormatString, Marker);\r
+  VA_END (Marker);\r
+  return NewString;\r
+}\r
+\r