//\r
// Get the first character from the format string\r
//\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
\r
while (FormatCharacter != 0) {\r
if (FormatCharacter == '%') {\r
//\r
// Get the next character from the format string\r
//\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
\r
switch (FormatCharacter) {\r
case '.': \r
//\r
// If BASE_LIST is larger than Size, then return FALSE\r
//\r
- if ((UINTN)((UINT8 *)BaseListMarker - (UINT8 *)BaseListStart) > Size) {\r
+ if (((UINTN)BaseListMarker - (UINTN)BaseListStart) > Size) {\r
DEBUG ((DEBUG_ERROR, "The input variable argument list is too long. Please consider breaking into multiple print calls.\n"));\r
return FALSE;\r
}\r
//\r
// Get the next character from the format string\r
//\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
}\r
return TRUE;\r
}\r
sign character, '0' characters, digit characters for Value, and the\r
Null-terminator add up to Width characters.\r
\r
- If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
- If an error would be returned, then the function will also ASSERT().\r
+ If an error would be returned, then the function will ASSERT().\r
\r
@param Buffer The pointer to the output buffer for the produced\r
Null-terminated Ascii string.\r
//\r
// Get the first character from the format string\r
//\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
\r
//\r
// Loop until the end of the format string is reached or the output buffer is full\r
//\r
for (Done = FALSE; !Done; ) {\r
Format += BytesPerFormatCharacter;\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
switch (FormatCharacter) {\r
case '.': \r
Flags |= PRECISION; \r
for (Count = 0; ((FormatCharacter >= '0') && (FormatCharacter <= '9')); ){\r
Count = (Count * 10) + FormatCharacter - '0';\r
Format += BytesPerFormatCharacter;\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
}\r
Format -= BytesPerFormatCharacter;\r
if ((Flags & PRECISION) == 0) {\r
\r
case '\r':\r
Format += BytesPerFormatCharacter;\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
if (FormatCharacter == '\n') {\r
//\r
// Translate '\r\n' to '\r\n'\r
//\r
ArgumentString = "\r\n";\r
Format += BytesPerFormatCharacter;\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
if (FormatCharacter != '\r') {\r
Format -= BytesPerFormatCharacter;\r
}\r
\r
case '\r':\r
Format += BytesPerFormatCharacter;\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
if (FormatCharacter == '\n') {\r
//\r
// Translate '\r\n' to '\r\n'\r
//\r
ArgumentString = "\r\n";\r
Format += BytesPerFormatCharacter;\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
if (FormatCharacter != '\r') {\r
Format -= BytesPerFormatCharacter;\r
}\r
//\r
// Get the next character from the format string\r
//\r
- FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;\r
+ FormatCharacter = ((*Format & 0xff) | ((BytesPerFormatCharacter == 1) ? 0 : (*(Format + 1) << 8))) & FormatMask;\r
}\r
\r
if ((Flags & COUNT_ONLY_NO_PRINT) != 0) {\r