1ZIP_SOURCE_ZIP_FILE(3) BSD Library Functions Manual ZIP_SOURCE_ZIP_FILE(3)
2
4 zip_source_zip_file, zip_source_zip_file_create — create data source from
5 zip file
6
8 libzip (-lzip)
9
11 #include <zip.h>
12
13 zip_source_t *
14 zip_source_zip_file(zip_t *archive, zip_t *srcarchive,
15 zip_uint64_t srcidx, zip_flags_t flags, zip_uint64_t start,
16 zip_int64_t length, const char *password);
17
18 zip_source_t *
19 zip_source_zip_file_create(zip_t *srcarchive, zip_uint64_t srcidx,
20 zip_flags_t flags, zip_uint64_t start, zip_int64_t length,
21 const char *password, zip_error_t *error);
22
24 The functions zip_source_zip_file() and zip_source_zip_file_create() cre‐
25 ate a zip source from a file in a zip archive. The srcarchive argument
26 is the (open) zip archive containing the source zip file at index srcidx.
27 length bytes from offset start will be used in the zip_source. If length
28 is -1, the rest of the file, starting from start, is used.
29
30 If you intend to copy a file from one archive to another, using the flag
31 ZIP_FL_COMPRESSED is more efficient, as it avoids recompressing the file
32 data.
33
34 Supported flags are:
35
36 ZIP_FL_COMPRESSED Get the compressed data. This is only supported if
37 the complete file data is requested (start == 0 and
38 length == -1). This is not supported for changed
39 data. Default is uncompressed.
40
41 ZIP_FL_ENCRYPTED Get the encrypted data. (This flag implies
42 ZIP_FL_COMPRESSED.) This is only supported if the
43 complete file data is requested (start == 0 and
44 length == -1). Default is decrypted.
45
46 ZIP_FL_UNCHANGED Try to get the original data without any changes
47 that may have been made to srcarchive after opening
48 it.
49
51 Upon successful completion, the created source is returned. Otherwise,
52 NULL is returned and the error code in archive or error is set to indi‐
53 cate the error.
54
56 zip_source_zip_file() and zip_source_zip_file_create() fail if:
57
58 [ZIP_ER_CHANGED] Unchanged data was requested, but it is not available.
59
60 [ZIP_ER_INVAL] srcarchive, srcidx, start, or length are invalid.
61
62 [ZIP_ER_MEMORY] Required memory could not be allocated.
63 Additionally, it can return all error codes from zip_stat_index() and
64 zip_fopen_index().
65
67 libzip(3), zip_file_add(3), zip_file_replace(3), zip_source(3)
68
70 zip_source_zip_file() and zip_source_zip_file_create() were added in
71 libzip 1.10.0.
72
74 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
75
76BSD March 10, 2023 BSD