diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-08-25 20:04:41 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:02:36 +0300 |
commit | eca1b5c650ee1e96b828df48cb49528be576ce93 (patch) | |
tree | 0a868def1ecd6795e44284a7fff0fbf79dd3f1f1 /search | |
parent | 64c1eb8feb54180fab138ef8c9889a6d1013d168 (diff) |
Query saver store fix for big endian systems.
Diffstat (limited to 'search')
-rw-r--r-- | search/query_saver.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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<MemReader> & reader, TLength & length) { if (reader.Size() < kLengthTypeSize) return false; - reader.Read(&length, kLengthTypeSize); + length = ReadPrimitiveFromSource<TLength>(reader); return true; } } // namespace @@ -59,11 +60,11 @@ void QuerySaver::Serialize(string & data) const vector<uint8_t> rawData; MemWriter<vector<uint8_t>> 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())); |