/PHP-7.1/ext/zip/lib/ |
H A D | zip_new.c | 47 zip_t *za; in _zip_new() local 50 if (!za) { in _zip_new() 56 free(za); in _zip_new() 60 za->src = NULL; in _zip_new() 61 za->open_flags = 0; in _zip_new() 63 za->flags = za->ch_flags = 0; in _zip_new() 65 za->comment_orig = za->comment_changes = NULL; in _zip_new() 67 za->nentry = za->nentry_alloc = 0; in _zip_new() 68 za->entry = NULL; in _zip_new() 69 za->nopen_source = za->nopen_source_alloc = 0; in _zip_new() [all …]
|
H A D | zip_discard.c | 45 zip_discard(zip_t *za) in zip_discard() argument 49 if (za == NULL) in zip_discard() 52 if (za->src) { in zip_discard() 53 zip_source_close(za->src); in zip_discard() 54 zip_source_free(za->src); in zip_discard() 61 _zip_hash_free(za->names); in zip_discard() 63 if (za->entry) { in zip_discard() 64 for (i=0; i<za->nentry; i++) in zip_discard() 66 free(za->entry); in zip_discard() 72 free(za->open_source); in zip_discard() [all …]
|
H A D | zip_unchange.c | 41 zip_unchange(zip_t *za, zip_uint64_t idx) in zip_unchange() argument 43 return _zip_unchange(za, idx, 0); in zip_unchange() 53 if (idx >= za->nentry) { in _zip_unchange() 58 …if (!allow_duplicates && za->entry[idx].changes && (za->entry[idx].changes->changed & ZIP_DIRENT_F… in _zip_unchange() 59 if (za->entry[idx].orig != NULL) { in _zip_unchange() 60 if ((orig_name=_zip_get_name(za, idx, ZIP_FL_UNCHANGED, &za->error)) == NULL) { in _zip_unchange() 74 if ((changed_name=_zip_get_name(za, idx, 0, &za->error)) == NULL) { in _zip_unchange() 79 if (_zip_hash_add(za->names, (const zip_uint8_t *)orig_name, idx, 0, &za->error) == false) { in _zip_unchange() 83 if (_zip_hash_delete(za->names, (const zip_uint8_t *)changed_name, &za->error) == false) { in _zip_unchange() 90 za->entry[idx].changes = NULL; in _zip_unchange() [all …]
|
H A D | zip_file_replace.c | 42 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_replace() 61 if (ZIP_IS_RDONLY(za)) { in _zip_file_replace() 66 za_nentry_prev = za->nentry; in _zip_file_replace() 75 if ((i=_zip_add_entry(za)) < 0) in _zip_file_replace() 82 if (za->nentry != za_nentry_prev) { in _zip_file_replace() 83 _zip_entry_finalize(za->entry+idx); in _zip_file_replace() 84 za->nentry = za_nentry_prev; in _zip_file_replace() 91 _zip_unchange_data(za->entry+idx); in _zip_file_replace() 93 …if (za->entry[idx].orig != NULL && (za->entry[idx].changes == NULL || (za->entry[idx].changes->cha… in _zip_file_replace() 95 if ((za->entry[idx].changes=_zip_dirent_clone(za->entry[idx].orig)) == NULL) { in _zip_file_replace() [all …]
|
H A D | zip_close.c | 81 _zip_error_set_from_source(&za->error, za->src); in zip_close() 85 zip_discard(za); in zip_close() 90 zip_discard(za); in zip_close() 123 _zip_error_set_from_source(&za->error, za->src); in zip_close() 195 _zip_error_set_from_source(&za->error, za->src); in zip_close() 215 _zip_error_set_from_source(&za->error, za->src); in zip_close() 355 _zip_error_set_from_source(&za->error, za->src); in add_data() 386 _zip_error_set_from_source(&za->error, za->src); in add_data() 402 if (_zip_read(za->src, buf, n, &za->error) < 0) { in copy_data() 478 if (za->comment_changed || za->ch_flags != za->flags) in _zip_changed() [all …]
|
H A D | zip_extra_field_api.c | 56 if (ZIP_IS_RDONLY(za)) { in zip_file_extra_field_delete() 64 de = za->entry[idx].changes; in zip_file_extra_field_delete() 89 if (ZIP_IS_RDONLY(za)) { in zip_file_extra_field_delete_by_id() 97 de = za->entry[idx].changes; in zip_file_extra_field_delete_by_id() 118 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_field_get() 160 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_field_get_by_id() 183 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_fields_count() 211 if ((de=_zip_get_dirent(za, idx, flags, &za->error)) == NULL) in zip_file_extra_fields_count_by_id() 243 if (ZIP_IS_RDONLY(za)) { in zip_file_extra_field_set() 336 if (idx >= za->nentry) { in _zip_file_extra_field_prepare_for_change() [all …]
|
H A D | zip_set_archive_comment.c | 45 if (ZIP_IS_RDONLY(za)) { in zip_set_archive_comment() 46 zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_archive_comment() 51 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_archive_comment() 61 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_archive_comment() 68 _zip_string_free(za->comment_changes); in zip_set_archive_comment() 69 za->comment_changes = NULL; in zip_set_archive_comment() 71 if (((za->comment_orig && _zip_string_equal(za->comment_orig, cstr)) in zip_set_archive_comment() 72 || (za->comment_orig == NULL && cstr == NULL))) { in zip_set_archive_comment() 74 za->comment_changed = 0; in zip_set_archive_comment() 77 za->comment_changes = cstr; in zip_set_archive_comment() [all …]
|
H A D | zip_delete.c | 39 zip_delete(zip_t *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() 53 if ((name=_zip_get_name(za, idx, 0, &za->error)) == NULL) { in zip_delete() 57 if (!_zip_hash_delete(za->names, (const zip_uint8_t *)name, &za->error)) { in zip_delete() 63 if (_zip_unchange(za, idx, 1) != 0) in zip_delete() 66 za->entry[idx].deleted = 1; in zip_delete()
|
H A D | zip_add_entry.c | 43 _zip_add_entry(zip_t *za) in _zip_add_entry() argument 47 if (za->nentry+1 >= za->nentry_alloc) { in _zip_add_entry() 49 zip_uint64_t nalloc = za->nentry_alloc; in _zip_add_entry() 63 if (sizeof(struct zip_entry) * (size_t)za->nentry_alloc > realloc_size) { in _zip_add_entry() 64 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_add_entry() 67 rentries = (zip_entry_t *)realloc(za->entry, sizeof(struct zip_entry) * (size_t)nalloc); in _zip_add_entry() 69 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_add_entry() 72 za->entry = rentries; in _zip_add_entry() 73 za->nentry_alloc = nalloc; in _zip_add_entry() 76 idx = za->nentry++; in _zip_add_entry() [all …]
|
H A D | zip_set_archive_flag.c | 39 zip_set_archive_flag(zip_t *za, zip_flags_t flag, int value) in zip_set_archive_flag() argument 44 new_flags = za->ch_flags | flag; in zip_set_archive_flag() 46 new_flags = za->ch_flags & ~flag; in zip_set_archive_flag() 48 if (new_flags == za->ch_flags) in zip_set_archive_flag() 51 if (ZIP_IS_RDONLY(za)) { in zip_set_archive_flag() 52 zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_archive_flag() 57 && (za->ch_flags & ZIP_AFL_RDONLY) == 0) { in zip_set_archive_flag() 58 if (_zip_changed(za, NULL)) { in zip_set_archive_flag() 59 zip_error_set(&za->error, ZIP_ER_CHANGED, 0); in zip_set_archive_flag() 64 za->ch_flags = new_flags; in zip_set_archive_flag()
|
H A D | zip_unchange_archive.c | 41 zip_unchange_archive(zip_t *za) in zip_unchange_archive() argument 43 if (za->comment_changed) { in zip_unchange_archive() 44 _zip_string_free(za->comment_changes); in zip_unchange_archive() 45 za->comment_changes = NULL; in zip_unchange_archive() 46 za->comment_changed = 0; in zip_unchange_archive() 49 za->ch_flags = za->flags; in zip_unchange_archive()
|
H A D | zip_fopen_index_encrypted.c | 40 static zip_file_t *_zip_file_new(zip_t *za); 44 zip_fopen_index_encrypted(zip_t *za, zip_uint64_t index, zip_flags_t flags, in zip_fopen_index_encrypted() argument 50 if ((src=_zip_source_zip_new(za, za, index, flags, 0, 0, password)) == NULL) in zip_fopen_index_encrypted() 54 _zip_error_set_from_source(&za->error, src); in zip_fopen_index_encrypted() 59 if ((zf=_zip_file_new(za)) == NULL) { in zip_fopen_index_encrypted() 71 _zip_file_new(zip_t *za) in _zip_file_new() argument 76 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_file_new() 80 zf->za = za; in _zip_file_new()
|
H A D | zip_file_rename.c | 41 zip_file_rename(zip_t *za, zip_uint64_t idx, const char *name, zip_flags_t flags) in zip_file_rename() argument 46 if (idx >= za->nentry || (name != NULL && strlen(name) > ZIP_UINT16_MAX)) { in zip_file_rename() 47 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_rename() 51 if (ZIP_IS_RDONLY(za)) { in zip_file_rename() 52 zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_file_rename() 56 if ((old_name=zip_get_name(za, idx, 0)) == NULL) in zip_file_rename() 63 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_file_rename() 67 return _zip_set_name(za, idx, name, flags); in zip_file_rename()
|
H A D | zip_open.c | 63 zip_t *za; in zip_open() local 82 return za; in zip_open() 133 zip_t *za; in zip_open_from_source() local 155 return za; in zip_open_from_source() 183 zip_t *za; in _zip_open() local 206 return za; in _zip_open() 248 za->ch_flags = za->flags; in _zip_open() 250 return za; in _zip_open() 521 zip_t *za; in _zip_allocate_new() local 533 return za; in _zip_allocate_new() [all …]
|
H A D | zip_dir_add.c | 44 zip_dir_add(zip_t *za, const char *name, zip_flags_t flags) in zip_dir_add() argument 51 if (ZIP_IS_RDONLY(za)) { in zip_dir_add() 52 zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_dir_add() 57 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_dir_add() 66 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_dir_add() 74 if ((source=zip_source_buffer(za, NULL, 0, 0)) == NULL) { in zip_dir_add() 79 idx = _zip_file_replace(za, ZIP_UINT64_MAX, s ? s : name, source, flags); in zip_dir_add() 86 …if (zip_file_set_external_attributes(za, (zip_uint64_t)idx, 0, ZIP_OPSYS_DEFAULT, ZIP_EXT_ATTRIB_D… in zip_dir_add() 87 zip_delete(za, (zip_uint64_t)idx); in zip_dir_add()
|
H A D | zip_set_name.c | 42 _zip_set_name(zip_t *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() 74 zip_error_set(&za->error, ZIP_ER_EXISTS, 0); in _zip_set_name() 84 e = za->entry+idx; in _zip_set_name() 93 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_set_name() 115 if ((old_name = _zip_string_get(old_str, NULL, 0, &za->error)) == NULL) { in _zip_set_name() 124 if (_zip_hash_add(za->names, new_name, idx, 0, &za->error) == false) { in _zip_set_name() [all …]
|
H A D | zip_source_window.c | 96 src->source_archive = za; in _zip_source_set_source_archive() 97 return _zip_register_source(za, src); in _zip_source_set_source_archive() 223 for (i=0; i<za->nopen_source; i++) { in _zip_deregister_source() 224 if (za->open_source[i] == src) { in _zip_deregister_source() 225 za->open_source[i] = za->open_source[za->nopen_source-1]; in _zip_deregister_source() 226 za->nopen_source--; in _zip_deregister_source() 238 if (za->nopen_source+1 >= za->nopen_source_alloc) { in _zip_register_source() 240 n = za->nopen_source_alloc + 10; in _zip_register_source() 246 za->nopen_source_alloc = n; in _zip_register_source() 247 za->open_source = open_source; in _zip_register_source() [all …]
|
H A D | zip_source_zip_new.c | 49 if (za == NULL) in _zip_source_zip_new() 53 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_source_zip_new() 59 zip_error_set(&za->error, ZIP_ER_CHANGED, 0); in _zip_source_zip_new() 64 zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); in _zip_source_zip_new() 72 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_source_zip_new() 78 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_source_zip_new() 85 zip_error_set(&za->error, ZIP_ER_NOPASSWD, 0); in _zip_source_zip_new() 98 zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); in _zip_source_zip_new() 108 return zip_source_buffer(za, NULL, 0, 0); in _zip_source_zip_new() 146 s2 = comp_impl(za, src, st.comp_method, 0); in _zip_source_zip_new() [all …]
|
H A D | zip_set_default_password.c | 42 zip_set_default_password(zip_t *za, const char *passwd) in zip_set_default_password() argument 44 if (za == NULL) in zip_set_default_password() 47 free(za->default_password); in zip_set_default_password() 50 if ((za->default_password=strdup(passwd)) == NULL) { in zip_set_default_password() 51 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_set_default_password() 56 za->default_password = NULL; in zip_set_default_password()
|
H A D | zip_name_locate.c | 44 zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags) in zip_name_locate() argument 46 return _zip_name_locate(za, fname, flags, &za->error); in zip_name_locate() 51 _zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *error) in _zip_name_locate() argument 57 if (za == NULL) in _zip_name_locate() 69 for (i=0; i<za->nentry; i++) { in _zip_name_locate() 70 fn = _zip_get_name(za, i, flags, error); in _zip_name_locate() 92 return _zip_hash_lookup(za->names, (const zip_uint8_t *)fname, flags, error); in _zip_name_locate()
|
H A D | zip_set_file_compression.c | 39 zip_set_file_compression(zip_t *za, zip_uint64_t idx, zip_int32_t method, zip_uint32_t flags) in zip_set_file_compression() argument 44 if (idx >= za->nentry) { in zip_set_file_compression() 45 zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_file_compression() 49 if (ZIP_IS_RDONLY(za)) { in zip_set_file_compression() 50 zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_file_compression() 55 zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); in zip_set_file_compression() 59 e = za->entry+idx; in zip_set_file_compression() 77 zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in zip_set_file_compression()
|
H A D | zip_get_num_files.c | 41 zip_get_num_files(zip_t *za) in zip_get_num_files() argument 43 if (za == NULL) in zip_get_num_files() 46 if (za->nentry > INT_MAX) { in zip_get_num_files() 47 zip_error_set(&za->error, ZIP_ER_OPNOTSUPP, 0); in zip_get_num_files() 51 return (int)za->nentry; in zip_get_num_files()
|
H A D | zip_unchange_all.c | 41 zip_unchange_all(zip_t *za) in zip_unchange_all() argument 46 _zip_hash_revert(za->names); in zip_unchange_all() 49 for (i=0; i<za->nentry; i++) in zip_unchange_all() 50 ret |= _zip_unchange(za, i, 1); in zip_unchange_all() 52 ret |= zip_unchange_archive(za); in zip_unchange_all()
|
/PHP-7.1/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-7.1/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();
|