diff options
Diffstat (limited to 'main/streams')
| -rw-r--r-- | main/streams/cast.c | 4 | ||||
| -rw-r--r-- | main/streams/filter.c | 4 | ||||
| -rw-r--r-- | main/streams/memory.c | 7 | ||||
| -rw-r--r-- | main/streams/mmap.c | 4 | ||||
| -rw-r--r-- | main/streams/php_stream_context.h | 4 | ||||
| -rw-r--r-- | main/streams/php_stream_filter_api.h | 6 | ||||
| -rw-r--r-- | main/streams/php_stream_mmap.h | 4 | ||||
| -rw-r--r-- | main/streams/php_stream_plain_wrapper.h | 4 | ||||
| -rw-r--r-- | main/streams/php_stream_transport.h | 4 | ||||
| -rw-r--r-- | main/streams/php_stream_userspace.h | 4 | ||||
| -rw-r--r-- | main/streams/php_streams_int.h | 4 | ||||
| -rw-r--r-- | main/streams/plain_wrapper.c | 7 | ||||
| -rwxr-xr-x | main/streams/streams.c | 35 | ||||
| -rw-r--r-- | main/streams/transports.c | 4 | ||||
| -rw-r--r-- | main/streams/userspace.c | 4 | ||||
| -rw-r--r-- | main/streams/xp_socket.c | 10 |
16 files changed, 53 insertions, 56 deletions
diff --git a/main/streams/cast.c b/main/streams/cast.c index 8e80fade0..e2c65d8a0 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cast.c,v 1.12.2.1.2.1 2007/01/01 09:36:11 sebastian Exp $ */ +/* $Id: cast.c,v 1.12.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */ #define _GNU_SOURCE #include "php.h" diff --git a/main/streams/filter.c b/main/streams/filter.c index 906d7a069..334fd81d8 100644 --- a/main/streams/filter.c +++ b/main/streams/filter.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filter.c,v 1.17.2.3.2.10 2007/07/21 01:43:33 jani Exp $ */ +/* $Id: filter.c,v 1.17.2.3.2.11 2007/12/31 07:20:15 sebastian Exp $ */ #include "php.h" #include "php_globals.h" diff --git a/main/streams/memory.c b/main/streams/memory.c index 49469757d..bbd900734 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: memory.c,v 1.8.2.6.2.17 2007/02/22 23:26:03 helly Exp $ */ +/* $Id: memory.c,v 1.8.2.6.2.19 2008/03/15 10:28:53 felipe Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -234,6 +234,9 @@ static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TS #ifndef PHP_WIN32 ssb->sb.st_blksize = -1; +#endif + +#if !defined(PHP_WIN32) && !defined(__BEOS__) ssb->sb.st_blocks = -1; #endif diff --git a/main/streams/mmap.c b/main/streams/mmap.c index 5fee2bbad..7f7a88ec4 100644 --- a/main/streams/mmap.c +++ b/main/streams/mmap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mmap.c,v 1.8.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: mmap.c,v 1.8.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */ /* Memory Mapping interface for streams */ #include "php.h" diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h index e52e2bc56..f1619a6ae 100644 --- a/main/streams/php_stream_context.h +++ b/main/streams/php_stream_context.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_context.h,v 1.11.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: php_stream_context.h,v 1.11.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */ /* Stream context and status notification related definitions */ diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h index 97b232053..0870e64c2 100644 --- a/main/streams/php_stream_filter_api.h +++ b/main/streams/php_stream_filter_api.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_filter_api.h,v 1.13.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: php_stream_filter_api.h,v 1.13.2.1.2.3 2007/12/31 07:20:15 sebastian Exp $ */ /* The filter API works on the principle of "Bucket-Brigades". This is * partially inspired by the Apache 2 method of doing things, although @@ -62,7 +62,7 @@ struct _php_stream_bucket_brigade { typedef enum { PSFS_ERR_FATAL, /* error in data stream */ PSFS_FEED_ME, /* filter needs more data; stop processing chain until more is available */ - PSFS_PASS_ON, /* filter generated output buckets; pass them on to next in chain */ + PSFS_PASS_ON /* filter generated output buckets; pass them on to next in chain */ } php_stream_filter_status_t; /* Buckets API. */ diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h index 5cd5c4155..50f3bd815 100644 --- a/main/streams/php_stream_mmap.h +++ b/main/streams/php_stream_mmap.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_mmap.h,v 1.5.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: php_stream_mmap.h,v 1.5.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */ /* Memory Mapping interface for streams. * The intention is to provide a uniform interface over the most common diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h index 6ce262184..eb7da457f 100644 --- a/main/streams/php_stream_plain_wrapper.h +++ b/main/streams/php_stream_plain_wrapper.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_plain_wrapper.h,v 1.7.2.2.2.1 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: php_stream_plain_wrapper.h,v 1.7.2.2.2.2 2007/12/31 07:20:15 sebastian Exp $ */ /* definitions for the plain files wrapper */ diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index e797c1092..12300ad72 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_transport.h,v 1.10.2.1.2.4 2007/02/05 05:15:16 andi Exp $ */ +/* $Id: php_stream_transport.h,v 1.10.2.1.2.5 2007/12/31 07:20:15 sebastian Exp $ */ #if HAVE_SYS_SOCKET_H # include <sys/socket.h> diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h index 095f06c1b..9277529f5 100644 --- a/main/streams/php_stream_userspace.h +++ b/main/streams/php_stream_userspace.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_stream_userspace.h,v 1.5.2.1.2.1 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: php_stream_userspace.h,v 1.5.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */ /* for user-space streams */ diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h index f7e0c7b15..b24555bb8 100644 --- a/main/streams/php_streams_int.h +++ b/main/streams/php_streams_int.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_streams_int.h,v 1.7.2.2.2.2 2007/01/01 09:36:12 sebastian Exp $ */ +/* $Id: php_streams_int.h,v 1.7.2.2.2.3 2007/12/31 07:20:15 sebastian Exp $ */ #if ZEND_DEBUG diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 1ef34ea27..af665b716 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: plain_wrapper.c,v 1.52.2.6.2.25 2007/11/01 17:32:26 jani Exp $ */ +/* $Id: plain_wrapper.c,v 1.52.2.6.2.27 2007/12/31 07:20:15 sebastian Exp $ */ #include "php.h" #include "php_globals.h" @@ -63,6 +63,9 @@ PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags) case 'x': flags = O_CREAT|O_EXCL; break; + case 'c': + flags = O_CREAT; + break; default: /* unknown mode */ return FAILURE; diff --git a/main/streams/streams.c b/main/streams/streams.c index a42d1fd79..2352bfbcc 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.82.2.6.2.18 2007/08/08 07:01:49 jani Exp $ */ +/* $Id: streams.c,v 1.82.2.6.2.22 2008/03/24 16:28:56 tony2001 Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -855,10 +855,17 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re if (delim_len == 0 || !delim) { toread = maxlen; } else { + size_t seek_len; + + seek_len = stream->writepos - stream->readpos; + if (seek_len > maxlen) { + seek_len = maxlen; + } + if (delim_len == 1) { - e = memchr(stream->readbuf + stream->readpos, *delim, stream->writepos - stream->readpos); + e = memchr(stream->readbuf + stream->readpos, *delim, seek_len); } else { - e = php_memnstr(stream->readbuf + stream->readpos, delim, delim_len, (stream->readbuf + stream->writepos)); + e = php_memnstr(stream->readbuf + stream->readpos, delim, delim_len, (stream->readbuf + stream->readpos + seek_len)); } if (!e) { @@ -1210,26 +1217,6 @@ PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen maxlen = 0; } - if (php_stream_mmap_possible(src)) { - char *p; - size_t mapped; - - p = php_stream_mmap_range(src, php_stream_tell(src), maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); - - if (p && mapped) { - *buf = pemalloc_rel_orig(mapped + 1, persistent); - - if (*buf) { - memcpy(*buf, p, mapped); - (*buf)[mapped] = '\0'; - } - - php_stream_mmap_unmap(src); - - return mapped; - } - } - if (maxlen > 0) { ptr = *buf = pemalloc_rel_orig(maxlen + 1, persistent); while ((len < maxlen) & !php_stream_eof(src)) { diff --git a/main/streams/transports.c b/main/streams/transports.c index 36cf85a9c..9c6aa00d9 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: transports.c,v 1.16.2.1.2.4 2007/02/24 15:48:40 iliaa Exp $ */ +/* $Id: transports.c,v 1.16.2.1.2.5 2007/12/31 07:20:15 sebastian Exp $ */ #include "php.h" #include "php_streams_int.h" diff --git a/main/streams/userspace.c b/main/streams/userspace.c index a2edee414..ae18d05b0 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: userspace.c,v 1.31.2.3.2.7 2007/08/16 23:54:24 stas Exp $ */ +/* $Id: userspace.c,v 1.31.2.3.2.8 2007/12/31 07:20:15 sebastian Exp $ */ #include "php.h" #include "php_globals.h" diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 43442499b..0f6842aa8 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2007 The PHP Group | + | Copyright (c) 1997-2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.33.2.2.2.6 2007/07/24 14:24:44 dmitry Exp $ */ +/* $Id: xp_socket.c,v 1.33.2.2.2.9 2008/03/10 20:09:22 andrey Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -35,6 +35,10 @@ # define MSG_DONTWAIT 0 #endif +#ifndef MSG_PEEK +# define MSG_PEEK 0 +#endif + php_stream_ops php_stream_generic_socket_ops; PHPAPI php_stream_ops php_stream_socket_ops; php_stream_ops php_stream_udp_socket_ops; @@ -597,7 +601,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_ { char *host = NULL, *bindto = NULL; int portno, bindport = 0; - int err; + int err = 0; int ret; zval **tmpzval = NULL; |
