[libbluray-devel] cast file read/write result to size_t

Joakim Plate elupus at xbmc.org
Sun Apr 14 21:46:43 CEST 2013


On Sun, Apr 14, 2013 at 12:35 PM, Petri Hintukainen <
phintuka at users.sourceforge.net> wrote:

> On pe, 2013-04-12 at 00:26 +0200, Joakim Plate wrote:
>


> I think this API is not well designed. At least it should be
> documented...
>
> Negative values are not needed and shouldn't be allowed at all:
>   1) It does not make any sense to read/write zero or negative
>      amount of bytes.
>   2) If request size is unsigned also result must be unsigned
>      (range of result type can't be smaller than range of
>      request type)
>   3) Returning anything else than requested already indicates
>      failure (EOF or error). There's no need for any special
>      error code.
>

I think it's a normal api of the read() function. Negative on error and can
return less than requested. The fread api requires the feof() and ferror()
functions to signify if it was a normal EOF or an error that occured, to me
that is silly to require those addition to know if it was an error or not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20130414/d28d4da7/attachment-0001.html>


More information about the libbluray-devel mailing list