@param Buffer Character buffer to print the results of the parsing\r
of Format into.\r
@param BufferSize Maximum number of characters to put into buffer.\r
- Zero means no limit.\r
@param Flags Intial flags value.\r
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r
@param Format Null-terminated format string.\r
UINTN Radix;\r
RETURN_STATUS Status;\r
\r
+ if (BufferSize == 0) {\r
+ return 0;\r
+ }\r
ASSERT (Buffer != NULL);\r
ASSERT (Format != NULL);\r
\r
\r
//\r
// Reserve space for the Null terminator.\r
- // If BufferSize is 0, this will set BufferSize to the max unsigned value\r
//\r
BufferSize--;\r
\r
} else {\r
BasePrintLibSPrint (\r
ValueBuffer,\r
- 0, \r
+ MAXIMUM_VALUE_CHARACTERS, \r
0,\r
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",\r
TmpGuid->Data1,\r
} else {\r
BasePrintLibSPrint (\r
ValueBuffer,\r
- 0,\r
+ MAXIMUM_VALUE_CHARACTERS,\r
0,\r
"%02d/%02d/%04d %02d:%02d",\r
TmpTime->Month,\r
}\r
}\r
if (ArgumentString == ValueBuffer) {\r
- BasePrintLibSPrint ((CHAR8 *) ValueBuffer, 0, 0, "%08X", Status);\r
+ BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);\r
}\r
break;\r
\r
+ case '\n':\r
+ ArgumentString = "\r\n";\r
+ break;\r
+\r
case '%':\r
default:\r
//\r
break;\r
}\r
break;\r
- case '\n':\r
- ArgumentString = "\r\n";\r
- break;\r
default:\r
ArgumentString = (CHAR8 *)&FormatCharacter;\r
Flags |= ARGUMENT_UNICODE;\r
VA_LIST Marker;\r
\r
VA_START (Marker, FormatString);\r
- return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize >> 1, FormatString, Marker);\r
+ return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
}\r
\r
/**\r