diff --git a/search/query_saver.cpp b/search/query_saver.cpp index 5a9592fcab..8aba809c52 100644 --- a/search/query_saver.cpp +++ b/search/query_saver.cpp @@ -5,6 +5,7 @@ #include "coding/base64.hpp" #include "coding/reader.hpp" #include "coding/writer.hpp" +#include "coding/write_to_sink.hpp" #include "base/logging.hpp" @@ -19,7 +20,7 @@ bool ReadLength(ReaderSource & reader, TLength & length) { if (reader.Size() < kLengthTypeSize) return false; - reader.Read(&length, kLengthTypeSize); + length = ReadPrimitiveFromSource(reader); return true; } } // namespace @@ -59,11 +60,11 @@ void QuerySaver::Serialize(string & data) const vector rawData; MemWriter> writer(rawData); TLength size = m_topQueries.size(); - writer.Write(&size, kLengthTypeSize); + WriteToSink(writer, size); for (auto const & query : m_topQueries) { size = query.size(); - writer.Write(&size, kLengthTypeSize); + WriteToSink(writer, size); writer.Write(query.c_str(), size); } data = base64::Encode(string(rawData.begin(), rawData.end()));