diff --git a/autotest/StringsStream/StringsStream.cpp b/autotest/StringsStream/StringsStream.cpp index e9a2f13b4..e6e01b8b5 100644 --- a/autotest/StringsStream/StringsStream.cpp +++ b/autotest/StringsStream/StringsStream.cpp @@ -37,6 +37,8 @@ CONSOLE_APP_MAIN LoadFromStrings(data2, s); + DDUMP(data2.GetCount()); + ASSERT(data == data2); LOG("=============== OK"); diff --git a/uppsrc/Core/StringsStream.cpp b/uppsrc/Core/StringsStream.cpp index 352a129c9..bd8d8e844 100644 --- a/uppsrc/Core/StringsStream.cpp +++ b/uppsrc/Core/StringsStream.cpp @@ -75,8 +75,14 @@ StringsStreamIn::StringsStreamIn(const Vector& part) void StringsStreamIn::ResetBuffer() { - ptr = buffer = (byte *)part[i].begin(); - rdlim = (byte *)part[i].end(); + if(i < part.GetCount()) { + ptr = buffer = (byte *)part[i].begin(); + rdlim = (byte *)part[i].end(); + } + else { + static byte nothing; + ptr = buffer = rdlim = ¬hing; + } } int StringsStreamIn::_Term() diff --git a/uppsrc/Core/Util.h b/uppsrc/Core/Util.h index 3a33f01df..34a8afd08 100644 --- a/uppsrc/Core/Util.h +++ b/uppsrc/Core/Util.h @@ -396,7 +396,7 @@ public: Vector PickResult(); - StringsStreamOut(int part_size = 4096*1024); + StringsStreamOut(int part_size = 1024*1024 - 128); // - 128 - leave some space for header in huge block }; class StringsStreamIn : public Stream { diff --git a/uppsrc/Core/src.tpp/StringsStream_en-us.tpp b/uppsrc/Core/src.tpp/StringsStream_en-us.tpp index c353035e6..26fbb24d7 100644 --- a/uppsrc/Core/src.tpp/StringsStream_en-us.tpp +++ b/uppsrc/Core/src.tpp/StringsStream_en-us.tpp @@ -24,7 +24,7 @@ chunks which is potentially faster for repeated operation.]&] [ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&] [s3; &] [s5;:Upp`:`:StringsStreamOut`:`:StringsStreamOut`(int`): [* StringsStreamOut]([@(0.0.255) i -nt] [*@3 part`_size] [@(0.0.255) `=] [@3 4096] [@(0.0.255) `*][@3 1024])&] +nt] [*@3 part`_size] [@(0.0.255) `=] [@N 1024`*1024 `- 256])&] [s2;%% Constructor `- [*@3 pa][%-*@3 rt`_size] is the size of data chunk.&] [s3; &] [s4; &]