Skip to content

Commit

Permalink
add bufferStreamFullRead
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed May 26, 2024
1 parent b3c3146 commit 2b1ce58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ww/buffer_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include <stdlib.h>
#include <string.h>

extern size_t bufferStreamLen(buffer_stream_t *self);
extern size_t bufferStreamLen(buffer_stream_t *self);
extern shift_buffer_t *bufferStreamFullRead(buffer_stream_t *self);

enum
{
Expand Down Expand Up @@ -111,7 +112,6 @@ shift_buffer_t *bufferStreamIdealRead(buffer_stream_t *self)
shift_buffer_t *container = queue_pull_front(&self->q);
self->size -= bufLen(container);
return container;

}

uint8_t bufferStreamViewByteAt(buffer_stream_t *self, size_t at)
Expand Down Expand Up @@ -149,7 +149,7 @@ void bufferStreamViewBytesAt(buffer_stream_t *self, size_t at, uint8_t *buf, siz
size_t blen = bufLen(b);
if (len - buf_i <= blen - bufferstream_i)
{
memcpy(buf + buf_i, ((char*)rawBuf(b))+bufferstream_i , len - buf_i);
memcpy(buf + buf_i, ((char *) rawBuf(b)) + bufferstream_i, len - buf_i);
return;
}
while (bufferstream_i < blen)
Expand Down
5 changes: 5 additions & 0 deletions ww/buffer_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ inline size_t bufferStreamLen(buffer_stream_t *self)
{
return self->size;
}

inline shift_buffer_t* bufferStreamFullRead(buffer_stream_t *self)
{
return bufferStreamRead(self, bufferStreamLen(self));
}

0 comments on commit 2b1ce58

Please sign in to comment.