fix loading windows line ending files in textarchive

This commit is contained in:
Christopher Lackner 2023-01-19 16:39:24 +01:00
parent 2f4e52594e
commit 8745a12246

View File

@ -987,6 +987,8 @@ namespace ngcore
*stream >> len;
char ch;
stream->get(ch); // '\n'
if(ch == '\r') // windows line endings -> read \n as well
stream->get(ch);
str.resize(len);
if(len)
stream->get(&str[0], len+1, '\0');
@ -1006,6 +1008,8 @@ namespace ngcore
if(len)
{
stream->get(ch); // \n
if(ch == '\r') // windows line endings, read \n as well
stream->get(ch);
stream->get(&str[0], len+1, '\0'); // NOLINT
}
str[len] = '\0'; // NOLINT