1.1 --- a/src/buffer.c Mon Jul 25 14:16:49 2022 +0200 1.2 +++ b/src/buffer.c Mon Jul 25 15:29:56 2022 +0200 1.3 @@ -248,7 +248,8 @@ 1.4 // try again with the remaining stuff 1.5 unsigned char const *new_ptr = ptr; 1.6 new_ptr += items_flush * size; 1.7 - return cxBufferWrite(new_ptr, size, items_keep, buffer); 1.8 + // report the directly flushed items as written plus the remaining stuff 1.9 + return items_flush + cxBufferWrite(new_ptr, size, items_keep, buffer); 1.10 } else { 1.11 // all items have been flushed - report them as written 1.12 return nitems; 1.13 @@ -257,7 +258,7 @@ 1.14 // nothing could be flushed at all, we immediately give up without writing any data 1.15 return 0; 1.16 } else { 1.17 - // we were partially successful, we have shift left and try again 1.18 + // we were partially successful, we shift left and try again 1.19 cxBufferShiftLeft(buffer, flush_pos); 1.20 return cxBufferWrite(ptr, size, nitems, buffer); 1.21 }