List Archive

Thread

Thread Index

Message

From: Andreas Falkenhahn <andreas%falkenhahn.com@localhost>
To: libzip mailing list <libzip-discuss%nih.at@localhost>
Subject: Why should I return the size in ZIP_SOURCE_STAT?
Date: Tue, 31 Oct 2017 16:44:50 +0100

I'm using a custom source to feed data into zip_file_add(). According to the
docs, I have to implement ZIP_SOURCE_STAT for that. I use ZIP_SOURCE_STAT
to tell zip_file_add() the datestamp for my file but I don't see why I
should ever set ZIP_STAT_SIZE? Isn't that completely gratuitous because
the size can be automatically computed from the number of bytes fed by
ZIP_SOURCE_READ?

I've just done some tests and it seems that passing a size in ZIP_SOURCE_STAT
isn't necessary at all. Still, the docs sound like it needs to be set:

        Information only available after the source has been read (e.g. size) 
can
        be omitted in an earlier call.

To me this sounds like I don't have to submit a size when ZIP_SOURCE_STAT
is first called but I should submit it in the ZIP_SOURCE_STAT call that
comes in after all data has been read. But apparently that isn't necessary.

So I think the docs should be updated to mention that passing the size
in ZIP_SOURCE_STAT isn't really necessary... (unless I'm missing something
here)

-- 
Best regards,
 Andreas Falkenhahn                          
mailto:andreas%falkenhahn.com@localhost

Made by MHonArc.