[PHP-CVS] cvs: php4 / run-tests.php run-tests2.php /build buildcheck.sh /ext/gd gd.c php_gd.h /ext/iconv iconv.c php_iconv.h /ext/oci8 oci8.c php_oci8.h /ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h /ext/oracle oracle.c /ext/standard file.c formatted_print.c math.c php_ext_syslog.h php_math.h php_string.h php_versioning.h string.c syslog.c uniqid.c uniqid.h versioning.c /ext/xml php_xml.h xml.c /main build-defs.h.in php_ticks.c php_ticks.h snprintf.h /pear PEAR.php System.php package.dtd /pear/OS Guess.php /pear/PEAR Autoloader.php Builder.php Command.php Common.php Config.php Dependency.php Installer.php Packager.php Registry.php Remote.php /pear/PEAR/Command Auth.php Build.php Common.php Config.php Install.php Package.php Registry.php Remote.php /pear/PEAR/Frontend CLI.php /pear/scripts pear.in pearwin.php /sapi/apache php_apache.c php_apache_http.h sapi_apache.c /sapi/apache_hooks php_apache.c sapi_apache.c /sapi/cgi cgi_main.c ZendEngine2/RFCs 002.txt
ssb Tue Mar 18 07:06:10 2003 EDT Modified files: /php4 run-tests.php run-tests2.php /ZendEngine2/RFCs 002.txt /php4/build buildcheck.sh /php4/ext/gdgd.c php_gd.h /php4/ext/iconv iconv.c php_iconv.h /php4/ext/oci8 oci8.c php_oci8.h /php4/ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h /php4/ext/oracleoracle.c /php4/ext/standard file.c formatted_print.c math.c php_ext_syslog.h php_math.h php_string.h php_versioning.h string.c syslog.c uniqid.c uniqid.h versioning.c /php4/ext/xml php_xml.h xml.c /php4/main build-defs.h.in php_ticks.c php_ticks.h snprintf.h /php4/pear PEAR.php System.php package.dtd /php4/pear/OS Guess.php /php4/pear/PEAR Autoloader.php Builder.php Command.php Common.php Config.php Dependency.php Installer.php Packager.php Registry.php Remote.php /php4/pear/PEAR/Command Auth.php Build.php Common.php Config.php Install.php Package.php Registry.php Remote.php /php4/pear/PEAR/FrontendCLI.php /php4/pear/scripts pear.in pearwin.php /php4/sapi/apache php_apache.c php_apache_http.h sapi_apache.c /php4/sapi/apache_hooks php_apache.c sapi_apache.c /php4/sapi/cgi cgi_main.c Log: * email address change Index: php4/run-tests.php diff -u php4/run-tests.php:1.150 php4/run-tests.php:1.151 --- php4/run-tests.php:1.150Mon Mar 17 07:43:29 2003 +++ php4/run-tests.php Tue Mar 18 07:05:58 2003 @@ -18,7 +18,7 @@ | Marcus Boerger [EMAIL PROTECTED] | | Derick Rethans [EMAIL PROTECTED] | | Sander Roobol [EMAIL PROTECTED] | - | (based on version by: Stig Bakken [EMAIL PROTECTED]) | + | (based on version by: Stig Bakken [EMAIL PROTECTED]) | | (based on the PHP 3 test framework by Rasmus Lerdorf)| +--+ */ Index: php4/run-tests2.php diff -u php4/run-tests2.php:1.6 php4/run-tests2.php:1.7 --- php4/run-tests2.php:1.6 Sun Feb 16 19:19:16 2003 +++ php4/run-tests2.php Tue Mar 18 07:05:58 2003 @@ -19,7 +19,7 @@ | Derick Rethans [EMAIL PROTECTED] | | Sander Roobol [EMAIL PROTECTED] | | John Coggeshall [EMAIL PROTECTED] | - | (based on version by: Stig Bakken [EMAIL PROTECTED]) | + | (based on version by: Stig Bakken [EMAIL PROTECTED]) | | (based on the PHP 3 test framework by Rasmus Lerdorf)| +--+ */ Index: ZendEngine2/RFCs/002.txt diff -u ZendEngine2/RFCs/002.txt:1.2 ZendEngine2/RFCs/002.txt:1.3 --- ZendEngine2/RFCs/002.txt:1.2Sat Sep 8 07:17:25 2001 +++ ZendEngine2/RFCs/002.txtTue Mar 18 07:05:59 2003 @@ -1,7 +1,7 @@ Title: Zend 2.0 Namespaces -Version: $Revision: 1.2 $ +Version: $Revision: 1.3 $ Status: draft -Maintainer: Stig S. Bakken [EMAIL PROTECTED] +Maintainer: Stig S. Bakken [EMAIL PROTECTED] Created: 2001-09-08 Modified:2001-09-08 Index: php4/build/buildcheck.sh diff -u php4/build/buildcheck.sh:1.23 php4/build/buildcheck.sh:1.24 --- php4/build/buildcheck.sh:1.23 Tue Feb 11 16:11:42 2003 +++ php4/build/buildcheck.shTue Mar 18 07:05:59 2003 @@ -12,11 +12,11 @@ # | obtain it through the world-wide-web, please send a note to | # | [EMAIL PROTECTED] so we can mail you a copy immediately. | # +--+ -# | Authors: Stig Bakken [EMAIL PROTECTED] | +# | Authors: Stig Bakken [EMAIL PROTECTED] | # | Sascha Schumann [EMAIL PROTECTED]| # +--+ # -# $Id: buildcheck.sh,v 1.23 2003/02/11 21:11:42 sniper Exp $ +# $Id: buildcheck.sh,v 1.24 2003/03/18 12:05:59 ssb Exp $ # echo buildconf: checking installation... Index: php4/ext/gd/gd.c diff -u php4/ext/gd/gd.c:1.256 php4/ext/gd/gd.c:1.257 --- php4/ext/gd/gd.c:1.256 Mon Mar 17 08:50:27 2003 +++ php4/ext/gd/gd.cTue Mar 18 07:05:59 2003 @@ -13,12 +13,12 @@ | [EMAIL PROTECTED] so we can mail you a copy immediately. | +--+ | Authors: Rasmus Lerdorf [EMAIL PROTECTED] | - | Stig
Re: [PHP-CVS] cvs: php4 /sapi/apache2handler sapi_apache2.c
On Mon, 17 Mar 2003, Ian Holsman wrote: ianh Mon Mar 17 16:28:41 2003 EDT Modified files: /php4/sapi/apache2handler sapi_apache2.c Log: PR#22672 - User not logged under Apache2 patch provided by Andrew Bradford. -/* $Id: sapi_apache2.c,v 1.5 2003/03/07 13:45:33 iliaa Exp $ */ +/* $Id: sapi_apache2.c,v 1.6 2003/03/17 21:28:41 ianh Exp $ */ #include fcntl.h @@ -429,6 +429,7 @@ if (!PG(safe_mode)) { auth = apr_table_get(r-headers_in, Authorization); php_handle_auth_data(auth TSRMLS_CC); +ctx-r-user = apr_pstrdup(ctx-r-pool, SG(request_info).auth_user); } else { Please fix the indentation, we use tabs. Derick -- my other box is your windows PC - Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main streams.c
wez Tue Mar 18 09:41:47 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main streams.c Log: Fix my 64-bit casting fix. MFH Fix for #22721 - poor performance for file() on systems without mmap support. Index: php4/main/streams.c diff -u php4/main/streams.c:1.125.2.40 php4/main/streams.c:1.125.2.41 --- php4/main/streams.c:1.125.2.40 Mon Mar 17 17:26:51 2003 +++ php4/main/streams.c Tue Mar 18 09:41:46 2003 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: streams.c,v 1.125.2.40 2003/03/17 22:26:51 iliaa Exp $ */ +/* $Id: streams.c,v 1.125.2.41 2003/03/18 14:41:46 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -1075,6 +1075,7 @@ size_t len = 0, max_len; int step = CHUNK_SIZE; int min_room = CHUNK_SIZE / 4; + php_stream_statbuf ssbuf; #if HAVE_MMAP int srcfd; #endif @@ -1133,7 +1134,20 @@ } #endif - ptr = *buf = pemalloc_rel_orig(step, persistent); + /* avoid many reallocs by allocating a good sized chunk to begin with, if we can. +* Note that the stream may be filtered, in which case the stat result may be inaccurate, +* as the filter may inflate or deflate the number of bytes that we can read. +* In order to avoid an upsize followed by a downsize of the buffer, overestimate by the +* step size (which is 2K). +* */ + if (php_stream_stat(src, ssbuf) == 0 ssbuf.sb.st_size 0) { + max_len = ssbuf.sb.st_size + step; + } else { + max_len = step; + } + + ptr = *buf = pemalloc_rel_orig(max_len, persistent); + max_len = step; while((ret = php_stream_read(src, ptr, max_len - len))) { @@ -1536,7 +1550,7 @@ } if (ret) { fflush(data-file); - *(int**)ret = fd; + *(int*)ret = fd; } return SUCCESS; default: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/openssl xp_ssl.c /main/streams xp_socket.c
wez Tue Mar 18 10:15:10 2003 EDT Modified files: /php4/ext/openssl xp_ssl.c /php4/main/streams xp_socket.c Log: avoid unsigned issues. Index: php4/ext/openssl/xp_ssl.c diff -u php4/ext/openssl/xp_ssl.c:1.4 php4/ext/openssl/xp_ssl.c:1.5 --- php4/ext/openssl/xp_ssl.c:1.4 Fri Feb 28 14:53:20 2003 +++ php4/ext/openssl/xp_ssl.c Tue Mar 18 10:15:09 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.4 2003/02/28 19:53:20 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.5 2003/03/18 15:15:09 wez Exp $ */ #include php.h #include ext/standard/file.h @@ -122,7 +122,7 @@ static size_t php_openssl_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream-abstract; - size_t didwrite; + int didwrite; if (sslsock-ssl_active) { int retry = 1; @@ -141,9 +141,14 @@ didwrite = php_stream_socket_ops.write(stream, buf, count TSRMLS_CC); } - if (didwrite 0) + if (didwrite 0) { php_stream_notify_progress_increment(stream-context, didwrite, 0); + } + if (didwrite 0) { + didwrite = 0; + } + return didwrite; } @@ -174,8 +179,13 @@ nr_bytes = php_stream_socket_ops.read(stream, buf, count TSRMLS_CC); } - if (nr_bytes 0) + if (nr_bytes 0) { php_stream_notify_progress_increment(stream-context, nr_bytes, 0); + } + + if (nr_bytes 0) { + nr_bytes = 0; + } return nr_bytes; } Index: php4/main/streams/xp_socket.c diff -u php4/main/streams/xp_socket.c:1.8 php4/main/streams/xp_socket.c:1.9 --- php4/main/streams/xp_socket.c:1.8 Sat Mar 15 08:29:56 2003 +++ php4/main/streams/xp_socket.c Tue Mar 18 10:15:10 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_socket.c,v 1.8 2003/03/15 13:29:56 wez Exp $ */ +/* $Id: xp_socket.c,v 1.9 2003/03/18 15:15:10 wez Exp $ */ #include php.h #include ext/standard/file.h @@ -46,7 +46,7 @@ static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream-abstract; - size_t didwrite; + int didwrite; if (sock-socket == -1) { return 0; @@ -66,6 +66,10 @@ php_stream_notify_progress_increment(stream-context, didwrite, 0); } + if (didwrite 0) { + didwrite = 0; + } + return didwrite; } @@ -124,8 +128,13 @@ stream-eof = 1; } - if (nr_bytes 0) + if (nr_bytes 0) { php_stream_notify_progress_increment(stream-context, nr_bytes, 0); + } + + if (nr_bytes 0) { + nr_bytes = 0; + } return nr_bytes; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) / NEWS
wez Tue Mar 18 10:21:33 2003 EDT Modified files: (Branch: PHP_4_3) /php4 NEWS Log: BFN Index: php4/NEWS diff -u php4/NEWS:1.1247.2.148 php4/NEWS:1.1247.2.149 --- php4/NEWS:1.1247.2.148 Mon Mar 17 21:15:22 2003 +++ php4/NEWS Tue Mar 18 10:21:33 2003 @@ -32,6 +32,7 @@ - Fixed several 64-bit problems. (Dave) - Fixed several errors in hwapi extension. Objects weren't handled properly. (Uwe) - Fixed bug #22751 (Compile error in gdcache.c when external libgd is used). (Jani) +- Fixed bug #22721 (Poor file() performance on systems without mmap). (Wez) - Fixed bug #22709 (Crash in interbase when database unavailable). (Vladimir Michl) - Fixed bug #22681 (Crash when reading from invalid file pointer). (Ilia) - Fixed bug #22672 (User not logged under Apache2). (Ian) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/ftp ftp.c
sniper Tue Mar 18 12:30:32 2003 EDT Modified files: /php4/ext/ftp ftp.c Log: Fixed bug #22765 Index: php4/ext/ftp/ftp.c diff -u php4/ext/ftp/ftp.c:1.83 php4/ext/ftp/ftp.c:1.84 --- php4/ext/ftp/ftp.c:1.83 Fri Feb 28 16:03:35 2003 +++ php4/ext/ftp/ftp.c Tue Mar 18 12:30:32 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: ftp.c,v 1.83 2003/02/28 21:03:35 wez Exp $ */ +/* $Id: ftp.c,v 1.84 2003/03/18 17:30:32 sniper Exp $ */ #include php.h @@ -88,8 +88,7 @@ /* wrapper around send/recv to handle timeouts */ static int my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len); static int my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len); -static int my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, - int *addrlen); +static int my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen); /* reads a line the socket , returns true on success, false on error */ static int ftp_readline(ftpbuf_t *ftp); @@ -125,7 +124,7 @@ ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC) { ftpbuf_t*ftp; - int size; + socklen_tsize; struct timeval tv; @@ -148,7 +147,7 @@ size = sizeof(ftp-localaddr); memset(ftp-localaddr, 0, size); - if (getsockname(ftp-fd, (struct sockaddr*) ftp-localaddr, (unsigned int*)size) == -1) { + if (getsockname(ftp-fd, (struct sockaddr*) ftp-localaddr, size) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, getsockname failed: %s (%d)\n, strerror(errno), errno); goto bail; } @@ -662,7 +661,7 @@ char*ptr; union ipbox ipbox; unsigned long b[6]; - int n; + socklen_t n; struct sockaddr *sa; struct sockaddr_in *sin; @@ -1320,7 +1319,7 @@ /* {{{ my_accept */ int -my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, int *addrlen) +my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrlen) { fd_set accept_set; struct timeval tv; @@ -1341,7 +1340,7 @@ return -1; } - return accept(s, addr, (unsigned int*)addrlen); + return accept(s, addr, addrlen); } /* }}} */ @@ -1354,7 +1353,7 @@ databuf_t *data; php_sockaddr_storage addr; struct sockaddr *sa; - int size; + socklen_t size; union ipbox ipbox; chararg[sizeof(255, 255, 255, 255, 255, 255)]; struct timeval tv; @@ -1410,7 +1409,7 @@ goto bail; } - if (getsockname(fd, (struct sockaddr*) addr, (unsigned int*)size) == -1) { + if (getsockname(fd, (struct sockaddr*) addr, size) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, getsockname() failed: %s (%d)\n, strerror(errno), errno); goto bail; } @@ -1473,7 +1472,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp) { php_sockaddr_storage addr; - int size; + socklen_t size; #if HAVE_OPENSSL_EXT SSL_CTX *ctx; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /ext/ftp ftp.c
sniper Tue Mar 18 12:31:55 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/ftp ftp.c Log: MFH: fix for bug #22765 Index: php4/ext/ftp/ftp.c diff -u php4/ext/ftp/ftp.c:1.68.2.5 php4/ext/ftp/ftp.c:1.68.2.6 --- php4/ext/ftp/ftp.c:1.68.2.5 Thu Feb 13 17:18:20 2003 +++ php4/ext/ftp/ftp.c Tue Mar 18 12:31:55 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: ftp.c,v 1.68.2.5 2003/02/13 22:18:20 pollita Exp $ */ +/* $Id: ftp.c,v 1.68.2.6 2003/03/18 17:31:55 sniper Exp $ */ #include php.h @@ -79,8 +79,7 @@ /* wrapper around send/recv to handle timeouts */ static int my_send(ftpbuf_t *ftp, int s, void *buf, size_t len); static int my_recv(ftpbuf_t *ftp, int s, void *buf, size_t len); -static int my_accept(ftpbuf_t *ftp, int s, struct sockaddr *addr, - int *addrlen); +static int my_accept(ftpbuf_t *ftp, int s, struct sockaddr *addr, socklen_t *addrlen); /* reads a line the socket , returns true on success, false on error */ static int ftp_readline(ftpbuf_t *ftp); @@ -116,7 +115,7 @@ ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC) { ftpbuf_t*ftp; - int size; + socklen_tsize; struct timeval tv; @@ -137,7 +136,7 @@ size = sizeof(ftp-localaddr); memset(ftp-localaddr, 0, size); - if (getsockname(ftp-fd, (struct sockaddr*) ftp-localaddr, (unsigned int*)size) == -1) { + if (getsockname(ftp-fd, (struct sockaddr*) ftp-localaddr, size) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, getsockname failed: %s (%d)\n, strerror(errno), errno); goto bail; } @@ -560,7 +559,7 @@ char*ptr; union ipbox ipbox; unsigned long b[6]; - int n; + socklen_t n; struct sockaddr *sa; struct sockaddr_in *sin; @@ -1203,7 +1202,7 @@ /* {{{ my_accept */ int -my_accept(ftpbuf_t *ftp, int s, struct sockaddr *addr, int *addrlen) +my_accept(ftpbuf_t *ftp, int s, struct sockaddr *addr, socklen_t *addrlen) { fd_set accept_set; struct timeval tv; @@ -1223,7 +1222,7 @@ return -1; } - return accept(s, addr, (unsigned int*)addrlen); + return accept(s, addr, addrlen); } /* }}} */ @@ -1236,7 +1235,7 @@ databuf_t *data; php_sockaddr_storage addr; struct sockaddr *sa; - int size; + socklen_t size; union ipbox ipbox; chararg[sizeof(255, 255, 255, 255, 255, 255)]; struct timeval tv; @@ -1292,7 +1291,7 @@ goto bail; } - if (getsockname(fd, (struct sockaddr*) addr, (unsigned int*)size) == -1) { + if (getsockname(fd, (struct sockaddr*) addr, size) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, getsockname() failed: %s (%d)\n, strerror(errno), errno); goto bail; } @@ -1352,7 +1351,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp) { php_sockaddr_storage addr; - int size; + socklen_t size; #if HAVE_OPENSSL_EXT SSL_CTX *ctx; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gdxpm.c
iliaa Tue Mar 18 13:29:10 2003 EDT Modified files: /php4/ext/gd/libgd gdxpm.c Log: Cleanup. Index: php4/ext/gd/libgd/gdxpm.c diff -u php4/ext/gd/libgd/gdxpm.c:1.4 php4/ext/gd/libgd/gdxpm.c:1.5 --- php4/ext/gd/libgd/gdxpm.c:1.4 Sun Dec 1 06:43:54 2002 +++ php4/ext/gd/libgd/gdxpm.c Tue Mar 18 13:29:10 2003 @@ -15,123 +15,125 @@ #include X11/xpm.h -gdImagePtr -gdImageCreateFromXpm (char *filename) +gdImagePtr gdImageCreateFromXpm (char *filename) { - XpmInfo info; - XpmImage image; - int i, j, k, number; - char buf[5]; - gdImagePtr im = 0; - char *apixel; - int *pointer; - int red = 0, green = 0, blue = 0; - int *colors; - int ret; - - ret = XpmReadFileToXpmImage (filename, image, info); - if (ret != XpmSuccess) -return 0; - - if (!(im = gdImageCreate (image.width, image.height))) -return 0; - - number = image.ncolors; - colors = (int *) gdMalloc (sizeof (int) * number); - for (i = 0; i number; i++) -{ - switch (strlen (image.colorTable[i].c_color)) - { - case 4: - buf[1] = '\0'; - buf[0] = image.colorTable[i].c_color[1]; - red = strtol (buf, NULL, 16); - - buf[0] = image.colorTable[i].c_color[3]; - green = strtol (buf, NULL, 16); - - buf[0] = image.colorTable[i].c_color[5]; - blue = strtol (buf, NULL, 16); - break; - case 7: - buf[2] = '\0'; - buf[0] = image.colorTable[i].c_color[1]; - buf[1] = image.colorTable[i].c_color[2]; - red = strtol (buf, NULL, 16); - - buf[0] = image.colorTable[i].c_color[3]; - buf[1] = image.colorTable[i].c_color[4]; - green = strtol (buf, NULL, 16); - - buf[0] = image.colorTable[i].c_color[5]; - buf[1] = image.colorTable[i].c_color[6]; - blue = strtol (buf, NULL, 16); - break; - case 10: - buf[3] = '\0'; - buf[0] = image.colorTable[i].c_color[1]; - buf[1] = image.colorTable[i].c_color[2]; - buf[2] = image.colorTable[i].c_color[3]; - red = strtol (buf, NULL, 16); - red /= 64; - - buf[0] = image.colorTable[i].c_color[4]; - buf[1] = image.colorTable[i].c_color[5]; - buf[2] = image.colorTable[i].c_color[6]; - green = strtol (buf, NULL, 16); - green /= 64; - - buf[0] = image.colorTable[i].c_color[7]; - buf[1] = image.colorTable[i].c_color[8]; - buf[2] = image.colorTable[i].c_color[9]; - blue = strtol (buf, NULL, 16); - blue /= 64; - break; - case 13: - buf[4] = '\0'; - buf[0] = image.colorTable[i].c_color[1]; - buf[1] = image.colorTable[i].c_color[2]; - buf[2] = image.colorTable[i].c_color[3]; - buf[3] = image.colorTable[i].c_color[4]; - red = strtol (buf, NULL, 16); - red /= 256; - - buf[0] = image.colorTable[i].c_color[5]; - buf[1] = image.colorTable[i].c_color[6]; - buf[2] = image.colorTable[i].c_color[7]; - buf[3] = image.colorTable[i].c_color[8]; - green = strtol (buf, NULL, 16); - green /= 256; - - buf[0] = image.colorTable[i].c_color[9]; - buf[1] = image.colorTable[i].c_color[10]; - buf[2] = image.colorTable[i].c_color[11]; - buf[3] = image.colorTable[i].c_color[12]; - blue = strtol (buf, NULL, 16); - blue /= 256; - break; + XpmInfo info; + XpmImage image; + int i, j, k, number; + char buf[5]; + gdImagePtr im = 0; + char *apixel; + int *pointer; + int red = 0, green = 0, blue = 0; + int *colors; + int ret; + + ret = XpmReadFileToXpmImage(filename, image, info); + if (ret != XpmSuccess) { + return 0; } + if (!(im = gdImageCreate(image.width, image.height))) { + return 0; + } - colors[i] = gdImageColorResolve (im, red, green, blue); - if (colors[i] == -1) - php_gd_error(ARRRGH\n); -} - - apixel = (char *) gdMalloc (image.cpp + 1); - apixel[image.cpp] = '\0'; - - pointer = (int *) image.data; - for (i = 0; i image.height; i++) -{ - for (j = 0; j image.width; j++) - { - k = *pointer++; - gdImageSetPixel (im, j, i, colors[k]); + number = image.ncolors; + colors = (int *) gdMalloc (sizeof (int) * number); + for (i = 0; i number; i++) { + switch (strlen (image.colorTable[i].c_color)) { + case 4: + buf[1] = '\0'; + buf[0] = image.colorTable[i].c_color[1]; + red = strtol(buf, NULL, 16); + + buf[0] = image.colorTable[i].c_color[3]; + green = strtol(buf, NULL, 16); + + buf[0] = image.colorTable[i].c_color[5]; +
Re: [PHP-CVS] cvs: php4 /ext/openssl xp_ssl.c /main/streams xp_socket.c
On Tue, Mar 18, 2003 at 03:15:10PM -, Wez Furlong wrote: wez Tue Mar 18 10:15:10 2003 EDT Modified files: /php4/ext/openssl xp_ssl.c /php4/main/streamsxp_socket.c Log: avoid unsigned issues. [...] - if (didwrite 0) + if (didwrite 0) { php_stream_notify_progress_increment(stream-context, didwrite, 0); + } + if (didwrite 0) { + didwrite = 0; + } [...] + if (nr_bytes 0) { php_stream_notify_progress_increment(stream-context, nr_bytes, 0); + } + + if (nr_bytes 0) { + nr_bytes = 0; + } [...] + if (nr_bytes 0) { php_stream_notify_progress_increment(stream-context, nr_bytes, 0); + } + + if (nr_bytes 0) { + nr_bytes = 0; + } Would it be preferable to use 'else if's in these cases, instead? if (nr_bytes 0) { php_stream_notify_progress_increment(stream-context, nr_bytes, 0); } else if (nr_bytes 0) { nr_bytes = 0; } -- Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard info.c /main SAPI.h /sapi/cli php_cli.c
helly Tue Mar 18 15:52:52 2003 EDT Modified files: /php4/ext/standard info.c /php4/main SAPI.h /php4/sapi/cli php_cli.c Log: make phpinfo() depend on executed sapi Index: php4/ext/standard/info.c diff -u php4/ext/standard/info.c:1.228 php4/ext/standard/info.c:1.229 --- php4/ext/standard/info.c:1.228 Sun Mar 2 08:35:01 2003 +++ php4/ext/standard/info.cTue Mar 18 15:52:51 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: info.c,v 1.228 2003/03/02 13:35:01 zeev Exp $ */ +/* $Id: info.c,v 1.229 2003/03/18 20:52:51 helly Exp $ */ #include php.h #include php_ini.h @@ -48,7 +48,7 @@ ZEND_EXTERN_MODULE_GLOBALS(iconv) #endif -#define SECTION(name) if (PG(html_errors)) { \ +#define SECTION(name) if (!sapi_module.phpinfo_as_text) { \ PUTS(h2 name /h2\n); \ } else { \ php_info_print_table_start(); \ @@ -66,7 +66,7 @@ int show_info_func = *((int *) arg); if (show_info_func module-info_func) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf(h2a name=\module_%s\%s/a/h2\n, module-name, module-name); } else { php_info_print_table_start(); @@ -75,7 +75,7 @@ } module-info_func(module TSRMLS_CC); } else if (!show_info_func !module-info_func) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { php_printf(tr); php_printf(td); php_printf(%s, module-name); @@ -105,7 +105,7 @@ (Z_TYPE_PP(data)==IS_ARRAY)) { zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); while (zend_hash_get_current_data(Z_ARRVAL_PP(data), (void **) tmp) == SUCCESS) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS(tr); PUTS(td class=\e\); @@ -116,7 +116,7 @@ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), string_key, string_len, num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { elem_esc = php_info_html_esc(string_key TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); @@ -129,24 +129,24 @@ break; } PUTS(\]); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS(/tdtd class=\v\); } else { PUTS( = ); } if (Z_TYPE_PP(tmp) == IS_ARRAY) { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS(pre); } zend_print_zval_r(*tmp, 0 TSRMLS_CC); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { PUTS(/pre); } } else if (Z_TYPE_PP(tmp) != IS_STRING) { tmp2 = **tmp; zval_copy_ctor(tmp2); convert_to_string(tmp2); - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { if (Z_STRLEN(tmp2) == 0) { PUTS(ino value/i); } else { @@ -159,7 +159,7 @@ } zval_dtor(tmp2); } else { - if (PG(html_errors)) { + if (!sapi_module.phpinfo_as_text) { if (Z_STRLEN_PP(tmp) == 0) { PUTS(ino value/i); } else { @@ -171,7 +171,7 @@ PUTS(Z_STRVAL_PP(tmp)); } } - if (PG(html_errors)) { +
Re: [PHP-CVS] cvs: php4 /ext/openssl xp_ssl.c /main/streamsxp_socket.c
Possibly, although I plan to revise the notify_progress_increment() stuff someday soon, so I'm happy to leave things as they are for the moment. --Wez. On Tue, 18 Mar 2003, Jon Parise wrote: - if (didwrite 0) + if (didwrite 0) { php_stream_notify_progress_increment(stream-context, didwrite, 0); + } + if (didwrite 0) { + didwrite = 0; + } Would it be preferable to use 'else if's in these cases, instead? if (nr_bytes 0) { php_stream_notify_progress_increment(stream-context, nr_bytes, 0); } else if (nr_bytes 0) { nr_bytes = 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard browscap.c
jay Tue Mar 18 16:49:02 2003 EDT Modified files: /php4/ext/standard browscap.c Log: get_browser() needs to use zend_is_auto_global() on _SERVER. Index: php4/ext/standard/browscap.c diff -u php4/ext/standard/browscap.c:1.69 php4/ext/standard/browscap.c:1.70 --- php4/ext/standard/browscap.c:1.69 Fri Mar 14 12:54:38 2003 +++ php4/ext/standard/browscap.cTue Mar 18 16:49:01 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: browscap.c,v 1.69 2003/03/14 17:54:38 jay Exp $ */ +/* $Id: browscap.c,v 1.70 2003/03/18 21:49:01 jay Exp $ */ #include php.h #include php_regex.h @@ -244,6 +244,7 @@ } if (agent_name == NULL || Z_TYPE_PP(agent_name) == IS_NULL) { + zend_is_auto_global(_SERVER, sizeof(_SERVER)-1 TSRMLS_CC); if (!PG(http_globals)[TRACK_VARS_SERVER] || zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]-value.ht, HTTP_USER_AGENT, sizeof(HTTP_USER_AGENT), (void **) agent_name)==FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, HTTP_USER_AGENT variable is not set, cannot determine user agent name); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main streams.c
wez Tue Mar 18 17:25:03 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main streams.c Log: WS Fix: I forgot to apply Q} to my comment. Index: php4/main/streams.c diff -u php4/main/streams.c:1.125.2.42 php4/main/streams.c:1.125.2.43 --- php4/main/streams.c:1.125.2.42 Tue Mar 18 11:39:06 2003 +++ php4/main/streams.c Tue Mar 18 17:25:02 2003 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: streams.c,v 1.125.2.42 2003/03/18 16:39:06 wez Exp $ */ +/* $Id: streams.c,v 1.125.2.43 2003/03/18 22:25:02 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -1136,12 +1136,12 @@ } #endif - /* avoid many reallocs by allocating a good sized chunk to begin with, if we can. -* Note that the stream may be filtered, in which case the stat result may be inaccurate, -* as the filter may inflate or deflate the number of bytes that we can read. -* In order to avoid an upsize followed by a downsize of the buffer, overestimate by the -* step size (which is 2K). -* */ + /* avoid many reallocs by allocating a good sized chunk to begin with, if +* we can. Note that the stream may be filtered, in which case the stat +* result may be inaccurate, as the filter may inflate or deflate the +* number of bytes that we can read. In order to avoid an upsize followed +* by a downsize of the buffer, overestimate by the step size (which is +* 2K). */ if (php_stream_stat(src, ssbuf) == 0 ssbuf.sb.st_size 0) { max_len = ssbuf.sb.st_size + step; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /main/streams streams.c
wez Tue Mar 18 17:26:03 2003 EDT Modified files: /php4/main/streams streams.c Log: Q} Index: php4/main/streams/streams.c diff -u php4/main/streams/streams.c:1.11 php4/main/streams/streams.c:1.12 --- php4/main/streams/streams.c:1.11Tue Mar 18 09:35:01 2003 +++ php4/main/streams/streams.c Tue Mar 18 17:26:02 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.11 2003/03/18 14:35:01 wez Exp $ */ +/* $Id: streams.c,v 1.12 2003/03/18 22:26:02 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -1131,12 +1131,12 @@ } } - /* avoid many reallocs by allocating a good sized chunk to begin with, if we can. -* Note that the stream may be filtered, in which case the stat result may be inaccurate, -* as the filter may inflate or deflate the number of bytes that we can read. -* In order to avoid an upsize followed by a downsize of the buffer, overestimate by the -* step size (which is 2K). -* */ + /* avoid many reallocs by allocating a good sized chunk to begin with, if +* we can. Note that the stream may be filtered, in which case the stat +* result may be inaccurate, as the filter may inflate or deflate the +* number of bytes that we can read. In order to avoid an upsize followed +* by a downsize of the buffer, overestimate by the step size (which is +* 2K). */ if (php_stream_stat(src, ssbuf) == 0 ssbuf.sb.st_size 0) { max_len = ssbuf.sb.st_size + step; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main main.c
helly Tue Mar 18 17:43:00 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main main.c Log: MFH Index: php4/main/main.c diff -u php4/main/main.c:1.512.2.18 php4/main/main.c:1.512.2.19 --- php4/main/main.c:1.512.2.18 Mon Mar 17 08:50:22 2003 +++ php4/main/main.cTue Mar 18 17:43:00 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: main.c,v 1.512.2.18 2003/03/17 13:50:22 wez Exp $ */ +/* $Id: main.c,v 1.512.2.19 2003/03/18 22:43:00 helly Exp $ */ /* {{{ includes */ @@ -292,7 +292,7 @@ STD_PHP_INI_BOOLEAN(display_startup_errors, 0,PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(enable_dl,1, PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(expose_php, 1, PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals) - STD_PHP_INI_ENTRY(docref_root, http://www.php.net/;, PHP_INI_ALL, OnUpdateString, docref_root,php_core_globals, core_globals) + STD_PHP_INI_ENTRY(docref_root,, PHP_INI_ALL,OnUpdateString, docref_root, php_core_globals, core_globals) STD_PHP_INI_ENTRY(docref_ext, , PHP_INI_ALL,OnUpdateString, docref_ext, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(html_errors, 1, PHP_INI_ALL,OnUpdateBool, html_errors, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN(xmlrpc_errors,0, PHP_INI_SYSTEM, OnUpdateBool, xmlrpc_errors, php_core_globals, core_globals) @@ -508,7 +508,10 @@ } } } - if (PG(html_errors)) { + if (!PG(html_errors) || !strlen(PG(docref_root))) { + /* no docref and no html errors - do not point to any documentation (e.g. production boxes) */ + php_error(type, %s(%s): %s, get_active_function_name(TSRMLS_C), params, buffer); + } else if (PG(html_errors)) { php_error(type, %s(%s) [a href='%s%s%s'%s/a]: %s, get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, docref, buffer); } else { php_error(type, %s(%s) [%s%s%s]: %s, get_active_function_name(TSRMLS_C), params, docref_root, docref, docref_target, buffer); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/standard php_fopen_wrapper.c /main php_streams.h /main/streams php_stream_plain_wrapper.h plain_wrapper.c
wez Tue Mar 18 18:37:54 2003 EDT Modified files: /php4/ext/standard php_fopen_wrapper.c /php4/main php_streams.h /php4/main/streams php_stream_plain_wrapper.h plain_wrapper.c Log: Implement persistent plain file streams. Usage: php_stream *stream = php_stream_fopen(/path/to/file, r+b, NULL, STREAM_OPEN_PERSISTENT | ENFORCE_SAFE_MODE | REPORT_ERRORS); the filename and mode are combined to form the hash key for the persistent list; they must be identical for this same stream to be returned again in the next request. Calling php_stream_close() on a persistent stream *will* close it, as is usual with all persistent resources in PHP/ZE. This is deliberately *not* exposed to user-space PHP at this time. Index: php4/ext/standard/php_fopen_wrapper.c diff -u php4/ext/standard/php_fopen_wrapper.c:1.36 php4/ext/standard/php_fopen_wrapper.c:1.37 --- php4/ext/standard/php_fopen_wrapper.c:1.36 Tue Mar 18 11:40:28 2003 +++ php4/ext/standard/php_fopen_wrapper.c Tue Mar 18 18:37:53 2003 @@ -17,7 +17,7 @@ | Hartmut Holzgraefe [EMAIL PROTECTED] | +--+ */ -/* $Id: php_fopen_wrapper.c,v 1.36 2003/03/18 16:40:28 wez Exp $ */ +/* $Id: php_fopen_wrapper.c,v 1.37 2003/03/18 23:37:53 wez Exp $ */ #include stdio.h #include stdlib.h @@ -218,7 +218,7 @@ return NULL; } - stream = php_stream_fopen_from_fd(fd, mode); + stream = php_stream_fopen_from_fd(fd, mode, NULL); if (stream == NULL) { close(fd); } Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.76 php4/main/php_streams.h:1.77 --- php4/main/php_streams.h:1.76Thu Feb 27 14:10:23 2003 +++ php4/main/php_streams.h Tue Mar 18 18:37:54 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.76 2003/02/27 19:10:23 wez Exp $ */ +/* $Id: php_streams.h,v 1.77 2003/03/18 23:37:54 wez Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -64,7 +64,7 @@ #define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) _php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_fopen_from_fd_rel(fd, mode) _php_stream_fopen_from_fd((fd), (mode) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_from_fd_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC) #define php_stream_fopen_from_file_rel(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC TSRMLS_CC) #define php_stream_fopen_from_pipe_rel(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC TSRMLS_CC) @@ -436,6 +436,9 @@ /* don't apply open_basedir checks */ #define STREAM_DISABLE_OPEN_BASEDIR1024 + +/* get (or create) a persistent version of the stream */ +#define STREAM_OPEN_PERSISTENT 2048 /* Antique - no longer has meaning */ #define IGNORE_URL_WIN 0 Index: php4/main/streams/php_stream_plain_wrapper.h diff -u php4/main/streams/php_stream_plain_wrapper.h:1.2 php4/main/streams/php_stream_plain_wrapper.h:1.3 --- php4/main/streams/php_stream_plain_wrapper.h:1.2Wed Feb 19 03:40:19 2003 +++ php4/main/streams/php_stream_plain_wrapper.hTue Mar 18 18:37:54 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_stream_plain_wrapper.h,v 1.2 2003/02/19 08:40:19 sniper Exp $ */ +/* $Id: php_stream_plain_wrapper.h,v 1.3 2003/03/18 23:37:54 wez Exp $ */ /* definitions for the plain files wrapper */ @@ -33,8 +33,8 @@ PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); #define php_stream_fopen_from_file(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_CC TSRMLS_CC) -PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_from_fd(fd, mode) _php_stream_fopen_from_fd((fd), (mode) STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC); +#define php_stream_fopen_from_fd(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC) PHPAPI php_stream *_php_stream_fopen_from_pipe(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); #define php_stream_fopen_from_pipe(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_CC TSRMLS_CC) Index: php4/main/streams/plain_wrapper.c diff -u php4/main/streams/plain_wrapper.c:1.11 php4/main/streams/plain_wrapper.c:1.12 --- php4/main/streams/plain_wrapper.c:1.11 Tue Mar 18 11:40:29 2003 +++ php4/main/streams/plain_wrapper.c Tue Mar 18 18:37:54 2003
[PHP-CVS] cvs: php4(PHP_4_3) /main php_streams.h streams.c
wez Tue Mar 18 18:39:31 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main php_streams.h streams.c Log: Manual merge of the persistent plain file streams code. See http://news.php.net/article.php?group=php.cvsarticle=19680 for more information. Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.61.2.9 php4/main/php_streams.h:1.61.2.10 --- php4/main/php_streams.h:1.61.2.9Tue Mar 18 11:39:06 2003 +++ php4/main/php_streams.h Tue Mar 18 18:39:31 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.61.2.9 2003/03/18 16:39:06 wez Exp $ */ +/* $Id: php_streams.h,v 1.61.2.10 2003/03/18 23:39:31 wez Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -65,7 +65,7 @@ #define php_stream_fopen_with_path_rel(filename, mode, path, opened, options) _php_stream_fopen_with_path((filename), (mode), (path), (opened), (options) STREAMS_REL_CC TSRMLS_CC) #define php_stream_fopen_from_file_rel(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_REL_CC TSRMLS_CC) -#define php_stream_fopen_from_fd_rel(fd, mode) _php_stream_fopen_from_fd((fd), (mode) STREAMS_REL_CC TSRMLS_CC) +#define php_stream_fopen_from_fd_rel(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_REL_CC TSRMLS_CC) #define php_stream_fopen_from_pipe_rel(file, mode) _php_stream_fopen_from_pipe((file), (mode) STREAMS_REL_CC TSRMLS_CC) @@ -440,8 +440,8 @@ PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC); #define php_stream_fopen_with_path(filename, mode, path, opened) _php_stream_fopen_with_path((filename), (mode), (path), (opened) STREAMS_CC TSRMLS_CC) -PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode STREAMS_DC TSRMLS_DC); -#define php_stream_fopen_from_fd(fd, mode) _php_stream_fopen_from_fd((fd), (mode) STREAMS_CC TSRMLS_CC) +PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const char *persistent_id STREAMS_DC TSRMLS_DC); +#define php_stream_fopen_from_fd(fd, mode, persistent_id) _php_stream_fopen_from_fd((fd), (mode), (persistent_id) STREAMS_CC TSRMLS_CC) PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); #define php_stream_fopen_from_file(file, mode) _php_stream_fopen_from_file((file), (mode) STREAMS_CC TSRMLS_CC) @@ -510,6 +510,9 @@ /* if set, skip open_basedir checks */ #define STREAM_DISABLE_OPEN_BASEDIR1024 + +/* get (or create) a persistent version of the stream */ +#define STREAM_OPEN_PERSISTENT 2048 /* Antique - no longer has meaning */ #define IGNORE_URL_WIN 0 Index: php4/main/streams.c diff -u php4/main/streams.c:1.125.2.43 php4/main/streams.c:1.125.2.44 --- php4/main/streams.c:1.125.2.43 Tue Mar 18 17:25:02 2003 +++ php4/main/streams.c Tue Mar 18 18:39:31 2003 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: streams.c,v 1.125.2.43 2003/03/18 22:25:02 wez Exp $ */ +/* $Id: streams.c,v 1.125.2.44 2003/03/18 23:39:31 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -1295,7 +1295,7 @@ int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC); if (fd != -1) { - php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b); + php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b, NULL); if (stream) { return stream; } @@ -1314,7 +1314,7 @@ int fd = php_open_temporary_fd(NULL, php, opened_path TSRMLS_CC); if (fd != -1) { - php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b); + php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b, NULL); if (stream) { php_stdio_stream_data *self = (php_stdio_stream_data*)stream-abstract; @@ -1465,6 +1465,7 @@ } if (data-temp_file_name) { unlink(data-temp_file_name); + /* temporary streams are never persistent */ efree(data-temp_file_name); } } else { @@ -1472,8 +1473,7 @@ data-file = NULL; } - /* STDIO streams are never persistent! */ - efree(data); + pefree(data, stream-is_persistent); return ret; } @@ -1875,7 +1875,9 @@ struct stat st; int open_flags; int fd; - php_stream *ret; + php_stream *ret = NULL; + int persistent = options STREAM_OPEN_PERSISTENT; + char *persistent_id = NULL; if (FAILURE == php_stream_parse_fopen_modes(mode, open_flags)) { if (options REPORT_ERRORS) { @@ -1886,6 +1888,25 @@ realpath
[PHP-CVS] cvs: php4 /main/streams streams.c
wez Tue Mar 18 19:17:15 2003 EDT Modified files: /php4/main/streams streams.c Log: Sanity check for when a stream is requested to be persistent but the wrapper does not respect the flag. Index: php4/main/streams/streams.c diff -u php4/main/streams/streams.c:1.12 php4/main/streams/streams.c:1.13 --- php4/main/streams/streams.c:1.12Tue Mar 18 17:26:02 2003 +++ php4/main/streams/streams.c Tue Mar 18 19:17:15 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.12 2003/03/18 22:26:02 wez Exp $ */ +/* $Id: streams.c,v 1.13 2003/03/19 00:17:15 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -1461,6 +1461,15 @@ stream = wrapper-wops-stream_opener(wrapper, path_to_open, mode, options ^ REPORT_ERRORS, opened_path, context STREAMS_REL_CC TSRMLS_CC); + + /* if the caller asked for a persistent stream but the wrapper did not +* return one, force an error here */ + if (stream (options STREAM_OPEN_PERSISTENT) !stream-is_persistent) { + php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, + wrapper does not support persistent streams); + php_stream_close(stream); + stream = NULL; + } if (stream) { stream-wrapper = wrapper; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main streams.c
wez Tue Mar 18 19:18:12 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main streams.c Log: Manual merge of persistent stream sanity check from php5. Index: php4/main/streams.c diff -u php4/main/streams.c:1.125.2.44 php4/main/streams.c:1.125.2.45 --- php4/main/streams.c:1.125.2.44 Tue Mar 18 18:39:31 2003 +++ php4/main/streams.c Tue Mar 18 19:18:12 2003 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: streams.c,v 1.125.2.44 2003/03/18 23:39:31 wez Exp $ */ +/* $Id: streams.c,v 1.125.2.45 2003/03/19 00:18:12 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -2552,6 +2552,16 @@ stream = wrapper-wops-stream_opener(wrapper, path_to_open, mode, options ^ REPORT_ERRORS, opened_path, context STREAMS_REL_CC TSRMLS_CC); + + /* if the caller asked for a persistent stream but the wrapper did not +* return one, force an error here */ + if (stream (options STREAM_OPEN_PERSISTENT) !stream-is_persistent) { + php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS TSRMLS_CC, + wrapper does not support persistent streams); + php_stream_close(stream); + stream = NULL; + } + if (stream) stream-wrapper = wrapper; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4(PHP_4_3) /main streams.c
wez Tue Mar 18 20:34:38 2003 EDT Modified files: (Branch: PHP_4_3) /php4/main streams.c Log: Fix my fix. # The perils of manual merging :/ Index: php4/main/streams.c diff -u php4/main/streams.c:1.125.2.45 php4/main/streams.c:1.125.2.46 --- php4/main/streams.c:1.125.2.45 Tue Mar 18 19:18:12 2003 +++ php4/main/streams.c Tue Mar 18 20:34:38 2003 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: streams.c,v 1.125.2.45 2003/03/19 00:18:12 wez Exp $ */ +/* $Id: streams.c,v 1.125.2.46 2003/03/19 01:34:38 wez Exp $ */ #define _GNU_SOURCE #include php.h @@ -1150,8 +1150,6 @@ ptr = *buf = pemalloc_rel_orig(max_len, persistent); - max_len = step; - while((ret = php_stream_read(src, ptr, max_len - len))) { len += ret; if (len + min_room = max_len) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php