X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_encoding.c;h=48eb1c36eef2bf1436bd857d15a27ad086c81d56;hp=b7c994bf928a78d2d652ad45a378af409a2b99f5;hb=20a7c37b273e313e53a37f4406eb49898dd50b6d;hpb=7dc5de0b79846bfe33ca36a9eeb894ef2ecfdee1 diff --git a/php_http_encoding.c b/php_http_encoding.c index b7c994b..48eb1c3 100644 --- a/php_http_encoding.c +++ b/php_http_encoding.c @@ -6,12 +6,10 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner | + | Copyright (c) 2004-2011, Michael Wallner | +--------------------------------------------------------------------+ */ -/* $Id: http_encoding_api.c 298592 2010-04-26 11:47:29Z mike $ */ - #include "php_http.h" #include @@ -222,6 +220,7 @@ retry_raw_inflate: wbits = PHP_HTTP_WINDOW_BITS_RAW; goto retry_raw_inflate; } + break; } inflateEnd(&Z); @@ -393,7 +392,6 @@ static php_http_encoding_stream_t *inflate_init(php_http_encoding_stream_t *s) static php_http_encoding_stream_t *dechunk_init(php_http_encoding_stream_t *s) { struct dechunk_ctx *ctx = pecalloc(1, sizeof(*ctx), (s->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT)); - TSRMLS_FETCH_FROM_CTX(s->ts); if (!php_http_buffer_init_ex(&ctx->buffer, PHP_HTTP_BUFFER_DEFAULT_SIZE, (s->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT) ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0)) { return NULL; @@ -510,6 +508,7 @@ retry_raw_inflate: inflateInit2(ctx, PHP_HTTP_WINDOW_BITS_RAW); goto retry_raw_inflate; } + break; } php_http_error(HE_WARNING, PHP_HTTP_E_ENCODING, "Failed to update inflate stream: %s", zError(status)); @@ -942,7 +941,7 @@ void php_http_encoding_stream_object_free(void *object TSRMLS_DC) php_http_encoding_stream_object_t *o = (php_http_encoding_stream_object_t *) object; if (o->stream) { - php_http_encoding_stream_free(&o->stream TSRMLS_CC); + php_http_encoding_stream_free(&o->stream); } zend_object_std_dtor((zend_object *) o TSRMLS_CC); efree(o); @@ -994,7 +993,7 @@ PHP_METHOD(HttpEncodingStream, update) size_t encoded_len; char *encoded_str; - if (SUCCESS == php_http_encoding_stream_update(obj->stream, data_str, data_len, &encoded_str, &encoded_len TSRMLS_CC)) { + if (SUCCESS == php_http_encoding_stream_update(obj->stream, data_str, data_len, &encoded_str, &encoded_len)) { RETURN_STRINGL(encoded_str, encoded_len, 0); } } @@ -1011,7 +1010,7 @@ PHP_METHOD(HttpEncodingStream, flush) char *encoded_str; size_t encoded_len; - if (SUCCESS == php_http_encoding_stream_flush(obj->stream, &encoded_str, &encoded_len TSRMLS_CC)) { + if (SUCCESS == php_http_encoding_stream_flush(obj->stream, &encoded_str, &encoded_len)) { RETURN_STRINGL(encoded_str, encoded_len, 0); } } @@ -1040,7 +1039,7 @@ PHP_METHOD(HttpEncodingStream, finish) char *encoded_str; size_t encoded_len; - if (SUCCESS == php_http_encoding_stream_finish(obj->stream, &encoded_str, &encoded_len TSRMLS_CC)) { + if (SUCCESS == php_http_encoding_stream_finish(obj->stream, &encoded_str, &encoded_len)) { if (SUCCESS == php_http_encoding_stream_reset(&obj->stream)) { RETURN_STRINGL(encoded_str, encoded_len, 0); } else { @@ -1162,7 +1161,7 @@ PHP_METHOD(HttpDechunkStream, decode) PHP_MINIT_FUNCTION(http_encoding) { - PHP_HTTP_REGISTER_CLASS(http\\encoding, Stream, http_encoding_stream, php_http_object_class_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + PHP_HTTP_REGISTER_CLASS(http\\Encoding, Stream, http_encoding_stream, php_http_object_class_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); php_http_encoding_stream_class_entry->create_object = php_http_encoding_stream_object_new; memcpy(&php_http_encoding_stream_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_encoding_stream_object_handlers.clone_obj = php_http_encoding_stream_object_clone; @@ -1171,7 +1170,7 @@ PHP_MINIT_FUNCTION(http_encoding) zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_SYNC"), PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC TSRMLS_CC); zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_FULL"), PHP_HTTP_ENCODING_STREAM_FLUSH_FULL TSRMLS_CC); - PHP_HTTP_REGISTER_CLASS(http\\encoding\\stream, Deflate, http_deflate_stream, php_http_encoding_stream_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Encoding\\Stream, Deflate, http_deflate_stream, php_http_encoding_stream_class_entry, 0); zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_GZIP"), PHP_HTTP_DEFLATE_TYPE_GZIP TSRMLS_CC); zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_ZLIB"), PHP_HTTP_DEFLATE_TYPE_ZLIB TSRMLS_CC); @@ -1185,8 +1184,8 @@ PHP_MINIT_FUNCTION(http_encoding) zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_RLE"), PHP_HTTP_DEFLATE_STRATEGY_RLE TSRMLS_CC); zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_FIXED"), PHP_HTTP_DEFLATE_STRATEGY_FIXED TSRMLS_CC); - PHP_HTTP_REGISTER_CLASS(http\\encoding\\stream, Inflate, http_inflate_stream, php_http_encoding_stream_class_entry, 0); - PHP_HTTP_REGISTER_CLASS(http\\encoding\\stream, Dechunk, http_dechunk_stream, php_http_encoding_stream_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Encoding\\Stream, Inflate, http_inflate_stream, php_http_encoding_stream_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Encoding\\Stream, Dechunk, http_dechunk_stream, php_http_encoding_stream_class_entry, 0); return SUCCESS; }