Lines Matching refs:za

70 zip_close(struct zip *za)  in zip_close()  argument
86 if (za == NULL) in zip_close()
89 changed = _zip_changed(za, &survivors); in zip_close()
93 if (za->zn && ((za->open_flags & ZIP_TRUNCATE) || (changed && za->zp))) { in zip_close()
94 if (remove(za->zn) != 0) { in zip_close()
95 _zip_error_set(&za->error, ZIP_ER_REMOVE, errno); in zip_close()
99 zip_discard(za); in zip_close()
104 zip_discard(za); in zip_close()
108 if (survivors > za->nentry) { in zip_close()
109 _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in zip_close()
117 if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) { in zip_close()
119 if (zip_set_archive_comment(za, TORRENT_SIG "XXXXXXXX", TORRENT_SIG_LEN + TORRENT_CRC_LEN) < 0) { in zip_close()
128 for (i=j=0; i<za->nentry; i++) { in zip_close()
129 if (za->entry[i].deleted) in zip_close()
134 _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in zip_close()
139 filelist[j].name = zip_get_name(za, i, 0); in zip_close()
144 _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in zip_close()
149 if ((temp=_zip_create_temp_output(za, &out)) == NULL) { in zip_close()
155 if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) in zip_close()
159 new_torrentzip = (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 1 in zip_close()
160 && zip_get_archive_flag(za, ZIP_AFL_TORRENT, in zip_close()
169 entry = za->entry+i; in zip_close()
176 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_close()
183 if (_zip_read_local_ef(za, i) < 0) { in zip_close()
188 if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) in zip_close()
199 if ((zs=_zip_source_zip_new(za, za, i, ZIP_FL_UNCHANGED, 0, 0, NULL)) == NULL) { in zip_close()
206 if (add_data(za, zs ? zs : entry->source, de, out) < 0) { in zip_close()
220 if (_zip_dirent_write(de, out, ZIP_FL_LOCAL, &za->error) < 0) { in zip_close()
224 if ((offset=_zip_file_get_offset(za, i, &za->error)) == 0) { in zip_close()
228 if ((fseeko(za->zp, (off_t)offset, SEEK_SET) < 0)) { in zip_close()
229 _zip_error_set(&za->error, ZIP_ER_SEEK, errno); in zip_close()
233 if (copy_data(za->zp, de->comp_size, out, &za->error) < 0) { in zip_close()
241 if (write_cdir(za, filelist, survivors, out) < 0) in zip_close()
255 _zip_error_set(&za->error, ZIP_ER_CLOSE, errno); in zip_close()
261 if (za->zp) { in zip_close()
262 fclose(za->zp); in zip_close()
263 za->zp = NULL; in zip_close()
266 if (_zip_rename(temp, za->zn) != 0) { in zip_close()
267 _zip_error_set(&za->error, ZIP_ER_RENAME, errno); in zip_close()
272 za->zp = fopen(za->zn, "rb"); in zip_close()
279 chmod(za->zn, 0666&~mask); in zip_close()
282 zip_discard(za); in zip_close()
291 add_data(struct zip *za, struct zip_source *src, struct zip_dirent *de, FILE *ft) in add_data() argument
301 _zip_error_set_from_source(&za->error, src); in add_data()
343 if ((is_zip64=_zip_dirent_write(de, ft, flags, &za->error)) < 0) in add_data()
353 _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); in add_data()
356 if ((s_store=comp_impl(za, src, st.comp_method, ZIP_CODEC_DECODE)) == NULL) { in add_data()
364 if ((s_crc=zip_source_crc(za, s_store, 0)) == NULL) { in add_data()
373 _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); in add_data()
379 if ((s2=comp_impl(za, s_crc, de->comp_method, ZIP_CODEC_ENCODE)) == NULL) { in add_data()
394 ret = copy_source(za, s2, ft); in add_data()
413 _zip_error_set(&za->error, ZIP_ER_SEEK, errno); in add_data()
418 _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in add_data()
431 if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) in add_data()
434 if ((ret=_zip_dirent_write(de, ft, flags, &za->error)) < 0) in add_data()
439 _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in add_data()
445 _zip_error_set(&za->error, ZIP_ER_SEEK, errno); in add_data()
490 copy_source(struct zip *za, struct zip_source *src, FILE *ft) in copy_source() argument
497 _zip_error_set_from_source(&za->error, src); in copy_source()
504 _zip_error_set(&za->error, ZIP_ER_WRITE, errno); in copy_source()
512 _zip_error_set_from_source(&za->error, src); in copy_source()
524 write_cdir(struct zip *za, const struct zip_filelist *filelist, zip_uint64_t survivors, FILE *out) in write_cdir() argument
533 if ((size=_zip_cdir_write(za, filelist, survivors, out)) < 0) in write_cdir()
538 if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0) == 0) in write_cdir()
544 if (_zip_filerange_crc(out, cd_start, size, &crc, &za->error) < 0) in write_cdir()
550 _zip_error_set(&za->error, ZIP_ER_SEEK, errno); in write_cdir()
555 _zip_error_set(&za->error, ZIP_ER_WRITE, errno); in write_cdir()
565 _zip_changed(const struct zip *za, zip_uint64_t *survivorsp) in _zip_changed() argument
573 if (za->comment_changed || za->ch_flags != za->flags) in _zip_changed()
576 for (i=0; i<za->nentry; i++) { in _zip_changed()
577 …if (za->entry[i].deleted || za->entry[i].source || (za->entry[i].changes && za->entry[i].changes->… in _zip_changed()
579 if (!za->entry[i].deleted) in _zip_changed()
592 _zip_create_temp_output(struct zip *za, FILE **outp) in _zip_create_temp_output() argument
598 if (za->tempdir) { in _zip_create_temp_output()
599 if ((temp=(char *)malloc(strlen(za->tempdir)+13)) == NULL) { in _zip_create_temp_output()
600 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_create_temp_output()
603 sprintf(temp, "%s/.zip.XXXXXX", za->tempdir); in _zip_create_temp_output()
606 if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) { in _zip_create_temp_output()
607 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_create_temp_output()
610 sprintf(temp, "%s.XXXXXX", za->zn); in _zip_create_temp_output()
614 _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); in _zip_create_temp_output()
620 _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno); in _zip_create_temp_output()