From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Jiewen Yao <jiewen.yao@intel.com>,
Liming Gao <liming.gao@intel.com>,
Michael Kinney <michael.d.kinney@intel.com>
Subject: [PATCH v2 3/3] MdeModulePkg: Refine the services comments in EFI_PRINT2_PROTOCOL
Date: Thu, 9 Feb 2017 11:32:41 +0800 [thread overview]
Message-ID: <1486611161-37308-4-git-send-email-hao.a.wu@intel.com> (raw)
In-Reply-To: <1486611161-37308-1-git-send-email-hao.a.wu@intel.com>
For the following 8 services in EFI_PRINT2_PROTOCOL:
UNICODE_BS_PRINT
UNICODE_S_PRINT
UNICODE_BS_PRINT_ASCII_FORMAT
UNICODE_S_PRINT_ASCII_FORMAT
ASCII_BS_PRINT
ASCII_S_PRINT
ASCII_BS_PRINT_UNICODE_FORMAT
ASCII_S_PRINT_UNICODE_FORMAT
They will ASSERT when:
1) The input parameter 'StartOfBuffer' is NULL if 'BufferSize' indicates
at least 1 Ascii/Unicode character can be held.
2) The input parameter 'FormatString' is NULL if 'BufferSize' indicates at
least 1 Ascii/Unicode character can be held.
3) The input parameter 'FormatString' contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
4) The produced string contains more than
PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters.
This commits removes the ASSERT case 4) and add the following new ASSERT
case:
4) The input parameter 'BufferSize' is greater than
(PcdMaximumAsciiStringLength * sizeof (CHAR8)) for Ascii format string or
(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1) for Unicode format
string.
And for those ASSERT cases, 0 will be returned by those services.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Include/Protocol/Print2.h | 361 +++++++++++---------
1 file changed, 205 insertions(+), 156 deletions(-)
diff --git a/MdeModulePkg/Include/Protocol/Print2.h b/MdeModulePkg/Include/Protocol/Print2.h
index 1c127d5..8cad6fd 100644
--- a/MdeModulePkg/Include/Protocol/Print2.h
+++ b/MdeModulePkg/Include/Protocol/Print2.h
@@ -3,7 +3,7 @@
This print protocol defines six basic print functions to
print the format unicode and ascii string.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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 that accompanies this distribution.
The full text of the license may be found at
@@ -26,35 +26,40 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL;
/**
- Produces a Null-terminated Unicode string in an output buffer, based on
- a Null-terminated Unicode format string and a BASE_LIST argument list
-
- Produces a Null-terminated Unicode string in the output buffer
- specified by StartOfBuffer and BufferSize.
- The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker.
- Marker is constructed based on the contents of the format string.
- This function returns the number of Unicode characters in the produced output buffer,
- not including the Null-terminator.
- If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+ Produces a Null-terminated Unicode string in an output buffer based on
+ a Null-terminated Unicode format string and a BASE_LIST argument list.
+
+ Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
+ and BufferSize.
+ The Unicode string is produced by parsing the format string specified by FormatString.
+ Arguments are pulled from the variable argument list specified by Marker based on the
+ contents of the format string.
+ The number of Unicode characters in the produced output buffer is returned not including
+ the Null-terminator.
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 1 and FormatString is NULL, then ASSERT().
- If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
- Null-terminator, then ASSERT().
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
+ If FormatString is not aligned on a 16-bit boundary, then ASSERT().
+
+ If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
+ (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
+ buffer is unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
+
+ If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
+ @param FormatString A Null-terminated Unicode format string.
@param Marker BASE_LIST marker for the variable argument list.
-
- @return The number of Unicode characters in the produced output buffer, not including the
+
+ @return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
@@ -68,34 +73,41 @@ UINTN
);
/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
+ Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
Unicode format string and variable argument list.
-
- Produces a Null-terminated Unicode string in the output buffer
- specified by StartOfBuffer and BufferSize.
+
+ This function is similar as snprintf_s defined in C11.
+
+ Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list based on the contents of the format string.
- This function returns the number of Unicode characters in the produced output buffer,
- not including the Null-terminator.
- If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+ The number of Unicode characters in the produced output buffer is returned not including
+ the Null-terminator.
+
+ If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
+ If FormatString is not aligned on a 16-bit boundary, then ASSERT().
+
+ If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
+ (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
+ buffer is unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 1 and FormatString is NULL, then ASSERT().
- If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
- Null-terminator, then ASSERT().
-
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
- @param ... Variable argument list whose contents are accessed based on the
+ @param FormatString A Null-terminated Unicode format string.
+ @param ... Variable argument list whose contents are accessed based on the
format string specified by FormatString.
-
+
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
@@ -110,33 +122,38 @@ UINTN
);
/**
- Produces a Null-terminated Unicode string in an output buffer, based on a Null-terminated
- ASCII format string and a BASE_LIST argument list
-
- Produces a Null-terminated Unicode string in the output buffer
- specified by StartOfBuffer and BufferSize.
+ Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
+ ASCII format string and a BASE_LIST argument list.
+
+ Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on the
+ Arguments are pulled from the variable argument list specified by Marker based on the
contents of the format string.
- This function returns the number of Unicode characters in the produced output buffer,
- not including the Null-terminator.
- If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+ The number of Unicode characters in the produced output buffer is returned not including
+ the Null-terminator.
+
+ If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 1 and FormatString is NULL, then ASSERT().
+ If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
+ (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
+ buffer is unmodified and 0 is returned.
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
- Null-terminator, then ASSERT().
+ PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
+
+ If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated ASCII format string.
+ @param FormatString A Null-terminated ASCII format string.
@param Marker BASE_LIST marker for the variable argument list.
-
+
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
@@ -151,33 +168,41 @@ UINTN
);
/**
- Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
- ASCII format string and a variable argument list.
-
- Produces a Null-terminated Unicode string in the output buffer
- specified by StartOfBuffer and BufferSize.
+ Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
+ ASCII format string and variable argument list.
+
+ This function is similar as snprintf_s defined in C11.
+
+ Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the format string.
- This function returns the number of Unicode characters in the produced output buffer,
- not including the Null-terminator.
- If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+ Arguments are pulled from the variable argument list based on the contents of the
+ format string.
+ The number of Unicode characters in the produced output buffer is returned not including
+ the Null-terminator.
- If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 1 and FormatString is NULL, then ASSERT().
+ If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
+
+ If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
+ (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
+ buffer is unmodified and 0 is returned.
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
- contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
- Null-terminator, then ASSERT().
+ PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
+
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated ASCII format string.
- @param ... Variable argument list whose contents are accessed based on the
+ @param FormatString A Null-terminated ASCII format string.
+ @param ... Variable argument list whose contents are accessed based on the
format string specified by FormatString.
-
+
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
@@ -244,30 +269,34 @@ UINTN
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and a BASE_LIST argument list.
-
- Produces a Null-terminated ASCII string in the output buffer
- pecified by StartOfBuffer and BufferSize.
+
+ Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on
+ Arguments are pulled from the variable argument list specified by Marker based on
the contents of the format string.
- This function returns the number of ASCII characters in the output buffer,
- not including the Null-terminator.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
+ The number of ASCII characters in the produced output buffer is returned not including
+ the Null-terminator.
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 0 and FormatString is NULL, then ASSERT().
+ If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumAsciiStringLength is not zero, and BufferSize >
+ (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
+ is unmodified and 0 is returned.
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
- contains more than PcdMaximumAsciiStringLength ASCII characters not including the
- Null-terminator, then ASSERT().
+ PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
+
+ If BufferSize is 0, then no output buffer is produced and 0 is returned.
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated ASCII format string.
+ @param FormatString A Null-terminated ASCII format string.
@param Marker BASE_LIST marker for the variable argument list.
-
+
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
@@ -283,31 +312,38 @@ UINTN
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
- ASCII format string and variable argument list.
-
- Produces a Null-terminated ASCII string in the output buffer
- specified by StartOfBuffer and BufferSize.
+ ASCII format string and variable argument list.
+
+ This function is similar as snprintf_s defined in C11.
+
+ Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the format string.
- This function returns the number of ASCII characters in the output buffer,
- not including the Null-terminator.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
+ Arguments are pulled from the variable argument list based on the contents of the
+ format string.
+ The number of ASCII characters in the produced output buffer is returned not including
+ the Null-terminator.
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 0 and FormatString is NULL, then ASSERT().
+ If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumAsciiStringLength is not zero, and BufferSize >
+ (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
+ is unmodified and 0 is returned.
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
- contains more than PcdMaximumAsciiStringLength ASCII characters not including the
- Null-terminator, then ASSERT().
+ PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
+
+ If BufferSize is 0, then no output buffer is produced and 0 is returned.
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated ASCII format string.
- @param ... Variable argument list whose contents are accessed based on the
+ @param FormatString A Null-terminated ASCII format string.
+ @param ... Variable argument list whose contents are accessed based on the
format string specified by FormatString.
-
+
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
@@ -324,31 +360,36 @@ UINTN
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
Unicode format string and a BASE_LIST argument list.
-
- Produces a Null-terminated ASCII string in the output buffer
- specified by StartOfBuffer and BufferSize.
+
+ Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list specified by Marker based on
+ Arguments are pulled from the variable argument list specified by Marker based on
the contents of the format string.
- This function returns the number of ASCII characters in the output buffer,
- not including the Null-terminator.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
+ The number of ASCII characters in the produced output buffer is returned not including
+ the Null-terminator.
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 0 and FormatString is NULL, then ASSERT().
- If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
+ If FormatString is not aligned on a 16-bit boundary, then ASSERT().
+
+ If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumAsciiStringLength is not zero, and BufferSize >
+ (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
+ is unmodified and 0 is returned.
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
- contains more than PcdMaximumAsciiStringLength ASCII characters not including the
- Null-terminator, then ASSERT().
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
+
+ If BufferSize is 0, then no output buffer is produced and 0 is returned.
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
+ @param FormatString A Null-terminated Unicode format string.
@param Marker BASE_LIST marker for the variable argument list.
-
+
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
@@ -365,31 +406,39 @@ UINTN
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
Unicode format string and variable argument list.
-
- Produces a Null-terminated ASCII string in the output buffer
- specified by StartOfBuffer and BufferSize.
+
+ This function is similar as snprintf_s defined in C11.
+
+ Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
+ and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
- Arguments are pulled from the variable argument list based on the contents of the format string.
- This function returns the number of ASCII characters in the output buffer,
- not including the Null-terminator.
- If BufferSize is 0, then no output buffer is produced and 0 is returned.
+ Arguments are pulled from the variable argument list based on the contents of the
+ format string.
+ The number of ASCII characters in the produced output buffer is returned not including
+ the Null-terminator.
+
+ If FormatString is not aligned on a 16-bit boundary, then ASSERT().
- If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
- If BufferSize > 0 and FormatString is NULL, then ASSERT().
- If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
- contains more than PcdMaximumAsciiStringLength ASCII characters not including the
- Null-terminator, then ASSERT().
+ If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
+ unmodified and 0 is returned.
+ If PcdMaximumAsciiStringLength is not zero, and BufferSize >
+ (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
+ is unmodified and 0 is returned.
+ If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
+ ASSERT(). Also, the output buffer is unmodified and 0 is returned.
+
+ If BufferSize is 0, then no output buffer is produced and 0 is returned.
- @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
+ @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
- @param FormatString Null-terminated Unicode format string.
- @param ... Variable argument list whose contents are accessed based on the
+ @param FormatString A Null-terminated Unicode format string.
+ @param ... Variable argument list whose contents are accessed based on the
format string specified by FormatString.
-
+
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
--
1.9.5.msysgit.0
prev parent reply other threads:[~2017-02-09 3:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 3:32 [PATCH v2 0/3] PrintLib: Refine the SPrint functions Hao Wu
2017-02-09 3:32 ` [PATCH v2 1/3] MdePkg/BasePrintLib: " Hao Wu
2017-02-09 3:32 ` [PATCH v2 2/3] MdeModulePkg/PrintLib: " Hao Wu
2017-02-09 3:32 ` Hao Wu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486611161-37308-4-git-send-email-hao.a.wu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox