diff options
author | Remi Collet <remi@fedoraproject.org> | 2015-05-06 14:43:47 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2015-05-06 15:16:43 +0200 |
commit | 3638ac2300bc7464b30cf26bf3c7be5beea82503 (patch) | |
tree | 0c7681238139d6c91e18518898c418fb64cd1adf /ext/zip/php_zip.c | |
parent | 9e0cc7a1d926c1364a834177cadea431cd8b39a7 (diff) | |
download | php-git-3638ac2300bc7464b30cf26bf3c7be5beea82503.tar.gz |
don't use deprecated libzip call
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 991ab90220..f8b6a88fd7 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -395,18 +395,36 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char static int php_zip_status(struct zip *za) /* {{{ */ { +#if LIBZIP_VERSION_MAJOR < 1 int zep, syp; zip_error_get(za, &zep, &syp); +#else + int zep; + zip_error_t *err; + + err = zip_get_error(za); + zep = zip_error_code_zip(err); + zip_error_fini(err); +#endif return zep; } /* }}} */ static int php_zip_status_sys(struct zip *za) /* {{{ */ { +#if LIBZIP_VERSION_MAJOR < 1 int zep, syp; zip_error_get(za, &zep, &syp); +#else + int syp; + zip_error_t *err; + + err = zip_get_error(za); + syp = zip_error_code_system(err); + zip_error_fini(err); +#endif return syp; } /* }}} */ @@ -1505,8 +1523,12 @@ static ZIPARCHIVE_METHOD(getStatusString) { struct zip *intern; zval *self = getThis(); +#if LIBZIP_VERSION_MAJOR < 1 int zep, syp, len; char error_string[128]; +#else + zip_error_t *err; +#endif if (!self) { RETURN_FALSE; @@ -1514,10 +1536,16 @@ static ZIPARCHIVE_METHOD(getStatusString) ZIP_FROM_OBJECT(intern, self); +#if LIBZIP_VERSION_MAJOR < 1 zip_error_get(intern, &zep, &syp); len = zip_error_to_str(error_string, 128, zep, syp); RETVAL_STRINGL(error_string, len); +#else + err = zip_get_error(intern); + RETVAL_STRING(zip_error_strerror(err), 1); + zip_error_fini(err); +#endif } /* }}} */ |