Re: [PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
2009/5/17 Arnaud Le Blanc lbarn...@php.net: lbarnaud Sun May 17 16:52:35 2009 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: un-duplicated code (merged unicode/string variants of stream_copy_to_stream and let the compiler optimize specializations) main\streams\streams.c(517) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(684) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(699) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(703) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(703) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(765) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(779) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(783) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(783) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1039) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1043) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1043) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1204) : warning C4047: 'function' : 'int32_t' differs in levels of indirection from 'UChar *' main\streams\streams.c(1204) : warning C4024: 'u_strFindFirst_3_8' : different types for formal and actual parameter 2 main\streams\streams.c(1232) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1232) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1753) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1758) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1860) : error C2036: 'void *' : unknown size NMAKE : fatal error U1077: 'E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe' : return code '0x2' Stop. Doesn't build, plus it added a million new warnings -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Kalle Sommer Nielsen ka...@php.net -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
On Tue, 2009-05-19 at 11:24 +0200, Kalle Sommer Nielsen wrote: 2009/5/17 Arnaud Le Blanc lbarn...@php.net: lbarnaudSun May 17 16:52:35 2009 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: un-duplicated code (merged unicode/string variants of stream_copy_to_stream and let the compiler optimize specializations) main\streams\streams.c(517) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(684) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(699) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(703) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(703) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(765) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(779) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(783) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(783) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1039) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1043) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1043) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1204) : warning C4047: 'function' : 'int32_t' differs in levels of indirection from 'UChar *' main\streams\streams.c(1204) : warning C4024: 'u_strFindFirst_3_8' : different types for formal and actual parameter 2 main\streams\streams.c(1232) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1232) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1753) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1758) : warning C4018: '' : signed/unsigned mismatch main\streams\streams.c(1860) : error C2036: 'void *' : unknown size NMAKE : fatal error U1077: 'E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe' : return code '0x2' Stop. Doesn't build, plus it added a million new warnings Sorry, fixed the error. However it does not seems that these warnings are due to this change. Regards, Arnaud -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
Hi 2009/5/19 Arnaud Le Blanc lbarn...@php.net: Sorry, fixed the error. However it does not seems that these warnings are due to this change. I'll see if I have some time to look into these warnings, I don't reckon streams.c had this many but its HEAD anyway, and thanks ;) Regards, Arnaud -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Kalle Sommer Nielsen ka...@php.net -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
lbarnaudSun May 17 16:52:35 2009 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: un-duplicated code (merged unicode/string variants of stream_copy_to_stream and let the compiler optimize specializations) http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.142r2=1.143diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.142 php-src/main/php_streams.h:1.143 --- php-src/main/php_streams.h:1.142Sun Apr 19 17:09:46 2009 +++ php-src/main/php_streams.h Sun May 17 16:52:35 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.142 2009/04/19 17:09:46 lbarnaud Exp $ */ +/* $Id: php_streams.h,v 1.143 2009/05/17 16:52:35 lbarnaud Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -305,6 +305,12 @@ #define php_stream_read_unicode(stream, buf, maxlen) _php_stream_read_unicode((stream), (buf), (maxlen), -1 TSRMLS_CC) #define php_stream_read_unicode_ex(stream, buf, maxlen, maxchars) _php_stream_read_unicode((stream), (buf), (maxlen), (maxchars) TSRMLS_CC) +#define php_stream_u_read_ex(stream, type, zbuf, maxlen, maxchars) ((type == IS_UNICODE) ? \ + php_stream_read_unicode_ex(stream, zbuf.u, maxlen, maxchars) : \ + php_stream_read(stream, zbuf.s, maxlen)) + +#define php_stream_u_read(stream, type, zbuf, maxlen) php_stream_u_read_ex(stream, type, zbuf, maxlen, -1) + PHPAPI UChar *_php_stream_read_unicode_chars(php_stream *stream, int *pchars TSRMLS_DC); #define php_stream_read_unicode_chars(stream, pchars) _php_stream_read_unicode_chars((stream), (pchars) TSRMLS_CC) http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.185r2=1.186diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.185 php-src/main/streams/streams.c:1.186 --- php-src/main/streams/streams.c:1.185Sun May 17 14:57:05 2009 +++ php-src/main/streams/streams.c Sun May 17 16:52:35 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.185 2009/05/17 14:57:05 lbarnaud Exp $ */ +/* $Id: streams.c,v 1.186 2009/05/17 16:52:35 lbarnaud Exp $ */ #define _GNU_SOURCE #include php.h @@ -1767,112 +1767,8 @@ return len; } -/* Designed for copying UChars (taking into account both maxlen and maxchars) */ -PHPAPI size_t _php_stream_ucopy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t maxchars, size_t *len STREAMS_DC TSRMLS_DC) -{ - size_t haveread = 0; - php_stream_statbuf ssbuf; - size_t dummy; - - if (!len) { - len = dummy; - } - - if (src-readbuf_type == IS_STRING) { - /* Called incorrectly, don't do that. */ - return _php_stream_copy_to_stream_ex(src, dest, maxlen, len STREAMS_CC TSRMLS_CC); - } - - if (maxlen == 0 || maxchars == 0) { - *len = 0; - return SUCCESS; - } - - if (maxlen == PHP_STREAM_COPY_ALL) { - maxlen = 0; - } - - if (php_stream_stat(src, ssbuf) == 0) { - if (ssbuf.sb.st_size == 0 -#ifdef S_ISREG -S_ISREG(ssbuf.sb.st_mode) -#endif - ) { - *len = 0; - return SUCCESS; - } - } - - while(1) { - UChar buf[CHUNK_SIZE]; - size_t readchunk = CHUNK_SIZE; - size_t didread; - - if (maxlen (maxlen - haveread) readchunk) { - readchunk = maxlen - haveread; - } - - didread = php_stream_read_unicode_ex(src, buf, readchunk, maxchars); - - if (didread) { - /* extra paranoid */ - size_t didwrite, towrite; - UChar *writeptr; - - if (maxchars 0) { - /* Determine number of chars in this buf */ - maxchars -= u_countChar32(buf, didread); - } - - towrite = didread; - writeptr = buf; - haveread += didread; - - while(towrite) { - didwrite = php_stream_write_unicode(dest, writeptr, towrite); - if (didwrite == 0) { - *len = haveread - (didread - towrite); - return FAILURE; - } - - towrite -= didwrite; - writeptr += didwrite; - } - } else { - break; - } - - if
[PHP-CVS] cvs: php-src /main php_streams.h
lstrojnySat Dec 13 15:07:20 2008 UTC Modified files: /php-src/main php_streams.h Log: MFB: Remove trailing whitespaces http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.137r2=1.138diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.137 php-src/main/php_streams.h:1.138 --- php-src/main/php_streams.h:1.137Wed Jul 23 11:24:35 2008 +++ php-src/main/php_streams.h Sat Dec 13 15:07:20 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.137 2008/07/23 11:24:35 tony2001 Exp $ */ +/* $Id: php_streams.h,v 1.138 2008/12/13 15:07:20 lstrojny Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -40,11 +40,11 @@ #if ZEND_DEBUG /* these have more of a dependency on the definitions of the zend macros than * I would prefer, but doing it this way saves loads of idefs :-/ */ -# define STREAMS_D int __php_stream_call_depth ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC -# define STREAMS_C 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC +# define STREAMS_D int __php_stream_call_depth ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC +# define STREAMS_C 0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC # define STREAMS_REL_C __php_stream_call_depth + 1 ZEND_FILE_LINE_CC, \ __php_stream_call_depth ? __zend_orig_filename : __zend_filename, \ - __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno + __php_stream_call_depth ? __zend_orig_lineno : __zend_lineno # define STREAMS_DC, STREAMS_D # define STREAMS_CC, STREAMS_C @@ -64,33 +64,33 @@ #define php_stream_alloc_rel(ops, thisptr, persistent, mode) _php_stream_alloc((ops), (thisptr), (persistent), (mode) STREAMS_REL_CC TSRMLS_CC) #define php_stream_copy_to_mem_rel(src, buf, maxlen, persistent) _php_stream_copy_to_mem((src), (buf), (maxlen), (persistent) STREAMS_REL_CC TSRMLS_CC) - + #define php_stream_fopen_rel(filename, mode, opened, options) _php_stream_fopen((filename), (mode), (opened), (options) STREAMS_REL_CC TSRMLS_CC) #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, 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) - + #define php_stream_fopen_tmpfile_rel() _php_stream_fopen_tmpfile(0 STREAMS_REL_CC TSRMLS_CC) #define php_stream_fopen_temporary_file_rel(dir, pfx, opened_path) _php_stream_fopen_temporary_file((dir), (pfx), (opened_path) STREAMS_REL_CC TSRMLS_CC) - + #define php_stream_open_wrapper_rel(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_REL_CC TSRMLS_CC) #define php_stream_open_wrapper_ex_rel(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_REL_CC TSRMLS_CC) #define php_stream_make_seekable_rel(origstream, newstream, flags) _php_stream_make_seekable((origstream), (newstream), (flags) STREAMS_REL_CC TSRMLS_CC) /* }}} */ - + /* The contents of the php_stream_ops and php_stream should only be accessed * using the functions/macros in this header. * If you need to get at something that doesn't have an API, * drop me a line w...@thebrainroom.com and we can sort out a way to do * it properly. - * + * * The only exceptions to this rule are that stream implementations can use * the php_stream-abstract pointer to hold their context, and streams * opened via stream_open_wrappers can use the zval ptr in @@ -121,9 +121,9 @@ size_t (*read)(php_stream *stream, char *buf, size_t count TSRMLS_DC); int(*close)(php_stream *stream, int close_handle TSRMLS_DC); int(*flush)(php_stream *stream TSRMLS_DC); - + const char *label; /* label for this ops structure */ - + /* these are optional */ int (*seek)(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC); int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC); @@ -144,7 +144,7 @@ /* open a directory stream */ php_stream *(*dir_opener)(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); - + const char *label; /* delete a file */ @@ -188,14 +188,14 @@
[PHP-CVS] cvs: php-src /main php_streams.h
dmitry Mon Jul 9 16:42:45 2007 UTC Modified files: /php-src/main php_streams.h Log: wrong comments http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.129r2=1.130diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.129 php-src/main/php_streams.h:1.130 --- php-src/main/php_streams.h:1.129Tue Jul 3 10:22:55 2007 +++ php-src/main/php_streams.h Mon Jul 9 16:42:45 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.129 2007/07/03 10:22:55 dmitry Exp $ */ +/* $Id: php_streams.h,v 1.130 2007/07/09 16:42:45 dmitry Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -619,7 +619,7 @@ /* use glob stream for directory open in plain files stream */ #define STREAM_USE_GLOB_DIR_OPEN0x1000 -/* use glob stream for directory open in plain files stream */ +/* don't check allow_url_fopen and allow_url_include */ #define STREAM_DISABLE_URL_PROTECTION 0x2000 /* Antique - no longer has meaning */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h
helly Sat Mar 3 22:30:07 2007 UTC Modified files: /php-src/main php_streams.h Log: - One more tab to go http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.127r2=1.128diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.127 php-src/main/php_streams.h:1.128 --- php-src/main/php_streams.h:1.127Sat Mar 3 22:28:21 2007 +++ php-src/main/php_streams.h Sat Mar 3 22:30:07 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.127 2007/03/03 22:28:21 helly Exp $ */ +/* $Id: php_streams.h,v 1.128 2007/03/03 22:30:07 helly Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -614,7 +614,7 @@ #define STREAM_DISABLE_OPEN_BASEDIR 0x0400 /* get (or create) a persistent version of the stream */ -#define STREAM_OPEN_PERSISTENT 0x0800 +#define STREAM_OPEN_PERSISTENT 0x0800 /* use glob stream for directory open in plain files stream */ #define STREAM_USE_GLOB_DIR_OPEN0x1000 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams plain_wrapper.c streams.c /sapi/cli php_cli.c
tony2001Wed Feb 21 21:56:45 2007 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams plain_wrapper.c streams.c /php-src/sapi/cli php_cli.c Log: implement PHP_STREAM_FLAG_NO_CLOSE and avoid hacks in plain wrapper http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.124r2=1.125diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.124 php-src/main/php_streams.h:1.125 --- php-src/main/php_streams.h:1.124Wed Jan 24 21:43:47 2007 +++ php-src/main/php_streams.h Wed Feb 21 21:56:45 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.124 2007/01/24 21:43:47 pollita Exp $ */ +/* $Id: php_streams.h,v 1.125 2007/02/21 21:56:45 tony2001 Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -186,6 +186,8 @@ * might otherwise cause the read to block for much longer than * is strictly required. */ #define PHP_STREAM_FLAG_AVOID_BLOCKING 16 + +#define PHP_STREAM_FLAG_NO_CLOSE 32 struct _php_stream { php_stream_ops *ops; http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.80r2=1.81diff_format=u Index: php-src/main/streams/plain_wrapper.c diff -u php-src/main/streams/plain_wrapper.c:1.80 php-src/main/streams/plain_wrapper.c:1.81 --- php-src/main/streams/plain_wrapper.c:1.80 Mon Jan 1 09:29:35 2007 +++ php-src/main/streams/plain_wrapper.cWed Feb 21 21:56:45 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: plain_wrapper.c,v 1.80 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: plain_wrapper.c,v 1.81 2007/02/21 21:56:45 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -396,16 +396,7 @@ data-file = NULL; } } else if (data-fd != -1) { -#if PHP_DEBUG - if ((data-fd == 1 || data-fd == 2) 0 == strcmp(sapi_module.name, cli)) { - /* don't close stdout or stderr in CLI in DEBUG mode, as we want to see any leaks */ - ret = 0; - } else { - ret = close(data-fd); - } -#else ret = close(data-fd); -#endif data-fd = -1; } else { return 0; /* everything should be closed already - success */ http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.147r2=1.148diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.147 php-src/main/streams/streams.c:1.148 --- php-src/main/streams/streams.c:1.147Wed Jan 24 21:43:47 2007 +++ php-src/main/streams/streams.c Wed Feb 21 21:56:45 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.147 2007/01/24 21:43:47 pollita Exp $ */ +/* $Id: streams.c,v 1.148 2007/02/21 21:56:45 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -285,6 +285,10 @@ int preserve_handle = close_options PHP_STREAM_FREE_PRESERVE_HANDLE ? 1 : 0; int release_cast = 1; + if (stream-flags PHP_STREAM_FLAG_NO_CLOSE) { + preserve_handle = 1; + } + #if STREAM_DEBUG fprintf(stderr, stream_free: %s:%p[%s] in_free=%d opts=%08x\n, stream-ops-label, stream, stream-orig_path, stream-in_free, close_options); #endif http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.168r2=1.169diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.168 php-src/sapi/cli/php_cli.c:1.169 --- php-src/sapi/cli/php_cli.c:1.168Tue Feb 20 19:19:14 2007 +++ php-src/sapi/cli/php_cli.c Wed Feb 21 21:56:45 2007 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_cli.c,v 1.168 2007/02/20 19:19:14 tony2001 Exp $ */ +/* $Id: php_cli.c,v 1.169 2007/02/21 21:56:45 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -487,6 +487,12 @@ s_out = php_stream_open_wrapper_ex(php://stdout, wb, 0, NULL, sc_out); s_err = php_stream_open_wrapper_ex(php://stderr, wb, 0, NULL, sc_err); +#if PHP_DEBUG + /* do not close stdout and stderr */ + s_out-flags |= PHP_STREAM_FLAG_NO_CLOSE; + s_err-flags |= PHP_STREAM_FLAG_NO_CLOSE; +#endif + if (s_in==NULL || s_out==NULL || s_err==NULL) { FREE_ZVAL(zin); FREE_ZVAL(zout); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
helly Tue Jan 16 20:36:04 2007 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: - Add more unicode stuff http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.122r2=1.123diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.122 php-src/main/php_streams.h:1.123 --- php-src/main/php_streams.h:1.122Mon Jan 15 22:19:33 2007 +++ php-src/main/php_streams.h Tue Jan 16 20:36:04 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.122 2007/01/15 22:19:33 helly Exp $ */ +/* $Id: php_streams.h,v 1.123 2007/01/16 20:36:04 helly Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -360,7 +360,9 @@ #define php_stream_rmdir(path, options, context) _php_stream_rmdir(path, options, context TSRMLS_CC) PHPAPI php_stream *_php_stream_opendir(char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_u_opendir(zend_uchar type, zstr path, int path_len, int options, php_stream_context *context STREAMS_DC TSRMLS_DC); #define php_stream_opendir(path, options, context) _php_stream_opendir((path), (options), (context) STREAMS_CC TSRMLS_CC) +#define php_stream_u_opendir(path_type, path, path_len, options, context) _php_stream_u_opendir((path_type), (path), (path_len), (options), (context) STREAMS_CC TSRMLS_CC) PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC); #define php_stream_readdir(dirstream, dirent) _php_stream_readdir((dirstream), (dirent) TSRMLS_CC) #define php_stream_closedir(dirstream) php_stream_close((dirstream)) http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.145r2=1.146diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.145 php-src/main/streams/streams.c:1.146 --- php-src/main/streams/streams.c:1.145Mon Jan 15 22:19:33 2007 +++ php-src/main/streams/streams.c Tue Jan 16 20:36:04 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.145 2007/01/15 22:19:33 helly Exp $ */ +/* $Id: streams.c,v 1.146 2007/01/16 20:36:04 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -2278,6 +2278,27 @@ } /* }}} */ +PHPAPI php_stream *_php_stream_u_opendir(zend_uchar type, zstr path, int path_len, int options, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +{ + char *filename; + int filename_len; + php_stream *stream; + + if (type == IS_STRING) { + return php_stream_opendir(path.s, options, context); + } + + /* type == IS_UNICODE */ + if (FAILURE == php_stream_path_encode(NULL, filename, filename_len, path.u, path_len, options, context)) { + return NULL; + } + + stream = php_stream_opendir(filename, options, context); + efree(filename); + return stream; +} +/* }}} */ + /* {{{ _php_stream_readdir */ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_dirent *ent TSRMLS_DC) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams cast.c streams.c
helly Mon Jan 15 22:19:33 2007 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams cast.c streams.c Log: - Help streams debugging http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.121r2=1.122diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.121 php-src/main/php_streams.h:1.122 --- php-src/main/php_streams.h:1.121Wed Jan 10 22:43:17 2007 +++ php-src/main/php_streams.h Mon Jan 15 22:19:33 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.121 2007/01/10 22:43:17 pollita Exp $ */ +/* $Id: php_streams.h,v 1.122 2007/01/15 22:19:33 helly Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -225,7 +225,12 @@ int eof; +#if ZEND_DEBUG + char *open_filename; + uint open_lineno; +#endif }; /* php_stream */ + /* state definitions when closing down; these are private to streams.c */ #define PHP_STREAM_FCLOSE_NONE 0 #define PHP_STREAM_FCLOSE_FDOPEN 1 http://cvs.php.net/viewvc.cgi/php-src/main/streams/cast.c?r1=1.16r2=1.17diff_format=u Index: php-src/main/streams/cast.c diff -u php-src/main/streams/cast.c:1.16 php-src/main/streams/cast.c:1.17 --- php-src/main/streams/cast.c:1.16Mon Jan 1 09:29:35 2007 +++ php-src/main/streams/cast.c Mon Jan 15 22:19:33 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: cast.c,v 1.16 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: cast.c,v 1.17 2007/01/15 22:19:33 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -327,6 +327,11 @@ if (*newstream == NULL) return PHP_STREAM_FAILED; +#if ZEND_DEBUG + (*newstream)-open_filename = origstream-open_filename; + (*newstream)-open_lineno = origstream-open_lineno; +#endif + if (php_stream_copy_to_stream(origstream, *newstream, PHP_STREAM_COPY_ALL) == 0) { php_stream_close(*newstream); *newstream = NULL; http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.144r2=1.145diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.144 php-src/main/streams/streams.c:1.145 --- php-src/main/streams/streams.c:1.144Mon Jan 15 17:06:52 2007 +++ php-src/main/streams/streams.c Mon Jan 15 22:19:33 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.144 2007/01/15 17:06:52 tony2001 Exp $ */ +/* $Id: streams.c,v 1.145 2007/01/15 22:19:33 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -241,6 +241,11 @@ ret-chunk_size = FG(def_chunk_size); ret-readbuf_type = IS_STRING; +#if ZEND_DEBUG + ret-open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename; + ret-open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno; +#endif + if (FG(auto_detect_line_endings)) { ret-flags |= PHP_STREAM_FLAG_DETECT_EOL; } @@ -384,7 +389,7 @@ * as leaked; it will log a warning, but lets help it out and display what kind * of stream it was. */ char *leakinfo; - spprintf(leakinfo, 0, __FILE__ (%d) : Stream of type '%s' %p (path:%s) was not closed\n, __LINE__, stream-ops-label, stream, stream-orig_path); + spprintf(leakinfo, 0, __FILE__ (%d) : Stream of type '%s' %p (path:%s) was not closed (opened in %s on line %d)\n, __LINE__, stream-ops-label, stream, stream-orig_path, stream-open_filename, stream-open_lineno); if (stream-orig_path) { pefree(stream-orig_path, stream-is_persistent); @@ -2376,6 +2381,10 @@ } copy_of_path = pestrdup(path, persistent); stream-orig_path = copy_of_path; +#if ZEND_DEBUG + stream-open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename; + stream-open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno; +#endif } if (stream != NULL (options STREAM_MUST_SEEK)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
pollita Wed Jan 10 22:43:17 2007 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: Add convenience function for openeing files with unicode names http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.120r2=1.121diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.120 php-src/main/php_streams.h:1.121 --- php-src/main/php_streams.h:1.120Mon Jan 1 09:29:35 2007 +++ php-src/main/php_streams.h Wed Jan 10 22:43:17 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.120 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: php_streams.h,v 1.121 2007/01/10 22:43:17 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -618,12 +618,18 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC); PHPAPI void php_stream_fix_encoding(php_stream *stream, const char *mode, php_stream_context *context TSRMLS_DC); PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_u_open_wrapper(zend_uchar type, zstr path, int path_len, char *mode, int options, zstr *opened_path, int *opened_path_len, php_stream_context *context STREAMS_DC TSRMLS_DC); PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC); PHPAPI void *php_stream_locate_eol(php_stream *stream, zstr zbuf, int buf_len TSRMLS_DC); #define php_stream_open_wrapper(path, mode, options, opened) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC TSRMLS_CC) #define php_stream_open_wrapper_ex(path, mode, options, opened, context) _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC TSRMLS_CC) +#define php_stream_u_open_wrapper(type, path, path_len, mode, options, opened, context)\ + _php_stream_u_open_wrapper((type), (path), (path_len), (mode), (options), (opened), NULL, (context) STREAMS_CC TSRMLS_CC) +#define php_stream_u_open_wrapper_ex(type, path, path_len, mode, options, opened, opened_len, context) \ + _php_stream_u_open_wrapper((type), (path), (path_len), (mode), (options), (opened), (opened_len), (context) STREAMS_CC TSRMLS_CC) + #define php_stream_get_from_zval(stream, zstream, mode, options, opened, context) \ if (Z_TYPE_PP((zstream)) == IS_RESOURCE) { \ php_stream_from_zval((stream), (zstream)); \ http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.142r2=1.143diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.142 php-src/main/streams/streams.c:1.143 --- php-src/main/streams/streams.c:1.142Mon Jan 1 09:29:35 2007 +++ php-src/main/streams/streams.c Wed Jan 10 22:43:17 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.142 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: streams.c,v 1.143 2007/01/10 22:43:17 pollita Exp $ */ #define _GNU_SOURCE #include php.h @@ -2434,6 +2434,61 @@ } /* }}} */ +/* {{{ _php_stream_u_open_wrapper */ +PHPAPI php_stream *_php_stream_u_open_wrapper(zend_uchar type, zstr path, int path_len, + char *mode, int options, zstr *opened_path, int *opened_path_len, + php_stream_context *context STREAMS_DC TSRMLS_DC) +{ + php_stream *stream; + char *filename = NULL; + int filename_len; + + if (opened_path) { + opened_path-v = NULL; + } + if (opened_path_len) { + *opened_path_len = 0; + } + + if (type == IS_STRING) { + stream = php_stream_open_wrapper_ex(path.s, mode, options, (char**)opened_path, context); + + if (opened_path_len opened_path opened_path-s) { + *opened_path_len = strlen(opened_path-s); + } + + return stream; + } + + /* type == IS_UNICODE */ + if (FAILURE == php_stream_path_encode(NULL, filename, filename_len, path.u, path_len, options, context)) { + return NULL; + } + + stream = php_stream_open_wrapper_ex(filename, mode, options, (char**)opened_path, context); + efree(filename); + + if (opened_path opened_path-s) { + UChar *upath; + int upath_len; + + if (SUCCESS == php_stream_path_decode(NULL, upath, upath_len, opened_path-s, strlen(opened_path-s), options, context)) { + efree(opened_path-s); + opened_path-u = upath; + if (opened_path_len) { + *opened_path_len = upath_len; +
[PHP-CVS] cvs: php-src /main php_streams.h
tony2001Wed Dec 27 15:22:46 2006 UTC Modified files: /php-src/main php_streams.h Log: fix php_stream_u_get_line() macro http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.118r2=1.119diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.118 php-src/main/php_streams.h:1.119 --- php-src/main/php_streams.h:1.118Thu Nov 9 01:06:45 2006 +++ php-src/main/php_streams.h Wed Dec 27 15:22:46 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.118 2006/11/09 01:06:45 tony2001 Exp $ */ +/* $Id: php_streams.h,v 1.119 2006/12/27 15:22:46 tony2001 Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -335,7 +335,7 @@ PHPAPI UChar *_php_stream_u_get_line(php_stream *stream, UChar *buf, int32_t *pmax_bytes, int32_t *pmax_chars, int *pis_unicode TSRMLS_DC); -#define php_stream_u_get_line(stream, buf, maxlen_buf, maxlen_chars, buf_type) _php_stream_u_get_line((stream), (buf), (maxlen_buf), (maxlen_chars), (buf_type) TSRMLS_CC) +#define php_stream_u_get_line(stream, buf, maxlen_buf, maxlen_chars, retlen) _php_stream_get_line((stream), IS_UNICODE, (buf), (maxlen_buf), (maxlen_chars), (retlen) TSRMLS_CC) /* CAREFUL! this is equivalent to puts NOT fputs! */ PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
tony2001Thu Nov 9 01:06:45 2006 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: eliminate a couple of compile warnings http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.117r2=1.118diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.117 php-src/main/php_streams.h:1.118 --- php-src/main/php_streams.h:1.117Tue Oct 3 23:22:21 2006 +++ php-src/main/php_streams.h Thu Nov 9 01:06:45 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.117 2006/10/03 23:22:21 tony2001 Exp $ */ +/* $Id: php_streams.h,v 1.118 2006/11/09 01:06:45 tony2001 Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -156,9 +156,9 @@ int (*stream_rmdir)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); /* Unicode path manipulation -- Leave NULL to use UG(filesystem_encoding_conv) for conversion */ - int (*path_encode)(php_stream_wrapper *wrapper, char **encpath, int *encpath_len, UChar *path, int path_len, + int (*path_encode)(php_stream_wrapper *wrapper, char **encpath, int *encpath_len, const UChar *path, int path_len, int options, php_stream_context *context TSRMLS_DC); - int (*path_decode)(php_stream_wrapper *wrapper, UChar **decpath, int *decpath_len, char *path, int path_len, + int (*path_decode)(php_stream_wrapper *wrapper, UChar **decpath, int *decpath_len, const char *path, int path_len, int options, php_stream_context *context TSRMLS_DC); } php_stream_wrapper_ops; @@ -374,13 +374,13 @@ #define php_stream_set_chunk_size(stream, size) _php_stream_set_option((stream), PHP_STREAM_OPTION_SET_CHUNK_SIZE, (size), NULL TSRMLS_CC) PHPAPI int _php_stream_path_encode(php_stream_wrapper *wrapper, - char **pathenc, int *pathenc_len, UChar *path, int path_len, + char **pathenc, int *pathenc_len, const UChar *path, int path_len, int options, php_stream_context *context TSRMLS_DC); #define php_stream_path_encode(wrapper, pathenc, pathenc_len, path, path_len, options, context) \ _php_stream_path_encode((wrapper), (pathenc), (pathenc_len), (path), (path_len), (options), (context) TSRMLS_CC) PHPAPI int _php_stream_path_decode(php_stream_wrapper *wrapper, - UChar **pathdec, int *pathdec_len, char *path, int path_len, + UChar **pathdec, int *pathdec_len, const char *path, int path_len, int options, php_stream_context *context TSRMLS_DC); #define php_stream_path_decode(wrapper, pathdec, pathdec_len, path, path_len, options, context) \ _php_stream_path_decode((wrapper), (pathdec), (pathdec_len), (path), (path_len), (options), (context) TSRMLS_CC) http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.140r2=1.141diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.140 php-src/main/streams/streams.c:1.141 --- php-src/main/streams/streams.c:1.140Sun Oct 8 13:34:24 2006 +++ php-src/main/streams/streams.c Thu Nov 9 01:06:45 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.140 2006/10/08 13:34:24 bjori Exp $ */ +/* $Id: streams.c,v 1.141 2006/11/09 01:06:45 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -2664,7 +2664,7 @@ If wrapper == NULL, the path will be explored to locate the correct wrapper */ PHPAPI int _php_stream_path_encode(php_stream_wrapper *wrapper, - char **pathenc, int *pathenc_len, UChar *path, int path_len, + char **pathenc, int *pathenc_len, const UChar *path, int path_len, int options, php_stream_context *context TSRMLS_DC) { UErrorCode status = U_ZERO_ERROR; @@ -2745,7 +2745,7 @@ Otherwise (or if wrapper == NULL) the INI defined filesystem_encoding converter will be used. */ PHPAPI int _php_stream_path_decode(php_stream_wrapper *wrapper, - UChar **pathdec, int *pathdec_len, char *path, int path_len, + UChar **pathdec, int *pathdec_len, const char *path, int path_len, int options, php_stream_context *context TSRMLS_DC) { int num_conv; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
tony2001Tue Oct 3 23:22:21 2006 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: int - size_t http://cvs.php.net/viewvc.cgi/php-src/main/php_streams.h?r1=1.116r2=1.117diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.116 php-src/main/php_streams.h:1.117 --- php-src/main/php_streams.h:1.116Mon Oct 2 02:24:29 2006 +++ php-src/main/php_streams.h Tue Oct 3 23:22:21 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.116 2006/10/02 02:24:29 pollita Exp $ */ +/* $Id: php_streams.h,v 1.117 2006/10/03 23:22:21 tony2001 Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -511,7 +511,7 @@ #define PHP_STREAM_COPY_ALL((size_t)-1) BEGIN_EXTERN_C() -PHPAPI size_t _php_stream_ucopy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, int maxchars STREAMS_DC TSRMLS_DC); +PHPAPI size_t _php_stream_ucopy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, size_t maxchars STREAMS_DC TSRMLS_DC); PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC); /* Preserve characters semantics by having maxlen refer to maxchars in a unicode context */ #define php_stream_copy_to_stream(src, dest, maxlen) ( ((src)-readbuf_type == IS_STRING) \ http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.138r2=1.139diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.138 php-src/main/streams/streams.c:1.139 --- php-src/main/streams/streams.c:1.138Tue Oct 3 19:52:34 2006 +++ php-src/main/streams/streams.c Tue Oct 3 23:22:21 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.138 2006/10/03 19:52:34 iliaa Exp $ */ +/* $Id: streams.c,v 1.139 2006/10/03 23:22:21 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -1734,7 +1734,7 @@ } /* Designed for copying UChars (taking into account both maxlen and maxchars) */ -PHPAPI size_t _php_stream_ucopy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, int maxchars STREAMS_DC TSRMLS_DC) +PHPAPI size_t _php_stream_ucopy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, size_t maxchars STREAMS_DC TSRMLS_DC) { size_t haveread = 0; php_stream_statbuf ssbuf; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
pollita Tue Apr 18 19:09:31 2006 UTC Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: Fix copy/paste typo in php_stream_path_decode() proto http://cvs.php.net/viewcvs.cgi/php-src/main/php_streams.h?r1=1.111r2=1.112diff_format=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.111 php-src/main/php_streams.h:1.112 --- php-src/main/php_streams.h:1.111Fri Mar 31 22:51:37 2006 +++ php-src/main/php_streams.h Tue Apr 18 19:09:31 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.111 2006/03/31 22:51:37 pollita Exp $ */ +/* $Id: php_streams.h,v 1.112 2006/04/18 19:09:31 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -380,7 +380,7 @@ _php_stream_path_encode((wrapper), (pathenc), (pathenc_len), (path), (path_len), (options), (context) TSRMLS_CC) PHPAPI int _php_stream_path_decode(php_stream_wrapper *wrapper, - char **pathdec, int *pathdec_len, UChar *path, int path_len, + UChar **pathdec, int *pathdec_len, char *path, int path_len, int options, php_stream_context *context TSRMLS_DC); #define php_stream_path_decode(wrapper, pathdec, pathdec_len, path, path_len, options, context) \ _php_stream_path_decode((wrapper), (pathdec), (pathdec_len), (path), (path_len), (options), (context) TSRMLS_CC) http://cvs.php.net/viewcvs.cgi/php-src/main/streams/streams.c?r1=1.120r2=1.121diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.120 php-src/main/streams/streams.c:1.121 --- php-src/main/streams/streams.c:1.120Wed Apr 12 22:40:56 2006 +++ php-src/main/streams/streams.c Tue Apr 18 19:09:31 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.120 2006/04/12 22:40:56 pollita Exp $ */ +/* $Id: streams.c,v 1.121 2006/04/18 19:09:31 pollita Exp $ */ #define _GNU_SOURCE #include php.h @@ -2653,7 +2653,7 @@ Otherwise (or if wrapper == NULL) the INI defined filesystem_encoding converter will be used. */ PHPAPI int _php_stream_path_decode(php_stream_wrapper *wrapper, - char **pathdec, int *pathdec_len, UChar *path, int path_len, + UChar **pathdec, int *pathdec_len, char *path, int path_len, int options, php_stream_context *context TSRMLS_DC) { int num_conv; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h
wez Sun Feb 6 18:17:10 2005 EDT Modified files: /php-src/main php_streams.h Log: Avoid bug where stream_copy_to_stream() call for precisely 200 bytes would result in entire resource being copied. The mmap brake is already present inside mmap_range() and is set to 1MB. http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.99r2=1.100ty=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.99 php-src/main/php_streams.h:1.100 --- php-src/main/php_streams.h:1.99 Mon Nov 15 18:43:12 2004 +++ php-src/main/php_streams.h Sun Feb 6 18:17:09 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.99 2004/11/15 23:43:12 iliaa Exp $ */ +/* $Id: php_streams.h,v 1.100 2005/02/06 23:17:09 wez Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -407,10 +407,8 @@ #define PHP_STREAM_OPTION_RETURN_NOTIMPL -2 /* underlying stream does not implement; streams can handle it instead */ /* copy up to maxlen bytes from src to dest. If maxlen is PHP_STREAM_COPY_ALL, copy until eof(src). - * Uses mmap if the src is a plain file and at offset 0 - * To ensure we don't take up too much memory when reading large files, set the default mmap length - * at this many bytes */ -#define PHP_STREAM_COPY_ALL200 + * Uses mmap if the src is a plain file and at offset 0 */ +#define PHP_STREAM_COPY_ALL((size_t)-1) BEGIN_EXTERN_C() PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
iliaa Mon Nov 15 18:43:13 2004 EDT Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: Fixed bug #29801 (Set limit on the size of mmapable data). http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.98r2=1.99ty=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.98 php-src/main/php_streams.h:1.99 --- php-src/main/php_streams.h:1.98 Wed Sep 29 06:54:56 2004 +++ php-src/main/php_streams.h Mon Nov 15 18:43:12 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.98 2004/09/29 10:54:56 hyanantha Exp $ */ +/* $Id: php_streams.h,v 1.99 2004/11/15 23:43:12 iliaa Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -407,8 +407,11 @@ #define PHP_STREAM_OPTION_RETURN_NOTIMPL -2 /* underlying stream does not implement; streams can handle it instead */ /* copy up to maxlen bytes from src to dest. If maxlen is PHP_STREAM_COPY_ALL, copy until eof(src). - * Uses mmap if the src is a plain file and at offset 0 */ -#define PHP_STREAM_COPY_ALL-1 + * Uses mmap if the src is a plain file and at offset 0 + * To ensure we don't take up too much memory when reading large files, set the default mmap length + * at this many bytes */ +#define PHP_STREAM_COPY_ALL200 + BEGIN_EXTERN_C() PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen STREAMS_DC TSRMLS_DC); #define php_stream_copy_to_stream(src, dest, maxlen) _php_stream_copy_to_stream((src), (dest), (maxlen) STREAMS_CC TSRMLS_CC) http://cvs.php.net/diff.php/php-src/main/streams/streams.c?r1=1.69r2=1.70ty=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.69 php-src/main/streams/streams.c:1.70 --- php-src/main/streams/streams.c:1.69 Thu Nov 11 08:08:32 2004 +++ php-src/main/streams/streams.c Mon Nov 15 18:43:12 2004 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.69 2004/11/11 13:08:32 rrichards Exp $ */ +/* $Id: streams.c,v 1.70 2004/11/15 23:43:12 iliaa Exp $ */ #define _GNU_SOURCE #include php.h @@ -1162,7 +1162,7 @@ char *p; size_t mapped; - p = php_stream_mmap_range(stream, php_stream_tell(stream), 0, PHP_STREAM_MAP_MODE_SHARED_READONLY, mapped); + p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_COPY_ALL, PHP_STREAM_MAP_MODE_SHARED_READONLY, mapped); if (p) { PHPWRITE(p, mapped); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h
hyanantha Wed Sep 29 06:54:57 2004 EDT Modified files: /php-src/main php_streams.h Log: NETWARE has a proper stat structure Now no need of CLIB_STAT_PATCH checks http://cvs.php.net/diff.php/php-src/main/php_streams.h?r1=1.97r2=1.98ty=u Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.97 php-src/main/php_streams.h:1.98 --- php-src/main/php_streams.h:1.97 Mon Sep 13 23:48:16 2004 +++ php-src/main/php_streams.h Wed Sep 29 06:54:56 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.97 2004/09/14 03:48:16 pollita Exp $ */ +/* $Id: php_streams.h,v 1.98 2004/09/29 10:54:56 hyanantha Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -104,11 +104,7 @@ #include streams/php_stream_filter_api.h typedef struct _php_stream_statbuf { -#if defined(NETWARE) defined(CLIB_STAT_PATCH) - struct stat_libc sb; /* regular info */ -#else struct stat sb; /* regular info */ -#endif /* extended info to go here some day: content-type etc. etc. */ } php_stream_statbuf; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams streams.c
pollita Sat Dec 13 13:48:40 2003 EDT Modified files: /php-src/main php_streams.h /php-src/main/streams streams.c Log: Fix Win32 Build. mkdir/rmdir are macros Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.89 php-src/main/php_streams.h:1.90 --- php-src/main/php_streams.h:1.89 Fri Dec 12 23:07:13 2003 +++ php-src/main/php_streams.h Sat Dec 13 13:48:37 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.89 2003/12/13 04:07:13 pollita Exp $ */ +/* $Id: php_streams.h,v 1.90 2003/12/13 18:48:37 pollita Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -153,8 +153,8 @@ int (*rename)(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); /* Create/Remove directory */ - int (*mkdir)(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC); - int (*rmdir)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); + int (*stream_mkdir)(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC); + int (*stream_rmdir)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); } php_stream_wrapper_ops; struct _php_stream_wrapper { Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.45 php-src/main/streams/streams.c:1.46 --- php-src/main/streams/streams.c:1.45 Fri Dec 12 23:07:14 2003 +++ php-src/main/streams/streams.c Sat Dec 13 13:48:39 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.45 2003/12/13 04:07:14 pollita Exp $ */ +/* $Id: streams.c,v 1.46 2003/12/13 18:48:39 pollita Exp $ */ #define _GNU_SOURCE #include php.h @@ -1464,11 +1464,11 @@ php_stream_wrapper *wrapper = NULL; wrapper = php_stream_locate_url_wrapper(path, NULL, ENFORCE_SAFE_MODE TSRMLS_CC); - if (!wrapper || !wrapper-wops || !wrapper-wops-mkdir) { + if (!wrapper || !wrapper-wops || !wrapper-wops-stream_mkdir) { return 0; } - return wrapper-wops-mkdir(wrapper, path, mode, options, context TSRMLS_CC); + return wrapper-wops-stream_mkdir(wrapper, path, mode, options, context TSRMLS_CC); } /* }}} */ @@ -1479,11 +1479,11 @@ php_stream_wrapper *wrapper = NULL; wrapper = php_stream_locate_url_wrapper(path, NULL, ENFORCE_SAFE_MODE TSRMLS_CC); - if (!wrapper || !wrapper-wops || !wrapper-wops-rmdir) { + if (!wrapper || !wrapper-wops || !wrapper-wops-stream_rmdir) { return 0; } - return wrapper-wops-rmdir(wrapper, path, options, context TSRMLS_CC); + return wrapper-wops-stream_rmdir(wrapper, path, options, context TSRMLS_CC); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main php_streams.h /main/streams transports.c xp_socket.c
wez Thu Nov 27 12:39:02 2003 EDT Modified files: /php-src/main php_streams.h /php-src/main/streams transports.c xp_socket.c Log: port liveness checks and a couple of other things from the 4.3 branch. Liveness checks are used to validate persistent socket connects when they are re-used. Index: php-src/main/php_streams.h diff -u php-src/main/php_streams.h:1.84 php-src/main/php_streams.h:1.85 --- php-src/main/php_streams.h:1.84 Mon Nov 3 09:12:45 2003 +++ php-src/main/php_streams.h Thu Nov 27 12:39:01 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_streams.h,v 1.84 2003/11/03 14:12:45 derick Exp $ */ +/* $Id: php_streams.h,v 1.85 2003/11/27 17:39:01 wez Exp $ */ #ifndef PHP_STREAMS_H #define PHP_STREAMS_H @@ -358,6 +358,10 @@ #define PHP_STREAM_OPTION_META_DATA_API11 /* ptrparam is a zval* to which to add meta data information */ #define php_stream_populate_meta_data(stream, zv) (_php_stream_set_option((stream), PHP_STREAM_OPTION_META_DATA_API, 0, zv TSRMLS_CC) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0) +/* Check if the stream is still live; for sockets/pipes this means the socket + * is still connected; for files, this does not really have meaning */ +#define PHP_STREAM_OPTION_CHECK_LIVENESS 12 /* no parameters */ + #define PHP_STREAM_OPTION_RETURN_OK 0 /* option set OK */ #define PHP_STREAM_OPTION_RETURN_ERR -1 /* problem setting option */ #define PHP_STREAM_OPTION_RETURN_NOTIMPL -2 /* underlying stream does not implement; streams can handle it instead */ Index: php-src/main/streams/transports.c diff -u php-src/main/streams/transports.c:1.6 php-src/main/streams/transports.c:1.7 --- php-src/main/streams/transports.c:1.6 Wed Jul 2 17:11:35 2003 +++ php-src/main/streams/transports.c Thu Nov 27 12:39:01 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: transports.c,v 1.6 2003/07/02 21:11:35 wez Exp $ */ +/* $Id: transports.c,v 1.7 2003/11/27 17:39:01 wez Exp $ */ #include php.h #include php_streams_int.h @@ -74,8 +74,10 @@ if (persistent_id) { switch(php_stream_from_persistent_id(persistent_id, stream TSRMLS_CC)) { case PHP_STREAM_PERSISTENT_SUCCESS: - /* TODO: check if the socket is still live */ - return stream; + if (PHP_STREAM_OPTION_RETURN_OK == php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, 0, NULL)) { + return stream; + } + /* fall through */ case PHP_STREAM_PERSISTENT_FAILURE: default: Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.15 php-src/main/streams/xp_socket.c:1.16 --- php-src/main/streams/xp_socket.c:1.15 Wed Oct 8 06:55:51 2003 +++ php-src/main/streams/xp_socket.cThu Nov 27 12:39:01 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_socket.c,v 1.15 2003/10/08 10:55:51 wez Exp $ */ +/* $Id: xp_socket.c,v 1.16 2003/11/27 17:39:01 wez Exp $ */ #include php.h #include ext/standard/file.h @@ -148,15 +148,9 @@ if (close_handle) { if (sock-socket != -1) { +#ifdef PHP_WIN32 /* prevent more data from coming in */ - -#ifdef AF_UNIX - if (stream-ops != php_stream_unix_socket_ops stream-ops != php_stream_unixdg_socket_ops) { -#endif - shutdown(sock-socket, SHUT_RD); -#ifdef AF_UNIX - } -#endif + shutdown(sock-socket, SHUT_RD); /* try to make sure that the OS sends all data before we close the connection. * Essentially, we are waiting for the socket to become writeable, which means @@ -174,6 +168,7 @@ n = select(sock-socket + 1, NULL, wrfds, efds, timeout); } while (n == -1 php_socket_errno() == EINTR); +#endif closesocket(sock-socket); sock-socket = -1; @@ -205,6 +200,28 @@ php_stream_xport_param *xparam; switch(option) { + case PHP_STREAM_OPTION_CHECK_LIVENESS: + { + fd_set rfds; + struct timeval tv = {0,0}; + char buf; + int alive = 1; + + if (sock-socket == -1) { + alive = 0; + } else { +