<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 3, 2016 at 11:50 PM, Bernhard Fischer <span dir="ltr"><<a href="mailto:bf@abenteuerland.at" target="_blank">bf@abenteuerland.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sunday 03 January 2016 14:29:57 Behdad Esfahbod wrote:<br>
> On 16-01-02 09:34 PM, Bill Spitzak wrote:<br>
> > On 01/02/2016 01:27 PM, Bernhard Fischer wrote:<br>
> >> On Saturday 02 January 2016 13:01:39 Bill Spitzak wrote:<br>
> >>> I think the api has to be changed to return number of bytes read, and a<br>
> >>> negative number for eof.<br>
> >><br>
> >> The return value should be the number of bytes read and on eof it is<br>
> >> something between 0 and length. If it is called again at/after eof it<br>
> >> returns 0 again. A negative value (-1) is only returned in case of error<br>
> >> (but not EOF). This is exactly like read(3) behaves.<br>
> ><br>
> > Yes you are correct, I made a typo, I meant to say "error" where I wrote<br>
> > "eof". I fully agree with your description.<br>
><br>
> Given that we cannot change the signature now, I suggest we hack it up to<br>
> interpret negative numbers returned from the callback to be interpreted as a<br>
> short read; the absolute value of the returned negative number is the<br>
> number of bytes read.<br>
><br>
> Cairo itself won't need to be updated, but clients should be encouraged to<br>
> implement the new behaviour.<br>
><br>
> b<br>
<br>
<br>
</div></div>I agree, that is a backwards compatible solution.<br></blockquote><div><br></div><div>I think you need to make negative number mean "it was this short". Ie if a request to read 10 bytes only reads 8, it returns -2.<br><br></div><div>The reason is so that reading the entire block still returns CAIRO_STATUS_SUCCESS.<br><br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Bernhard<br>
</font></span></blockquote></div><br></div></div>