diff options
author | Determinant <[email protected]> | 2018-07-05 18:08:33 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-07-05 18:08:33 -0400 |
commit | fe416dcb509770dbce1710358ef39fec43962d69 (patch) | |
tree | 52ee7c6d53e802533745ba85a769ed2798c27cc6 /include | |
parent | 905e6649a7deb8db7325e8ff44caf6bc61b899b4 (diff) |
...
Diffstat (limited to 'include')
-rw-r--r-- | include/salticidae/stream.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 8824f97..ffb577e 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -219,8 +219,16 @@ class Blob { size_t cheap_hash() const { return *data; } void serialize(DataStream &s) const { - for (const _impl_type *ptr = data; ptr < data + _len; ptr++) - s << htole(*ptr); + if (loaded) + { + for (const _impl_type *ptr = data; ptr < data + _len; ptr++) + s << htole(*ptr); + } + else + { + for (const _impl_type *ptr = data; ptr < data + _len; ptr++) + s << htole((_impl_type)0); + } } void unserialize(DataStream &s) { @@ -230,6 +238,7 @@ class Blob { s >> x; *ptr = letoh(x); } + loaded = true; } }; |