mirror of https://github.com/acidanthera/audk.git
MdePkg/BasePrintLib: Refine the SPrint functions
For the following 12 APIs in MdePkg/BasePrintLib: UnicodeVSPrint UnicodeBSPrint UnicodeSPrint UnicodeVSPrintAsciiFormat UnicodeBSPrintAsciiFormat UnicodeSPrintAsciiFormat AsciiVSPrint AsciiBSPrint AsciiSPrint AsciiVSPrintUnicodeFormat AsciiBSPrintUnicodeFormat AsciiSPrintUnicodeFormat 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 12 APIs. For the following 2 APIs in MdePkg/BasePrintLib: SPrintLength SPrintLengthAsciiFormat They will ASSERT when: 1) The input parameter 'FormatString' is NULL. 2) The input parameter 'FormatString' contains more than PcdMaximum[Ascii|Unicode]StringLength Ascii/Unicode characters. And for those ASSERT cases, 0 will be returned by those 2 APIs. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
063bcff758
commit
9b002aa447
|
@ -2,7 +2,7 @@
|
||||||
Provides services to print a formatted string to a buffer. All combinations of
|
Provides services to print a formatted string to a buffer. All combinations of
|
||||||
Unicode and ASCII strings are supported.
|
Unicode and ASCII strings are supported.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2015, 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
|
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 terms and conditions of the BSD License that accompanies this distribution.
|
||||||
The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
|
@ -207,33 +207,39 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
Produces a Null-terminated Unicode string in an output buffer based on
|
Produces a Null-terminated Unicode string in an output buffer based on
|
||||||
a Null-terminated Unicode format string and a VA_LIST argument list.
|
a Null-terminated Unicode format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned, not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If BufferSize > 1 and 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 FormatString is NULL, then ASSERT().
|
|
||||||
If BufferSize > 1 and 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the
|
If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@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 VA_LIST marker for the variable argument list.
|
@param Marker VA_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.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -255,28 +261,32 @@ UnicodeVSPrint (
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned, not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If BufferSize > 1 and 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 FormatString is NULL, then ASSERT().
|
|
||||||
If BufferSize > 1 and 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the
|
If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@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.
|
@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.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -293,33 +303,39 @@ UnicodeBSPrint (
|
||||||
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.
|
Unicode 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
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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.
|
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 number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If BufferSize > 1 and 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 FormatString is NULL, then ASSERT().
|
|
||||||
If BufferSize > 1 and 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated Unicode format string.
|
@param FormatString A Null-terminated Unicode format string.
|
||||||
@param ... The variable argument list whose contents are accessed based on the
|
@param ... Variable argument list whose contents are accessed based on the
|
||||||
format string specified by FormatString.
|
format string specified by FormatString.
|
||||||
|
|
||||||
@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.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -334,31 +350,37 @@ UnicodeSPrint (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
||||||
ASCII format string and a VA_LIST argument list
|
ASCII format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned, not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, 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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the
|
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated ASCII format string.
|
@param FormatString A Null-terminated ASCII format string.
|
||||||
@param Marker VA_LIST marker for the variable argument list.
|
@param Marker VA_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
|
||||||
|
@ -376,34 +398,38 @@ UnicodeVSPrintAsciiFormat (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
||||||
ASCII format string and a BASE_LIST argument list
|
ASCII format string and a BASE_LIST argument list.
|
||||||
|
|
||||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned, not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, 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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the
|
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated ASCII format string.
|
@param FormatString A Null-terminated ASCII format string.
|
||||||
@param Marker A BASE_LIST marker for the variable argument list.
|
@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.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -420,33 +446,39 @@ UnicodeBSPrintAsciiFormat (
|
||||||
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
|
||||||
ASCII format string and variable argument list.
|
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
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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
|
Arguments are pulled from the variable argument list based on the contents of the
|
||||||
format string.
|
format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned, not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, 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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters, the
|
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated ASCII format string.
|
@param FormatString A Null-terminated ASCII format string.
|
||||||
@param ... Variable argument list whose contents are accessed based on the
|
@param ... Variable argument list whose contents are accessed based on the
|
||||||
format string specified by FormatString.
|
format string specified by FormatString.
|
||||||
|
|
||||||
@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.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -513,31 +545,36 @@ UnicodeValueToString (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
ASCII format string and a VA_LIST argument list.
|
ASCII format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
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.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned, not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters, not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated ASCII format string.
|
@param FormatString A Null-terminated ASCII format string.
|
||||||
@param Marker VA_LIST marker for the variable argument list.
|
@param Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
@return The number of ASCII characters in the produced output buffer, not including the
|
@return The number of ASCII characters in the produced output buffer not including the
|
||||||
Null-terminator.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -559,26 +596,29 @@ AsciiVSPrint (
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
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.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned, not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters, not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated ASCII format string.
|
@param FormatString A Null-terminated ASCII format string.
|
||||||
@param Marker BASE_LIST marker for the variable argument list.
|
@param Marker BASE_LIST marker for the variable argument list.
|
||||||
|
|
||||||
@return The number of ASCII characters in the produced output buffer, not including the
|
@return The number of ASCII characters in the produced output buffer not including the
|
||||||
Null-terminator.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -595,32 +635,37 @@ AsciiBSPrint (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
ASCII format string and variable argument list.
|
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
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
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
|
Arguments are pulled from the variable argument list based on the contents of the
|
||||||
format string.
|
format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned, not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters, not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated ASCII format string.
|
@param FormatString A Null-terminated ASCII format string.
|
||||||
@param ... The variable argument list whose contents are accessed based on the
|
@param ... Variable argument list whose contents are accessed based on the
|
||||||
format string specified by FormatString.
|
format string specified by FormatString.
|
||||||
|
|
||||||
@return The number of ASCII characters in the produced output buffer, not including the
|
@return The number of ASCII characters in the produced output buffer not including the
|
||||||
Null-terminator.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -637,32 +682,38 @@ AsciiSPrint (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
Unicode format string and a VA_LIST argument list.
|
Unicode format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
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.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned, not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, 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 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters, not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated Unicode format string.
|
@param FormatString A Null-terminated Unicode format string.
|
||||||
@param Marker VA_LIST marker for the variable argument list.
|
@param Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
@return The number of ASCII characters in the produced output buffer, not including the
|
@return The number of ASCII characters in the produced output buffer not including the
|
||||||
Null-terminator.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -684,27 +735,31 @@ AsciiVSPrintUnicodeFormat (
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
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.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned, not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, 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 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters, not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated Unicode format string.
|
@param FormatString A Null-terminated Unicode format string.
|
||||||
@param Marker BASE_LIST marker for the variable argument list.
|
@param Marker BASE_LIST marker for the variable argument list.
|
||||||
|
|
||||||
@return The number of ASCII characters in the produced output buffer, not including the
|
@return The number of ASCII characters in the produced output buffer not including the
|
||||||
Null-terminator.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -721,33 +776,39 @@ AsciiBSPrintUnicodeFormat (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
Unicode format string and variable argument list.
|
Unicode 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
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
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
|
Arguments are pulled from the variable argument list based on the contents of the
|
||||||
format string.
|
format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned, not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, 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 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters, not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
|
||||||
@param FormatString A null-terminated Unicode format string.
|
@param FormatString A Null-terminated Unicode format string.
|
||||||
@param ... Variable argument list whose contents are accessed based on the
|
@param ... Variable argument list whose contents are accessed based on the
|
||||||
format string specified by FormatString.
|
format string specified by FormatString.
|
||||||
|
|
||||||
@return The number of ASCII characters in the produced output buffer, not including the
|
@return The number of ASCII characters in the produced output buffer not including the
|
||||||
Null-terminator.
|
Null-terminator.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -813,8 +874,12 @@ AsciiValueToString (
|
||||||
Returns the number of characters that would be produced by if the formatted
|
Returns the number of characters that would be produced by if the formatted
|
||||||
output were produced not including the Null-terminator.
|
output were produced not including the Null-terminator.
|
||||||
|
|
||||||
If Format is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If Format is not aligned on a 16-bit boundary, then ASSERT().
|
|
||||||
|
If FormatString is NULL, then ASSERT() and 0 is returned.
|
||||||
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more
|
||||||
|
than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||||
|
Null-terminator, then ASSERT() and 0 is returned.
|
||||||
|
|
||||||
@param[in] FormatString A Null-terminated Unicode format string.
|
@param[in] FormatString A Null-terminated Unicode format string.
|
||||||
@param[in] Marker VA_LIST marker for the variable argument list.
|
@param[in] Marker VA_LIST marker for the variable argument list.
|
||||||
|
@ -833,7 +898,10 @@ SPrintLength (
|
||||||
Returns the number of characters that would be produced by if the formatted
|
Returns the number of characters that would be produced by if the formatted
|
||||||
output were produced not including the Null-terminator.
|
output were produced not including the Null-terminator.
|
||||||
|
|
||||||
If Format is NULL, then ASSERT().
|
If FormatString is NULL, then ASSERT() and 0 is returned.
|
||||||
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more
|
||||||
|
than PcdMaximumAsciiStringLength Ascii characters not including the
|
||||||
|
Null-terminator, then ASSERT() and 0 is returned.
|
||||||
|
|
||||||
@param[in] FormatString A Null-terminated ASCII format string.
|
@param[in] FormatString A Null-terminated ASCII format string.
|
||||||
@param[in] Marker VA_LIST marker for the variable argument list.
|
@param[in] Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Print Library implementation.
|
# Print Library implementation.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -41,4 +41,10 @@
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
DebugLib
|
DebugLib
|
||||||
BaseLib
|
BaseLib
|
||||||
|
PcdLib
|
||||||
|
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## SOMETIMES_CONSUMES
|
||||||
|
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Base Print Library instance implementation.
|
Base Print Library instance implementation.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -27,7 +27,9 @@ VA_LIST gNullVaList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Produces a Null-terminated Unicode string in an output buffer based on
|
Produces a Null-terminated Unicode string in an output buffer based on
|
||||||
a Null-terminated Unicode format string and a VA_LIST argument list
|
a Null-terminated Unicode format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
|
@ -36,18 +38,22 @@ VA_LIST gNullVaList;
|
||||||
contents of the format string.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If BufferSize > 1 and 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 FormatString is NULL, then ASSERT().
|
|
||||||
If BufferSize > 1 and 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
|
@ -75,7 +81,7 @@ UnicodeVSPrint (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Produces a Null-terminated Unicode string in an output buffer based on
|
Produces a Null-terminated Unicode string in an output buffer based on
|
||||||
a Null-terminated Unicode format string and a BASE_LIST argument list
|
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
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
|
@ -84,18 +90,22 @@ UnicodeVSPrint (
|
||||||
contents of the format string.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If BufferSize > 1 and 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 FormatString is NULL, then ASSERT().
|
|
||||||
If BufferSize > 1 and 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
|
@ -125,24 +135,30 @@ UnicodeBSPrint (
|
||||||
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.
|
Unicode 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
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
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.
|
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 number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
If BufferSize > 1 and 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 FormatString is NULL, then ASSERT().
|
|
||||||
If BufferSize > 1 and 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
|
@ -175,7 +191,9 @@ UnicodeSPrint (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
||||||
ASCII format string and a VA_LIST argument list
|
ASCII format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
|
@ -184,17 +202,21 @@ UnicodeSPrint (
|
||||||
contents of the format string.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, 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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
|
@ -221,7 +243,7 @@ UnicodeVSPrintAsciiFormat (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
||||||
ASCII format string and a BASE_LIST argument list
|
ASCII format string and a BASE_LIST argument list.
|
||||||
|
|
||||||
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
|
@ -230,17 +252,21 @@ UnicodeVSPrintAsciiFormat (
|
||||||
contents of the format string.
|
contents of the format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, 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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
|
@ -269,6 +295,8 @@ UnicodeBSPrintAsciiFormat (
|
||||||
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
|
||||||
ASCII format string and variable argument list.
|
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
|
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The Unicode string is produced by parsing the format string specified by FormatString.
|
The Unicode string is produced by parsing the format string specified by FormatString.
|
||||||
|
@ -276,17 +304,21 @@ UnicodeBSPrintAsciiFormat (
|
||||||
format string.
|
format string.
|
||||||
The number of Unicode characters in the produced output buffer is returned not including
|
The number of Unicode characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
|
If StartOfBuffer is not aligned on a 16-bit boundary, 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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
|
|
||||||
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
|
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
Unicode string.
|
||||||
|
@ -375,6 +407,8 @@ UnicodeValueToString (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
ASCII format string and a VA_LIST argument list.
|
ASCII format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||||
|
@ -382,16 +416,19 @@ UnicodeValueToString (
|
||||||
the contents of the format string.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
|
@ -426,16 +463,19 @@ AsciiVSPrint (
|
||||||
the contents of the format string.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
|
@ -463,6 +503,8 @@ AsciiBSPrint (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
ASCII format string and variable argument list.
|
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
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||||
|
@ -470,16 +512,19 @@ AsciiBSPrint (
|
||||||
format string.
|
format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
|
||||||
If BufferSize > 0 and FormatString is NULL, then ASSERT().
|
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
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
|
PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
|
@ -514,6 +559,8 @@ AsciiSPrint (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
Unicode format string and a VA_LIST argument list.
|
Unicode format string and a VA_LIST argument list.
|
||||||
|
|
||||||
|
This function is similar as vsnprintf_s defined in C11.
|
||||||
|
|
||||||
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||||
|
@ -521,17 +568,21 @@ AsciiSPrint (
|
||||||
the contents of the format string.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, 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 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
|
@ -567,17 +618,21 @@ AsciiVSPrintUnicodeFormat (
|
||||||
the contents of the format string.
|
the contents of the format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, 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 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
|
@ -606,6 +661,8 @@ AsciiBSPrintUnicodeFormat (
|
||||||
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
|
||||||
Unicode format string and variable argument list.
|
Unicode 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
|
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
|
||||||
and BufferSize.
|
and BufferSize.
|
||||||
The ASCII string is produced by parsing the format string specified by FormatString.
|
The ASCII string is produced by parsing the format string specified by FormatString.
|
||||||
|
@ -613,17 +670,21 @@ AsciiBSPrintUnicodeFormat (
|
||||||
format string.
|
format string.
|
||||||
The number of ASCII characters in the produced output buffer is returned not including
|
The number of ASCII characters in the produced output buffer is returned not including
|
||||||
the Null-terminator.
|
the Null-terminator.
|
||||||
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
|
||||||
|
|
||||||
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, 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 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
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
|
||||||
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
|
||||||
ASSERT().
|
ASSERT(). Also, the output buffer is unmodified and 0 is returned.
|
||||||
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
|
|
||||||
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
|
If BufferSize is 0, then no output buffer is produced and 0 is returned.
|
||||||
Null-terminator, then ASSERT().
|
|
||||||
|
|
||||||
@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.
|
ASCII string.
|
||||||
|
@ -711,9 +772,13 @@ AsciiValueToString (
|
||||||
Returns the number of characters that would be produced by if the formatted
|
Returns the number of characters that would be produced by if the formatted
|
||||||
output were produced not including the Null-terminator.
|
output were produced not including the Null-terminator.
|
||||||
|
|
||||||
If FormatString is NULL, then ASSERT().
|
|
||||||
If FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
If FormatString is not aligned on a 16-bit boundary, then ASSERT().
|
||||||
|
|
||||||
|
If FormatString is NULL, then ASSERT() and 0 is returned.
|
||||||
|
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more
|
||||||
|
than PcdMaximumUnicodeStringLength Unicode characters not including the
|
||||||
|
Null-terminator, then ASSERT() and 0 is returned.
|
||||||
|
|
||||||
@param[in] FormatString A Null-terminated Unicode format string.
|
@param[in] FormatString A Null-terminated Unicode format string.
|
||||||
@param[in] Marker VA_LIST marker for the variable argument list.
|
@param[in] Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
|
@ -727,7 +792,6 @@ SPrintLength (
|
||||||
IN VA_LIST Marker
|
IN VA_LIST Marker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT(FormatString != NULL);
|
|
||||||
ASSERT_UNICODE_BUFFER (FormatString);
|
ASSERT_UNICODE_BUFFER (FormatString);
|
||||||
return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
|
return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
|
||||||
}
|
}
|
||||||
|
@ -736,7 +800,10 @@ SPrintLength (
|
||||||
Returns the number of characters that would be produced by if the formatted
|
Returns the number of characters that would be produced by if the formatted
|
||||||
output were produced not including the Null-terminator.
|
output were produced not including the Null-terminator.
|
||||||
|
|
||||||
If FormatString is NULL, then ASSERT().
|
If FormatString is NULL, then ASSERT() and 0 is returned.
|
||||||
|
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more
|
||||||
|
than PcdMaximumAsciiStringLength Ascii characters not including the
|
||||||
|
Null-terminator, then ASSERT() and 0 is returned.
|
||||||
|
|
||||||
@param[in] FormatString A Null-terminated ASCII format string.
|
@param[in] FormatString A Null-terminated ASCII format string.
|
||||||
@param[in] Marker VA_LIST marker for the variable argument list.
|
@param[in] Marker VA_LIST marker for the variable argument list.
|
||||||
|
@ -751,6 +818,5 @@ SPrintLengthAsciiFormat (
|
||||||
IN VA_LIST Marker
|
IN VA_LIST Marker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT(FormatString != NULL);
|
|
||||||
return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
|
return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Print Library internal worker functions.
|
Print Library internal worker functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -17,6 +17,20 @@
|
||||||
#define WARNING_STATUS_NUMBER 5
|
#define WARNING_STATUS_NUMBER 5
|
||||||
#define ERROR_STATUS_NUMBER 33
|
#define ERROR_STATUS_NUMBER 33
|
||||||
|
|
||||||
|
//
|
||||||
|
// Safe print checks
|
||||||
|
//
|
||||||
|
#define RSIZE_MAX (PcdGet32 (PcdMaximumUnicodeStringLength))
|
||||||
|
#define ASCII_RSIZE_MAX (PcdGet32 (PcdMaximumAsciiStringLength))
|
||||||
|
|
||||||
|
#define SAFE_PRINT_CONSTRAINT_CHECK(Expression, RetVal) \
|
||||||
|
do { \
|
||||||
|
ASSERT (Expression); \
|
||||||
|
if (!(Expression)) { \
|
||||||
|
return RetVal; \
|
||||||
|
} \
|
||||||
|
} while (FALSE)
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 * CONST mStatusString[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 * CONST mStatusString[] = {
|
||||||
|
@ -352,6 +366,56 @@ BasePrintLibSPrintMarker (
|
||||||
// DxePrintLibPrint2Protocol (both PrintLib instances).
|
// DxePrintLibPrint2Protocol (both PrintLib instances).
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// 1. Buffer shall not be a null pointer when both BufferSize > 0 and
|
||||||
|
// COUNT_ONLY_NO_PRINT is not set in Flags.
|
||||||
|
//
|
||||||
|
if ((BufferSize > 0) && ((Flags & COUNT_ONLY_NO_PRINT) == 0)) {
|
||||||
|
SAFE_PRINT_CONSTRAINT_CHECK ((Buffer != NULL), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 2. Format shall not be a null pointer when BufferSize > 0 or when
|
||||||
|
// COUNT_ONLY_NO_PRINT is set in Flags.
|
||||||
|
//
|
||||||
|
if ((BufferSize > 0) || ((Flags & COUNT_ONLY_NO_PRINT) != 0)) {
|
||||||
|
SAFE_PRINT_CONSTRAINT_CHECK ((Format != NULL), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 3. BufferSize shall not be greater than RSIZE_MAX for Unicode output or
|
||||||
|
// ASCII_RSIZE_MAX for Ascii output.
|
||||||
|
//
|
||||||
|
if ((Flags & OUTPUT_UNICODE) != 0) {
|
||||||
|
if (RSIZE_MAX != 0) {
|
||||||
|
SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize <= RSIZE_MAX), 0);
|
||||||
|
}
|
||||||
|
BytesPerOutputCharacter = 2;
|
||||||
|
} else {
|
||||||
|
if (ASCII_RSIZE_MAX != 0) {
|
||||||
|
SAFE_PRINT_CONSTRAINT_CHECK ((BufferSize <= ASCII_RSIZE_MAX), 0);
|
||||||
|
}
|
||||||
|
BytesPerOutputCharacter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 4. Format shall not contain more than RSIZE_MAX Unicode characters or
|
||||||
|
// ASCII_RSIZE_MAX Ascii characters.
|
||||||
|
//
|
||||||
|
if ((Flags & FORMAT_UNICODE) != 0) {
|
||||||
|
if (RSIZE_MAX != 0) {
|
||||||
|
SAFE_PRINT_CONSTRAINT_CHECK ((StrnLenS ((CHAR16 *)Format, RSIZE_MAX + 1) <= RSIZE_MAX), 0);
|
||||||
|
}
|
||||||
|
BytesPerFormatCharacter = 2;
|
||||||
|
FormatMask = 0xffff;
|
||||||
|
} else {
|
||||||
|
if (ASCII_RSIZE_MAX != 0) {
|
||||||
|
SAFE_PRINT_CONSTRAINT_CHECK ((AsciiStrnLenS (Format, ASCII_RSIZE_MAX + 1) <= ASCII_RSIZE_MAX), 0);
|
||||||
|
}
|
||||||
|
BytesPerFormatCharacter = 1;
|
||||||
|
FormatMask = 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
if ((Flags & COUNT_ONLY_NO_PRINT) != 0) {
|
if ((Flags & COUNT_ONLY_NO_PRINT) != 0) {
|
||||||
if (BufferSize == 0) {
|
if (BufferSize == 0) {
|
||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
|
@ -363,13 +427,6 @@ BasePrintLibSPrintMarker (
|
||||||
if (BufferSize == 0) {
|
if (BufferSize == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ASSERT (Buffer != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Flags & OUTPUT_UNICODE) != 0) {
|
|
||||||
BytesPerOutputCharacter = 2;
|
|
||||||
} else {
|
|
||||||
BytesPerOutputCharacter = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LengthToReturn = 0;
|
LengthToReturn = 0;
|
||||||
|
@ -389,24 +446,6 @@ BasePrintLibSPrintMarker (
|
||||||
EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter;
|
EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Flags & FORMAT_UNICODE) != 0) {
|
|
||||||
//
|
|
||||||
// Make sure format string cannot contain more than PcdMaximumUnicodeStringLength
|
|
||||||
// Unicode characters if PcdMaximumUnicodeStringLength is not zero.
|
|
||||||
//
|
|
||||||
ASSERT (StrSize ((CHAR16 *) Format) != 0);
|
|
||||||
BytesPerFormatCharacter = 2;
|
|
||||||
FormatMask = 0xffff;
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Make sure format string cannot contain more than PcdMaximumAsciiStringLength
|
|
||||||
// Ascii characters if PcdMaximumAsciiStringLength is not zero.
|
|
||||||
//
|
|
||||||
ASSERT (AsciiStrSize (Format) != 0);
|
|
||||||
BytesPerFormatCharacter = 1;
|
|
||||||
FormatMask = 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the first character from the format string
|
// Get the first character from the format string
|
||||||
//
|
//
|
||||||
|
@ -975,16 +1014,6 @@ BasePrintLibSPrintMarker (
|
||||||
// Null terminate the Unicode or ASCII string
|
// Null terminate the Unicode or ASCII string
|
||||||
//
|
//
|
||||||
BasePrintLibFillBuffer (Buffer, EndBuffer + BytesPerOutputCharacter, 1, 0, BytesPerOutputCharacter);
|
BasePrintLibFillBuffer (Buffer, EndBuffer + BytesPerOutputCharacter, 1, 0, BytesPerOutputCharacter);
|
||||||
//
|
|
||||||
// Make sure output buffer cannot contain more than PcdMaximumUnicodeStringLength
|
|
||||||
// Unicode characters if PcdMaximumUnicodeStringLength is not zero.
|
|
||||||
//
|
|
||||||
ASSERT ((((Flags & OUTPUT_UNICODE) == 0)) || (StrSize ((CHAR16 *) OriginalBuffer) != 0));
|
|
||||||
//
|
|
||||||
// Make sure output buffer cannot contain more than PcdMaximumAsciiStringLength
|
|
||||||
// ASCII characters if PcdMaximumAsciiStringLength is not zero.
|
|
||||||
//
|
|
||||||
ASSERT ((((Flags & OUTPUT_UNICODE) != 0)) || (AsciiStrSize (OriginalBuffer) != 0));
|
|
||||||
|
|
||||||
return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);
|
return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Base Print Library instance Internal Functions definition.
|
Base Print Library instance Internal Functions definition.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
#include <Library/PrintLib.h>
|
#include <Library/PrintLib.h>
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue