gmio_core: fix bug in gmio_next_char_from_stream()
This commit is contained in:
parent
69d68a4ba9
commit
6a5ac600bd
@ -58,20 +58,11 @@ GMIO_INLINE const char* gmio_next_char_from_buffer(
|
|||||||
GMIO_INLINE const char* gmio_next_char_from_stream(
|
GMIO_INLINE const char* gmio_next_char_from_stream(
|
||||||
gmio_string_stream_fwd_iterator_t *it)
|
gmio_string_stream_fwd_iterator_t *it)
|
||||||
{
|
{
|
||||||
if (gmio_stream_error(it->stream) != 0
|
|
||||||
|| gmio_stream_at_end(it->stream) == GMIO_TRUE)
|
|
||||||
{
|
|
||||||
it->buffer_pos = it->buffer.len;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read next chunk of data */
|
/* Read next chunk of data */
|
||||||
it->buffer_pos = 0;
|
it->buffer_pos = 0;
|
||||||
it->buffer.len = gmio_stream_read(it->stream,
|
it->buffer.len = gmio_stream_read(
|
||||||
it->buffer.ptr,
|
it->stream, it->buffer.ptr, sizeof(char), it->buffer.max_len);
|
||||||
sizeof(char),
|
if (it->buffer.len > 0) {
|
||||||
it->buffer.max_len);
|
|
||||||
if (gmio_stream_error(it->stream) == 0) {
|
|
||||||
if (it->stream_read_hook != NULL)
|
if (it->stream_read_hook != NULL)
|
||||||
it->stream_read_hook(it->cookie, &it->buffer);
|
it->stream_read_hook(it->cookie, &it->buffer);
|
||||||
return it->buffer.ptr;
|
return it->buffer.ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user