[Scummvm-devel] eof & err
Willem Jan Palenstijn
wjp at usecode.org
Sun Jul 12 21:50:03 CEST 2009
On Sun, Jul 12, 2009 at 09:44:44PM +0200, sunmax at libero.it wrote:
> >> Just returning 0 directly without doing anything when length
> >> is 0 is ok.
>
> Ok, I will add this extra condition.
>
> Just to be sure: is that the expected semantics of read (ie,
> to return 0 when we are at the end of the file, on a 0 size
> read without setting eof?), or we are just hacking it in?
That's the expected behaviour, matching POSIX fread (which our streams
are modelled after):
"
If size or nitems is 0, fread() shall return 0 and the contents of the
array and the state of the stream remain unchanged.
"
-Willem Jan
More information about the Scummvm-devel
mailing list