Re: Implementing cairo_read_func_t/cairo_write_func_t properly
Bernhard Fischer <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <2117668.GDvz0MW7T7@winnie> |
On Sunday 03 January 2016 14:29:57 Behdad Esfahbod wrote: > On 16-01-02 09:34 PM, Bill Spitzak wrote: > > On 01/02/2016 01:27 PM, Bernhard Fischer wrote: > >> On Saturday 02 January 2016 13:01:39 Bill Spitzak wrote: > >>> I think the api has to be changed to return number of bytes read, and a > >>> negative number for eof. > >> > >> The return value should be the number of bytes read and on eof it is > >> something between 0 and length. If it is called again at/after eof it > >> returns 0 again. A negative value (-1) is only returned in case of error > >> (but not EOF). This is exactly like read(3) behaves. > > > > Yes you are correct, I made a typo, I meant to say "error" where I wrote > > "eof". I fully agree with your description. > > Given that we cannot change the signature now, I suggest we hack it up to > interpret negative numbers returned from the callback to be interpreted as a > short read; the absolute value of the returned negative number is the > number of bytes read. > > Cairo itself won't need to be updated, but clients should be encouraged to > implement the new behaviour. > > b I agree, that is a backwards compatible solution. Bernhard -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo