php_zlib_buffer buffer;
} php_zlib_context;
-int php_zlib_output_encoding(TSRMLS_D);
-int php_zlib_encode(const char *in_buf, size_t in_len, char **out_buf, size_t *out_len, int encoding, int level TSRMLS_DC);
-int php_zlib_decode(const char *in_buf, size_t in_len, char **out_buf, size_t *out_len, int encoding, size_t max_len TSRMLS_DC);
-php_output_handler *php_zlib_output_handler_init(zval *handler_name, size_t chunk_size, int flags TSRMLS_DC);
-int php_zlib_output_handler(void **handler_context, php_output_context *output_context);
-void php_zlib_output_handler_dtor(void *opaq TSRMLS_DC);
-int php_zlib_output_conflict_check(zval *handler_name TSRMLS_DC);
-
php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
extern php_stream_ops php_stream_gzio_ops;
extern php_stream_wrapper php_stream_gzip_wrapper;
#define zlib_module_ptr &php_zlib_module_entry
#define phpext_zlib_ptr zlib_module_ptr
-PHP_MINIT_FUNCTION(zlib);
-PHP_MSHUTDOWN_FUNCTION(zlib);
-PHP_RINIT_FUNCTION(zlib);
-PHP_MINFO_FUNCTION(zlib);
-
-PHP_FUNCTION(gzfile);
-PHP_FUNCTION(gzopen);
-PHP_FUNCTION(readgzfile);
-
-PHP_FUNCTION(gzcompress);
-PHP_FUNCTION(gzuncompress);
-PHP_FUNCTION(gzdeflate);
-PHP_FUNCTION(gzinflate);
-PHP_FUNCTION(gzencode);
-PHP_FUNCTION(gzdecode);
-
-PHP_FUNCTION(zlib_encode);
-PHP_FUNCTION(zlib_decode);
-
-PHP_FUNCTION(zlib_get_coding_type);
-
-
#ifdef ZTS
# define ZLIBG(v) TSRMG(zlib_globals_id, zend_zlib_globals *, v)
#else
/* }}} */
/* {{{ php_zlib_output_conflict_check() */
-int php_zlib_output_conflict_check(zval *handler_name TSRMLS_DC)
+static int php_zlib_output_conflict_check(zval *handler_name TSRMLS_DC)
{
if (php_output_get_level(TSRMLS_C) > 0) {
PHP_OUTPUT_CONFLICT(PHP_ZLIB_OUTPUT_HANDLER_NAME, return FAILURE);
/* }}} */
/* {{{ php_zlib_output_encoding() */
-int php_zlib_output_encoding(TSRMLS_D)
+static int php_zlib_output_encoding(TSRMLS_D)
{
zval **enc;
}
/* }}} */
-/* {{{ php_zlib_output_compression_start() */
-void php_zlib_output_compression_start(TSRMLS_D)
-{
- zval *zoh, *tmp;
- php_output_handler *h;
-
- switch (ZLIBG(output_compression)) {
- case 0:
- break;
- case 1:
- ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE;
- /* break omitted intentionally */
- default:
- MAKE_STD_ZVAL(tmp);
- ZVAL_ASCII_STRING(tmp, PHP_ZLIB_OUTPUT_HANDLER_NAME, ZSTR_DUPLICATE);
- if ( (h = php_zlib_output_handler_init(tmp, ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) &&
- (SUCCESS == php_output_handler_start(h TSRMLS_CC))) {
- if (ZLIBG(output_handler) && *ZLIBG(output_handler)) {
- MAKE_STD_ZVAL(zoh);
- ZVAL_ASCII_STRING(zoh, ZLIBG(output_handler), ZSTR_DUPLICATE);
- php_output_start_user(zoh, ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
- zval_ptr_dtor(&zoh);
- }
- }
- zval_ptr_dtor(&tmp);
- break;
- }
-}
-/* }}} */
-
-/* {{{ php_zlib_output_handler_init() */
-php_output_handler *php_zlib_output_handler_init(zval *handler_name, size_t chunk_size, int flags TSRMLS_DC)
-{
- php_output_handler *h = NULL;
- php_zlib_context *ctx;
-
- if (!ZLIBG(output_compression)) {
- ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE;
- }
- if ((h = php_output_handler_create_internal(handler_name, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) {
- ctx = (php_zlib_context *) ecalloc(1, sizeof(php_zlib_context));
- ctx->Z.zalloc = php_zlib_alloc;
- ctx->Z.zfree = php_zlib_free;
- php_output_handler_set_context(h, ctx, php_zlib_output_handler_dtor TSRMLS_CC);
- }
-
- return h;
-}
-/* }}} */
-
/* {{{ php_zlib_output_handler() */
-int php_zlib_output_handler(void **handler_context, php_output_context *output_context)
+static int php_zlib_output_handler(void **handler_context, php_output_context *output_context)
{
php_zlib_context *ctx = *(php_zlib_context **) handler_context;
int flags = Z_SYNC_FLUSH;
/* }}} */
/* {{{ php_zlib_output_handler_dtor() */
-void php_zlib_output_handler_dtor(void *opaq TSRMLS_DC)
+static void php_zlib_output_handler_dtor(void *opaq TSRMLS_DC)
{
php_zlib_context *ctx = (php_zlib_context *) opaq;
}
/* }}} */
+/* {{{ php_zlib_output_handler_init() */
+static php_output_handler *php_zlib_output_handler_init(zval *handler_name, size_t chunk_size, int flags TSRMLS_DC)
+{
+ php_output_handler *h = NULL;
+ php_zlib_context *ctx;
+
+ if (!ZLIBG(output_compression)) {
+ ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE;
+ }
+ if ((h = php_output_handler_create_internal(handler_name, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) {
+ ctx = (php_zlib_context *) ecalloc(1, sizeof(php_zlib_context));
+ ctx->Z.zalloc = php_zlib_alloc;
+ ctx->Z.zfree = php_zlib_free;
+ php_output_handler_set_context(h, ctx, php_zlib_output_handler_dtor TSRMLS_CC);
+ }
+
+ return h;
+}
+/* }}} */
+
+/* {{{ php_zlib_output_compression_start() */
+static void php_zlib_output_compression_start(TSRMLS_D)
+{
+ zval *zoh, *tmp;
+ php_output_handler *h;
+
+ switch (ZLIBG(output_compression)) {
+ case 0:
+ break;
+ case 1:
+ ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE;
+ /* break omitted intentionally */
+ default:
+ MAKE_STD_ZVAL(tmp);
+ ZVAL_ASCII_STRING(tmp, PHP_ZLIB_OUTPUT_HANDLER_NAME, ZSTR_DUPLICATE);
+ if ( (h = php_zlib_output_handler_init(tmp, ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) &&
+ (SUCCESS == php_output_handler_start(h TSRMLS_CC))) {
+ if (ZLIBG(output_handler) && *ZLIBG(output_handler)) {
+ MAKE_STD_ZVAL(zoh);
+ ZVAL_ASCII_STRING(zoh, ZLIBG(output_handler), ZSTR_DUPLICATE);
+ php_output_start_user(zoh, ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC);
+ zval_ptr_dtor(&zoh);
+ }
+ }
+ zval_ptr_dtor(&tmp);
+ break;
+ }
+}
+/* }}} */
+
/* {{{ php_zlib_encode() */
-int php_zlib_encode(const char *in_buf, size_t in_len, char **out_buf, size_t *out_len, int encoding, int level TSRMLS_DC)
+static int php_zlib_encode(const char *in_buf, size_t in_len, char **out_buf, size_t *out_len, int encoding, int level TSRMLS_DC)
{
int status;
z_stream Z;
/* }}} */
/* {{{ php_zlib_decode() */
-int php_zlib_decode(const char *in_buf, size_t in_len, char **out_buf, size_t *out_len, int encoding, size_t max_len TSRMLS_DC)
+static int php_zlib_decode(const char *in_buf, size_t in_len, char **out_buf, size_t *out_len, int encoding, size_t max_len TSRMLS_DC)
{
int status = Z_DATA_ERROR;
z_stream Z;
/* {{{ proto string zlib_get_coding_type(void) U
Returns the coding type used for output compression */
-PHP_FUNCTION(zlib_get_coding_type)
+static PHP_FUNCTION(zlib_get_coding_type)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
/* {{{ proto array gzfile(string filename [, int use_include_path]) U
Read and uncompress entire .gz-file into an array */
-PHP_FUNCTION(gzfile)
+static PHP_FUNCTION(gzfile)
{
zstr filename;
int filename_len;
/* {{{ proto resource gzopen(string filename, string mode [, int use_include_path]) U
Open a .gz-file and return a .gz-file pointer */
-PHP_FUNCTION(gzopen)
+static PHP_FUNCTION(gzopen)
{
zstr filename;
char *mode;
/* {{{ proto int readgzfile(string filename [, int use_include_path]) U
Output a .gz-file */
-PHP_FUNCTION(readgzfile)
+static PHP_FUNCTION(readgzfile)
{
zstr filename;
int filename_len;
/* }}} */
#define PHP_ZLIB_ENCODE_FUNC(name, default_encoding) \
-PHP_FUNCTION(name) \
+static PHP_FUNCTION(name) \
{ \
char *in_buf, *out_buf; \
int in_len; \
}
#define PHP_ZLIB_DECODE_FUNC(name, encoding) \
-PHP_FUNCTION(name) \
+static PHP_FUNCTION(name) \
{ \
char *in_buf, *out_buf; \
int in_len; \
/* }}} */
/* {{{ php_zlib_functions[] */
-const zend_function_entry php_zlib_functions[] = {
+static const zend_function_entry php_zlib_functions[] = {
PHP_FE(readgzfile, arginfo_readgzfile)
PHP_FALIAS(gzrewind, rewind, NULL)
PHP_FALIAS(gzclose, fclose, NULL)
};
/* }}} */
-
/* {{{ OnUpdate_zlib_output_compression */
static PHP_INI_MH(OnUpdate_zlib_output_compression)
{
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(zlib)
+static PHP_MINIT_FUNCTION(zlib)
{
php_register_url_stream_wrapper("compress.zlib", &php_stream_gzip_wrapper TSRMLS_CC);
php_stream_filter_register_factory("zlib.*", &php_zlib_filter_factory TSRMLS_CC);
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION */
-PHP_MSHUTDOWN_FUNCTION(zlib)
+static PHP_MSHUTDOWN_FUNCTION(zlib)
{
php_unregister_url_stream_wrapper("zlib" TSRMLS_CC);
php_stream_filter_unregister_factory("zlib.*" TSRMLS_CC);
/* }}} */
/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION(zlib)
+static PHP_RINIT_FUNCTION(zlib)
{
ZLIBG(compression_coding) = 0;
/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
-PHP_MINFO_FUNCTION(zlib)
+static PHP_MINFO_FUNCTION(zlib)
{
php_info_print_table_start();
php_info_print_table_header(2, "ZLib Support", "enabled");