diff --git a/src/error.cpp b/src/error.cpp index d2e30cc4..f57aa27e 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -7,8 +7,7 @@ namespace pkpy{ // Skip utf8 BOM if there is any. if (strncmp(source.data(), "\xEF\xBB\xBF", 3) == 0) index += 3; // Drop all '\r' - // SStream ss(source.size()); - SStream ss; + SStream ss(source.size()); while(index < source.size()){ if(source[index] != '\r') ss << source[index]; index++; diff --git a/src/str.cpp b/src/str.cpp index bddd5bd3..9ce019ee 100644 --- a/src/str.cpp +++ b/src/str.cpp @@ -437,6 +437,7 @@ int utf8len(unsigned char c, bool suppress){ Str SStream::str(){ // after this call, the buffer is no longer valid + buffer.reserve(buffer.size() + 1); // allocate one more byte for '\0' return Str(buffer.detach()); }