1ZIP_FILE_EXTRA_FIELD_... BSD Library Functions Manual ZIP_FILE_EXTRA_FIELD_...
2
4 zip_file_extra_field_set — set extra field for file in zip
5
7 libzip (-lzip)
8
10 #include <zip.h>
11
12 int
13 zip_file_extra_field_set(zip_t *archive, zip_uint64_t index,
14 zip_uint16_t extra_field_id, zip_uint16_t extra_field_index,
15 const zip_uint8_t *extra_field_data, zip_uint16_t len,
16 zip_flags_t flags);
17
19 The zip_file_extra_field_set() function sets the extra field with ID
20 (two-byte signature) extra_field_id and index extra_field_index for the
21 file at position index in the zip archive. The extra field's data will
22 be set to extra_field_data and length len. If a new entry shall be
23 appended, set extra_field_index to ZIP_EXTRA_FIELD_NEW.
24
25 At least one of the following flags must be set:
26
27 ZIP_FL_CENTRAL Set extra field in the archive's central direc‐
28 tory.
29
30 ZIP_FL_LOCAL Set extra field in the local file headers.
31
32 Please note that the extra field IDs 0x0001 (ZIP64 extension), 0x6375
33 (Infozip UTF-8 comment), and 0x7075 (Infozip UTF-8 file name) can not be
34 set using zip_file_extra_field_set() since they are set by libzip(3)
35 automatically when needed.
36
38 Upon successful completion 0 is returned. Otherwise, -1 is returned and
39 the error code in archive is set to indicate the error.
40
42 zip_file_extra_field_set() fails if:
43
44 [ZIP_ER_INVAL] The extra field size is too large (ID and length need
45 4 bytes; the maximum length of all extra fields for
46 one file combined is 65536 bytes). This error also
47 occurs if extra_field_index is too large.
48
49 [ZIP_ER_MEMORY] Required memory could not be allocated.
50
51 [ZIP_ER_NOENT] index is not a valid file index in archive.
52
54 libzip(3), zip_file_extra_field_delete(3), zip_file_extra_field_get(3),
55 zip_file_extra_fields_count(3)
56
58 zip_file_extra_field_set() was added in libzip 0.11.
59
61 Dieter Baron <dillo@nih.at> and Thomas Klausner <tk@giga.or.at>
62
63BSD December 18, 2017 BSD