diff options
Diffstat (limited to 'Swiften/FileTransfer/ByteArrayReadBytestream.cpp')
-rw-r--r-- | Swiften/FileTransfer/ByteArrayReadBytestream.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Swiften/FileTransfer/ByteArrayReadBytestream.cpp b/Swiften/FileTransfer/ByteArrayReadBytestream.cpp index d1b0db3..c1fadee 100644 --- a/Swiften/FileTransfer/ByteArrayReadBytestream.cpp +++ b/Swiften/FileTransfer/ByteArrayReadBytestream.cpp @@ -14,20 +14,20 @@ using namespace Swift; boost::shared_ptr<ByteArray> ByteArrayReadBytestream::read(size_t size) { - size_t readSize = size; - if (position + readSize > data.size()) { - readSize = data.size() - position; - } - boost::shared_ptr<ByteArray> result = boost::make_shared<ByteArray>( - data.begin() + boost::numeric_cast<long long>(position), - data.begin() + boost::numeric_cast<long long>(position) + boost::numeric_cast<long long>(readSize)); + size_t readSize = size; + if (position + readSize > data.size()) { + readSize = data.size() - position; + } + boost::shared_ptr<ByteArray> result = boost::make_shared<ByteArray>( + data.begin() + boost::numeric_cast<long long>(position), + data.begin() + boost::numeric_cast<long long>(position) + boost::numeric_cast<long long>(readSize)); - onRead(*result); - position += readSize; - return result; + onRead(*result); + position += readSize; + return result; } void ByteArrayReadBytestream::addData(const std::vector<unsigned char>& moreData) { - append(data, moreData); - onDataAvailable(); + append(data, moreData); + onDataAvailable(); } |