[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pdf-devel] Confusion about return values
From: |
Brad Hards |
Subject: |
[pdf-devel] Confusion about return values |
Date: |
Sat, 8 Mar 2008 10:50:37 +1100 |
User-agent: |
KMail/1.9.9 |
I'm trying to get the unit tests to pass, and I'm getting failures in the file
stream tests. I'll fix up the code, but I need to understand what is
intended.
pdf_stm_t pdf_create_file_stm (char *filename, int mode)
I take it that this is meant to return a file object, or NULL on failure.
The code is wrong, because it checks the return value of the backend init
function against NULL, but the function signature in struct pdf_stm_be_s is
int (*init) (void **be_data, void *conf_data);
and the file backend returns PDF_OK or PDF_ERROR
Is the intent that the backend init() return value is really a pdf_status_t?
If so, why it is the signature an int?
Same logic applies for most of the other backend functions. The unit tests
contain checks like:
fail_if (!pdf_stm_close (stm));
which IMHO would be a lot clearer if it checked against PDF_OK.
Can you explain?
Brad