mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-02-17 03:48:38 +00:00
Handle '\r\0' from early RFCs in Readline
This commit is contained in:
parent
3b8c9303b4
commit
16a8708c58
@ -48,7 +48,7 @@ typedef std::map<std::string, std::string> TestData;
|
||||
const TestData *s_currentTestData = NULLPTR;
|
||||
const std::string testDataFilename = "cryptest.dat";
|
||||
|
||||
// Handles CR, LF, and CRLF properly
|
||||
// Handles CR, LF, and CRLF properly. Early RFC's used '\r\0' on occasion.
|
||||
// For istream.fail() see https://stackoverflow.com/q/34395801/608639.
|
||||
bool Readline(std::istream& stream, std::string& line)
|
||||
{
|
||||
@ -66,6 +66,8 @@ bool Readline(std::istream& stream, std::string& line)
|
||||
int next = stream.peek();
|
||||
if (next == '\n')
|
||||
(void)stream.get();
|
||||
else if (next == '\0')
|
||||
(void)stream.get();
|
||||
|
||||
break;
|
||||
}
|
||||
@ -74,8 +76,6 @@ bool Readline(std::istream& stream, std::string& line)
|
||||
break;
|
||||
}
|
||||
|
||||
// Let string class manage its own capacity.
|
||||
// The string will grow as needed.
|
||||
temp.push_back(static_cast<char>(ch));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user