- zip_file_extra_field_set(zip_t *archive, zip_uint64_t index, zip_uint16_t extra_field_id, zip_uint16_t extra_field_index, const zip_uint8_t *extra_field_data, zip_uint16_t len, zip_flags_t flags);
At least one of the following flags must be set:
- Set extra field in the archive's central directory.
- Set extra field in the local file headers.
Please note that the extra field IDs 0x0001 (ZIP64 extension), 0x6375 (Infozip UTF-8 comment), and 0x7075 (Infozip UTF-8 file name) can not be set using zip_file_extra_field_set() since they are set by libzip(3) automatically when needed.
RETURN VALUESUpon successful completion 0 is returned. Otherwise, -1 is returned and the error code in archive is set to indicate the error.
ERRORSzip_file_extra_field_set() fails if:
- The extra field size is too large (ID and length need 4 bytes; the maximum length of all extra fields for one file combined is 65536 bytes). This error also occurs if extra_field_index is too large.
- Required memory could not be allocated.
- index is not a valid file index in archive.
AUTHORSDieter Baron <[email protected]> and Thomas Klausner <[email protected]>