diff options
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/Makefile.in | 7 | ||||
-rw-r--r-- | ext/zlib/config.m4 | 44 | ||||
-rw-r--r-- | ext/zlib/php_zlib.h | 76 | ||||
-rw-r--r-- | ext/zlib/setup.stub | 7 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 747 | ||||
-rw-r--r-- | ext/zlib/zlib.dsp | 113 | ||||
-rw-r--r-- | ext/zlib/zlib_win32_howto.txt | 16 |
7 files changed, 0 insertions, 1010 deletions
diff --git a/ext/zlib/Makefile.in b/ext/zlib/Makefile.in deleted file mode 100644 index 3b767fb7fa..0000000000 --- a/ext/zlib/Makefile.in +++ /dev/null @@ -1,7 +0,0 @@ - -LTLIBRARY_NAME = libzlib.la -LTLIBRARY_SOURCES = zlib.c -LTLIBRARY_SHARED_NAME = zlib.la -LTLIBRARY_SHARED_LIBADD = $(ZLIB_SHARED_LIBADD) - -include $(top_srcdir)/build/dynlib.mk diff --git a/ext/zlib/config.m4 b/ext/zlib/config.m4 deleted file mode 100644 index d9b5dd66fb..0000000000 --- a/ext/zlib/config.m4 +++ /dev/null @@ -1,44 +0,0 @@ -dnl $Id$ - - - -PHP_ARG_WITH(zlib,whether to include zlib support, -[ --with-zlib[=DIR] Include zlib support (requires zlib >= 1.0.9). - DIR is the zlib install directory, - defaults to /usr.]) - -AC_DEFUN(AC_TEMP_LDFLAGS,[ - old_LDFLAGS="$LDFLAGS" - LDFLAGS="$1 $LDFLAGS" - $2 - LDFLAGS="$old_LDFLAGS" -]) - -if test "$PHP_ZLIB" != "no"; then - PHP_EXTENSION(zlib, $ext_shared) - for i in /usr/local /usr $PHP_ZLIB; do - if test -f $i/include/zlib/zlib.h; then - ZLIB_DIR=$i - ZLIB_INCDIR=$i/include/zlib - elif test -f $i/include/zlib.h; then - ZLIB_DIR=$i - ZLIB_INCDIR=$i/include - fi - done - - if test -z "$ZLIB_DIR"; then - AC_MSG_ERROR(Cannot find libz) - fi - - ZLIB_LIBDIR=$ZLIB_DIR/lib - - AC_TEMP_LDFLAGS(-L$ZLIB_LIBDIR,[ - AC_CHECK_LIB(z, gzgets, [AC_DEFINE(HAVE_ZLIB,1,[ ])], - [AC_MSG_ERROR(Zlib module requires zlib >= 1.0.9.)]) - ]) - - PHP_SUBST(ZLIB_SHARED_LIBADD) - AC_ADD_LIBRARY_WITH_PATH(z, $ZLIB_LIBDIR, ZLIB_SHARED_LIBADD) - - AC_ADD_INCLUDE($ZLIB_INCDIR) -fi diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h deleted file mode 100644 index e67f051f03..0000000000 --- a/ext/zlib/php_zlib.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of the GNU General Public License as published by | - | the Free Software Foundation; either version 2 of the License, or | - | (at your option) any later version. | - | | - | This program is distributed in the hope that it will be useful, | - | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | GNU General Public License for more details. | - | | - | You should have received a copy of the GNU General Public License | - | along with this program; if not, write to the Free Software | - | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | - | Stefan Röhrich <sr@linux.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef PHP_ZLIB_H -#define PHP_ZLIB_H - -#if HAVE_ZLIB - -typedef struct { - int gzgetss_state; -} php_zlib_globals; - -extern zend_module_entry php_zlib_module_entry; -#define zlib_module_ptr &php_zlib_module_entry - -extern PHP_MINIT_FUNCTION(zlib); -extern PHP_MSHUTDOWN_FUNCTION(zlib); -PHP_MINFO_FUNCTION(zlib); -PHP_FUNCTION(gzopen); -PHP_FUNCTION(gzclose); -PHP_FUNCTION(gzeof); -PHP_FUNCTION(gzread); -PHP_FUNCTION(gzgetc); -PHP_FUNCTION(gzgets); -PHP_FUNCTION(gzgetss); -PHP_FUNCTION(gzwrite); -PHP_FUNCTION(gzrewind); -PHP_FUNCTION(gztell); -PHP_FUNCTION(gzseek); -PHP_FUNCTION(gzpassthru); -PHP_FUNCTION(readgzfile); -PHP_FUNCTION(gzfile); -PHP_FUNCTION(gzcompress); -PHP_FUNCTION(gzuncompress); - -#ifdef ZTS -#define ZLIBLS_D php_zlib_globals *zlib_globals -#define ZLIBG(v) (zlib_globals->v) -#define ZLIBLS_FETCH() php_zlib_globals *zlib_globals = ts_resource(zlib_globals_id) -#else -#define ZLIBLS_D -#define ZLIBG(v) (zlib_globals.v) -#define ZLIBLS_FETCH() -#endif - -#else -#define zlib_module_ptr NULL -#endif /* HAVE_ZLIB */ - -#define phpext_zlib_ptr zlib_module_ptr - -#endif /* PHP_ZLIB_H */ diff --git a/ext/zlib/setup.stub b/ext/zlib/setup.stub deleted file mode 100644 index 158978766c..0000000000 --- a/ext/zlib/setup.stub +++ /dev/null @@ -1,7 +0,0 @@ -# $Source$ -# $Id$ - -define_option with-zlib 'zlib (>= 1.0.9) support? ' yesnodir \ - 'no /usr zlib install' \ -' Whether to use the zlib support to read/write .gz-files.\n - Requires zlib version >= 1.0.9!' diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c deleted file mode 100644 index 4f52bb6553..0000000000 --- a/ext/zlib/zlib.c +++ /dev/null @@ -1,747 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | - | Stefan Röhrich <sr@linux.de> | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ -#define IS_EXT_MODULE - -#include "php.h" - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#ifdef PHP_WIN32 -#include <windows.h> -#include <winsock.h> -#define O_RDONLY _O_RDONLY -#include "win32/param.h" -#else -#include <sys/param.h> -/* #include <sys/uio.h> */ -#endif -#include "ext/standard/head.h" -#include "safe_mode.h" -#include "ext/standard/php_standard.h" -#include "ext/standard/info.h" -#include "php_zlib.h" -#include "fopen-wrappers.h" -#if HAVE_PWD_H -#ifdef PHP_WIN32 -#include "win32/pwd.h" -#else -#include <pwd.h> -#endif -#endif -#if HAVE_ZLIB -#if defined(HAVE_UNISTD_H) && defined(PHP_WIN32) -#undef HAVE_UNISTD_H -#endif - -#include <zlib.h> - -#ifdef COMPILE_DL_ZLIB -#ifndef PUTS -#define PUTS(a) php_printf("%s",a) -#endif -#ifndef PUTC -#define PUTC(a) PUTS(a) -#endif -#ifndef PHPWRITE -#define PHPWRITE(a,n) php_write((a),(n)) -#endif -#endif - -#ifdef ZTS -int zlib_globals_id; -#else -static php_zlib_globals zlib_globals; -#endif - - -/* True globals, no need for thread safety */ -static int le_zp; - -function_entry php_zlib_functions[] = { - PHP_FE(readgzfile, NULL) - PHP_FE(gzrewind, NULL) - PHP_FE(gzclose, NULL) - PHP_FE(gzeof, NULL) - PHP_FE(gzgetc, NULL) - PHP_FE(gzgets, NULL) - PHP_FE(gzgetss, NULL) - PHP_FE(gzread, NULL) - PHP_FE(gzopen, NULL) - PHP_FE(gzpassthru, NULL) - PHP_FE(gzseek, NULL) - PHP_FE(gztell, NULL) - PHP_FE(gzwrite, NULL) - PHP_FALIAS(gzputs, gzwrite, NULL) - PHP_FE(gzfile, NULL) - PHP_FE(gzcompress, NULL) - PHP_FE(gzuncompress, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry php_zlib_module_entry = { - "zlib", - php_zlib_functions, - PHP_MINIT(zlib), - PHP_MSHUTDOWN(zlib), - NULL, - NULL, - PHP_MINFO(zlib), - STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_ZLIB -ZEND_GET_MODULE(php_zlib) -#endif - -static void phpi_destructor_gzclose(gzFile *zp) { - (void)gzclose(zp); -} - -#ifdef ZTS -static void php_zlib_init_globals(ZLIBLS_D) -{ - ZLIBG(gzgetss_state) = 0; -} -#endif - -PHP_MINIT_FUNCTION(zlib) -{ -#ifdef ZTS - zlib_globals_id = ts_allocate_id(sizeof(php_zlib_globals), (ts_allocate_ctor) php_zlib_init_globals, NULL); -#else - ZLIBG(gzgetss_state)=0; -#endif - le_zp = register_list_destructors(phpi_destructor_gzclose,NULL); - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(zlib) -{ - return SUCCESS; -} - -PHP_MINFO_FUNCTION(zlib) -{ - php_info_print_table_start(); - php_info_print_table_row(2, "ZLib Support", "enabled"); - php_info_print_table_row(2, "Compiled Version", ZLIB_VERSION ); - php_info_print_table_row(2, "Linked Version", (char *)zlibVersion() ); - php_info_print_table_end(); -} - -static gzFile php_gzopen_wrapper(char *path, char *mode, int options) -{ - FILE *f; - int issock=0, socketd=0; - - f = php_fopen_wrapper(path, mode, options, &issock, &socketd, NULL); - - if (!f) { - return NULL; - } - return gzdopen(fileno(f), mode); -} - -/* {{{ proto array gzfile(string filename [, int use_include_path]) - Read und uncompress entire .gz-file into an array */ -PHP_FUNCTION(gzfile) { - pval **filename, **arg2; - gzFile zp; - char *slashed, buf[8192]; - register int i=0; - int use_include_path = 0; - PLS_FETCH(); - - /* check args */ - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1,&filename) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (zend_get_parameters_ex(2,&filename,&arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg2); - use_include_path = (*arg2)->value.lval?USE_PATH:0; - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_string_ex(filename); - - zp = php_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE); - if (!zp) { - php_error(E_WARNING,"gzFile(\"%s\") - %s",(*filename)->value.str.val,strerror(errno)); - RETURN_FALSE; - } - - /* Initialize return array */ - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - /* Now loop through the file and do the magic quotes thing if needed */ - memset(buf,0,8191); - while(gzgets(zp, buf, 8191) != NULL) { - if (PG(magic_quotes_runtime)) { - int len; - - slashed = php_addslashes(buf,0,&len,0); /* 0 = don't free source string */ - add_index_stringl(return_value, i++, slashed, len, 0); - } else { - add_index_string(return_value, i++, buf, 1); - } - } - gzclose(zp); -} -/* }}} */ - -/* {{{ proto int gzopen(string filename, string mode [, int use_include_path]) - Open a .gz-file and return a .gz-file pointer */ -PHP_FUNCTION(gzopen) { - pval **arg1, **arg2, **arg3; - gzFile *zp; - char *p; - int use_include_path = 0; - ZLIBLS_FETCH(); - - switch(ZEND_NUM_ARGS()) { - case 2: - if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (zend_get_parameters_ex(3,&arg1,&arg2,&arg3) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg3); - use_include_path = (*arg3)->value.lval?USE_PATH:0; - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_string_ex(arg1); - convert_to_string_ex(arg2); - p = estrndup((*arg2)->value.str.val,(*arg2)->value.str.len); - - /* - * We need a better way of returning error messages from - * php_gzopen_wrapper(). - */ - zp = php_gzopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE); - if (!zp) { - php_error(E_WARNING,"gzopen(\"%s\",\"%s\") - %s", - (*arg1)->value.str.val, p, strerror(errno)); - efree(p); - RETURN_FALSE; - } - ZLIBG(gzgetss_state)=0; - efree(p); - ZEND_REGISTER_RESOURCE(return_value, zp, le_zp); -} -/* }}} */ - -/* {{{ proto int gzclose(int zp) - Close an open .gz-file pointer */ -PHP_FUNCTION(gzclose) { - pval **arg1; - gzFile *zp; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - zend_list_delete((*arg1)->value.lval); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int gzeof(int zp) - Test for end-of-file on a .gz-file pointer */ -PHP_FUNCTION(gzeof) { - pval **arg1; - gzFile *zp; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - if ((gzeof(zp))) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto string gzgets(int zp, int length) - Get a line from .gz-file pointer */ -PHP_FUNCTION(gzgets) { - pval **arg1, **arg2; - gzFile *zp; - int len; - char *buf; - PLS_FETCH(); - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg2); - len = (*arg2)->value.lval; - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - buf = emalloc(sizeof(char) * (len + 1)); - /* needed because recv doesnt put a null at the end*/ - memset(buf,0,len+1); - if (!(gzgets(zp, buf, len) != NULL)) { - efree(buf); - RETVAL_FALSE; - } else { - if (PG(magic_quotes_runtime)) { - return_value->value.str.val = php_addslashes(buf,0,&return_value->value.str.len,1); - } else { - return_value->value.str.val = buf; - return_value->value.str.len = strlen(return_value->value.str.val); - } - return_value->type = IS_STRING; - } - return; -} -/* }}} */ - -/* {{{ proto string gzgetc(int zp) - Get a character from .gz-file pointer */ -PHP_FUNCTION(gzgetc) { - pval **arg1; - gzFile *zp; - int c; - char *buf; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - buf = emalloc(sizeof(char) * 2); - if ((c=gzgetc(zp)) == (-1)) { - efree(buf); - RETVAL_FALSE; - } else { - buf[0]=(char)c; - buf[1]='\0'; - return_value->value.str.val = buf; - return_value->value.str.len = 1; - return_value->type = IS_STRING; - } - return; -} -/* }}} */ - -/* Strip any HTML tags while reading */ -/* {{{ proto string gzgetss(int zp, int length [, string allowable_tags]) - Get a line from file pointer and strip HTML tags */ -PHP_FUNCTION(gzgetss) -{ - pval **fd, **bytes, **allow=NULL; - gzFile *zp; - int len; - char *buf; - char *allowed_tags=NULL; - int allowed_tags_len=0; - ZLIBLS_FETCH(); - - switch(ZEND_NUM_ARGS()) { - case 2: - if(zend_get_parameters_ex(2, &fd, &bytes) == FAILURE) { - RETURN_FALSE; - } - break; - case 3: - if(zend_get_parameters_ex(3, &fd, &bytes, &allow) == FAILURE) { - RETURN_FALSE; - } - convert_to_string_ex(allow); - allowed_tags = (*allow)->value.str.val; - allowed_tags_len = (*allow)->value.str.len; - break; - default: - WRONG_PARAM_COUNT; - /* NOTREACHED */ - break; - } - - convert_to_long_ex(bytes); - - len = (*bytes)->value.lval; - - ZEND_FETCH_RESOURCE(zp, gzFile *, fd, -1, "Zlib file", le_zp); - - buf = emalloc(sizeof(char) * (len + 1)); - /*needed because recv doesnt set null char at end*/ - memset(buf,0,len+1); - if (!(gzgets(zp, buf, len) != NULL)) { - efree(buf); - RETURN_FALSE; - } - - /* strlen() can be used here since we are doing it on the return of an fgets() anyway */ - php_strip_tags(buf, strlen(buf), ZLIBG(gzgetss_state), allowed_tags, allowed_tags_len); - RETURN_STRING(buf, 0); - -} -/* }}} */ - -/* {{{ proto int gzwrite(int zp, string str [, int length]) - Binary-safe .gz-file write */ -PHP_FUNCTION(gzwrite) { - pval **arg1, **arg2, **arg3=NULL; - gzFile *zp; - int ret; - int num_bytes; - PLS_FETCH(); - - switch (ZEND_NUM_ARGS()) { - case 2: - if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) { - RETURN_FALSE; - } - convert_to_string_ex(arg2); - num_bytes = (*arg2)->value.str.len; - break; - case 3: - if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3)==FAILURE) { - RETURN_FALSE; - } - convert_to_string_ex(arg2); - convert_to_long_ex(arg3); - num_bytes = MIN((*arg3)->value.lval, (*arg2)->value.str.len); - break; - default: - WRONG_PARAM_COUNT; - /* NOTREACHED */ - break; - } - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - /* strip slashes only if the length wasn't specified explicitly */ - if (!arg3 && PG(magic_quotes_runtime)) { - php_stripslashes((*arg2)->value.str.val,&num_bytes); - } - - ret = gzwrite(zp, (*arg2)->value.str.val,num_bytes); - RETURN_LONG(ret); -} -/* }}} */ - -/* {{{ proto int gzputs(int zp, string str [, int length]) - An alias for gzwrite */ -/* }}} */ - -/* {{{ proto int gzrewind(int zp) - Rewind the position of a .gz-file pointer */ -PHP_FUNCTION(gzrewind) { - pval **arg1; - gzFile *zp; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - gzrewind(zp); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int gztell(int zp) - Get .gz-file pointer's read/write position */ -PHP_FUNCTION(gztell) { - pval **arg1; - long pos; - gzFile *zp; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - pos = gztell(zp); - RETURN_LONG(pos); -} -/* }}} */ - -/* {{{ proto int gzseek(int zp, int offset) - Seek on a file pointer */ -PHP_FUNCTION(gzseek) { - pval **arg1, **arg2; - int ret; - gzFile *zp; - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg2); - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - ret = gzseek(zp, (*arg2)->value.lval, SEEK_SET); - RETURN_LONG(ret); -} -/* }}} */ - -/* - * Read a file and write the ouput to stdout - */ -/* {{{ proto int readgzfile(string filename [, int use_include_path]) - Output a .gz-file */ -PHP_FUNCTION(readgzfile) { - pval **arg1, **arg2; - char buf[8192]; - gzFile *zp; - int b, size; - int use_include_path = 0; - - - /* check args */ - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1,&arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg2); - use_include_path = (*arg2)->value.lval?USE_PATH:0; - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_string_ex(arg1); - - /* - * We need a better way of returning error messages from - * php_gzopen_wrapper(). - */ - zp = php_gzopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE); - if (!zp){ - php_error(E_WARNING,"ReadGzFile(\"%s\") - %s",(*arg1)->value.str.val,strerror(errno)); - RETURN_FALSE; - } - size= 0; - while((b = gzread(zp, buf, sizeof(buf))) > 0) { - PHPWRITE(buf,b); - size += b ; - } - gzclose(zp); - RETURN_LONG(size); -} -/* }}} */ - -/* - * Read to EOF on a file descriptor and write the output to stdout. - */ -/* {{{ proto int gzpassthru(int zp) - Output all remaining data from a .gz-file pointer */ -PHP_FUNCTION(gzpassthru) { - pval **arg1; - gzFile *zp; - char buf[8192]; - int size, b; - - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - size = 0; - while((b = gzread(zp, buf, sizeof(buf))) > 0) { - PHPWRITE(buf,b); - size += b ; - } -/* gzclose(zp); */ - zend_list_delete((*arg1)->value.lval); - RETURN_LONG(size); -} -/* }}} */ - -/* {{{ proto string gzread(int zp, int length) - - Binary-safe file read */ -PHP_FUNCTION(gzread) -{ - pval **arg1, **arg2; - gzFile *zp; - int len; - PLS_FETCH(); - - if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(arg2); - len = (*arg2)->value.lval; - - ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp); - - return_value->value.str.val = emalloc(sizeof(char) * (len + 1)); - /* needed because recv doesnt put a null at the end*/ - - return_value->value.str.len = gzread(zp, return_value->value.str.val, len); - return_value->value.str.val[return_value->value.str.len] = 0; - - if (PG(magic_quotes_runtime)) { - return_value->value.str.val = php_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1); - } - return_value->type = IS_STRING; -} - -/* }}} */ - - -/* {{{ proto string gzcompress(string data [,int level]) - gzip-compress a string */ -PHP_FUNCTION(gzcompress) -{ - zval **data, **zlimit = NULL; - int limit,status; - unsigned long l2; - char *s2; - - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, &data) == FAILURE) - WRONG_PARAM_COUNT; - limit=-1; - break; - case 2: - if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) - WRONG_PARAM_COUNT; - convert_to_long_ex(zlimit); - limit = (*zlimit)->value.lval; - if((limit<0)||(limit>9)) { - php_error(E_WARNING,"gzcompress: compression level must be whithin 0..9"); - RETURN_FALSE; - } - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_string_ex(data); - - l2 = (*data)->value.str.len + ((*data)->value.str.len/1000) + 15; - s2 = (char *) emalloc(l2); - if(! s2) RETURN_FALSE; - - if(limit>=0) { - status = compress2(s2,&l2,(*data)->value.str.val, (*data)->value.str.len,limit); - } else { - status = compress(s2,&l2,(*data)->value.str.val, (*data)->value.str.len); - } - - if(status==Z_OK) { - RETURN_STRINGL(s2, l2, 0); - } else { - efree(s2); - php_error(E_WARNING,"gzcompress: %s",zError(status)); - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto string gzuncompress(string data ,int length) - unzip a gzip-compressed string */ -PHP_FUNCTION(gzuncompress) -{ - zval **data, **zlimit = NULL; - int status,factor=1,maxfactor=8; - unsigned long plength=0,length; - char *s1=NULL,*s2=NULL; - - switch (ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters_ex(1, &data) == FAILURE) - WRONG_PARAM_COUNT; - length=0; - break; - case 2: - if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE) - WRONG_PARAM_COUNT; - convert_to_long_ex(zlimit); - if((*zlimit)->value.lval<=0) { - php_error(E_WARNING,"gzuncompress: length must be greater zero"); - RETURN_FALSE; - } - plength = (*zlimit)->value.lval; - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_string_ex(data); - - /* - zlib::uncompress() wants to know the output data length - if none was given as a parameter - we try from input length * 2 up to input length * 2^8 - doubling it whenever it wasn't big enough - that should be eneugh for all real life cases - */ - do { - length=plength?plength:(*data)->value.str.len*(1<<factor++); - s2 = (char *) erealloc(s1,length); - if(! s2) { if(s1) efree(s1); RETURN_FALSE; } - status = uncompress(s2, &length ,(*data)->value.str.val, (*data)->value.str.len); - s1=s2; - } while((status==Z_BUF_ERROR)&&(!plength)&&(factor<maxfactor)); - - if(status==Z_OK) { - s2 = erealloc(s2, length); - RETURN_STRINGL(s2, length, 0); - } else { - efree(s2); - php_error(E_WARNING,"gzuncompress: %s",zError(status)); - RETURN_FALSE; - } -} -/* }}} */ - - - -#endif /* HAVE_ZLIB */ -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/zlib/zlib.dsp b/ext/zlib/zlib.dsp deleted file mode 100644 index 4b280ae07f..0000000000 --- a/ext/zlib/zlib.dsp +++ /dev/null @@ -1,113 +0,0 @@ -# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=zlib - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zlib - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "zlib - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_ZLIB" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\zlib" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib zlibstat.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_zlib.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\zlib\Release"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_ZLIB" /D "DBNTWIN32" /D ZTS=1 /D MSSQL70=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\zlib" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"mssql-70"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib zlibstat.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_zlib.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\zlib\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "zlib - Win32 Release_TS"
-# Name "zlib - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zlib.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_zlib.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/zlib/zlib_win32_howto.txt b/ext/zlib/zlib_win32_howto.txt deleted file mode 100644 index 72e767ac5e..0000000000 --- a/ext/zlib/zlib_win32_howto.txt +++ /dev/null @@ -1,16 +0,0 @@ -Rules for building ZLIB ------------------------ - -The zlib project requires the folowing files: - -php_build\zlib\include\zlib.h -php_build\zlib\include\zconf.h -php_build\zlib\lib\zlibstat.lib - -php_build is a directory at the same level as php4. - -Start Visual Studio, load php_modules.dsw, select the ZLIB projects, and build -it. - - -
\ No newline at end of file |