Add GError ** argument to _openslide_fread()
Callers cannot detect the difference between EOF and an I/O error, since
that requires access to the FILE *. Have _openslide_fread() do it and
return a GError in the latter case.
There are two possible approaches to signaling errors:
- Return -1 in an ssize_t. Any callers who really want a size_t (because
they're inside read callbacks for external libraries that want a size_t)
would need to convert -1 to 0.
- Return 0 in a size_t. Callers would need to create a temporary GError *
to check whether an error occurred.
The latter is slightly more painful, but if the caller fails to do it, the
error will be more obvious by inspection. Choose the latter approach.
Signed-off-by:
Benjamin Gilbert <bgilbert@cs.cmu.edu>
Loading
Please sign in to comment