StoreIOBuffer(size_t aLength, int64_t anOffset, char *someData) :
length (aLength), offset (anOffset), data (someData) {
- if (aLength < 0) {
- flags.error = 1;
- length = 0;
- } else {
- flags.error = 0;
- }
+ flags.error = 0;
}
/* Create a StoreIOBuffer from a MemBuf and offset */
void
store_client::callback(ssize_t sz, bool error)
{
- StoreIOBuffer result(sz, 0 ,copyInto.data);
+ size_t bSz = 0;
- if (error)
+ if (sz >= 0 && !error)
+ bSz = sz;
+
+ StoreIOBuffer result(bSz, 0 ,copyInto.data);
+
+ if (sz < 0 || error)
result.flags.error = 1;
result.offset = cmp_offset;
assert(_callback.pending());
- cmp_offset = copyInto.offset + sz;
+ cmp_offset = copyInto.offset + bSz;
STCB *temphandler = _callback.callback_handler;
void *cbdata = _callback.callback_data;
_callback = Callback(NULL, NULL);