/PHP-5.5/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() 60 za->cdir = NULL; in _zip_new() 63 za->nentry = za->nentry_alloc = 0; in _zip_new() 64 za->entry = NULL; in _zip_new() 65 za->nfile = za->nfile_alloc = 0; in _zip_new() 66 za->file = NULL; in _zip_new() 67 za->flags = za->ch_flags = 0; in _zip_new() [all …]
|
H A D | zip_free.c | 47 _zip_free(struct zip *za) in _zip_free() argument 51 if (za == NULL) in _zip_free() 54 if (za->zn) in _zip_free() 55 free(za->zn); in _zip_free() 57 if (za->zp) in _zip_free() 58 fclose(za->zp); in _zip_free() 64 if (za->entry) { in _zip_free() 68 free(za->entry); in _zip_free() 74 za->file[i]->za = NULL; in _zip_free() 78 free(za->file); in _zip_free() [all …]
|
H A D | zip_fopen_index_encrypted.c | 57 if (fileno >= za->nentry) { in zip_fopen_index_encrypted() 112 if ((src=_zip_source_file_or_p(za, NULL, za->zp, start, st.comp_size, in zip_fopen_index_encrypted() 125 if ((s2=comp_impl(za, src, za->cdir->entry[fileno].comp_method, in zip_fopen_index_encrypted() 150 zf = _zip_file_new(za); in zip_fopen_index_encrypted() 160 _zip_file_new(struct zip *za) in _zip_file_new() argument 170 if (za->nfile >= za->nfile_alloc-1) { in _zip_file_new() 171 n = za->nfile_alloc + 10; in _zip_file_new() 179 za->nfile_alloc = n; in _zip_file_new() 180 za->file = file; in _zip_file_new() 183 za->file[za->nfile++] = zf; in _zip_file_new() [all …]
|
H A D | zip_close.c | 88 if (za == NULL) in zip_close() 92 _zip_free(za); in zip_close() 98 if (za->zn && za->zp) { in zip_close() 104 _zip_free(za); in zip_close() 124 &za->error); in zip_close() 196 if ((NULL == za->zp) || (fseeko(za->zp, za->cdir->entry[i].offset, SEEK_SET) != 0)) { in zip_close() 257 if ((zs=zip_source_zip(za, za, i, ZIP_FL_RECOMPRESS, 0, -1)) in zip_close() 322 fclose(za->zp); in zip_close() 323 za->zp = NULL; in zip_close() 332 za->zp = fopen(za->zn, "rb"); in zip_close() [all …]
|
H A D | zip_unchange.c | 45 return _zip_unchange(za, idx, 0); in zip_unchange() 55 if (idx >= za->nentry) { in _zip_unchange() 60 if (za->entry[idx].ch_filename) { in _zip_unchange() 62 i = _zip_name_locate(za, in _zip_unchange() 71 free(za->entry[idx].ch_filename); in _zip_unchange() 72 za->entry[idx].ch_filename = NULL; in _zip_unchange() 75 free(za->entry[idx].ch_extra); in _zip_unchange() 76 za->entry[idx].ch_extra = NULL; in _zip_unchange() 77 za->entry[idx].ch_extra_len = -1; in _zip_unchange() 78 free(za->entry[idx].ch_comment); in _zip_unchange() [all …]
|
H A D | zip_replace.c | 43 if (idx >= za->nentry || source == NULL) { in zip_replace() 44 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_replace() 48 if (_zip_replace(za, idx, NULL, source) == -1) in zip_replace() 63 if (ZIP_IS_RDONLY(za)) { in _zip_replace() 64 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in _zip_replace() 69 if (_zip_entry_new(za) == NULL) in _zip_replace() 72 idx = za->nentry - 1; in _zip_replace() 75 _zip_unchange_data(za->entry+idx); in _zip_replace() 77 if (name && _zip_set_name(za, idx, name) != 0) in _zip_replace() 80 za->entry[idx].state = ((za->cdir == NULL || idx >= za->cdir->nentry) in _zip_replace() [all …]
|
H A D | zip_entry_new.c | 43 _zip_entry_new(struct zip *za) in _zip_entry_new() argument 46 if (!za) { in _zip_entry_new() 53 if (za->nentry+1 >= za->nentry_alloc) { in _zip_entry_new() 55 za->nentry_alloc += 16; in _zip_entry_new() 56 rentries = (struct zip_entry *)realloc(za->entry, in _zip_entry_new() 58 * za->nentry_alloc); in _zip_entry_new() 60 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_entry_new() 63 za->entry = rentries; in _zip_entry_new() 65 ze = za->entry+za->nentry; in _zip_entry_new() 77 if (za) in _zip_entry_new() [all …]
|
H A D | zip_stat_index.c | 46 if (index >= za->nentry) { in zip_stat_index() 47 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_stat_index() 51 if ((name=zip_get_name(za, index, flags)) == NULL) in zip_stat_index() 56 && ZIP_ENTRY_DATA_CHANGED(za->entry+index)) { in zip_stat_index() 58 _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); in zip_stat_index() 63 if (za->cdir == NULL || index >= za->cdir->nentry) { in zip_stat_index() 64 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_stat_index() 70 st->crc = za->cdir->entry[index].crc; in zip_stat_index() 71 st->size = za->cdir->entry[index].uncomp_size; in zip_stat_index() 72 st->mtime = za->cdir->entry[index].last_mod; in zip_stat_index() [all …]
|
H A D | zip_set_archive_flag.c | 41 zip_set_archive_flag(struct zip *za, int 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_get_name.c | 41 zip_get_name(struct zip *za, zip_uint64_t idx, int flags) in zip_get_name() argument 43 return _zip_get_name(za, idx, flags, &za->error); in zip_get_name() 49 _zip_get_name(struct zip *za, zip_uint64_t idx, int flags, in _zip_get_name() argument 52 if (idx >= za->nentry) { in _zip_get_name() 58 if (za->entry[idx].state == ZIP_ST_DELETED) { in _zip_get_name() 62 if (za->entry[idx].ch_filename) in _zip_get_name() 63 return za->entry[idx].ch_filename; in _zip_get_name() 66 if (za->cdir == NULL || idx >= za->cdir->nentry) { in _zip_get_name() 71 return za->cdir->entry[idx].filename; in _zip_get_name()
|
H A D | zip_set_name.c | 44 _zip_set_name(struct zip *za, zip_uint64_t idx, const char *name) in _zip_set_name() argument 49 if (idx >= za->nentry || name == NULL) { in _zip_set_name() 50 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in _zip_set_name() 54 if ((i=_zip_name_locate(za, name, 0, NULL)) != -1 && i != idx) { in _zip_set_name() 55 _zip_error_set(&za->error, ZIP_ER_EXISTS, 0); in _zip_set_name() 64 _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); in _zip_set_name() 68 if (za->entry[idx].state == ZIP_ST_UNCHANGED) in _zip_set_name() 69 za->entry[idx].state = ZIP_ST_RENAMED; in _zip_set_name() 71 free(za->entry[idx].ch_filename); in _zip_set_name() 72 za->entry[idx].ch_filename = s; in _zip_set_name()
|
H A D | zip_set_file_comment.c | 43 zip_set_file_comment(struct zip *za, zip_uint64_t idx, in zip_set_file_comment() argument 48 if (idx >= za->nentry in zip_set_file_comment() 51 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_file_comment() 55 if (ZIP_IS_RDONLY(za)) { in zip_set_file_comment() 56 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_file_comment() 61 if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) in zip_set_file_comment() 67 free(za->entry[idx].ch_comment); in zip_set_file_comment() 68 za->entry[idx].ch_comment = tmpcom; in zip_set_file_comment() 69 za->entry[idx].ch_comment_len = len; in zip_set_file_comment()
|
H A D | zip_set_file_extra.c | 43 zip_set_file_extra(struct zip *za, zip_uint64_t idx, in zip_set_file_extra() argument 48 if (idx >= za->nentry in zip_set_file_extra() 51 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_file_extra() 55 if (ZIP_IS_RDONLY(za)) { in zip_set_file_extra() 56 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_file_extra() 61 if ((tmpext=(char *)_zip_memdup(extra, len, &za->error)) == NULL) in zip_set_file_extra() 67 free(za->entry[idx].ch_extra); in zip_set_file_extra() 68 za->entry[idx].ch_extra = tmpext; in zip_set_file_extra() 69 za->entry[idx].ch_extra_len = len; in zip_set_file_extra()
|
H A D | zip_set_archive_comment.c | 43 zip_set_archive_comment(struct zip *za, const char *comment, int len) in zip_set_archive_comment() argument 49 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_set_archive_comment() 53 if (ZIP_IS_RDONLY(za)) { in zip_set_archive_comment() 54 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_set_archive_comment() 59 if ((tmpcom=(char *)_zip_memdup(comment, len, &za->error)) == NULL) in zip_set_archive_comment() 65 free(za->ch_comment); in zip_set_archive_comment() 66 za->ch_comment = tmpcom; in zip_set_archive_comment() 67 za->ch_comment_len = len; in zip_set_archive_comment()
|
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].state = ZIP_ST_DELETED; in zip_delete()
|
H A D | zip_get_file_comment.c | 41 zip_get_file_comment(struct zip *za, zip_uint64_t idx, int *lenp, int flags) in zip_get_file_comment() argument 43 if (idx >= za->nentry) { in zip_get_file_comment() 44 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_get_file_comment() 49 || (za->entry[idx].ch_comment_len == -1)) { in zip_get_file_comment() 51 *lenp = za->cdir->entry[idx].comment_len; in zip_get_file_comment() 52 return za->cdir->entry[idx].comment; in zip_get_file_comment() 56 *lenp = za->entry[idx].ch_comment_len; in zip_get_file_comment() 57 return za->entry[idx].ch_comment; in zip_get_file_comment()
|
H A D | zip_get_file_extra.c | 41 zip_get_file_extra(struct zip *za, zip_uint64_t idx, int *lenp, int flags) in zip_get_file_extra() argument 43 if (idx >= za->nentry) { in zip_get_file_extra() 44 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_get_file_extra() 49 || (za->entry[idx].ch_extra_len == -1)) { in zip_get_file_extra() 51 *lenp = za->cdir->entry[idx].extrafield_len; in zip_get_file_extra() 52 return za->cdir->entry[idx].extrafield; in zip_get_file_extra() 56 *lenp = za->entry[idx].ch_extra_len; in zip_get_file_extra() 57 return za->entry[idx].ch_extra; in zip_get_file_extra()
|
H A D | zip_rename.c | 43 zip_rename(struct zip *za, zip_uint64_t idx, const char *name) in zip_rename() argument 48 if (idx >= za->nentry || name[0] == '\0') { in zip_rename() 49 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_rename() 53 if (ZIP_IS_RDONLY(za)) { in zip_rename() 54 _zip_error_set(&za->error, ZIP_ER_RDONLY, 0); in zip_rename() 58 if ((old_name=zip_get_name(za, idx, 0)) == NULL) in zip_rename() 65 _zip_error_set(&za->error, ZIP_ER_INVAL, 0); in zip_rename() 69 return _zip_set_name(za, idx, name); in zip_rename()
|
H A D | zip_name_locate.c | 43 zip_name_locate(struct zip *za, const char *fname, int flags) in zip_name_locate() argument 45 return _zip_name_locate(za, fname, flags, &za->error); in zip_name_locate() 51 _zip_name_locate(struct zip *za, const char *fname, int flags, in _zip_name_locate() argument 58 if (za == NULL) in _zip_name_locate() 66 if ((flags & ZIP_FL_UNCHANGED) && za->cdir == NULL) { in _zip_name_locate() 73 n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry; in _zip_name_locate() 76 fn = za->cdir->entry[i].filename; in _zip_name_locate() 78 fn = _zip_get_name(za, i, flags, error); in _zip_name_locate()
|
H A D | zip_get_archive_comment.c | 41 zip_get_archive_comment(struct zip *za, int *lenp, int flags) in zip_get_archive_comment() argument 44 || (za->ch_comment_len == -1)) { in zip_get_archive_comment() 45 if (za->cdir) { in zip_get_archive_comment() 47 *lenp = za->cdir->comment_len; in zip_get_archive_comment() 48 return za->cdir->comment; in zip_get_archive_comment() 58 *lenp = za->ch_comment_len; in zip_get_archive_comment() 59 return za->ch_comment; in zip_get_archive_comment()
|
H A D | zip_unchange_archive.c | 43 zip_unchange_archive(struct zip *za) in zip_unchange_archive() argument 45 free(za->ch_comment); in zip_unchange_archive() 46 za->ch_comment = NULL; in zip_unchange_archive() 47 za->ch_comment_len = -1; in zip_unchange_archive() 49 za->ch_flags = za->flags; in zip_unchange_archive()
|
H A D | zip_file_get_offset.c | 54 _zip_file_get_offset(struct zip *za, int idx) in _zip_file_get_offset() argument 59 offset = za->cdir->entry[idx].offset; in _zip_file_get_offset() 61 if (fseeko(za->zp, offset, SEEK_SET) != 0) { in _zip_file_get_offset() 62 _zip_error_set(&za->error, ZIP_ER_SEEK, errno); in _zip_file_get_offset() 66 if (_zip_dirent_read(&de, za->zp, NULL, NULL, 1, &za->error) != 0) in _zip_file_get_offset()
|
/PHP-5.5/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.5/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();
|