summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c73
1 files changed, 1 insertions, 72 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 00a1e678c8..b3c1a88fc5 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -868,7 +868,6 @@ PHP_FUNCTION(inflate_init)
ctx->zfree = php_zlib_free;
((php_zlib_context *) ctx)->inflateDict = dict;
((php_zlib_context *) ctx)->inflateDictlen = dictlen;
- ((php_zlib_context *) ctx)->status = Z_OK;
if (encoding < 0) {
encoding += 15 - window;
@@ -936,13 +935,6 @@ PHP_FUNCTION(inflate_add)
"flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH");
RETURN_FALSE;
}
-
- /* Lazy-resetting the zlib stream so ctx->total_in remains available until the next inflate_add() call. */
- if (((php_zlib_context *) ctx)->status == Z_STREAM_END)
- {
- ((php_zlib_context *) ctx)->status = Z_OK;
- inflateReset(ctx);
- }
if (in_len <= 0 && flush_type != Z_FINISH) {
RETURN_EMPTY_STRING();
@@ -958,8 +950,6 @@ PHP_FUNCTION(inflate_add)
status = inflate(ctx, flush_type);
buffer_used = ZSTR_LEN(out) - ctx->avail_out;
- ((php_zlib_context *) ctx)->status = status; /* Save status for exposing to userspace */
-
switch (status) {
case Z_OK:
if (ctx->avail_out == 0) {
@@ -972,6 +962,7 @@ PHP_FUNCTION(inflate_add)
goto complete;
}
case Z_STREAM_END:
+ inflateReset(ctx);
goto complete;
case Z_BUF_ERROR:
if (flush_type == Z_FINISH && ctx->avail_out == 0) {
@@ -1020,48 +1011,6 @@ PHP_FUNCTION(inflate_add)
}
/* }}} */
-/* {{{ proto bool inflate_get_status(resource context)
- Get decompression status, usually returns either ZLIB_OK or ZLIB_STREAM_END. */
-PHP_FUNCTION(inflate_get_status)
-{
- zval *res;
- z_stream *ctx;
-
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res))
- {
- RETURN_NULL();
- }
-
- if (!(ctx = zend_fetch_resource_ex(res, NULL, le_inflate))) {
- php_error_docref(NULL, E_WARNING, "Invalid zlib.inflate resource");
- RETURN_FALSE;
- }
-
- RETURN_LONG(((php_zlib_context *) ctx)->status);
-}
-/* }}} */
-
-/* {{{ proto bool inflate_get_read_len(resource context)
- Get number of bytes read so far. */
-PHP_FUNCTION(inflate_get_read_len)
-{
- zval *res;
- z_stream *ctx;
-
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res))
- {
- RETURN_NULL();
- }
-
- if (!(ctx = zend_fetch_resource_ex(res, NULL, le_inflate))) {
- php_error_docref(NULL, E_WARNING, "Invalid zlib.inflate resource");
- RETURN_FALSE;
- }
-
- RETURN_LONG(ctx->total_in);
-}
-/* }}} */
-
/* {{{ proto resource deflate_init(int encoding[, array options])
Initialize an incremental deflate context using the specified encoding */
PHP_FUNCTION(deflate_init)
@@ -1373,14 +1322,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_add, 0, 0, 2)
ZEND_ARG_INFO(0, flush_behavior)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_status, 0, 0, 1)
- ZEND_ARG_INFO(0, resource)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_read_len, 0, 0, 1)
- ZEND_ARG_INFO(0, resource)
-ZEND_END_ARG_INFO()
-
/* }}} */
/* {{{ php_zlib_functions[] */
@@ -1413,8 +1354,6 @@ static const zend_function_entry php_zlib_functions[] = {
PHP_FE(deflate_add, arginfo_deflate_add)
PHP_FE(inflate_init, arginfo_inflate_init)
PHP_FE(inflate_add, arginfo_inflate_add)
- PHP_FE(inflate_get_status, arginfo_inflate_get_status)
- PHP_FE(inflate_get_read_len, arginfo_inflate_get_read_len)
PHP_FE(ob_gzhandler, arginfo_ob_gzhandler)
PHP_FE_END
};
@@ -1530,16 +1469,6 @@ static PHP_MINIT_FUNCTION(zlib)
REGISTER_STRING_CONSTANT("ZLIB_VERSION", ZLIB_VERSION, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ZLIB_VERNUM", ZLIB_VERNUM, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_OK", Z_OK, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_STREAM_END", Z_STREAM_END, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_NEED_DICT", Z_NEED_DICT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_ERRNO", Z_ERRNO, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_STREAM_ERROR", Z_STREAM_ERROR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_DATA_ERROR", Z_DATA_ERROR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_MEM_ERROR", Z_MEM_ERROR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_BUF_ERROR", Z_BUF_ERROR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ZLIB_VERSION_ERROR", Z_VERSION_ERROR, CONST_CS|CONST_PERSISTENT);
-
REGISTER_INI_ENTRIES();
return SUCCESS;
}