Open fdegros opened 1 month ago
To answer your questions:
NULL
would crash. If you pass NULL
as error
to zip_source_zip_file_create()
, the error information is lost.zip_source_foo()
/ zip_source_foo_create()
function pairs that all take archive
or error
as arguments, and keeping them consistent seems like a good idea. We'll add a paragraph to all their man pages to document these arguments.If you pass NULL
as password, the default password for the archive is used. If you pass the empty string, that is used as password.
If you pass
NULL
as password, the default password for the archive is used. If you pass the empty string, that is used as password.
This might be worth documenting very clearly. In particular, this is a place where a NULL
string and an empty string have different meanings and effects. This can be quite tricky.
This is also subtly different from the way zip_set_default_password
treats its password
parameter. See zip_set_default_password
's documentation:
If password is
NULL
or the empty string, the default password is unset.
In that case, a NULL
or an empty string have the same meaning and effect.
The functions
zip_source_zip_file
andzip_source_zip
take two parameters each of typezip_t*
namedarchive
andsrcarchive
.The role of the first
archive
parameter is not immediately obvious. Reading the documentation carefully, it seems that thearchive
parameter is used when setting the error status of azip_t
object in case of error. This raises a couple of questions:archive
andsrcarchive
pointers to point to the samezip_t
object?NULL
pointer to thearchive
parameter? If yes, what happens in case of error? Is the error status then stored in*srcarchive
or lost entirely?archive
parameters to something more indicative of its role, like maybeerror
, since it is playing a similar role as theerror
parameter inzip_source_zip_file_create
andzip_source_zip_create
?The role of the
password
parameter passed tozip_source_zip_file
andzip_source_zip_file_create
is not described in the documentation. Is it possible to pass aNULL
pointer aspassword
? If yes, does it have the same effect as passing an empty string?