mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-26 14:33:46 -04:00
fix setting EOF in memio (#1059)
This commit is contained in:
parent
3483ac7a96
commit
feb602580e
16
src/memio.c
16
src/memio.c
@ -71,21 +71,23 @@ size_t mem_fread(void *buf, size_t size, size_t nmemb, MEMFILE *stream)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stream->read_eof)
|
||||
{
|
||||
stream->eof = true;
|
||||
}
|
||||
|
||||
// Trying to read more bytes than we have left?
|
||||
|
||||
items = nmemb;
|
||||
|
||||
if (items * size > stream->buflen - stream->position)
|
||||
{
|
||||
items = (stream->buflen - stream->position) / size;
|
||||
if (stream->read_eof)
|
||||
{
|
||||
stream->eof = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream->read_eof = true;
|
||||
}
|
||||
|
||||
stream->read_eof = (items > 0 ? false : true);
|
||||
items = (stream->buflen - stream->position) / size;
|
||||
}
|
||||
|
||||
// Copy bytes to buffer
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user