/PHP-5.6/ext/zip/lib/ |
H A D | zip_new.c | 49 struct zip *za; in _zip_new() local 52 if (!za) { in _zip_new() 57 za->zn = NULL; in _zip_new() 58 za->zp = NULL; in _zip_new() 61 za->flags = za->ch_flags = 0; in _zip_new() 63 za->comment_orig = za->comment_changes = NULL; in _zip_new() 65 za->nentry = za->nentry_alloc = 0; in _zip_new() 66 za->entry = NULL; in _zip_new() 67 za->nfile = za->nfile_alloc = 0; in _zip_new() 68 za->file = NULL; in _zip_new() [all …]
|
H A D | zip_discard.c | 47 zip_discard(struct zip *za) in zip_discard() argument 51 if (za == NULL) in zip_discard() 54 if (za->zn) in zip_discard() 55 free(za->zn); in zip_discard() 57 if (za->zp) in zip_discard() 58 fclose(za->zp); in zip_discard() 64 if (za->entry) { in zip_discard() 67 free(za->entry); in zip_discard() 73 za->file[i]->za = NULL; in zip_discard() 78 free(za->file); in zip_discard() [all …]
|
H A D | zip_file_replace.c | 44 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_replace() 64 if (ZIP_IS_RDONLY(za)) { in _zip_file_replace() 69 za_nentry_prev = za->nentry; in _zip_file_replace() 78 if ((i=_zip_add_entry(za)) < 0) in _zip_file_replace() 85 if (za->nentry != za_nentry_prev) { in _zip_file_replace() 86 _zip_entry_finalize(za->entry+idx); in _zip_file_replace() 87 za->nentry = za_nentry_prev; in _zip_file_replace() 94 _zip_unchange_data(za->entry+idx); in _zip_file_replace() 96 …if (za->entry[idx].orig != NULL && (za->entry[idx].changes == NULL || (za->entry[idx].changes->cha… in _zip_file_replace() 98 if ((za->entry[idx].changes=_zip_dirent_clone(za->entry[idx].orig)) == NULL) { in _zip_file_replace() [all …]
|
H A D | zip_fopen_index_encrypted.c | 53 if ((src=_zip_source_zip_new(za, za, index, flags, 0, 0, password)) == NULL) in zip_fopen_index_encrypted() 57 _zip_error_set_from_source(&za->error, src); in zip_fopen_index_encrypted() 62 if ((zf=_zip_file_new(za)) == NULL) { in zip_fopen_index_encrypted() 75 _zip_file_new(struct zip *za) in _zip_file_new() argument 84 if (za->nfile+1 >= za->nfile_alloc) { in _zip_file_new() 86 n = za->nfile_alloc + 10; in _zip_file_new() 87 file = (struct zip_file **)realloc(za->file, in _zip_file_new() 94 za->nfile_alloc = n; in _zip_file_new() 95 za->file = file; in _zip_file_new() 98 za->file[za->nfile++] = zf; in _zip_file_new() [all …]
|
H A D | zip_close.c | 86 if (za == NULL) in zip_close() 93 if (za->zn && ((za->open_flags & ZIP_TRUNCATE) || (changed && za->zp))) { in zip_close() 99 zip_discard(za); in zip_close() 104 zip_discard(za); in zip_close() 224 if ((offset=_zip_file_get_offset(za, i, &za->error)) == 0) { in zip_close() 261 if (za->zp) { in zip_close() 262 fclose(za->zp); in zip_close() 263 za->zp = NULL; in zip_close() 272 za->zp = fopen(za->zn, "rb"); in zip_close() 573 if (za->comment_changed || za->ch_flags != za->flags) in _zip_changed() [all …]
|
H A D | zip_extra_field_api.c | 58 if (ZIP_IS_RDONLY(za)) { in zip_file_extra_field_delete() 66 de = za->entry[idx].changes; in zip_file_extra_field_delete() 92 if (ZIP_IS_RDONLY(za)) { in zip_file_extra_field_delete_by_id() 100 de = za->entry[idx].changes; in zip_file_extra_field_delete_by_id() 122 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_field_get() 165 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_field_get_by_id() 189 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_fields_count() 218 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_fields_count_by_id() 251 if (ZIP_IS_RDONLY(za)) { in zip_file_extra_field_set() 344 if (idx >= za->nentry) { in _zip_file_extra_field_prepare_for_change() [all …]
|
H A D | zip_set_archive_comment.c | 47 if (ZIP_IS_RDONLY(za)) { in zip_set_archive_comment() 48 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_archive_comment() 53 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_archive_comment() 63 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_archive_comment() 70 _zip_string_free(za->comment_changes); in zip_set_archive_comment() 71 za->comment_changes = NULL; in zip_set_archive_comment() 73 if (((za->comment_orig && _zip_string_equal(za->comment_orig, cstr)) in zip_set_archive_comment() 74 || (za->comment_orig == NULL && cstr == NULL))) { in zip_set_archive_comment() 76 za->comment_changed = 0; in zip_set_archive_comment() 79 za->comment_changes = cstr; in zip_set_archive_comment() [all …]
|
H A D | zip_unchange.c | 43 zip_unchange(struct zip *za, zip_uint64_t idx) in zip_unchange() argument 45 return _zip_unchange(za, idx, 0); in zip_unchange() 51 _zip_unchange(struct zip *za, zip_uint64_t idx, int allow_duplicates) in _zip_unchange() argument 55 if (idx >= za->nentry) { in _zip_unchange() 56 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_unchange() 60 …if (!allow_duplicates && za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_F… in _zip_unchange() 61 i = _zip_name_locate(za, _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL), 0, NULL); in _zip_unchange() 63 _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); in _zip_unchange() 68 _zip_dirent_free(za->entry[idx].changes); in _zip_unchange() 69 za->entry[idx].changes = NULL; in _zip_unchange() [all …]
|
H A D | zip_set_archive_flag.c | 41 zip_set_archive_flag(struct zip *za, zip_flags_t flag, int value) in zip_set_archive_flag() argument 46 new_flags = za->ch_flags | flag; in zip_set_archive_flag() 48 new_flags = za->ch_flags & ~flag; in zip_set_archive_flag() 50 if (new_flags == za->ch_flags) in zip_set_archive_flag() 53 if (ZIP_IS_RDONLY(za)) { in zip_set_archive_flag() 54 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_archive_flag() 59 && (za->ch_flags & ZIP_AFL_RDONLY) == 0) { in zip_set_archive_flag() 60 if (_zip_changed(za, NULL)) { in zip_set_archive_flag() 61 _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); in zip_set_archive_flag() 66 za->ch_flags = new_flags; in zip_set_archive_flag()
|
H A D | zip_add_entry.c | 45 _zip_add_entry(struct zip *za) in _zip_add_entry() argument 49 if (za->nentry+1 >= za->nentry_alloc) { in _zip_add_entry() 51 zip_uint64_t nalloc = za->nentry_alloc + 16; in _zip_add_entry() 53 rentries = (struct zip_entry *)realloc(za->entry, sizeof(struct zip_entry) * (size_t)nalloc); in _zip_add_entry() 55 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_add_entry() 58 za->entry = rentries; in _zip_add_entry() 59 za->nentry_alloc = nalloc; in _zip_add_entry() 62 idx = za->nentry++; in _zip_add_entry() 64 _zip_entry_init(za->entry+idx); in _zip_add_entry()
|
H A D | zip_unchange_archive.c | 43 zip_unchange_archive(struct zip *za) in zip_unchange_archive() argument 45 if (za->comment_changed) { in zip_unchange_archive() 46 _zip_string_free(za->comment_changes); in zip_unchange_archive() 47 za->comment_changes = NULL; in zip_unchange_archive() 48 za->comment_changed = 0; in zip_unchange_archive() 51 za->ch_flags = za->flags; in zip_unchange_archive()
|
H A D | zip_set_default_password.c | 44 zip_set_default_password(struct zip *za, const char *passwd) in zip_set_default_password() argument 46 if (za == NULL) in zip_set_default_password() 49 if (za->default_password) in zip_set_default_password() 50 free(za->default_password); in zip_set_default_password() 53 if ((za->default_password=strdup(passwd)) == NULL) { in zip_set_default_password() 54 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_set_default_password() 59 za->default_password = NULL; in zip_set_default_password()
|
H A D | zip_delete.c | 41 zip_delete(struct zip *za, zip_uint64_t idx) in zip_delete() argument 43 if (idx >= za->nentry) { in zip_delete() 44 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_delete() 48 if (ZIP_IS_RDONLY(za)) { in zip_delete() 49 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_delete() 55 if (_zip_unchange(za, idx, 1) != 0) in zip_delete() 58 za->entry[idx].deleted = 1; in zip_delete()
|
H A D | zip_file_rename.c | 43 zip_file_rename(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t flags) in zip_file_rename() argument 48 if (idx >= za->nentry || (name != NULL && strlen(name) > ZIP_UINT16_MAX)) { in zip_file_rename() 49 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_rename() 53 if (ZIP_IS_RDONLY(za)) { in zip_file_rename() 54 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_file_rename() 58 if ((old_name=zip_get_name(za, idx, 0)) == NULL) in zip_file_rename() 65 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_rename() 69 return _zip_set_name(za, idx, name, flags); in zip_file_rename()
|
H A D | zip_dir_add.c | 46 zip_dir_add(struct zip *za, const char *name, zip_flags_t flags) in zip_dir_add() argument 53 if (ZIP_IS_RDONLY(za)) { in zip_dir_add() 54 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_dir_add() 59 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_dir_add() 68 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_dir_add() 76 if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) { in zip_dir_add() 81 idx = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); in zip_dir_add() 88 …if (zip_file_set_external_attributes(za, (zip_uint64_t)idx, 0, ZIP_OPSYS_DEFAULT, ZIP_EXT_ATTRIB_D… in zip_dir_add() 89 zip_delete(za, (zip_uint64_t)idx); in zip_dir_add()
|
H A D | zip_source_zip_new.c | 52 if (za == NULL) in _zip_source_zip_new() 56 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_source_zip_new() 62 _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); in _zip_source_zip_new() 67 _zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in _zip_source_zip_new() 75 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_source_zip_new() 81 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_source_zip_new() 88 _zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0); in _zip_source_zip_new() 92 _zip_error_set(&za->error, ZIP_ER_ENCRNOTSUPP, 0); in _zip_source_zip_new() 101 _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); in _zip_source_zip_new() 111 if ((src=zip_source_buffer(za, NULL, 0, 0)) == NULL) in _zip_source_zip_new() [all …]
|
H A D | zip_fclose.c | 51 if (zf->za) { in zip_fclose() 52 for (i=0; i<zf->za->nfile; i++) { in zip_fclose() 53 if (zf->za->file[i] == zf) { in zip_fclose() 54 zf->za->file[i] = zf->za->file[zf->za->nfile-1]; in zip_fclose() 55 zf->za->nfile--; in zip_fclose()
|
H A D | zip_set_file_compression.c | 41 zip_set_file_compression(struct zip *za, zip_uint64_t idx, in zip_set_file_compression() argument 47 if (idx >= za->nentry) { in zip_set_file_compression() 48 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_file_compression() 52 if (ZIP_IS_RDONLY(za)) { in zip_set_file_compression() 53 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_file_compression() 58 _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); in zip_set_file_compression() 62 e = za->entry+idx; in zip_set_file_compression() 80 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_set_file_compression()
|
H A D | zip_set_name.c | 44 _zip_set_name(struct zip *za, zip_uint64_t idx, const char *name, zip_flags_t flags) in _zip_set_name() argument 51 if (idx >= za->nentry) { in _zip_set_name() 52 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_set_name() 56 if (ZIP_IS_RDONLY(za)) { in _zip_set_name() 57 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in _zip_set_name() 63 …if ((str=_zip_string_new((const zip_uint8_t *)name, (zip_uint16_t)strlen(name), flags, &za->error)… in _zip_set_name() 72 if ((i=_zip_name_locate(za, name, 0, NULL)) >= 0 && (zip_uint64_t)i != idx) { in _zip_set_name() 74 _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); in _zip_set_name() 84 e = za->entry+idx; in _zip_set_name() 100 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_set_name()
|
H A D | zip_name_locate.c | 46 zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags) in zip_name_locate() argument 48 return _zip_name_locate(za, fname, flags, &za->error); in zip_name_locate() 54 _zip_name_locate(struct zip *za, const char *fname, zip_flags_t flags, struct zip_error *error) in _zip_name_locate() argument 60 if (za == NULL) in _zip_name_locate() 70 for (i=0; i<za->nentry; i++) { in _zip_name_locate() 71 fn = _zip_get_name(za, i, flags, error); in _zip_name_locate()
|
H A D | zip_get_num_entries.c | 41 zip_get_num_entries(struct zip *za, zip_flags_t flags) in zip_get_num_entries() argument 45 if (za == NULL) in zip_get_num_entries() 49 n = za->nentry; in zip_get_num_entries() 50 while (n>0 && za->entry[n-1].orig == NULL) in zip_get_num_entries() 54 return (zip_int64_t)za->nentry; in zip_get_num_entries()
|
H A D | zip_file_set_comment.c | 43 zip_file_set_comment(struct zip *za, zip_uint64_t idx, in zip_file_set_comment() argument 50 if (_zip_get_dirent(za, idx, 0, NULL) == NULL) in zip_file_set_comment() 53 if (ZIP_IS_RDONLY(za)) { in zip_file_set_comment() 54 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_file_set_comment() 59 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_set_comment() 64 if ((cstr=_zip_string_new((const zip_uint8_t *)comment, len, flags, &za->error)) == NULL) in zip_file_set_comment() 72 e = za->entry+idx; in zip_file_set_comment() 88 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_file_set_comment()
|
H A D | zip_get_archive_comment.c | 43 zip_get_archive_comment(struct zip *za, int *lenp, zip_flags_t flags) in zip_get_archive_comment() argument 49 if ((flags & ZIP_FL_UNCHANGED) || (za->comment_changes == NULL)) in zip_get_archive_comment() 50 comment = za->comment_orig; in zip_get_archive_comment() 52 comment = za->comment_changes; in zip_get_archive_comment() 54 if ((str=_zip_string_get(comment, &len, flags, &za->error)) == NULL) in zip_get_archive_comment()
|
/PHP-5.6/ext/zip/examples/ |
H A D | dir.php | 6 $za = new ZipArchive(); variable 8 $za->open('test_with_comment.zip'); 9 print_r($za); 10 var_dump($za); 11 echo "numFiles: " . $za->numFiles . "\n"; 12 echo "status: " . $za->status . "\n"; 14 echo "filename: " . $za->filename . "\n"; 15 echo "comment: " . $za->comment . "\n"; 17 for ($i=0; $i<$za->numFiles;$i++) { 19 print_r($za->statIndex($i)); [all …]
|
/PHP-5.6/ext/zip/tests/ |
H A D | bug14962.phpt | 14 $za = new ZipArchive; 15 $za->open($dir . '/__14962.zip', ZIPARCHIVE::CREATE); 16 $za->addFromString($file, '1234'); 17 $za->close(); 22 $za = new ZipArchive; 23 $za->open($dir . '/__14962.zip'); 24 $za->extractTo($dir, NULL); 25 $za->close();
|