diff options
| author | Gavin Andresen <[email protected]> | 2013-10-29 11:16:27 +1000 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2013-10-29 11:20:14 +1000 |
| commit | d5d1425657d0dd2dc76f4938c8141a387a81a5a8 (patch) | |
| tree | 5083c171ee7a73e0c7ab6956987c23ddc2cf08af /src/serialize.h | |
| parent | Merge pull request #3164 from TheBlueMatt/master (diff) | |
| download | discoin-d5d1425657d0dd2dc76f4938c8141a387a81a5a8.tar.xz discoin-d5d1425657d0dd2dc76f4938c8141a387a81a5a8.zip | |
Bug fix: CDataStream::GetAndClear() when nReadPos > 0
Changed CDataStream::GetAndClear() to use the most obvious
get get and clear instead of a tricky swap().
Added a unit test for CDataStream insert/erase/GetAndClear.
Note: GetAndClear() is not performance critical, it is used only
by the send-a-message-to-the-network code. Bug was not noticed
before now because the send-a-message code never erased from the
stream.
Diffstat (limited to 'src/serialize.h')
| -rw-r--r-- | src/serialize.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/serialize.h b/src/serialize.h index 4d9aec342..32f386b36 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1104,8 +1104,8 @@ public: } void GetAndClear(CSerializeData &data) { - vch.swap(data); - CSerializeData().swap(vch); + data.insert(data.end(), begin(), end()); + clear(); } }; |