diff options
Diffstat (limited to 'main')
| -rw-r--r-- | main/SAPI.h | 5 | ||||
| -rw-r--r-- | main/fopen_wrappers.c | 2 | ||||
| -rw-r--r-- | main/main.c | 4 | ||||
| -rw-r--r-- | main/php.h | 2 | ||||
| -rw-r--r-- | main/php_stdint.h | 206 | ||||
| -rw-r--r-- | main/php_streams.h | 44 | ||||
| -rw-r--r-- | main/php_version.h | 8 | ||||
| -rw-r--r-- | main/rfc1867.c | 48 | ||||
| -rw-r--r-- | main/streams/glob_wrapper.c | 10 | ||||
| -rw-r--r-- | main/streams/memory.c | 8 | ||||
| -rw-r--r-- | main/streams/php_stream_plain_wrapper.h | 2 | ||||
| -rw-r--r-- | main/streams/php_stream_transport.h | 16 | ||||
| -rw-r--r-- | main/streams/plain_wrapper.c | 21 | ||||
| -rw-r--r-- | main/streams/streams.c | 62 | ||||
| -rw-r--r-- | main/streams/transports.c | 10 | ||||
| -rw-r--r-- | main/streams/userspace.c | 38 | ||||
| -rw-r--r-- | main/streams/xp_socket.c | 8 |
17 files changed, 369 insertions, 125 deletions
diff --git a/main/SAPI.h b/main/SAPI.h index 92b7329dbc..6fc60c8865 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -27,6 +27,7 @@ #include "zend_operators.h" #ifdef PHP_WIN32 #include "win95nt.h" +#include "win32/php_stdint.h" #endif #include <sys/stat.h> @@ -82,7 +83,7 @@ typedef struct { char *post_data, *raw_post_data; char *cookie_data; long content_length; - uint post_data_length, raw_post_data_length; + int64_t post_data_length, raw_post_data_length; char *path_translated; char *request_uri; @@ -119,7 +120,7 @@ typedef struct _sapi_globals_struct { void *server_context; sapi_request_info request_info; sapi_headers_struct sapi_headers; - int read_post_bytes; + int64_t read_post_bytes; unsigned char headers_sent; struct stat global_stat; char *default_mimetype; diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 6f11cf3f32..eb33ac7ba1 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -475,7 +475,7 @@ PHPAPI char *php_resolve_path(const char *filename, int filename_length, const c char resolved_path[MAXPATHLEN]; char trypath[MAXPATHLEN]; const char *ptr, *end, *p; - char *actual_path; + const char *actual_path; php_stream_wrapper *wrapper; if (!filename || CHECK_NULL_PATH(filename, filename_length)) { diff --git a/main/main.c b/main/main.c index 5942b23f72..2f56afa03a 100644 --- a/main/main.c +++ b/main/main.c @@ -1340,7 +1340,7 @@ PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *h handle->handle.stream.reader = (zend_stream_reader_t)_php_stream_read; handle->handle.stream.fsizer = php_zend_stream_fsizer; handle->handle.stream.isatty = 0; - /* can we mmap immeadiately? */ + /* can we mmap immediately? */ memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap)); len = php_zend_stream_fsizer(stream TSRMLS_CC); if (len != 0 @@ -2192,7 +2192,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod zend_set_utility_values(&zuv); php_startup_sapi_content_types(TSRMLS_C); - /* startup extensions staticly compiled in */ + /* startup extensions statically compiled in */ if (php_register_internal_extensions_func(TSRMLS_C) == FAILURE) { php_printf("Unable to start builtin modules\n"); return FAILURE; diff --git a/main/php.h b/main/php.h index 7c1f8fd0c7..17ac8b4fd2 100644 --- a/main/php.h +++ b/main/php.h @@ -180,6 +180,8 @@ typedef unsigned int socklen_t; # endif #endif +#include "php_stdint.h" + #include "zend_hash.h" #include "zend_alloc.h" #include "zend_stack.h" diff --git a/main/php_stdint.h b/main/php_stdint.h new file mode 100644 index 0000000000..87edb0fde0 --- /dev/null +++ b/main/php_stdint.h @@ -0,0 +1,206 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 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 | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Michael Wallner <mike@php.net> | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_STDINT_H +#define PHP_STDINT_H + +#if defined(_MSC_VER) +/* Make sure the regular stdint.h wasn't included already and prevent it to be + included afterwards. Though if some other library needs some stuff from + stdint.h included afterwards and misses it, we'd have to extend ours. On + the other hand, if stdint.h was included before, some conflicts might + happen so we'd likewise have to fix ours. */ +# if !defined(_STDINT) +# define _STDINT +# include "win32/php_stdint.h" +# endif +# define HAVE_INT8_T 1 +# define HAVE_UINT8_T 1 +# define HAVE_INT16_T 1 +# define HAVE_UINT16_T 1 +# define HAVE_INT32_T 1 +# define HAVE_UINT32_T 1 +# define HAVE_INT64_T 1 +# define HAVE_UINT64_T 1 +#else + +#include "php_config.h" + +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#if HAVE_INTTYPES_H +# include <inttypes.h> +#endif + +#if HAVE_STDINT_H +# include <stdint.h> +#endif + +#ifndef HAVE_INT8_T +# ifdef HAVE_INT8 +typedef int8 int8_t; +# else +typedef signed char int8_t; +# endif +#endif + +#ifndef INT8_C +# define INT8_C(c) c +#endif + +#ifndef HAVE_UINT8_T +# ifdef HAVE_UINT8 +typedef uint8 uint8_t +# elif HAVE_U_INT8_T +typedef u_int8_t uint8_t; +# else +typedef unsigned char uint8_t; +# endif +#endif + +#ifndef UINT8_C +# define UINT8_C(c) c +#endif + +#ifndef HAVE_INT16_T +# ifdef HAVE_INT16 +typedef int16 int16_t; +# elif SIZEOF_SHORT >= 2 +typedef signed short int16_t; +# else +# error "No suitable 16bit integer type found" +# endif +#endif + +#ifndef INT16_C +# define INT16_C(c) c +#endif + +#ifndef HAVE_UINT16_T +# ifdef HAVE_UINT16 +typedef uint16 uint16_t +# elif HAVE_U_INT16_T +typedef u_int16_t uint16_t; +# elif SIZEOF_SHORT >= 2 +typedef unsigned short uint16_t; +# else +# error "No suitable 16bit integer type found" +# endif +#endif + +#ifndef UINT16_C +# define UINT16_C(c) c +#endif + +#ifndef HAVE_INT32_T +# ifdef HAVE_INT32 +typedef int32 int32_t; +# elif SIZEOF_INT >= 4 +typedef int int32_t; +# elif SIZEOF_LONG >= 4 +typedef long int32_t; +# else +# error "No suitable 32bit integer type found" +# endif +#endif + +#ifndef INT32_C +# define INT32_C(c) c +#endif + +#ifndef HAVE_UINT32_T +# ifdef HAVE_UINT32 +typedef uint32 uint32_t +# elif HAVE_U_INT32_T +typedef u_int32_t uint32_t; +# elif SIZEOF_INT >= 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG >= 4 +typedef unsigned long uint32_t; +# else +# error "No suitable 32bit integer type found" +# endif +#endif + +#ifndef UINT32_C +# define UINT32_C(c) c ## U +#endif + +#ifndef HAVE_INT64_T +# ifdef HAVE_INT64 +typedef int64 int64_t; +# elif SIZEOF_INT >= 8 +typedef int int64_t; +# elif SIZEOF_LONG >= 8 +typedef long int64_t; +# elif SIZEOF_LONG_LONG >= 8 +typedef long long int64_t; +# else +# error "No suitable 64bit integer type found" +# endif +#endif + +#ifndef INT64_C +# if SIZEOF_INT >= 8 +# define INT64_C(c) c +# elif SIZEOF_LONG >= 8 +# define INT64_C(c) c ## L +# elif SIZEOF_LONG_LONG >= 8 +# define INT64_C(c) c ## LL +# endif +#endif + +#ifndef HAVE_UINT64_T +# ifdef HAVE_UINT64 +typedef uint64 uint64_t +# elif HAVE_U_INT64_T +typedef u_int64_t uint64_t; +# elif SIZEOF_INT >= 8 +typedef unsigned int uint64_t; +# elif SIZEOF_LONG >= 8 +typedef unsigned long uint64_t; +# elif SIZEOF_LONG_LONG >= 8 +typedef unsigned long long uint64_t; +# else +# error "No suitable 64bit integer type found" +# endif +#endif + +#ifndef UINT64_C +# if SIZEOF_INT >= 8 +# define UINT64_C(c) c ## U +# elif SIZEOF_LONG >= 8 +# define UINT64_C(c) c ## UL +# elif SIZEOF_LONG_LONG >= 8 +# define UINT64_C(c) c ## ULL +# endif +#endif + +#endif /* !PHP_WIN32 */ +#endif /* PHP_STDINT_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/main/php_streams.h b/main/php_streams.h index 5acf942e43..c56014c62e 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -131,31 +131,31 @@ typedef struct _php_stream_ops { typedef struct _php_stream_wrapper_ops { /* open/create a wrapped stream */ - php_stream *(*stream_opener)(php_stream_wrapper *wrapper, char *filename, char *mode, + php_stream *(*stream_opener)(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); /* close/destroy a wrapped stream */ int (*stream_closer)(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC); /* stat a wrapped stream */ int (*stream_stat)(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); /* stat a URL */ - int (*url_stat)(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); + int (*url_stat)(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); /* open a "directory" stream */ - php_stream *(*dir_opener)(php_stream_wrapper *wrapper, char *filename, char *mode, + php_stream *(*dir_opener)(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); const char *label; /* delete a file */ - int (*unlink)(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); + int (*unlink)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); /* rename a file */ - int (*rename)(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); + int (*rename)(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); /* Create/Remove directory */ - 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); + int (*stream_mkdir)(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC); + int (*stream_rmdir)(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); /* Metadata handling */ - int (*stream_metadata)(php_stream_wrapper *wrapper, char *url, int options, void *value, php_stream_context *context TSRMLS_DC); + int (*stream_metadata)(php_stream_wrapper *wrapper, const char *url, int options, void *value, php_stream_context *context TSRMLS_DC); } php_stream_wrapper_ops; struct _php_stream_wrapper { @@ -322,26 +322,26 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, #define php_stream_gets(stream, buf, maxlen) _php_stream_get_line((stream), (buf), (maxlen), NULL TSRMLS_CC) #define php_stream_get_line(stream, buf, maxlen, retlen) _php_stream_get_line((stream), (buf), (maxlen), (retlen) TSRMLS_CC) -PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC); +PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, const char *delim, size_t delim_len TSRMLS_DC); /* CAREFUL! this is equivalent to puts NOT fputs! */ -PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC); +PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC); #define php_stream_puts(stream, buf) _php_stream_puts((stream), (buf) TSRMLS_CC) PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); #define php_stream_stat(stream, ssb) _php_stream_stat((stream), (ssb) TSRMLS_CC) -PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); +PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); #define php_stream_stat_path(path, ssb) _php_stream_stat_path((path), 0, (ssb), NULL TSRMLS_CC) #define php_stream_stat_path_ex(path, flags, ssb, context) _php_stream_stat_path((path), (flags), (ssb), (context) TSRMLS_CC) -PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_context *context TSRMLS_DC); +PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context TSRMLS_DC); #define php_stream_mkdir(path, mode, options, context) _php_stream_mkdir(path, mode, options, context TSRMLS_CC) -PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *context TSRMLS_DC); +PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context TSRMLS_DC); #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_opendir(const char *path, 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) 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) @@ -351,7 +351,7 @@ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_ PHPAPI int php_stream_dirent_alphasort(const char **a, const char **b); PHPAPI int php_stream_dirent_alphasortr(const char **a, const char **b); -PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_stream_context *context, +PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags, php_stream_context *context, int (*compare) (const char **a, const char **b) TSRMLS_DC); #define php_stream_scandir(dirname, namelist, context, compare) _php_stream_scandir((dirname), (namelist), 0, (context), (compare) TSRMLS_CC) @@ -540,13 +540,13 @@ void php_shutdown_stream_hashes(TSRMLS_D); PHP_RSHUTDOWN_FUNCTION(streams); BEGIN_EXTERN_C() -PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); -PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC); -PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); -PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol 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_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC); -PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len TSRMLS_DC); +PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); +PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC); +PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); +PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC); +PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC); +PHPAPI const char *php_stream_locate_eol(php_stream *stream, const char *buf, size_t 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) diff --git a/main/php_version.h b/main/php_version.h index d9ea4aab3c..d48bf13c6f 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -1,8 +1,8 @@ /* automatically generated by configure */ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 -#define PHP_MINOR_VERSION 5 -#define PHP_RELEASE_VERSION 5 +#define PHP_MINOR_VERSION 6 +#define PHP_RELEASE_VERSION 0 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.5.5-dev" -#define PHP_VERSION_ID 50505 +#define PHP_VERSION "5.6.0-dev" +#define PHP_VERSION_ID 50600 diff --git a/main/rfc1867.c b/main/rfc1867.c index 7c208c368c..4adc25767d 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -34,6 +34,10 @@ #include "rfc1867.h" #include "ext/standard/php_string.h" +#if defined(PHP_WIN32) && !defined(HAVE_ATOLL) +# define atoll(s) _atoi64(s) +#endif + #define DEBUG_FILE_UPLOAD ZEND_DEBUG static int dummy_encoding_translation(TSRMLS_D) @@ -676,8 +680,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ { char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL; char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL; - int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0; - int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous; + int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0; + int64_t total_bytes = 0, max_file_size = 0; + int skip_upload = 0, anonindex = 0, is_anonymous; zval *http_post_files = NULL; HashTable *uploaded_files = NULL; multipart_buffer *mbuff; @@ -898,7 +903,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } if (!strcasecmp(param, "MAX_FILE_SIZE")) { - max_file_size = atol(value); + max_file_size = atoll(value); } efree(param); @@ -1210,17 +1215,32 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ { zval file_size, error_type; + int size_overflow = 0; + char file_size_buf[65]; - error_type.value.lval = cancel_upload; - error_type.type = IS_LONG; + ZVAL_LONG(&error_type, cancel_upload); /* Add $foo[error] */ if (cancel_upload) { - file_size.value.lval = 0; - file_size.type = IS_LONG; + ZVAL_LONG(&file_size, 0); } else { - file_size.value.lval = total_bytes; - file_size.type = IS_LONG; + if (total_bytes > LONG_MAX) { +#ifdef PHP_WIN32 + if (_i64toa_s(total_bytes, file_size_buf, 65, 10)) { + file_size_buf[0] = '0'; + file_size_buf[1] = '\0'; + } +#else + { + int __len = snprintf(file_size_buf, 65, "%lld", total_bytes); + file_size_buf[__len] = '\0'; + } +#endif + size_overflow = 1; + + } else { + ZVAL_LONG(&file_size, total_bytes); + } } if (is_arr_upload) { @@ -1237,7 +1257,10 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ snprintf(lbuf, llen, "%s_size", param); } if (!is_anonymous) { - safe_php_register_variable_ex(lbuf, &file_size, NULL, 0 TSRMLS_CC); + if (size_overflow) { + ZVAL_STRING(&file_size, file_size_buf, 1); + } + safe_php_register_variable_ex(lbuf, &file_size, NULL, size_overflow TSRMLS_CC); } /* Add $foo[size] */ @@ -1246,7 +1269,10 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } else { snprintf(lbuf, llen, "%s[size]", param); } - register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, 0 TSRMLS_CC); + if (size_overflow) { + ZVAL_STRING(&file_size, file_size_buf, 1); + } + register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, size_overflow TSRMLS_CC); } efree(param); } diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index 9c051a5921..8c3836fea0 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -109,9 +109,9 @@ PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC } /* }}} */ -static void php_glob_stream_path_split(glob_s_t *pglob, char *path, int get_path, char **p_file TSRMLS_DC) /* {{{ */ +static void php_glob_stream_path_split(glob_s_t *pglob, const char *path, int get_path, const char **p_file TSRMLS_DC) /* {{{ */ { - char *pos, *gpath = path; + const char *pos, *gpath = path; if ((pos = strrchr(path, '/')) != NULL) { path = pos+1; @@ -141,7 +141,7 @@ static size_t php_glob_stream_read(php_stream *stream, char *buf, size_t count T { glob_s_t *pglob = (glob_s_t *)stream->abstract; php_stream_dirent *ent = (php_stream_dirent*)buf; - char *path; + const char *path; /* avoid problems if someone mis-uses the stream */ if (count == sizeof(php_stream_dirent) && pglob) { @@ -206,12 +206,12 @@ php_stream_ops php_glob_stream_ops = { }; /* {{{ php_glob_stream_opener */ -static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, char *path, char *mode, +static php_stream *php_glob_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { glob_s_t *pglob; int ret; - char *tmp, *pos; + const char *tmp, *pos; if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { return NULL; diff --git a/main/streams/memory.c b/main/streams/memory.c index 328d3be399..90780ea78f 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -598,7 +598,9 @@ PHPAPI php_stream_ops php_stream_rfc2397_ops = { php_stream_temp_set_option }; -static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ +static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, const char *path, + const char *mode, int options, char **opened_path, + php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { php_stream *stream; php_stream_temp_data *ts; @@ -640,11 +642,11 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, cha MAKE_STD_ZVAL(meta); array_init(meta); if (!semi) { /* there is only a mime type */ - add_assoc_stringl(meta, "mediatype", path, mlen, 1); + add_assoc_stringl(meta, "mediatype", (char *) path, mlen, 1); mlen = 0; } else if (sep && sep < semi) { /* there is a mime type */ plen = semi - path; - add_assoc_stringl(meta, "mediatype", path, plen, 1); + add_assoc_stringl(meta, "mediatype", (char *) 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 */ diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h index d88b30c479..6700df0b29 100644 --- a/main/streams/php_stream_plain_wrapper.h +++ b/main/streams/php_stream_plain_wrapper.h @@ -30,7 +30,7 @@ BEGIN_EXTERN_C() PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char **opened_path, int options STREAMS_DC TSRMLS_DC); #define php_stream_fopen(filename, mode, opened) _php_stream_fopen((filename), (mode), (opened), 0 STREAMS_CC TSRMLS_CC) -PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC); +PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC); #define php_stream_fopen_with_path(filename, mode, path, opened) _php_stream_fopen_with_path((filename), (mode), (path), (opened), 0 STREAMS_CC TSRMLS_CC) PHPAPI php_stream *_php_stream_fopen_from_file(FILE *file, const char *mode STREAMS_DC TSRMLS_DC); diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h index c2d911032e..52df73d731 100644 --- a/main/streams/php_stream_transport.h +++ b/main/streams/php_stream_transport.h @@ -26,16 +26,16 @@ # include <sys/socket.h> #endif -typedef php_stream *(php_stream_transport_factory_func)(const char *proto, long protolen, - char *resourcename, long resourcenamelen, +typedef php_stream *(php_stream_transport_factory_func)(const char *proto, size_t protolen, + const char *resourcename, size_t resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC); typedef php_stream_transport_factory_func *php_stream_transport_factory; BEGIN_EXTERN_C() -PHPAPI int php_stream_xport_register(char *protocol, php_stream_transport_factory factory TSRMLS_DC); -PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC); +PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC); +PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC); #define STREAM_XPORT_CLIENT 0 #define STREAM_XPORT_SERVER 1 @@ -46,7 +46,7 @@ PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC); #define STREAM_XPORT_CONNECT_ASYNC 16 /* Open a client or server socket connection */ -PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options, +PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options, int flags, const char *persistent_id, struct timeval *timeout, php_stream_context *context, @@ -59,13 +59,13 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, - const char *name, long namelen, + const char *name, size_t namelen, char **error_text TSRMLS_DC); /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, - const char *name, long namelen, + const char *name, size_t namelen, int asynchronous, struct timeval *timeout, char **error_text, @@ -141,7 +141,7 @@ typedef struct _php_stream_xport_param { struct { char *name; - long namelen; + size_t namelen; int backlog; struct timeval *timeout; struct sockaddr *addr; diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 39df31a170..949b827679 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -851,7 +851,7 @@ static php_stream_ops php_plain_files_dirstream_ops = { NULL /* set_option */ }; -static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, char *path, char *mode, +static php_stream *php_plain_files_dir_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { DIR *dir = NULL; @@ -989,7 +989,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha /* }}} */ -static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, char *path, char *mode, +static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(path TSRMLS_CC)) { @@ -999,7 +999,7 @@ static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, ch return php_stream_fopen_rel(path, mode, opened_path, options); } -static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { char *p; @@ -1029,7 +1029,7 @@ static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, in return VCWD_STAT(url, &ssb->sb); } -static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) { char *p; int ret; @@ -1058,7 +1058,7 @@ static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int op return 1; } -static int php_plain_files_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) { char *p; int ret; @@ -1147,7 +1147,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, char *url_from, c return 1; } -static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mode, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, int mode, int options, php_stream_context *context TSRMLS_DC) { int ret, recursive = options & PHP_STREAM_MKDIR_RECURSIVE; char *p; @@ -1235,7 +1235,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, char *dir, int mod } } -static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) { #if PHP_WIN32 int url_len = strlen(url); @@ -1262,7 +1262,7 @@ static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int opt return 1; } -static int php_plain_files_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC) +static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC) { struct utimbuf *newtime; char *p; @@ -1371,10 +1371,11 @@ php_stream_wrapper php_plain_files_wrapper = { }; /* {{{ php_stream_fopen_with_path */ -PHPAPI php_stream *_php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC) +PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char *mode, const char *path, char **opened_path, int options STREAMS_DC TSRMLS_DC) { /* code ripped off from fopen_wrappers.c */ - char *pathbuf, *ptr, *end; + char *pathbuf, *end; + const char *ptr; const char *exec_fname; char trypath[MAXPATHLEN]; php_stream *stream; diff --git a/main/streams/streams.c b/main/streams/streams.c index 823b8859bf..d74f9fd04a 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -803,7 +803,7 @@ PHPAPI int _php_stream_getc(php_stream *stream TSRMLS_DC) return EOF; } -PHPAPI int _php_stream_puts(php_stream *stream, char *buf TSRMLS_DC) +PHPAPI int _php_stream_puts(php_stream *stream, const char *buf TSRMLS_DC) { int len; char newline[2] = "\n"; /* is this OK for Win? */ @@ -835,11 +835,11 @@ PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D return (stream->ops->stat)(stream, ssb TSRMLS_CC); } -PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len TSRMLS_DC) +PHPAPI const char *php_stream_locate_eol(php_stream *stream, const char *buf, size_t buf_len TSRMLS_DC) { size_t avail; - char *cr, *lf, *eol = NULL; - char *readptr; + const char *cr, *lf, *eol = NULL; + const char *readptr; if (!buf) { readptr = stream->readbuf + stream->readpos; @@ -911,7 +911,7 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, if (avail > 0) { size_t cpysz = 0; char *readptr; - char *eol; + const char *eol; int done = 0; readptr = stream->readbuf + stream->readpos; @@ -994,11 +994,11 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, #define STREAM_BUFFERED_AMOUNT(stream) \ ((size_t)(((stream)->writepos) - (stream)->readpos)) -static char *_php_stream_search_delim(php_stream *stream, - size_t maxlen, - size_t skiplen, - char *delim, /* non-empty! */ - size_t delim_len TSRMLS_DC) +static const char *_php_stream_search_delim(php_stream *stream, + size_t maxlen, + size_t skiplen, + const char *delim, /* non-empty! */ + size_t delim_len TSRMLS_DC) { size_t seek_len; @@ -1018,10 +1018,10 @@ static char *_php_stream_search_delim(php_stream *stream, } } -PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, char *delim, size_t delim_len TSRMLS_DC) +PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *returned_len, const char *delim, size_t delim_len TSRMLS_DC) { - char *ret_buf, /* returned buffer */ - *found_delim = NULL; + char *ret_buf; /* returned buffer */ + const char *found_delim = NULL; size_t buffered_len, tent_ret_len; /* tentative returned length */ int has_delim = delim_len > 0; @@ -1676,9 +1676,9 @@ int php_shutdown_stream_wrappers(int module_number TSRMLS_DC) /* Validate protocol scheme names during registration * Must conform to /^[a-zA-Z0-9+.-]+$/ */ -static inline int php_stream_wrapper_scheme_validate(char *protocol, int protocol_len) +static inline int php_stream_wrapper_scheme_validate(const char *protocol, unsigned int protocol_len) { - int i; + unsigned int i; for(i = 0; i < protocol_len; i++) { if (!isalnum((int)protocol[i]) && @@ -1693,9 +1693,9 @@ static inline int php_stream_wrapper_scheme_validate(char *protocol, int protoco } /* API for registering GLOBAL wrappers */ -PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) +PHPAPI int php_register_url_stream_wrapper(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - int protocol_len = strlen(protocol); + unsigned int protocol_len = strlen(protocol); if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) { return FAILURE; @@ -1704,7 +1704,7 @@ PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *w return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL); } -PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC) +PHPAPI int php_unregister_url_stream_wrapper(const char *protocol TSRMLS_DC) { return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol) + 1); } @@ -1719,9 +1719,9 @@ static void clone_wrapper_hash(TSRMLS_D) } /* API for registering VOLATILE wrappers */ -PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) +PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper TSRMLS_DC) { - int protocol_len = strlen(protocol); + unsigned int protocol_len = strlen(protocol); if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) { return FAILURE; @@ -1734,7 +1734,7 @@ PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_w return zend_hash_add(FG(stream_wrappers), protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL); } -PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC) +PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol TSRMLS_DC) { if (!FG(stream_wrappers)) { clone_wrapper_hash(TSRMLS_C); @@ -1745,7 +1745,7 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC) /* }}} */ /* {{{ php_stream_locate_url_wrapper */ -PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char **path_for_open, int options TSRMLS_DC) +PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC) { HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash); php_stream_wrapper **wrapperpp = NULL; @@ -1880,7 +1880,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char /* {{{ _php_stream_mkdir */ -PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_mkdir(const char *path, int mode, int options, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; @@ -1895,7 +1895,7 @@ PHPAPI int _php_stream_mkdir(char *path, int mode, int options, php_stream_conte /* {{{ _php_stream_rmdir */ -PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_rmdir(const char *path, int options, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; @@ -1909,10 +1909,10 @@ PHPAPI int _php_stream_rmdir(char *path, int options, php_stream_context *contex /* }}} */ /* {{{ _php_stream_stat_path */ -PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +PHPAPI int _php_stream_stat_path(const char *path, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; - char *path_to_open = path; + const char *path_to_open = path; int ret; /* Try to hit the cache first */ @@ -1954,12 +1954,12 @@ PHPAPI int _php_stream_stat_path(char *path, int flags, php_stream_statbuf *ssb, /* }}} */ /* {{{ php_stream_opendir */ -PHPAPI php_stream *_php_stream_opendir(char *path, int options, +PHPAPI php_stream *_php_stream_opendir(const char *path, int options, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream = NULL; php_stream_wrapper *wrapper = NULL; - char *path_to_open; + const char *path_to_open; if (!path || !*path) { return NULL; @@ -2003,12 +2003,12 @@ PHPAPI php_stream_dirent *_php_stream_readdir(php_stream *dirstream, php_stream_ /* }}} */ /* {{{ php_stream_open_wrapper_ex */ -PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int options, +PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { php_stream *stream = NULL; php_stream_wrapper *wrapper = NULL; - char *path_to_open; + const char *path_to_open; int persistent = options & STREAM_OPEN_PERSISTENT; char *resolved_path = NULL; char *copy_of_path = NULL; @@ -2264,7 +2264,7 @@ PHPAPI int php_stream_dirent_alphasortr(const char **a, const char **b) /* {{{ php_stream_scandir */ -PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_stream_context *context, +PHPAPI int _php_stream_scandir(const char *dirname, char **namelist[], int flags, php_stream_context *context, int (*compare) (const char **a, const char **b) TSRMLS_DC) { php_stream *stream; diff --git a/main/streams/transports.c b/main/streams/transports.c index c24bf97ce6..2d31074ded 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -29,12 +29,12 @@ PHPAPI HashTable *php_stream_xport_get_hash(void) return &xport_hash; } -PHPAPI int php_stream_xport_register(char *protocol, php_stream_transport_factory factory TSRMLS_DC) +PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory TSRMLS_DC) { return zend_hash_update(&xport_hash, protocol, strlen(protocol) + 1, &factory, sizeof(factory), NULL); } -PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC) +PHPAPI int php_stream_xport_unregister(const char *protocol TSRMLS_DC) { return zend_hash_del(&xport_hash, protocol, strlen(protocol) + 1); } @@ -49,7 +49,7 @@ PHPAPI int php_stream_xport_unregister(char *protocol TSRMLS_DC) if (local_err) { efree(local_err); local_err = NULL; } \ } -PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int options, +PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, int options, int flags, const char *persistent_id, struct timeval *timeout, php_stream_context *context, @@ -194,7 +194,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int /* Bind the stream to a local address */ PHPAPI int php_stream_xport_bind(php_stream *stream, - const char *name, long namelen, + const char *name, size_t namelen, char **error_text TSRMLS_DC) { @@ -222,7 +222,7 @@ PHPAPI int php_stream_xport_bind(php_stream *stream, /* Connect to a remote address */ PHPAPI int php_stream_xport_connect(php_stream *stream, - const char *name, long namelen, + const char *name, size_t namelen, int asynchronous, struct timeval *timeout, char **error_text, diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 69edbaafa9..1e626e4b4c 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -45,14 +45,14 @@ struct php_user_stream_wrapper { php_stream_wrapper wrapper; }; -static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); -static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); -static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC); -static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode, +static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); +static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC); +static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC); +static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); static php_stream_wrapper_ops user_stream_wops = { @@ -332,7 +332,8 @@ static zval *user_stream_create_object(struct php_user_stream_wrapper *uwrap, ph return object; } -static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) +static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, const char *filename, const char *mode, + int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; php_userstream_data_t *us; @@ -437,7 +438,7 @@ static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filena return stream; } -static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode, +static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; @@ -1151,7 +1152,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value } -static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zfuncname, *zretval; @@ -1198,7 +1199,8 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio return ret; } -static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, + int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zold_name, *znew_name, *zfuncname, *zretval; @@ -1250,7 +1252,8 @@ static int user_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char return ret; } -static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, + int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zmode, *zoptions, *zfuncname, *zretval; @@ -1308,7 +1311,8 @@ static int user_wrapper_mkdir(php_stream_wrapper *wrapper, char *url, int mode, return ret; } -static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +static int user_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, + int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zoptions, *zfuncname, *zretval; @@ -1361,7 +1365,8 @@ static int user_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int option return ret; } -static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC) +static int user_wrapper_metadata(php_stream_wrapper *wrapper, const char *url, int option, + void *value, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zoption, *zvalue, *zfuncname, *zretval; @@ -1444,7 +1449,8 @@ static int user_wrapper_metadata(php_stream_wrapper *wrapper, char *url, int opt } -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, const char *url, int flags, + php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper->abstract; zval *zfilename, *zfuncname, *zretval, *zflags; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index a9c050f267..4edc68b015 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -230,7 +230,7 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC #endif } -static inline int sock_sendto(php_netstream_data_t *sock, char *buf, size_t buflen, int flags, +static inline int sock_sendto(php_netstream_data_t *sock, const char *buf, size_t buflen, int flags, struct sockaddr *addr, socklen_t addrlen TSRMLS_DC) { @@ -521,7 +521,7 @@ static inline int parse_unix_address(php_stream_xport_param *xparam, struct sock } #endif -static inline char *parse_ip_address_ex(const char *str, int str_len, int *portno, int get_err, char **err TSRMLS_DC) +static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *portno, int get_err, char **err TSRMLS_DC) { char *colon; char *host = NULL; @@ -774,8 +774,8 @@ static int php_tcp_sockop_set_option(php_stream *stream, int option, int value, } -PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, long protolen, - char *resourcename, long resourcenamelen, +PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t protolen, + const char *resourcename, size_t resourcenamelen, const char *persistent_id, int options, int flags, struct timeval *timeout, php_stream_context *context STREAMS_DC TSRMLS_DC) |
