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;
}
/* }}} */
{
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;
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
}
/* }}} */
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