com php-src: don't use deprecated libzip call: ext/zip/php_zi p.c ext/zip/zip_stream.c

From: Date: Wed, 06 May 2015 13:16:43 +0000
Subject: com php-src: don't use deprecated libzip call: ext/zip/php_zi p.c ext/zip/zip_stream.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-86620@lists.php.net to get a copy of this message
Commit: 3638ac2300bc7464b30cf26bf3c7be5beea82503 Author: Remi Collet <remi@fedoraproject.org> Wed, 6 May 2015 14:43:47 +0200 Committer: Remi Collet <remi@php.net> Wed, 6 May 2015 15:16:43 +0200 Parents: 9e0cc7a1d926c1364a834177cadea431cd8b39a7 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3638ac2300bc7464b30cf26bf3c7be5beea82503 Log: don't use deprecated libzip call Changed paths: M ext/zip/php_zip.c M ext/zip/zip_stream.c Diff: diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 991ab90..f8b6a88 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 } /* }}} */ diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c index 18707ee..3ae3e34 100644 --- a/ext/zip/zip_stream.c +++ b/ext/zip/zip_stream.c @@ -52,10 +52,18 @@ static size_t php_zip_ops_read(php_stream *stream, char *buf, size_t count) if (self->za && self->zf) { n = zip_fread(self->zf, buf, count); if (n < 0) { +#if LIBZIP_VERSION_MAJOR < 1 int ze, se; zip_file_error_get(self->zf, &ze, &se); stream->eof = 1; php_error_docref(NULL, E_WARNING, "Zip stream error: %s", zip_file_strerror(self->zf)); +#else + zip_error_t *err; + err = zip_file_get_error(self->zf); + stream->eof = 1; + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Zip stream error: %s", zip_error_strerror(err)); + zip_error_fini(err); +#endif return 0; } /* cast count to signed value to avoid possibly negative n

« previous php.cvs (#86620) next »