Be sure there is a final line return when writing streams data

This commit is contained in:
Grégory Soutadé 2022-03-14 08:19:43 +01:00
parent 114ef1c5d1
commit 6be1a4707f

View File

@ -106,6 +106,10 @@ namespace uPDFParser
std::string res = "stream\n";
const char* streamData = (const char*)data(); // Force reading if not in memory
res += std::string(streamData, _dataLength);
// Be sure there is a final line return
if (streamData[_dataLength-1] != '\n' &&
streamData[_dataLength-1] != '\r')
res += "\n";
res += "endstream\n";
return res;