diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-05-20 12:05:20 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-05-20 14:22:11 +0200 |
commit | 86d58e9fff3740eeccba67c79d87c05aedced7ac (patch) | |
tree | 809017ee5568cc730d63c73928dfea681a0e5bed /ext/zip/php_zip.c | |
parent | a582931f4255a0a022f06da613558482beeb5451 (diff) | |
download | php-git-86d58e9fff3740eeccba67c79d87c05aedced7ac.tar.gz |
Generate function entries for ext/zip
Closes GH-5601
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 216 |
1 files changed, 59 insertions, 157 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 837c7d383b..f131966c1f 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -30,18 +30,6 @@ #include "php_zip.h" #include "php_zip_arginfo.h" -/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */ -static PHP_NAMED_FUNCTION(zif_zip_open); -static PHP_NAMED_FUNCTION(zif_zip_read); -static PHP_NAMED_FUNCTION(zif_zip_close); -static PHP_NAMED_FUNCTION(zif_zip_entry_read); -static PHP_NAMED_FUNCTION(zif_zip_entry_filesize); -static PHP_NAMED_FUNCTION(zif_zip_entry_name); -static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize); -static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod); -static PHP_NAMED_FUNCTION(zif_zip_entry_open); -static PHP_NAMED_FUNCTION(zif_zip_entry_close); - #ifdef HAVE_GLOB #ifndef PHP_WIN32 #include <glob.h> @@ -800,26 +788,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val } /* }}} */ -/* {{{ zend_function_entry */ -static const zend_function_entry zip_functions[] = { - ZEND_RAW_FENTRY("zip_open", zif_zip_open, arginfo_zip_open, 0) - ZEND_RAW_FENTRY("zip_close", zif_zip_close, arginfo_zip_close, 0) - ZEND_RAW_FENTRY("zip_read", zif_zip_read, arginfo_zip_read, 0) - PHP_FE(zip_entry_open, arginfo_zip_entry_open) - PHP_FE(zip_entry_close, arginfo_zip_entry_close) - PHP_FE(zip_entry_read, arginfo_zip_entry_read) - PHP_FE(zip_entry_filesize, arginfo_zip_entry_filesize) - PHP_FE(zip_entry_name, arginfo_zip_entry_name) - PHP_FE(zip_entry_compressedsize, arginfo_zip_entry_compressedsize) - PHP_FE(zip_entry_compressionmethod, arginfo_zip_entry_compressionmethod) -#ifdef PHP_FE_END - PHP_FE_END -#else - {NULL,NULL,NULL} -#endif -}; -/* }}} */ - /* {{{ ZE2 OO definitions */ static zend_class_entry *zip_class_entry; static zend_object_handlers zip_object_handlers; @@ -1138,7 +1106,7 @@ static PHP_MINFO_FUNCTION(zip); zend_module_entry zip_module_entry = { STANDARD_MODULE_HEADER, "zip", - zip_functions, + ext_functions, PHP_MINIT(zip), PHP_MSHUTDOWN(zip), NULL, @@ -1156,7 +1124,7 @@ ZEND_GET_MODULE(zip) /* {{{ proto resource zip_open(string filename) Create new zip using source uri for output */ -static PHP_NAMED_FUNCTION(zif_zip_open) +PHP_FUNCTION(zip_open) { char resolved_path[MAXPATHLEN + 1]; zip_rsrc *rsrc_int; @@ -1197,7 +1165,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open) /* {{{ proto void zip_close(resource zip) Close a Zip archive */ -static PHP_NAMED_FUNCTION(zif_zip_close) +PHP_FUNCTION(zip_close) { zval * zip; zip_rsrc *z_rsrc = NULL; @@ -1217,7 +1185,7 @@ static PHP_NAMED_FUNCTION(zif_zip_close) /* {{{ proto resource zip_read(resource zip) Returns the next file in the archive */ -static PHP_NAMED_FUNCTION(zif_zip_read) +PHP_FUNCTION(zip_read) { zval *zip_dp; zip_read_rsrc *zr_rsrc; @@ -1264,7 +1232,7 @@ static PHP_NAMED_FUNCTION(zif_zip_read) /* {{{ proto bool zip_entry_open(resource zip_dp, resource zip_entry [, string mode]) Open a Zip File, pointed by the resource entry */ /* Dummy function to follow the old API */ -static PHP_NAMED_FUNCTION(zif_zip_entry_open) +PHP_FUNCTION(zip_entry_open) { zval * zip; zval * zip_entry; @@ -1295,7 +1263,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open) /* {{{ proto bool zip_entry_close(resource zip_ent) Close a zip entry */ -static PHP_NAMED_FUNCTION(zif_zip_entry_close) +PHP_FUNCTION(zip_entry_close) { zval * zip_entry; zip_read_rsrc * zr_rsrc; @@ -1314,7 +1282,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close) /* {{{ proto mixed zip_entry_read(resource zip_entry [, int len]) Read from an open directory entry */ -static PHP_NAMED_FUNCTION(zif_zip_entry_read) +PHP_FUNCTION(zip_entry_read) { zval * zip_entry; zend_long len = 0; @@ -1408,7 +1376,7 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ /* {{{ proto string zip_entry_name(resource zip_entry) Return the name given a ZZip entry */ -static PHP_NAMED_FUNCTION(zif_zip_entry_name) +PHP_FUNCTION(zip_entry_name) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -1416,7 +1384,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_name) /* {{{ proto int zip_entry_compressedsize(resource zip_entry) Return the compressed size of a ZZip entry */ -static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize) +PHP_FUNCTION(zip_entry_compressedsize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } @@ -1424,7 +1392,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_compressedsize) /* {{{ proto int zip_entry_filesize(resource zip_entry) Return the actual filesize of a ZZip entry */ -static PHP_NAMED_FUNCTION(zif_zip_entry_filesize) +PHP_FUNCTION(zip_entry_filesize) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); } @@ -1432,7 +1400,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_filesize) /* {{{ proto string zip_entry_compressionmethod(resource zip_entry) Return a string containing the compression method used on a particular entry */ -static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod) +PHP_FUNCTION(zip_entry_compressionmethod) { php_zip_entry_get_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); } @@ -1440,7 +1408,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_compressionmethod) /* {{{ proto mixed ZipArchive::open(string source [, int flags]) Create new zip using source uri for output, return TRUE on success or the error code */ -static ZIPARCHIVE_METHOD(open) +PHP_METHOD(ZipArchive, open) { struct zip *intern; int err = 0; @@ -1512,7 +1480,7 @@ static ZIPARCHIVE_METHOD(open) /* {{{ proto resource ZipArchive::setPassword(string password) Set the password for the active archive */ -static ZIPARCHIVE_METHOD(setPassword) +PHP_METHOD(ZipArchive, setPassword) { struct zip *intern; zval *self = ZEND_THIS; @@ -1540,7 +1508,7 @@ static ZIPARCHIVE_METHOD(setPassword) /* {{{ proto bool ZipArchive::close() close the zip archive */ -static ZIPARCHIVE_METHOD(close) +PHP_METHOD(ZipArchive, close) { struct zip *intern; zval *self = ZEND_THIS; @@ -1592,7 +1560,7 @@ static ZIPARCHIVE_METHOD(close) /* {{{ proto bool ZipArchive::count() close the zip archive */ -static ZIPARCHIVE_METHOD(count) +PHP_METHOD(ZipArchive, count) { struct zip *intern; zval *self = ZEND_THIS; @@ -1611,7 +1579,7 @@ static ZIPARCHIVE_METHOD(count) /* {{{ proto string ZipArchive::getStatusString() * Returns the status error message, system and/or zip messages */ -static ZIPARCHIVE_METHOD(getStatusString) +PHP_METHOD(ZipArchive, getStatusString) { zval *self = ZEND_THIS; #if LIBZIP_VERSION_MAJOR < 1 @@ -1655,7 +1623,7 @@ static ZIPARCHIVE_METHOD(getStatusString) /* {{{ proto bool ZipArchive::addEmptyDir(string dirname [, bool flags = 0]) Returns the index of the entry named filename in the archive */ -static ZIPARCHIVE_METHOD(addEmptyDir) +PHP_METHOD(ZipArchive, addEmptyDir) { struct zip *intern; zval *self = ZEND_THIS; @@ -1812,7 +1780,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* /* {{{ proto bool ZipArchive::addGlob(string pattern[,int flags [, array options]]) Add files matching the glob pattern. See php's glob for the pattern syntax. */ -static ZIPARCHIVE_METHOD(addGlob) +PHP_METHOD(ZipArchive, addGlob) { php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } @@ -1820,7 +1788,7 @@ static ZIPARCHIVE_METHOD(addGlob) /* {{{ proto bool ZipArchive::addPattern(string pattern[, string path [, array options]]) Add files matching the pcre pattern. See php's pcre for the pattern syntax. */ -static ZIPARCHIVE_METHOD(addPattern) +PHP_METHOD(ZipArchive, addPattern) { php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); } @@ -1828,7 +1796,7 @@ static ZIPARCHIVE_METHOD(addPattern) /* {{{ proto bool ZipArchive::addFile(string filepath[, string entryname[, int start [, int length [, int flags = FL_OVERWRITE]]]]) Add a file in a Zip archive using its path and the name to use. */ -static ZIPARCHIVE_METHOD(addFile) +PHP_METHOD(ZipArchive, addFile) { zval *self = ZEND_THIS; char *entry_name = NULL; @@ -1863,7 +1831,7 @@ static ZIPARCHIVE_METHOD(addFile) /* {{{ proto bool ZipArchive::replaceFile(string filepath, int index[, int start [, int length [, int flags = 0]]]) Add a file in a Zip archive using its path and the name to use. */ -static ZIPARCHIVE_METHOD(replaceFile) +PHP_METHOD(ZipArchive, replaceFile) { zval *self = ZEND_THIS; zend_long index; @@ -1897,7 +1865,7 @@ static ZIPARCHIVE_METHOD(replaceFile) /* {{{ proto bool ZipArchive::addFromString(string name, string content [, int flags = FL_OVERWRITE]) Add a file using content and the entry name */ -static ZIPARCHIVE_METHOD(addFromString) +PHP_METHOD(ZipArchive, addFromString) { struct zip *intern; zval *self = ZEND_THIS; @@ -1947,7 +1915,7 @@ static ZIPARCHIVE_METHOD(addFromString) /* {{{ proto array ZipArchive::statName(string filename[, int flags]) Returns the information about a the zip entry filename */ -static ZIPARCHIVE_METHOD(statName) +PHP_METHOD(ZipArchive, statName) { struct zip *intern; zval *self = ZEND_THIS; @@ -1969,7 +1937,7 @@ static ZIPARCHIVE_METHOD(statName) /* {{{ proto resource ZipArchive::statIndex(int index[, int flags]) Returns the zip entry information using its index */ -static ZIPARCHIVE_METHOD(statIndex) +PHP_METHOD(ZipArchive, statIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -1993,7 +1961,7 @@ static ZIPARCHIVE_METHOD(statIndex) /* {{{ proto int ZipArchive::locateName(string filename[, int flags]) Returns the index of the entry named filename in the archive */ -static ZIPARCHIVE_METHOD(locateName) +PHP_METHOD(ZipArchive, locateName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2023,7 +1991,7 @@ static ZIPARCHIVE_METHOD(locateName) /* {{{ proto string ZipArchive::getNameIndex(int index [, int flags]) Returns the name of the file at position index */ -static ZIPARCHIVE_METHOD(getNameIndex) +PHP_METHOD(ZipArchive, getNameIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2049,7 +2017,7 @@ static ZIPARCHIVE_METHOD(getNameIndex) /* {{{ proto bool ZipArchive::setArchiveComment(string comment) Set or remove (NULL/'') the comment of the archive */ -static ZIPARCHIVE_METHOD(setArchiveComment) +PHP_METHOD(ZipArchive, setArchiveComment) { struct zip *intern; zval *self = ZEND_THIS; @@ -2077,7 +2045,7 @@ static ZIPARCHIVE_METHOD(setArchiveComment) /* {{{ proto string ZipArchive::getArchiveComment([int flags]) Returns the comment of an entry using its index */ -static ZIPARCHIVE_METHOD(getArchiveComment) +PHP_METHOD(ZipArchive, getArchiveComment) { struct zip *intern; zval *self = ZEND_THIS; @@ -2101,7 +2069,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment) /* {{{ proto bool ZipArchive::setCommentName(string name, string comment) Set or remove (NULL/'') the comment of an entry using its Name */ -static ZIPARCHIVE_METHOD(setCommentName) +PHP_METHOD(ZipArchive, setCommentName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2135,7 +2103,7 @@ static ZIPARCHIVE_METHOD(setCommentName) /* {{{ proto bool ZipArchive::setCommentIndex(int index, string comment) Set or remove (NULL/'') the comment of an entry using its index */ -static ZIPARCHIVE_METHOD(setCommentIndex) +PHP_METHOD(ZipArchive, setCommentIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2166,7 +2134,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex) /* {{{ proto bool ZipArchive::setExternalAttributesName(string name, int opsys, int attr [, int flags]) Set external attributes for file in zip, using its name */ -static ZIPARCHIVE_METHOD(setExternalAttributesName) +PHP_METHOD(ZipArchive, setExternalAttributesName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2200,7 +2168,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName) /* {{{ proto bool ZipArchive::setExternalAttributesIndex(int index, int opsys, int attr [, int flags]) Set external attributes for file in zip, using its index */ -static ZIPARCHIVE_METHOD(setExternalAttributesIndex) +PHP_METHOD(ZipArchive, setExternalAttributesIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2225,7 +2193,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex) /* {{{ proto bool ZipArchive::getExternalAttributesName(string name, int &opsys, int &attr [, int flags]) Get external attributes for file in zip, using its name */ -static ZIPARCHIVE_METHOD(getExternalAttributesName) +PHP_METHOD(ZipArchive, getExternalAttributesName) { struct zip *intern; zval *self = ZEND_THIS, *z_opsys, *z_attr; @@ -2263,7 +2231,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName) /* {{{ proto bool ZipArchive::getExternalAttributesIndex(int index, int &opsys, int &attr [, int flags]) Get external attributes for file in zip, using its index */ -static ZIPARCHIVE_METHOD(getExternalAttributesIndex) +PHP_METHOD(ZipArchive, getExternalAttributesIndex) { struct zip *intern; zval *self = ZEND_THIS, *z_opsys, *z_attr; @@ -2294,7 +2262,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex) #ifdef HAVE_ENCRYPTION /* {{{ proto bool ZipArchive::setEncryptionName(string name, int method, [string password]) Set encryption method for file in zip, using its name */ -static ZIPARCHIVE_METHOD(setEncryptionName) +PHP_METHOD(ZipArchive, setEncryptionName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2328,7 +2296,7 @@ static ZIPARCHIVE_METHOD(setEncryptionName) /* {{{ proto bool ZipArchive::setEncryptionIndex(int index, int method, [string password]) Set encryption method for file in zip, using its index */ -static ZIPARCHIVE_METHOD(setEncryptionIndex) +PHP_METHOD(ZipArchive, setEncryptionIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2353,7 +2321,7 @@ static ZIPARCHIVE_METHOD(setEncryptionIndex) /* {{{ proto string ZipArchive::getCommentName(string name[, int flags]) Returns the comment of an entry using its name */ -static ZIPARCHIVE_METHOD(getCommentName) +PHP_METHOD(ZipArchive, getCommentName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2388,7 +2356,7 @@ static ZIPARCHIVE_METHOD(getCommentName) /* {{{ proto string ZipArchive::getCommentIndex(int index[, int flags]) Returns the comment of an entry using its index */ -static ZIPARCHIVE_METHOD(getCommentIndex) +PHP_METHOD(ZipArchive, getCommentIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2412,7 +2380,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex) /* {{{ proto bool ZipArchive::setCompressionName(string name, int comp_method[, int comp_flags]) Set the compression of a file in zip, using its name */ -static ZIPARCHIVE_METHOD(setCompressionName) +PHP_METHOD(ZipArchive, setCompressionName) { struct zip *intern; zval *this = ZEND_THIS; @@ -2447,7 +2415,7 @@ static ZIPARCHIVE_METHOD(setCompressionName) /* {{{ proto bool ZipArchive::setCompressionIndex(int index, int comp_method[, int comp_flags]) Set the compression of a file in zip, using its index */ -static ZIPARCHIVE_METHOD(setCompressionIndex) +PHP_METHOD(ZipArchive, setCompressionIndex) { struct zip *intern; zval *this = ZEND_THIS; @@ -2472,7 +2440,7 @@ static ZIPARCHIVE_METHOD(setCompressionIndex) #ifdef HAVE_SET_MTIME /* {{{ proto bool ZipArchive::setMtimeName(string name, int timestamp[, int flags]) Set the modification time of a file in zip, using its name */ -static ZIPARCHIVE_METHOD(setMtimeName) +PHP_METHOD(ZipArchive, setMtimeName) { struct zip *intern; zval *this = ZEND_THIS; @@ -2507,7 +2475,7 @@ static ZIPARCHIVE_METHOD(setMtimeName) /* {{{ proto bool ZipArchive::setMtimeIndex(int index, int timestamp[, int flags]) Set the modification time of a file in zip, using its index */ -static ZIPARCHIVE_METHOD(setMtimeIndex) +PHP_METHOD(ZipArchive, setMtimeIndex) { struct zip *intern; zval *this = ZEND_THIS; @@ -2532,7 +2500,7 @@ static ZIPARCHIVE_METHOD(setMtimeIndex) /* {{{ proto bool ZipArchive::deleteIndex(int index) Delete a file using its index */ -static ZIPARCHIVE_METHOD(deleteIndex) +PHP_METHOD(ZipArchive, deleteIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2558,7 +2526,7 @@ static ZIPARCHIVE_METHOD(deleteIndex) /* {{{ proto bool ZipArchive::deleteName(string name) Delete a file using its index */ -static ZIPARCHIVE_METHOD(deleteName) +PHP_METHOD(ZipArchive, deleteName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2586,7 +2554,7 @@ static ZIPARCHIVE_METHOD(deleteName) /* {{{ proto bool ZipArchive::renameIndex(int index, string new_name) Rename an entry selected by its index to new_name */ -static ZIPARCHIVE_METHOD(renameIndex) +PHP_METHOD(ZipArchive, renameIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2619,7 +2587,7 @@ static ZIPARCHIVE_METHOD(renameIndex) /* {{{ proto bool ZipArchive::renameName(string name, string new_name) Rename an entry selected by its name to new_name */ -static ZIPARCHIVE_METHOD(renameName) +PHP_METHOD(ZipArchive, renameName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2650,7 +2618,7 @@ static ZIPARCHIVE_METHOD(renameName) /* {{{ proto bool ZipArchive::unchangeIndex(int index) Changes to the file at position index are reverted */ -static ZIPARCHIVE_METHOD(unchangeIndex) +PHP_METHOD(ZipArchive, unchangeIndex) { struct zip *intern; zval *self = ZEND_THIS; @@ -2676,7 +2644,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex) /* {{{ proto bool ZipArchive::unchangeName(string name) Changes to the file named 'name' are reverted */ -static ZIPARCHIVE_METHOD(unchangeName) +PHP_METHOD(ZipArchive, unchangeName) { struct zip *intern; zval *self = ZEND_THIS; @@ -2706,7 +2674,7 @@ static ZIPARCHIVE_METHOD(unchangeName) /* {{{ proto bool ZipArchive::unchangeAll() All changes to files and global information in archive are reverted */ -static ZIPARCHIVE_METHOD(unchangeAll) +PHP_METHOD(ZipArchive, unchangeAll) { struct zip *intern; zval *self = ZEND_THIS; @@ -2727,7 +2695,7 @@ static ZIPARCHIVE_METHOD(unchangeAll) /* {{{ proto bool ZipArchive::unchangeArchive() Revert all global changes to the archive archive. For now, this only reverts archive comment changes. */ -static ZIPARCHIVE_METHOD(unchangeArchive) +PHP_METHOD(ZipArchive, unchangeArchive) { struct zip *intern; zval *self = ZEND_THIS; @@ -2753,7 +2721,7 @@ Extract one or more file from a zip archive */ * - replace path * - patterns */ -static ZIPARCHIVE_METHOD(extractTo) +PHP_METHOD(ZipArchive, extractTo) { struct zip *intern; @@ -2902,7 +2870,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ /* {{{ proto string ZipArchive::getFromName(string entryname[, int len [, int flags]]) get the contents of an entry using its name */ -static ZIPARCHIVE_METHOD(getFromName) +PHP_METHOD(ZipArchive, getFromName) { php_zip_get_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } @@ -2910,7 +2878,7 @@ static ZIPARCHIVE_METHOD(getFromName) /* {{{ proto string ZipArchive::getFromIndex(int index[, int len [, int flags]]) get the contents of an entry using its index */ -static ZIPARCHIVE_METHOD(getFromIndex) +PHP_METHOD(ZipArchive, getFromIndex) { php_zip_get_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } @@ -2918,7 +2886,7 @@ static ZIPARCHIVE_METHOD(getFromIndex) /* {{{ proto resource ZipArchive::getStream(string entryname) get a stream for an entry using its name */ -static ZIPARCHIVE_METHOD(getStream) +PHP_METHOD(ZipArchive, getStream) { struct zip *intern; zval *self = ZEND_THIS; @@ -2964,7 +2932,7 @@ static void _php_zip_progress_callback(zip_t *arch, double state, void *ptr) /* {{{ proto bool ZipArchive::registerProgressCallback(double rate, callable callback) register a progression callback: void callback(double state); */ -static ZIPARCHIVE_METHOD(registerProgressCallback) +PHP_METHOD(ZipArchive, registerProgressCallback) { struct zip *intern; zval *self = getThis(); @@ -3023,7 +2991,7 @@ static int _php_zip_cancel_callback(zip_t *arch, void *ptr) /* {{{ proto bool ZipArchive::registerCancelCallback(callable callback) register a progression callback: int callback(double state); */ -static ZIPARCHIVE_METHOD(registerCancelCallback) +PHP_METHOD(ZipArchive, registerCancelCallback) { struct zip *intern; zval *self = getThis(); @@ -3067,7 +3035,7 @@ static ZIPARCHIVE_METHOD(registerCancelCallback) #ifdef HAVE_METHOD_SUPPORTED /* {{{ proto bool ZipArchive::isCompressionMethodSupported(int method, bool enc) check if a compression method is available in used libzip */ -static ZIPARCHIVE_METHOD(isCompressionMethodSupported) +PHP_METHOD(ZipArchive, isCompressionMethodSupported) { zend_long method; zend_bool enc = 1; @@ -3081,7 +3049,7 @@ static ZIPARCHIVE_METHOD(isCompressionMethodSupported) /* {{{ proto bool ZipArchive::isEncryptionMethodSupported(int method, bool enc) check if a encryption method is available in used libzip */ -static ZIPARCHIVE_METHOD(isEncryptionMethodSupported) +PHP_METHOD(ZipArchive, isEncryptionMethodSupported) { zend_long method; zend_bool enc = 1; @@ -3094,72 +3062,6 @@ static ZIPARCHIVE_METHOD(isEncryptionMethodSupported) /* }}} */ #endif -/* {{{ ze_zip_object_class_functions */ -static const zend_function_entry zip_class_functions[] = { - ZIPARCHIVE_ME(open, arginfo_class_ZipArchive_open, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setPassword, arginfo_class_ZipArchive_setPassword, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(close, arginfo_class_ZipArchive_close, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(count, arginfo_class_ZipArchive_count, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getStatusString, arginfo_class_ZipArchive_getStatusString, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(addEmptyDir, arginfo_class_ZipArchive_addEmptyDir, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(addFromString, arginfo_class_ZipArchive_addFromString, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(addFile, arginfo_class_ZipArchive_addFile, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(addGlob, arginfo_class_ZipArchive_addGlob, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(addPattern, arginfo_class_ZipArchive_addPattern, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(renameIndex, arginfo_class_ZipArchive_renameIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(renameName, arginfo_class_ZipArchive_renameName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(replaceFile, arginfo_class_ZipArchive_replaceFile, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setArchiveComment, arginfo_class_ZipArchive_setArchiveComment, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getArchiveComment, arginfo_class_ZipArchive_getArchiveComment, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setCommentIndex, arginfo_class_ZipArchive_setCommentIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setCommentName, arginfo_class_ZipArchive_setCommentName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getCommentIndex, arginfo_class_ZipArchive_getCommentIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getCommentName, arginfo_class_ZipArchive_getCommentName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(deleteIndex, arginfo_class_ZipArchive_deleteIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(deleteName, arginfo_class_ZipArchive_deleteName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(statName, arginfo_class_ZipArchive_statName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(statIndex, arginfo_class_ZipArchive_statIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(locateName, arginfo_class_ZipArchive_locateName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getNameIndex, arginfo_class_ZipArchive_getNameIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(unchangeArchive, arginfo_class_ZipArchive_unchangeArchive, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(unchangeAll, arginfo_class_ZipArchive_unchangeAll, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(unchangeIndex, arginfo_class_ZipArchive_unchangeIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(unchangeName, arginfo_class_ZipArchive_unchangeName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(extractTo, arginfo_class_ZipArchive_extractTo, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getFromName, arginfo_class_ZipArchive_getFromName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getFromIndex, arginfo_class_ZipArchive_getFromIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getStream, arginfo_class_ZipArchive_getStream, ZEND_ACC_PUBLIC) -#ifdef ZIP_OPSYS_DEFAULT - ZIPARCHIVE_ME(setExternalAttributesName, arginfo_class_ZipArchive_setExternalAttributesName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setExternalAttributesIndex, arginfo_class_ZipArchive_setExternalAttributesIndex, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getExternalAttributesName, arginfo_class_ZipArchive_getExternalAttributesName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(getExternalAttributesIndex, arginfo_class_ZipArchive_getExternalAttributesIndex, ZEND_ACC_PUBLIC) -#endif - ZIPARCHIVE_ME(setCompressionName, arginfo_class_ZipArchive_setCompressionName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setCompressionIndex, arginfo_class_ZipArchive_setCompressionIndex, ZEND_ACC_PUBLIC) -#ifdef HAVE_SET_MTIME - ZIPARCHIVE_ME(setMtimeName, arginfo_class_ZipArchive_setMtimeName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setMtimeIndex, arginfo_class_ZipArchive_setMtimeIndex, ZEND_ACC_PUBLIC) -#endif -#ifdef HAVE_ENCRYPTION - ZIPARCHIVE_ME(setEncryptionName, arginfo_class_ZipArchive_setEncryptionName, ZEND_ACC_PUBLIC) - ZIPARCHIVE_ME(setEncryptionIndex, arginfo_class_ZipArchive_setEncryptionIndex, ZEND_ACC_PUBLIC) -#endif -#ifdef HAVE_PROGRESS_CALLBACK - ZIPARCHIVE_ME(registerProgressCallback, arginfo_class_ZipArchive_registerProgressCallback, ZEND_ACC_PUBLIC) -#endif -#ifdef HAVE_CANCEL_CALLBACK - ZIPARCHIVE_ME(registerCancelCallback, arginfo_class_ZipArchive_registerCancelCallback, ZEND_ACC_PUBLIC) -#endif -#ifdef HAVE_METHOD_SUPPORTED - ZIPARCHIVE_ME(isCompressionMethodSupported, arginfo_class_ZipArchive_isCompressionMethodSupported, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - ZIPARCHIVE_ME(isEncryptionMethodSupported, arginfo_class_ZipArchive_isEncryptionMethodSupported, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) -#endif - - PHP_FE_END -}; -/* }}} */ - static void php_zip_free_prop_handler(zval *el) /* {{{ */ { pefree(Z_PTR_P(el), 1); } /* }}} */ @@ -3180,7 +3082,7 @@ static PHP_MINIT_FUNCTION(zip) zip_object_handlers.read_property = php_zip_read_property; zip_object_handlers.has_property = php_zip_has_property; - INIT_CLASS_ENTRY(ce, "ZipArchive", zip_class_functions); + INIT_CLASS_ENTRY(ce, "ZipArchive", class_ZipArchive_methods); ce.create_object = php_zip_object_new; zip_class_entry = zend_register_internal_class(&ce); |