diff options
Diffstat (limited to 'shared/serialize.cpp')
-rw-r--r-- | shared/serialize.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/shared/serialize.cpp b/shared/serialize.cpp index f819cb33..63e2037f 100644 --- a/shared/serialize.cpp +++ b/shared/serialize.cpp @@ -10,20 +10,19 @@ using namespace Utility; -void ReadInputStream::throwReadError() //throw FileError() +void ReadInputStream::throwReadError() const //throw FileError() { throw FreeFileSync::FileError(wxString(_("Error reading from synchronization database:")) + wxT(" \n") + wxT("\"") + errorObjName_ + wxT("\"")); } -ReadInputStream::CharArray ReadInputStream::readArrayC() +ReadInputStream::CharArray ReadInputStream::readArrayC() const { - CharArray buffer(new std::vector<char>); const size_t byteCount = readNumberC<size_t>(); + CharArray buffer(new std::vector<char>(byteCount)); if (byteCount > 0) { - buffer->resize(byteCount); stream_.Read(&(*buffer)[0], byteCount); check(); if (stream_.LastRead() != byteCount) //some additional check @@ -34,14 +33,14 @@ ReadInputStream::CharArray ReadInputStream::readArrayC() //-------------------------------------------------------------------------------------------------------- -void WriteOutputStream::throwWriteError() //throw FileError() +void WriteOutputStream::throwWriteError() const //throw FileError() { throw FreeFileSync::FileError(wxString(_("Error writing to synchronization database:")) + wxT(" \n") + wxT("\"") + errorObjName_ + wxT("\"")); } -void WriteOutputStream::writeArrayC(const std::vector<char>& buffer) +void WriteOutputStream::writeArrayC(const std::vector<char>& buffer) const { writeNumberC<size_t>(buffer.size()); if (buffer.size() > 0) |