summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BasePrintLib/PrintLib.c
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-13 06:31:11 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-13 06:31:11 +0000
commit8960cdebac8c75f13f1cb6afa932f0ae323a138b (patch)
tree0bf5bf973e6a379677db5282165ced3a69bae19d /MdePkg/Library/BasePrintLib/PrintLib.c
parentad82307c753df478012953df517006c58cd7b8a4 (diff)
downloadedk2-platforms-8960cdebac8c75f13f1cb6afa932f0ae323a138b.tar.xz
BaseMemoryLib (BaseMemoryLibRepStr):
Fix a logic error in SetMem64 (); The correct stride should be 8 instead of 4. BasePrintLib: Fix Printf(ā€œ%\nā€) passer error. Fix BufferSize = 0, 1 issue Fix some missing ASSERT ()s Move MAXIMUM_VALUE_CHARACTERS from PrintLibInternal.h to PrintLib.h ReportStatusCodeLib: Add CONST modifier to some interfaces Modify DebugLib: Replace some Unicode in comments. PeiServicesTablePointerLib Add ASSERT()s PciLib: Remove unnecessary ASSERT()s in PciRead/WriteBuffer() git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@496 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BasePrintLib/PrintLib.c')
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLib.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePrintLib/PrintLib.c
index 24e0175545..e940bedb34 100644
--- a/MdePkg/Library/BasePrintLib/PrintLib.c
+++ b/MdePkg/Library/BasePrintLib/PrintLib.c
@@ -66,7 +66,6 @@ static CONST STATUS_LOOKUP_TABLE_ENTRY StatusString[] = {
@param Buffer Character buffer to print the results of the parsing
of Format into.
@param BufferSize Maximum number of characters to put into buffer.
- Zero means no limit.
@param Flags Intial flags value.
Can only have FORMAT_UNICODE and OUTPUT_UNICODE set
@param Format Null-terminated format string.
@@ -110,6 +109,9 @@ BasePrintLibVSPrint (
UINTN Radix;
RETURN_STATUS Status;
+ if (BufferSize == 0) {
+ return 0;
+ }
ASSERT (Buffer != NULL);
ASSERT (Format != NULL);
@@ -130,7 +132,6 @@ BasePrintLibVSPrint (
//
// Reserve space for the Null terminator.
- // If BufferSize is 0, this will set BufferSize to the max unsigned value
//
BufferSize--;
@@ -338,7 +339,7 @@ BasePrintLibVSPrint (
} else {
BasePrintLibSPrint (
ValueBuffer,
- 0,
+ MAXIMUM_VALUE_CHARACTERS,
0,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
TmpGuid->Data1,
@@ -364,7 +365,7 @@ BasePrintLibVSPrint (
} else {
BasePrintLibSPrint (
ValueBuffer,
- 0,
+ MAXIMUM_VALUE_CHARACTERS,
0,
"%02d/%02d/%04d %02d:%02d",
TmpTime->Month,
@@ -386,10 +387,14 @@ BasePrintLibVSPrint (
}
}
if (ArgumentString == ValueBuffer) {
- BasePrintLibSPrint ((CHAR8 *) ValueBuffer, 0, 0, "%08X", Status);
+ BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);
}
break;
+ case '\n':
+ ArgumentString = "\r\n";
+ break;
+
case '%':
default:
//
@@ -400,9 +405,6 @@ BasePrintLibVSPrint (
break;
}
break;
- case '\n':
- ArgumentString = "\r\n";
- break;
default:
ArgumentString = (CHAR8 *)&FormatCharacter;
Flags |= ARGUMENT_UNICODE;
@@ -717,7 +719,7 @@ UnicodeSPrintAsciiFormat (
VA_LIST Marker;
VA_START (Marker, FormatString);
- return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize >> 1, FormatString, Marker);
+ return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
}
/**