Skip to content
Commit 69052db3 authored by Benjamin Gilbert's avatar Benjamin Gilbert
Browse files

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: default avatarBenjamin Gilbert <bgilbert@cs.cmu.edu>
parent 24413927
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment