(Network Stream) Add function netstream_eof (#14335)

This commit is contained in:
Cthulhu-throwaway 2022-08-21 16:52:57 -03:00 committed by GitHub
parent 30977a2603
commit e1a139ec0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -108,6 +108,17 @@ bool netstream_truncate(netstream_t *stream, size_t used);
*/
void netstream_data(netstream_t *stream, void **data, size_t *len);
/**
* netstream_eof:
*
* @stream : Pointer to a network stream object.
*
* Checks whether the network stream is at EOF or not.
*
* Returns: true if the stream is at EOF, false otherwise.
*/
bool netstream_eof(netstream_t *stream);
/**
* netstream_tell:
*

View File

@ -89,6 +89,11 @@ void netstream_data(netstream_t *stream, void **data, size_t *len)
*len = stream->used;
}
bool netstream_eof(netstream_t *stream)
{
return stream->pos >= stream->used;
}
size_t netstream_tell(netstream_t *stream)
{
return stream->pos;