Lines Matching refs:ef
41 _zip_ef_clone(const zip_extra_field_t *ef, zip_error_t *error) in _zip_ef_clone() argument
47 while (ef) { in _zip_ef_clone()
48 if ((def=_zip_ef_new(ef->id, ef->size, ef->data, ef->flags)) == NULL) { in _zip_ef_clone()
60 ef = ef->next; in _zip_ef_clone()
68 _zip_ef_delete_by_id(zip_extra_field_t *ef, zip_uint16_t id, zip_uint16_t id_idx, zip_flags_t flags) in _zip_ef_delete_by_id() argument
74 head = ef; in _zip_ef_delete_by_id()
76 for (; ef; ef=(prev ? prev->next : head)) { in _zip_ef_delete_by_id()
77 if ((ef->flags & flags & ZIP_EF_BOTH) && ((ef->id == id) || (id == ZIP_EXTRA_FIELD_ALL))) { in _zip_ef_delete_by_id()
79 ef->flags &= ~(flags & ZIP_EF_BOTH); in _zip_ef_delete_by_id()
80 if ((ef->flags & ZIP_EF_BOTH) == 0) { in _zip_ef_delete_by_id()
82 prev->next = ef->next; in _zip_ef_delete_by_id()
84 head = ef->next; in _zip_ef_delete_by_id()
85 ef->next = NULL; in _zip_ef_delete_by_id()
86 _zip_ef_free(ef); in _zip_ef_delete_by_id()
97 prev = ef; in _zip_ef_delete_by_id()
106 _zip_ef_free(zip_extra_field_t *ef) in _zip_ef_free() argument
110 while (ef) { in _zip_ef_free()
111 ef2 = ef->next; in _zip_ef_free()
112 free(ef->data); in _zip_ef_free()
113 free(ef); in _zip_ef_free()
114 ef = ef2; in _zip_ef_free()
120 _zip_ef_get_by_id(const zip_extra_field_t *ef, zip_uint16_t *lenp, zip_uint16_t id, zip_uint16_t id… in _zip_ef_get_by_id() argument
127 for (; ef; ef=ef->next) { in _zip_ef_get_by_id()
128 if (ef->id == id && (ef->flags & flags & ZIP_EF_BOTH)) { in _zip_ef_get_by_id()
135 *lenp = ef->size; in _zip_ef_get_by_id()
136 if (ef->size > 0) in _zip_ef_get_by_id()
137 return ef->data; in _zip_ef_get_by_id()
186 zip_extra_field_t *ef; in _zip_ef_new() local
188 if ((ef=(zip_extra_field_t *)malloc(sizeof(*ef))) == NULL) in _zip_ef_new()
191 ef->next = NULL; in _zip_ef_new()
192 ef->flags = flags; in _zip_ef_new()
193 ef->id = id; in _zip_ef_new()
194 ef->size = size; in _zip_ef_new()
196 if ((ef->data=(zip_uint8_t *)_zip_memdup(data, size, NULL)) == NULL) { in _zip_ef_new()
197 free(ef); in _zip_ef_new()
202 ef->data = NULL; in _zip_ef_new()
204 return ef; in _zip_ef_new()
212 zip_extra_field_t *ef, *ef2, *ef_head; in _zip_ef_parse() local
219 ef_head = ef = NULL; in _zip_ef_parse()
244 ef->next = ef2; in _zip_ef_parse()
245 ef = ef2; in _zip_ef_parse()
248 ef_head = ef = ef2; in _zip_ef_parse()
279 _zip_ef_remove_internal(zip_extra_field_t *ef) in _zip_ef_remove_internal() argument
284 ef_head = ef; in _zip_ef_remove_internal()
287 while (ef) { in _zip_ef_remove_internal()
288 if (ZIP_EF_IS_INTERNAL(ef->id)) { in _zip_ef_remove_internal()
289 next = ef->next; in _zip_ef_remove_internal()
290 if (ef_head == ef) in _zip_ef_remove_internal()
292 ef->next = NULL; in _zip_ef_remove_internal()
293 _zip_ef_free(ef); in _zip_ef_remove_internal()
296 ef = next; in _zip_ef_remove_internal()
299 prev = ef; in _zip_ef_remove_internal()
300 ef = ef->next; in _zip_ef_remove_internal()
309 _zip_ef_size(const zip_extra_field_t *ef, zip_flags_t flags) in _zip_ef_size() argument
314 for (; ef; ef=ef->next) { in _zip_ef_size()
315 if (ef->flags & flags & ZIP_EF_BOTH) in _zip_ef_size()
316 size = (zip_uint16_t)(size+4+ef->size); in _zip_ef_size()
324 _zip_ef_write(zip_t *za, const zip_extra_field_t *ef, zip_flags_t flags) in _zip_ef_write() argument
333 for (; ef; ef=ef->next) { in _zip_ef_write()
334 if (ef->flags & flags & ZIP_EF_BOTH) { in _zip_ef_write()
336 _zip_buffer_put_16(buffer, ef->id); in _zip_ef_write()
337 _zip_buffer_put_16(buffer, ef->size); in _zip_ef_write()
347 if (ef->size > 0) { in _zip_ef_write()
348 if (_zip_write(za, ef->data, ef->size) < 0) { in _zip_ef_write()
405 zip_extra_field_t *ef; in _zip_read_local_ef() local
418 if (!_zip_ef_parse(ef_raw, ef_len, ZIP_EF_LOCAL, &ef, &za->error)) { in _zip_read_local_ef()
424 if (ef) { in _zip_read_local_ef()
425 ef = _zip_ef_remove_internal(ef); in _zip_read_local_ef()
426 e->orig->extra_fields = _zip_ef_merge(e->orig->extra_fields, ef); in _zip_read_local_ef()