[PHP-CVS] cvs: php-src /main/streams memory.c
lbarnaudSat May 16 20:27:11 2009 UTC Modified files: /php-src/main/streams memory.c Log: Fix warning when inner stream of a temp:// stream is closed before the stream ifself http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.39r2=1.40diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.39 php-src/main/streams/memory.c:1.40 --- php-src/main/streams/memory.c:1.39 Tue Mar 10 23:40:01 2009 +++ php-src/main/streams/memory.c Sat May 16 20:27:11 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.39 2009/03/10 23:40:01 helly Exp $ */ +/* $Id: memory.c,v 1.40 2009/05/16 20:27:11 lbarnaud Exp $ */ #define _GNU_SOURCE #include php.h @@ -563,6 +563,7 @@ stream = php_stream_alloc_rel(php_stream_temp_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; self-innerstream = php_stream_memory_create_rel(mode); + php_stream_auto_cleanup(self-innerstream); // do not warn if innerstream is GC'ed before stream ((php_stream_memory_data*)self-innerstream-abstract)-owner_ptr = self-innerstream; return stream; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
felipe Sat Mar 15 10:34:12 2008 UTC Modified files: /php-src/main/streams memory.c Log: MFB: Fixed bug #0 (st_blocks undefined under BeOS) http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.36r2=1.37diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.36 php-src/main/streams/memory.c:1.37 --- php-src/main/streams/memory.c:1.36 Mon Dec 31 07:12:18 2007 +++ php-src/main/streams/memory.c Sat Mar 15 10:34:12 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.36 2007/12/31 07:12:18 sebastian Exp $ */ +/* $Id: memory.c,v 1.37 2008/03/15 10:34:12 felipe Exp $ */ #define _GNU_SOURCE #include php.h @@ -234,6 +234,9 @@ #ifndef PHP_WIN32 ssb-sb.st_blksize = -1; +#endif + +#if !defined(PHP_WIN32) !defined(__BEOS__) ssb-sb.st_blocks = -1; #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
dmitry Wed Jul 11 15:17:59 2007 UTC Modified files: /php-src/main/streams memory.c Log: Unicode support http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.34r2=1.35diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.34 php-src/main/streams/memory.c:1.35 --- php-src/main/streams/memory.c:1.34 Thu Feb 22 23:25:36 2007 +++ php-src/main/streams/memory.c Wed Jul 11 15:17:59 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.34 2007/02/22 23:25:36 helly Exp $ */ +/* $Id: memory.c,v 1.35 2007/07/11 15:17:59 dmitry Exp $ */ #define _GNU_SOURCE #include php.h @@ -640,11 +640,11 @@ MAKE_STD_ZVAL(meta); array_init(meta); if (!semi) { /* there is only a mime type */ - add_ascii_assoc_stringl(meta, mediatype, path, mlen, 1); + add_ascii_assoc_ascii_stringl(meta, mediatype, path, mlen, 1); mlen = 0; } else if (sep sep semi) { /* there is a mime type */ plen = semi - path; - add_ascii_assoc_stringl(meta, mediatype, path, plen, 1); + add_ascii_assoc_ascii_stringl(meta, mediatype, path, plen, 1); mlen -= plen; path += plen; } else if (semi != path || mlen != sizeof(;base64)-1 || memcmp(path, ;base64, sizeof(;base64)-1)) { /* must be error since parameters are only allowed after mediatype */ @@ -674,7 +674,7 @@ plen = sep - path; vlen = (semi ? semi - sep : mlen - plen) - 1 /* '=' */; key = estrndup(path, plen); - add_rt_assoc_stringl_ex(meta, key, plen + 1, sep + 1, vlen, 1); + add_rt_assoc_rt_stringl_ex(meta, key, plen + 1, sep + 1, vlen, 1); efree(key); plen += vlen + 1; mlen -= plen; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Thu Feb 22 23:25:36 2007 UTC Modified files: /php-src/main/streams memory.c Log: - Fix logic http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.33r2=1.34diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.33 php-src/main/streams/memory.c:1.34 --- php-src/main/streams/memory.c:1.33 Sat Feb 3 14:45:54 2007 +++ php-src/main/streams/memory.c Thu Feb 22 23:25:36 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.33 2007/02/03 14:45:54 helly Exp $ */ +/* $Id: memory.c,v 1.34 2007/02/22 23:25:36 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -260,14 +260,14 @@ if (newsize = ms-fsize) { if (newsize ms-fpos) { ms-fpos = newsize; - } else { - ms-data = erealloc(ms-data, newsize); - memset(ms-data+ms-fsize, 0, newsize - ms-fsize); - ms-fsize = newsize; } + } else { + ms-data = erealloc(ms-data, newsize); + memset(ms-data+ms-fsize, 0, newsize - ms-fsize); ms-fsize = newsize; - return PHP_STREAM_OPTION_RETURN_OK; } + ms-fsize = newsize; + return PHP_STREAM_OPTION_RETURN_OK; } default: return PHP_STREAM_OPTION_RETURN_NOTIMPL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sat Jan 27 15:17:23 2007 UTC Modified files: /php-src/main/streams memory.c Log: - Add option support for temp/memory stream (adds ftruncate support) http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.31r2=1.32diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.31 php-src/main/streams/memory.c:1.32 --- php-src/main/streams/memory.c:1.31 Sun Jan 14 19:13:34 2007 +++ php-src/main/streams/memory.c Sat Jan 27 15:17:23 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.31 2007/01/14 19:13:34 helly Exp $ */ +/* $Id: memory.c,v 1.32 2007/01/27 15:17:23 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -241,6 +241,37 @@ } /* }}} */ +static int php_stream_memory_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) /* {{{ */ +{ + php_stream_memory_data *ms = (php_stream_memory_data*)stream-abstract; + size_t newsize; + + switch(option) { + case PHP_STREAM_OPTION_TRUNCATE_API: + switch (value) { + case PHP_STREAM_TRUNCATE_SUPPORTED: + return PHP_STREAM_OPTION_RETURN_OK; + + case PHP_STREAM_TRUNCATE_SET_SIZE: + newsize = *(size_t*)ptrparam; + if (newsize = ms-fsize) { + if (newsize ms-fpos) { + ms-fpos = newsize; + } else { + ms-data = erealloc(ms-data, newsize); + memset(ms-data+ms-fsize, 0, newsize - ms-fsize); + ms-fsize = newsize; + } + ms-fsize = newsize; + return PHP_STREAM_OPTION_RETURN_OK; + } + } + default: + return PHP_STREAM_OPTION_RETURN_NOTIMPL; + } +} +/* }}} */ + php_stream_ops php_stream_memory_ops = { php_stream_memory_write, php_stream_memory_read, php_stream_memory_close, php_stream_memory_flush, @@ -248,7 +279,7 @@ php_stream_memory_seek, php_stream_memory_cast, php_stream_memory_stat, - NULL /* set_option */ + php_stream_memory_set_option }; @@ -493,6 +524,9 @@ } return PHP_STREAM_OPTION_RETURN_OK; default: + if (ts-innerstream) { + return php_stream_set_option(ts-innerstream, option, value, ptrparam); + } return PHP_STREAM_OPTION_RETURN_NOTIMPL; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sun Jan 14 19:09:55 2007 UTC Modified files: /php-src/main/streams memory.c Log: - Fix readonly mode to 'rb' http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.29r2=1.30diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.29 php-src/main/streams/memory.c:1.30 --- php-src/main/streams/memory.c:1.29 Mon Jan 1 09:29:35 2007 +++ php-src/main/streams/memory.c Sun Jan 14 19:09:55 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.29 2007/01/01 09:29:35 sebastian Exp $ */ +/* $Id: memory.c,v 1.30 2007/01/14 19:09:55 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -266,7 +266,7 @@ self-mode = mode; self-owner_ptr = NULL; - stream = php_stream_alloc(php_stream_memory_ops, self, 0, mode TEMP_STREAM_READONLY ? r+b : w+b); + stream = php_stream_alloc(php_stream_memory_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; return stream; } @@ -520,9 +520,9 @@ self-smax = max_memory_usage; self-mode = mode; self-meta = NULL; - stream = php_stream_alloc(php_stream_temp_ops, self, 0, mode TEMP_STREAM_READONLY ? r+b : w+b); + stream = php_stream_alloc(php_stream_temp_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; - self-innerstream = php_stream_memory_create(mode); + self-innerstream = php_stream_memory_create_rel(mode); ((php_stream_memory_data*)self-innerstream-abstract)-owner_ptr = self-innerstream; return stream; @@ -684,7 +684,7 @@ stream-ops = php_stream_rfc2397_ops; ts = (php_stream_temp_data*)stream-abstract; assert(ts != NULL); - ts-mode = mode mode[0] == 'r' ? TEMP_STREAM_READONLY : 0; + ts-mode = mode mode[0] == 'r' mode[1] != '+' ? TEMP_STREAM_READONLY : 0; ts-meta = meta; } efree(comma); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sun Jan 14 19:13:34 2007 UTC Modified files: /php-src/main/streams memory.c Log: - Use relay to aid debugging http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.30r2=1.31diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.30 php-src/main/streams/memory.c:1.31 --- php-src/main/streams/memory.c:1.30 Sun Jan 14 19:09:55 2007 +++ php-src/main/streams/memory.c Sun Jan 14 19:13:34 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.30 2007/01/14 19:09:55 helly Exp $ */ +/* $Id: memory.c,v 1.31 2007/01/14 19:13:34 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -266,7 +266,7 @@ self-mode = mode; self-owner_ptr = NULL; - stream = php_stream_alloc(php_stream_memory_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); + stream = php_stream_alloc_rel(php_stream_memory_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; return stream; } @@ -520,7 +520,7 @@ self-smax = max_memory_usage; self-mode = mode; self-meta = NULL; - stream = php_stream_alloc(php_stream_temp_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); + stream = php_stream_alloc_rel(php_stream_temp_ops, self, 0, mode TEMP_STREAM_READONLY ? rb : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; self-innerstream = php_stream_memory_create_rel(mode); ((php_stream_memory_data*)self-innerstream-abstract)-owner_ptr = self-innerstream; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
tony2001Thu Dec 21 00:46:51 2006 UTC Modified files: /php-src/main/streams memory.c Log: fix potential leak http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.26r2=1.27diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.26 php-src/main/streams/memory.c:1.27 --- php-src/main/streams/memory.c:1.26 Sat Nov 4 20:44:02 2006 +++ php-src/main/streams/memory.c Thu Dec 21 00:46:51 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.26 2006/11/04 20:44:02 rasmus Exp $ */ +/* $Id: memory.c,v 1.27 2006/12/21 00:46:51 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -688,6 +688,7 @@ ts-mode = mode mode[0] == 'r' ? TEMP_STREAM_READONLY : 0; ts-meta = meta; } + efree(comma); return stream; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
tony2001Thu Dec 21 01:18:14 2006 UTC Modified files: /php-src/main/streams memory.c Log: apply correct fix (aka oops!) http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.27r2=1.28diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.27 php-src/main/streams/memory.c:1.28 --- php-src/main/streams/memory.c:1.27 Thu Dec 21 00:46:51 2006 +++ php-src/main/streams/memory.c Thu Dec 21 01:18:14 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.27 2006/12/21 00:46:51 tony2001 Exp $ */ +/* $Id: memory.c,v 1.28 2006/12/21 01:18:14 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -673,7 +673,6 @@ if ((stream = php_stream_temp_create_rel(0, ~0u)) != NULL) { /* store data */ php_stream_temp_write(stream, comma, ilen TSRMLS_CC); - efree(comma); php_stream_temp_seek(stream, 0, SEEK_SET, newoffs TSRMLS_CC); /* set special stream stuff (enforce exact mode) */ vlen = strlen(mode); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
rasmus Sat Nov 4 20:44:02 2006 UTC Modified files: /php-src/main/streams memory.c Log: Mark memory streams as is_url http://cvs.php.net/viewvc.cgi/php-src/main/streams/memory.c?r1=1.25r2=1.26diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.25 php-src/main/streams/memory.c:1.26 --- php-src/main/streams/memory.c:1.25 Tue Sep 19 10:38:31 2006 +++ php-src/main/streams/memory.c Sat Nov 4 20:44:02 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.25 2006/09/19 10:38:31 dmitry Exp $ */ +/* $Id: memory.c,v 1.26 2006/11/04 20:44:02 rasmus Exp $ */ #define _GNU_SOURCE #include php.h @@ -708,7 +708,7 @@ php_stream_wrapper php_stream_rfc2397_wrapper ={ php_stream_rfc2397_wops, NULL, - 0, /* is_url */ + 1, /* is_url */ }; /* -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
tony2001Tue Jun 6 14:08:47 2006 UTC Modified files: /php-src/main/streams memory.c Log: don't leak when decoding failed http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.22r2=1.23diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.22 php-src/main/streams/memory.c:1.23 --- php-src/main/streams/memory.c:1.22 Tue May 23 22:26:23 2006 +++ php-src/main/streams/memory.c Tue Jun 6 14:08:47 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.22 2006/05/23 22:26:23 helly Exp $ */ +/* $Id: memory.c,v 1.23 2006/06/06 14:08:47 tony2001 Exp $ */ #define _GNU_SOURCE #include php.h @@ -661,6 +661,7 @@ if (base64) { comma = (char*)php_base64_decode((const unsigned char *)comma, dlen, ilen); if (!comma) { + zval_ptr_dtor(meta); php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, rfc2397: unable to decode); return NULL; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Tue May 23 22:26:23 2006 UTC Modified files: /php-src/main/streams memory.c Log: - Fix feof() with temp/memory streams http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.21r2=1.22diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.21 php-src/main/streams/memory.c:1.22 --- php-src/main/streams/memory.c:1.21 Sun May 21 13:35:06 2006 +++ php-src/main/streams/memory.c Tue May 23 22:26:23 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.21 2006/05/21 13:35:06 helly Exp $ */ +/* $Id: memory.c,v 1.22 2006/05/23 22:26:23 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -88,16 +88,15 @@ php_stream_memory_data *ms = (php_stream_memory_data*)stream-abstract; assert(ms != NULL); - if (ms-fpos + count ms-fsize) { + if (ms-fpos + count = ms-fsize) { count = ms-fsize - ms-fpos; + stream-eof = 1; } if (count) { assert(ms-data!= NULL); assert(buf!= NULL); memcpy(buf, ms-data+ms-fpos, count); ms-fpos += count; - } else { - stream-eof = 1; } return count; } @@ -147,6 +146,7 @@ } else { ms-fpos = ms-fpos + offset; *newoffs = ms-fpos; + stream-eof = 0; return 0; } } else { @@ -157,6 +157,7 @@ } else { ms-fpos = ms-fpos + offset; *newoffs = ms-fpos; + stream-eof = 0; return 0; } } @@ -168,6 +169,7 @@ } else { ms-fpos = offset; *newoffs = ms-fpos; + stream-eof = 0; return 0; } case SEEK_END: @@ -182,6 +184,7 @@ } else { ms-fpos = ms-fsize + offset; *newoffs = ms-fpos; + stream-eof = 0; return 0; } default: @@ -359,9 +362,7 @@ got = php_stream_read(ts-innerstream, buf, count); - if (!got) { - stream-eof |= ts-innerstream-eof; - } + stream-eof = ts-innerstream-eof; return got; } @@ -418,6 +419,7 @@ } ret = php_stream_seek(ts-innerstream, offset, whence); *newoffs = php_stream_tell(ts-innerstream); + stream-eof = ts-innerstream-eof; return ret; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sun May 14 19:13:17 2006 UTC Modified files: /php-src/main/streams memory.c Log: - No need to have this controlled by allow_url_fopen http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.19r2=1.20diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.19 php-src/main/streams/memory.c:1.20 --- php-src/main/streams/memory.c:1.19 Sun May 14 01:39:24 2006 +++ php-src/main/streams/memory.c Sun May 14 19:13:17 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.19 2006/05/14 01:39:24 helly Exp $ */ +/* $Id: memory.c,v 1.20 2006/05/14 19:13:17 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -701,7 +701,7 @@ php_stream_wrapper php_stream_rfc2397_wrapper ={ php_stream_rfc2397_wops, NULL, - 1, /* is_url */ + 0, /* is_url */ }; /* -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /main/streams memory.c
Are you sure about that? Seems to me that this is one case that really should be protected by allow_url_fopen, as it allows specifying arbitrary data in the filename. While this is not quite such a big deal in HEAD, it is in PHP 5.2. I think this needs further analysis and discussion before we roll PHP 5.2. --Wez. On 5/14/06, Marcus Boerger [EMAIL PROTECTED] wrote: helly Sun May 14 19:13:17 2006 UTC Modified files: /php-src/main/streams memory.c Log: - No need to have this controlled by allow_url_fopen http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.19r2=1.20diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.19 php-src/main/streams/memory.c:1.20 --- php-src/main/streams/memory.c:1.19 Sun May 14 01:39:24 2006 +++ php-src/main/streams/memory.c Sun May 14 19:13:17 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.19 2006/05/14 01:39:24 helly Exp $ */ +/* $Id: memory.c,v 1.20 2006/05/14 19:13:17 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -701,7 +701,7 @@ php_stream_wrapper php_stream_rfc2397_wrapper ={ php_stream_rfc2397_wops, NULL, - 1, /* is_url */ + 0, /* is_url */ }; /* -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sun May 14 01:03:42 2006 UTC Modified files: /php-src/main/streams memory.c Log: - Enforce stream mode correct http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.17r2=1.18diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.17 php-src/main/streams/memory.c:1.18 --- php-src/main/streams/memory.c:1.17 Sun May 14 00:45:27 2006 +++ php-src/main/streams/memory.c Sun May 14 01:03:42 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.17 2006/05/14 00:45:27 helly Exp $ */ +/* $Id: memory.c,v 1.18 2006/05/14 01:03:42 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -656,6 +656,13 @@ /* store data */ php_stream_temp_write(stream, comma, dlen TSRMLS_CC); php_stream_temp_seek(stream, 0, SEEK_SET, newoffs TSRMLS_CC); + /* set special stream stuff (enforce exact mode) */ + vlen = strlen(mode); + if (vlen = sizeof(stream-mode)) { + vlen = sizeof(stream-mode) - 1; + } + memcpy(stream-mode, mode, vlen); + stream-mode[vlen] = '\0'; stream-ops = php_stream_rfc2397_ops; ts = (php_stream_temp_data*)stream-abstract; assert(ts != NULL); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sat Mar 18 19:56:35 2006 UTC Modified files: /php-src/main/streams memory.c Log: - Fix seek/eof issue in temp streams http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.13r2=1.14diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.13 php-src/main/streams/memory.c:1.14 --- php-src/main/streams/memory.c:1.13 Thu Jan 5 22:05:44 2006 +++ php-src/main/streams/memory.c Sat Mar 18 19:56:35 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.13 2006/01/05 22:05:44 helly Exp $ */ +/* $Id: memory.c,v 1.14 2006/03/18 19:56:35 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -159,7 +159,7 @@ return 0; } } else { - if (ms-fpos (size_t)(offset)) { + if (ms-fpos + (size_t)(offset) ms-fsize) { ms-fpos = ms-fsize; *newoffs = -1; return -1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Thu Jan 5 22:05:44 2006 UTC Modified files: /php-src/main/streams memory.c Log: - Fix issue with memset seeking - Fix issue with shutdown order of temp/memory stream http://cvs.php.net/viewcvs.cgi/php-src/main/streams/memory.c?r1=1.12r2=1.13diff_format=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.12 php-src/main/streams/memory.c:1.13 --- php-src/main/streams/memory.c:1.12 Sun Jan 1 13:09:57 2006 +++ php-src/main/streams/memory.c Thu Jan 5 22:05:44 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.12 2006/01/01 13:09:57 sniper Exp $ */ +/* $Id: memory.c,v 1.13 2006/01/05 22:05:44 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -39,6 +39,7 @@ size_t fsize; size_t smax; int mode; + php_stream **owner_ptr; } php_stream_memory_data; @@ -118,6 +119,9 @@ if (ms-data close_handle ms-mode != TEMP_STREAM_READONLY) { efree(ms-data); } + if (ms-owner_ptr) { + *ms-owner_ptr = NULL; + } efree(ms); return 0; } @@ -147,44 +151,51 @@ if (offset 0) { if (ms-fpos (size_t)(-offset)) { ms-fpos = 0; - /*return EINVAL;*/ + *newoffs = -1; + return -1; } else { ms-fpos = ms-fpos + offset; + *newoffs = ms-fpos; + return 0; } } else { if (ms-fpos (size_t)(offset)) { ms-fpos = ms-fsize; - /*return EINVAL;*/ + *newoffs = -1; + return -1; } else { ms-fpos = ms-fpos + offset; + *newoffs = ms-fpos; + return 0; } } - *newoffs = ms-fpos; - return 0; case SEEK_SET: if (ms-fsize (size_t)(offset)) { ms-fpos = ms-fsize; - /*return EINVAL;*/ + *newoffs = -1; + return -1; } else { ms-fpos = offset; + *newoffs = ms-fpos; + return 0; } - *newoffs = ms-fpos; - return 0; case SEEK_END: if (offset 0) { ms-fpos = ms-fsize; - /*return EINVAL;*/ - } else if (ms-fpos (size_t)(-offset)) { + *newoffs = -1; + return -1; + } else if (ms-fsize (size_t)(-offset)) { ms-fpos = 0; - /*return EINVAL;*/ + *newoffs = -1; + return -1; } else { ms-fpos = ms-fsize + offset; + *newoffs = ms-fpos; + return 0; } - *newoffs = ms-fpos; - return 0; default: - return 0; - /*return EINVAL;*/ + *newoffs = ms-fpos; + return -1; } } /* }}} */ @@ -220,6 +231,7 @@ self-fsize = 0; self-smax = -1; self-mode = mode; + self-owner_ptr = NULL; stream = php_stream_alloc(php_stream_memory_ops, self, 0, mode TEMP_STREAM_READONLY ? r+b : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; @@ -288,6 +300,9 @@ ts = stream-abstract; assert(ts != NULL); + if (!ts-innerstream) { + return -1; + } if (php_stream_is(ts-innerstream, PHP_STREAM_IS_MEMORY)) { size_t memsize; char *membuf = php_stream_memory_get_buffer(ts-innerstream, memsize); @@ -314,6 +329,10 @@ ts = stream-abstract; assert(ts != NULL); + if (!ts-innerstream) { + return -1; + } + got = php_stream_read(ts-innerstream, buf,
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Sun Oct 30 12:17:46 2005 EDT Modified files: /php-src/main/streams memory.c Log: - Fix mode handling http://cvs.php.net/diff.php/php-src/main/streams/memory.c?r1=1.10r2=1.11ty=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.10 php-src/main/streams/memory.c:1.11 --- php-src/main/streams/memory.c:1.10 Fri Oct 7 03:37:37 2005 +++ php-src/main/streams/memory.c Sun Oct 30 12:17:44 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.10 2005/10/07 07:37:37 helly Exp $ */ +/* $Id: memory.c,v 1.11 2005/10/30 17:17:44 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -221,7 +221,7 @@ self-smax = -1; self-mode = mode; - stream = php_stream_alloc(php_stream_memory_ops, self, 0, r+b); + stream = php_stream_alloc(php_stream_memory_ops, self, 0, mode TEMP_STREAM_READONLY ? r+b : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; return stream; } @@ -441,7 +441,7 @@ self = ecalloc(1, sizeof(*self)); self-smax = max_memory_usage; self-mode = mode; - stream = php_stream_alloc(php_stream_temp_ops, self, 0, r+b); + stream = php_stream_alloc(php_stream_temp_ops, self, 0, mode TEMP_STREAM_READONLY ? r+b : w+b); stream-flags |= PHP_STREAM_FLAG_NO_BUFFER; self-innerstream = php_stream_memory_create(mode); @@ -456,7 +456,7 @@ php_stream *stream; php_stream_temp_data *ms; - if ((stream = php_stream_temp_create_rel(mode ~TEMP_STREAM_READONLY, max_memory_usage)) != NULL) { + if ((stream = php_stream_temp_create_rel(mode, max_memory_usage)) != NULL) { if (length) { assert(buf != NULL); php_stream_temp_write(stream, buf, length 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/streams memory.c
helly Fri Oct 7 03:37:38 2005 EDT Modified files: /php-src/main/streams memory.c Log: - C vs. C++ fix # I do too much C++ and too much languages anyway, right now actively: # C, C++, Java, PHP, Peral http://cvs.php.net/diff.php/php-src/main/streams/memory.c?r1=1.9r2=1.10ty=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.9 php-src/main/streams/memory.c:1.10 --- php-src/main/streams/memory.c:1.9 Thu Oct 6 17:30:56 2005 +++ php-src/main/streams/memory.c Fri Oct 7 03:37:37 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.9 2005/10/06 21:30:56 helly Exp $ */ +/* $Id: memory.c,v 1.10 2005/10/07 07:37:37 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -308,12 +308,13 @@ static size_t php_stream_temp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { php_stream_temp_data *ts; + size_t got; assert(stream != NULL); ts = stream-abstract; assert(ts != NULL); - size_t got = php_stream_read(ts-innerstream, buf, count); + got = php_stream_read(ts-innerstream, buf, count); if (!got) { stream-eof |= ts-innerstream-eof; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams memory.c
helly Thu Oct 6 17:30:58 2005 EDT Modified files: /php-src/main/streams memory.c Log: - Fix issue (endless loop) with temp/memory streams http://cvs.php.net/diff.php/php-src/main/streams/memory.c?r1=1.8r2=1.9ty=u Index: php-src/main/streams/memory.c diff -u php-src/main/streams/memory.c:1.8 php-src/main/streams/memory.c:1.9 --- php-src/main/streams/memory.c:1.8 Wed Aug 3 10:08:42 2005 +++ php-src/main/streams/memory.c Thu Oct 6 17:30:56 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: memory.c,v 1.8 2005/08/03 14:08:42 sniper Exp $ */ +/* $Id: memory.c,v 1.9 2005/10/06 21:30:56 helly Exp $ */ #define _GNU_SOURCE #include php.h @@ -313,7 +313,13 @@ ts = stream-abstract; assert(ts != NULL); - return php_stream_read(ts-innerstream, buf, count); + size_t got = php_stream_read(ts-innerstream, buf, count); + + if (!got) { + stream-eof |= ts-innerstream-eof; + } + + return got; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php