Lines Matching refs:za

50 static zip_int64_t _zip_checkcons(zip_t *za, zip_cdir_t *cdir, zip_error_t *error);
51 static zip_cdir_t *_zip_find_central_dir(zip_t *za, zip_uint64_t len);
55 static zip_cdir_t *_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err…
63 zip_t *za; in zip_open() local
74 if ((za = zip_open_from_source(src, _flags, &error)) == NULL) { in zip_open()
82 return za; in zip_open()
133 zip_t *za; in zip_open_from_source() local
144 za = _zip_allocate_new(src, flags, error); in zip_open_from_source()
148 za = _zip_open(src, flags, error); in zip_open_from_source()
151 if (za == NULL) { in zip_open_from_source()
155 return za; in zip_open_from_source()
161 zip_archive_set_tempdir(zip_t *za, const char *tempdir) in zip_archive_set_tempdir() argument
167 zip_error_set(&za->error, ZIP_ER_MEMORY, errno); in zip_archive_set_tempdir()
174 free(za->tempdir); in zip_archive_set_tempdir()
175 za->tempdir = new_tempdir; in zip_archive_set_tempdir()
183 zip_t *za; in _zip_open() local
201 if ((za=_zip_allocate_new(src, flags, error)) == NULL) { in _zip_open()
206 return za; in _zip_open()
209 if ((za=_zip_allocate_new(src, flags, error)) == NULL) { in _zip_open()
213 if ((cdir = _zip_find_central_dir(za, len)) == NULL) { in _zip_open()
214 _zip_error_copy(error, &za->error); in _zip_open()
217 zip_discard(za); in _zip_open()
221 za->entry = cdir->entry; in _zip_open()
222 za->nentry = cdir->nentry; in _zip_open()
223 za->nentry_alloc = cdir->nentry_alloc; in _zip_open()
224 za->comment_orig = cdir->comment; in _zip_open()
228 for (idx = 0; idx < za->nentry; idx++) { in _zip_open()
229 const zip_uint8_t *name = _zip_string_get(za->entry[idx].orig->filename, NULL, 0, error); in _zip_open()
233 zip_discard(za); in _zip_open()
237 if (_zip_hash_add(za->names, name, idx, ZIP_FL_UNCHANGED, &za->error) == false) { in _zip_open()
238 if (za->error.zip_err != ZIP_ER_EXISTS || (flags & ZIP_CHECKCONS)) { in _zip_open()
239 _zip_error_copy(error, &za->error); in _zip_open()
242 zip_discard(za); in _zip_open()
248 za->ch_flags = za->flags; in _zip_open()
250 return za; in _zip_open()
276 _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error) in _zip_read_cdir() argument
298 cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error); in _zip_read_cdir()
302 cd = _zip_read_eocd(buffer, buf_offset, za->flags, error); in _zip_read_cdir()
318 if (comment_len || (za->open_flags & ZIP_CHECKCONS)) { in _zip_read_cdir()
324 … if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) { in _zip_read_cdir()
357 if (zip_source_seek(za->src, (zip_int64_t)cd->offset, SEEK_SET) < 0) { in _zip_read_cdir()
358 _zip_error_set_from_source(error, za->src); in _zip_read_cdir()
364 if (zip_source_tell(za->src) != (zip_int64_t)cd->offset) { in _zip_read_cdir()
375 …dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, fal… in _zip_read_cdir()
391 if (za->open_flags & ZIP_CHECKCONS) { in _zip_read_cdir()
398 zip_int64_t offset = zip_source_tell(za->src); in _zip_read_cdir()
401 _zip_error_set_from_source(error, za->src); in _zip_read_cdir()
429 _zip_checkcons(zip_t *za, zip_cdir_t *cd, zip_error_t *error) in _zip_checkcons() argument
460 if (zip_source_seek(za->src, (zip_int64_t)cd->entry[i].orig->offset, SEEK_SET) < 0) { in _zip_checkcons()
461 _zip_error_set_from_source(error, za->src); in _zip_checkcons()
465 if (_zip_dirent_read(&temp, za->src, NULL, true, error) == -1) { in _zip_checkcons()
521 zip_t *za; in _zip_allocate_new() local
523 if ((za = _zip_new(error)) == NULL) { in _zip_allocate_new()
527 za->src = src; in _zip_allocate_new()
528 za->open_flags = flags; in _zip_allocate_new()
530 za->flags |= ZIP_AFL_RDONLY; in _zip_allocate_new()
531 za->ch_flags |= ZIP_AFL_RDONLY; in _zip_allocate_new()
533 return za; in _zip_allocate_new()
560 _zip_find_central_dir(zip_t *za, zip_uint64_t len) in _zip_find_central_dir() argument
572 zip_error_set(&za->error, ZIP_ER_NOZIP, 0); in _zip_find_central_dir()
577 if (zip_source_seek(za->src, -(zip_int64_t)buflen, SEEK_END) < 0) { in _zip_find_central_dir()
578 zip_error_t *src_error = zip_source_error(za->src); in _zip_find_central_dir()
581 _zip_error_copy(&za->error, src_error); in _zip_find_central_dir()
585 if ((buf_offset = zip_source_tell(za->src)) < 0) { in _zip_find_central_dir()
586 _zip_error_set_from_source(&za->error, za->src); in _zip_find_central_dir()
590 if ((buffer = _zip_buffer_new_from_source(za->src, buflen, NULL, &za->error)) == NULL) { in _zip_find_central_dir()
605 if ((cdirnew = _zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &error)) != NULL) { in _zip_find_central_dir()
608 best = _zip_checkcons(za, cdir, &error); in _zip_find_central_dir()
611 a = _zip_checkcons(za, cdirnew, &error); in _zip_find_central_dir()
623 if (za->open_flags & ZIP_CHECKCONS) in _zip_find_central_dir()
624 best = _zip_checkcons(za, cdir, &error); in _zip_find_central_dir()
639 _zip_error_copy(&za->error, &error); in _zip_find_central_dir()