From 8745a122466e5549b8d326bf8bbf8c1a498f47c3 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Thu, 19 Jan 2023 16:39:24 +0100 Subject: [PATCH] fix loading windows line ending files in textarchive --- libsrc/core/archive.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 4271e725..5d699062 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -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