diff --git a/sys/chunked_ringbuffer/chunked_ringbuffer.c b/sys/chunked_ringbuffer/chunked_ringbuffer.c index a3c8e592b3..9eb0e35c8c 100644 --- a/sys/chunked_ringbuffer/chunked_ringbuffer.c +++ b/sys/chunked_ringbuffer/chunked_ringbuffer.c @@ -87,13 +87,13 @@ static unsigned _get_cur_len(chunk_ringbuf_t *rb) } } -bool crb_end_chunk(chunk_ringbuf_t *rb, bool keep) +unsigned crb_end_chunk(chunk_ringbuf_t *rb, bool keep) { int idx; /* no chunk was started */ if (rb->cur_start == NULL) { - return false; + return 0; } if (keep) { @@ -109,7 +109,7 @@ bool crb_end_chunk(chunk_ringbuf_t *rb, bool keep) } rb->cur = rb->cur_start; rb->cur_start = NULL; - return false; + return 0; } /* store complete chunk */ @@ -117,7 +117,7 @@ bool crb_end_chunk(chunk_ringbuf_t *rb, bool keep) rb->chunk_len[idx] = _get_cur_len(rb); rb->cur_start = NULL; - return true; + return rb->chunk_len[idx]; } bool crb_get_chunk_size(chunk_ringbuf_t *rb, size_t *len) diff --git a/sys/include/chunked_ringbuffer.h b/sys/include/chunked_ringbuffer.h index d1727ba02c..75cf9fa4ba 100644 --- a/sys/include/chunked_ringbuffer.h +++ b/sys/include/chunked_ringbuffer.h @@ -82,10 +82,10 @@ void crb_init(chunk_ringbuf_t *rb, void *buffer, size_t len); * @param[in] valid True if the chunk is valid and should be stored * False if the current chunk should be discarded * - * @return true If the chunk could be stored in the valid chunk array - * @return false If there is no more space in the valid chunk array + * @return size of chunk if the chunk could be stored in the valid chunk array + * @return 0 if there is no more space in the valid chunk array */ -bool crb_end_chunk(chunk_ringbuf_t *rb, bool valid); +unsigned crb_end_chunk(chunk_ringbuf_t *rb, bool valid); /** * @brief Start a new chunk on the ringbuffer