=== modified file 'src/StoreIOBuffer.h' --- src/StoreIOBuffer.h 2012-09-01 14:38:36 +0000 +++ src/StoreIOBuffer.h 2012-12-28 15:34:13 +0000 @@ -45,7 +45,11 @@ StoreIOBuffer(size_t aLength, int64_t anOffset, char *someData) : length (aLength), offset (anOffset), data (someData) { - flags.error = 0; + flags.error = false; + if (length < 0) { + flags.error = true; + length = 0; + } } /* Create a StoreIOBuffer from a MemBuf and offset */ @@ -54,14 +58,14 @@ length(aMemBuf->contentSize()), offset (anOffset), data(aMemBuf->content()) { - flags.error = 0; + flags.error = false; } StoreIOBuffer(MemBuf *aMemBuf, int64_t anOffset, size_t anLength) : length(anLength), offset (anOffset), data(aMemBuf->content()) { - flags.error = 0; + flags.error = false; } Range range() const { @@ -74,7 +78,7 @@ } struct { - unsigned error:1; + bool error:1; } flags; size_t length; int64_t offset; === modified file 'src/store_client.cc' --- src/store_client.cc 2012-09-18 21:05:32 +0000 +++ src/store_client.cc 2012-12-28 15:36:02 +0000 @@ -146,14 +146,12 @@ void store_client::callback(ssize_t sz, bool error) { - StoreIOBuffer result(sz, 0 ,copyInto.data); + // result.flags.error will be set to true if sz < 0 + StoreIOBuffer result(sz, 0, copyInto.data); - if (sz < 0) { - result.flags.error = 1; - result.length = 0; - } else { - result.flags.error = error ? 1 : 0; - } + // but we may have received an error; in that case, override. + if (error) + result.flags.error = true; result.offset = cmp_offset; assert(_callback.pending());