summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BasePrintLib
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-30 23:13:06 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-30 23:13:06 +0000
commitc553db4b78024d7b3a14c0224c750976f4062585 (patch)
treeb21f7824c9c798eebcf1ed64b662a9ddd96a1ee8 /MdePkg/Library/BasePrintLib
parent40f2c454343be84ab3bacf9955cc8d7842c70b5c (diff)
downloadedk2-c553db4b78024d7b3a14c0224c750976f4062585.tar.gz
edk2-c553db4b78024d7b3a14c0224c750976f4062585.tar.bz2
edk2-c553db4b78024d7b3a14c0224c750976f4062585.zip
Adjust the behavior of the MdePkg Print Library class to produce a consistent style of EOL characters.
Previously, the Print Library class would translate '\n' to '\n\r'. With this update, the following EOL translations are performed: 1) '\r' to '\r' 2) '\r\n' to '\r\n' 3) '\n' to '\r\n' 4) '\n\r' to '\r\n' git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8692 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BasePrintLib')
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLibInternal.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index ef006bbd00..cf5c28e6f7 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -702,8 +702,33 @@ BasePrintLibSPrintMarker (
}
break;
+ case '\r':
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+ if (FormatCharacter == '\n') {
+ //
+ // Translate '\r\n' to '\r\n'
+ //
+ ArgumentString = "\r\n";
+ } else {
+ //
+ // Translate '\r' to '\r'
+ //
+ ArgumentString = "\r";
+ Format -= BytesPerFormatCharacter;
+ }
+ break;
+
case '\n':
- ArgumentString = "\n\r";
+ //
+ // Translate '\n' to '\r\n' and '\n\r' to '\r\n'
+ //
+ ArgumentString = "\r\n";
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+ if (FormatCharacter != '\r') {
+ Format -= BytesPerFormatCharacter;
+ }
break;
case '%':
@@ -717,8 +742,33 @@ BasePrintLibSPrintMarker (
}
break;
+ case '\r':
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+ if (FormatCharacter == '\n') {
+ //
+ // Translate '\r\n' to '\r\n'
+ //
+ ArgumentString = "\r\n";
+ } else {
+ //
+ // Translate '\r' to '\r'
+ //
+ ArgumentString = "\r";
+ Format -= BytesPerFormatCharacter;
+ }
+ break;
+
case '\n':
- ArgumentString = "\n\r";
+ //
+ // Translate '\n' to '\r\n' and '\n\r' to '\r\n'
+ //
+ ArgumentString = "\r\n";
+ Format += BytesPerFormatCharacter;
+ FormatCharacter = ((*Format & 0xff) | (*(Format + 1) << 8)) & FormatMask;
+ if (FormatCharacter != '\r') {
+ Format -= BytesPerFormatCharacter;
+ }
break;
default: