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
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user