pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Missing stream backend error conditions.


From: Michael Gold
Subject: Re: [pdf-devel] Missing stream backend error conditions.
Date: Fri, 22 May 2009 18:42:09 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, May 19, 2009 at 17:16:35 -0300, gerel wrote:
> The list of status code so far is:
> 
>        - PDF_OK
>        - PDF_EEOF (read)
>        - PDF_EAGAIN (read/write)
>        - PDF_ENOSPC (write)
>        - PDF_EINVOP (read for write mode and viceversa)
>        - PDF_ERROR (other error)
>        - PDF_EBADFILE (invalid data)
>        - PDF_EIO (future use i/o error)
>        - PDF_EIMPLLIMIT (filter specific)
>        - PDF_ENOMEM (filter specific)
>        - PDF_EINTR (signal interruption)

PDF_EINTR isn't needed; if the backend gets EINTR from a function like
fread/fwrite, it will retry the operation rather than returning an error
code.

> The backend and the fsys module are deeply related. If we decide we need a
> status code in the backend it's very likely that we need it in the fsys mod 
> too.
> 
> Then, from the bottom and upwards the returned values would be,
> 
>     Fsys mod:
>        - PDF_OK
>        - PDF_EEOF (read)
>        - PDF_EAGAIN (read/write)
>        - PDF_ENOSPC (write)
>        - PDF_EINVOP (read for write mode and viceversa)
>        - PDF_EINTR (signal interruption)
>        - PDF_ERROR (other error)

PDF_EIO is a possibility too.

>      Stm mod:
>        - PDF_OK
>        - PDF_EEOF (read)
>        - PDF_EAGAIN (read/write)
>        - PDF_ENOSPC (write)
>        - PDF_EINVOP (read for write mode and viceversa)
>        - PDF_EINTR (signal interruption)
>        - PDF_EBADFILE (invalid data)
>        - PDF_EIO (future use i/o error)

PDF_EIO isn't just for future use; it should be returned by the cfile
backend if fread or fwrite sets errno to EIO.

Note that C99 doesn't seem to require fread and fwrite to set errno on
failure (although POSIX.1-2008 does); so for portability, it's probably
necessary to set errno to 0 before using these functions.

>        - PDF_EIMPLLIMIT (filter specific)
>        - PDF_ENOMEM (filter specific)
>        - PDF_ERROR (other error)
> 
>      Additional filter return values:
>        - PDF_EIMPLLIMIT (filter specific)
>        - PDF_ENOMEM (filter specific)
>        - PDF_EBADFILE (invalid data)
> 
> Tell me what you think and then  i'll proceed.

It looks fine apart from the issues I mentioned above.

-- Michael

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]