1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 02:02:32 +01:00
Files
archived-php-src/ext/zip/php_zip.h
Pierre Joye 945f4cdfc4 - initial unicode support
. entry names will be converted to ascii. zip works with cp437
   when 7zip support will be added, unicode string will be supported
 . path and filenames are now encoded using php_stream_path_param_encode
   if the filename/path is used as entry name, it is converted to ascii
 . the stream (getStream and zip://) needs some tweak. I'm not sure if it
   should return unicode or binary, neither how to change the default. For
   now it returns unicode (seems to be the default :)
comments/suggestions welcome
2006-10-31 14:27:09 +00:00

109 lines
3.3 KiB
C

/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Pierre-Alain Joye <pajoye@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_ZIP_H
#define PHP_ZIP_H
extern zend_module_entry zip_module_entry;
#define phpext_zip_ptr &zip_module_entry
#ifdef PHP_WIN32
#define PHP_ZIP_API __declspec(dllexport)
#else
#define PHP_ZIP_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include "lib/zip.h"
#ifndef ZEND_ENGINE_2_1
# if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0) || PHP_MAJOR_VERSION == 6
# define ZEND_ENGINE_2_1
# endif
#endif
#if PHP_MAJOR_VERSION < 6
#define zend_ascii_hash_find(hash, name, sizeof_name, val) zend_hash_find(hash, name, sizeof_name, val)
#define add_ascii_assoc_long(array, name, val) add_assoc_long(array, name, val)
#define add_ascii_assoc_string(array, name, val, dup) add_assoc_long(array, name, val, dup)
#endif
typedef struct _ze_zip_rsrc {
struct zip *za;
int index_current;
int num_files;
} zip_rsrc;
typedef zip_rsrc * zip_rsrc_ptr;
typedef struct _ze_zip_read_rsrc {
struct zip_file *zf;
struct zip_stat sb;
} zip_read_rsrc;
#ifdef ZEND_ENGINE_2_1
#define ZIPARCHIVE_ME(name, arg_info, flags) ZEND_FENTRY(name, c_ziparchive_ ##name, arg_info, flags)
#define ZIPARCHIVE_METHOD(name) ZEND_NAMED_FUNCTION(c_ziparchive_##name)
/* Extends zend object */
typedef struct _ze_zip_object {
zend_object zo;
struct zip *za;
int buffers_cnt;
char **buffers;
HashTable *prop_handler;
char *filename;
int filename_len;
} ze_zip_object;
zend_class_entry *zip_class_entry_ce;
php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_DC TSRMLS_DC);
extern php_stream_wrapper php_stream_zip_wrapper;
#endif
PHP_FUNCTION(zip_open);
PHP_FUNCTION(zip_read);
PHP_FUNCTION(zip_close);
PHP_FUNCTION(zip_entry_read);
PHP_FUNCTION(zip_entry_filesize);
PHP_FUNCTION(zip_entry_name);
PHP_FUNCTION(zip_entry_compressedsize);
PHP_FUNCTION(zip_entry_compressionmethod);
PHP_FUNCTION(zip_entry_open);
PHP_FUNCTION(zip_entry_close);
#endif /* PHP_ZIP_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/