]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/PrintLib.h
MdePkg/BaseLib: Add safe string functions [Ascii]StrnSizeS
[mirror_edk2.git] / MdePkg / Include / Library / PrintLib.h
index ab487f289ab1723666c8d59465cb76e22289eb1e..fcaacde6522a763893eda0bfd299557790c2f96a 100644 (file)
@@ -2,7 +2,7 @@
   Provides services to print a formatted string to a buffer. All combinations of\r
   Unicode and ASCII strings are supported.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -46,8 +46,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       - Place a comma every 3rd digit of the number.  Only valid for type d.\r
         If 0 is also specified, then 0 is ignored.\r
     - L, l\r
-      - The number being printed is a UINT64.  Only valid for types X, x, and d.\r
-        If this flag is not specified, then the number being printed is a int.\r
+      - The number being printed is size UINT64.  Only valid for types X, x, and d.\r
+        If this flag is not specified, then the number being printed is size int.\r
     - NOTE: All invalid flags are ignored.\r
 \r
   [width]:\r
@@ -78,20 +78,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       - The argument is a Unicode character.  ASCII characters can be printed \r
         using this type too by making sure bits 8..15 of the argument are set to 0.\r
     - x\r
-      - The argument is a hexadecimal number.  The characters used are 0..9 and \r
+      - The argument is an unsigned hexadecimal number.  The characters used are 0..9 and \r
         A..F.  If the flag 'L' is not specified, then the argument is assumed \r
-        to be an int.  This does not follow ANSI C.\r
+        to be size int.  This does not follow ANSI C.\r
     - X\r
-      - The argument is a hexadecimal number and the number is padded with \r
+      - The argument is an unsigned hexadecimal number and the number is padded with \r
         zeros.  This is equivalent to a format string of "0x". If the flag \r
-        'L' is not specified, then the argument is assumed to be an int.  \r
+        'L' is not specified, then the argument is assumed to be size int.  \r
         This does not follow ANSI C.\r
     - d\r
-      - The argument is a decimal number.  If the flag 'L' is not specified, \r
-        then the argument is assumed to be an int.  \r
+      - The argument is a signed decimal number.  If the flag 'L' is not specified, \r
+        then the argument is assumed to be size int.  \r
+    - u\r
+      - The argument is a unsigned decimal number.  If the flag 'L' is not specified, \r
+        then the argument is assumed to be size int.\r
     - p\r
-      - The argument is a pointer that is a (VOID *), and it is printed as a \r
-        hexadecimal number  The characters used are 0..9 and A..F.\r
+      - The argument is a pointer that is a (VOID *), and it is printed as an \r
+        unsigned hexadecimal number  The characters used are 0..9 and A..F.\r
     - a\r
       - The argument is a pointer to an ASCII string.  \r
         This does not follow ANSI C.\r
@@ -806,4 +809,43 @@ AsciiValueToString (
   IN  UINTN      Width\r
   );\r
 \r
+/**\r
+  Returns the number of characters that would be produced by if the formatted \r
+  output were produced not including the Null-terminator.\r
+\r
+  If Format is NULL, then ASSERT().\r
+  If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+\r
+  @param[in]  FormatString    A Null-terminated Unicode format string.\r
+  @param[in]  Marker          VA_LIST marker for the variable argument list.\r
+\r
+  @return The number of characters that would be produced, not including the \r
+          Null-terminator.\r
+**/\r
+UINTN\r
+EFIAPI\r
+SPrintLength (\r
+  IN  CONST CHAR16   *FormatString,\r
+  IN  VA_LIST       Marker\r
+  );\r
+\r
+/**\r
+  Returns the number of characters that would be produced by if the formatted \r
+  output were produced not including the Null-terminator.\r
+\r
+  If Format is NULL, then ASSERT().\r
+\r
+  @param[in]  FormatString    A Null-terminated ASCII format string.\r
+  @param[in]  Marker          VA_LIST marker for the variable argument list.\r
+\r
+  @return The number of characters that would be produced, not including the \r
+          Null-terminator.\r
+**/\r
+UINTN\r
+EFIAPI\r
+SPrintLengthAsciiFormat (\r
+  IN  CONST CHAR8   *FormatString,\r
+  IN  VA_LIST       Marker\r
+  );\r
+\r
 #endif\r