]> granicus.if.org Git - php/commitdiff
Constify streams API and a few other calls down the rabbit hole.
authorAndrey Hristov <andrey@php.net>
Tue, 30 Jul 2013 10:49:36 +0000 (12:49 +0200)
committerAndrey Hristov <andrey@php.net>
Tue, 30 Jul 2013 10:49:36 +0000 (12:49 +0200)
(`char *` to `const char *` for parameters and few return values)
In a few places int len moved to size_t len.

38 files changed:
README.STREAMS
TSRM/tsrm_virtual_cwd.c
TSRM/tsrm_virtual_cwd.h
Zend/zend_operators.h
ext/bz2/bz2.c
ext/bz2/php_bz2.h
ext/fileinfo/fileinfo.c
ext/libxml/libxml.c
ext/openssl/xp_ssl.c
ext/phar/dirstream.c
ext/phar/dirstream.h
ext/phar/phar.c
ext/phar/phar_internal.h
ext/phar/stream.c
ext/phar/stream.h
ext/phar/util.c
ext/standard/file.c
ext/standard/file.h
ext/standard/filestat.c
ext/standard/ftp_fopen_wrapper.c
ext/standard/http_fopen_wrapper.c
ext/standard/php_fopen_wrapper.c
ext/standard/php_fopen_wrappers.h
ext/zip/php_zip.h
ext/zip/zip_stream.c
ext/zlib/php_zlib.h
ext/zlib/zlib_fopen_wrapper.c
main/fopen_wrappers.c
main/php_streams.h
main/streams/glob_wrapper.c
main/streams/memory.c
main/streams/php_stream_plain_wrapper.h
main/streams/php_stream_transport.h
main/streams/plain_wrapper.c
main/streams/streams.c
main/streams/transports.c
main/streams/userspace.c
main/streams/xp_socket.c

index f625406a3bae64a6ca71b20a6d44128bcc872d62..0046e6a75438d1555d12192dafafcd9208ca78dd 100644 (file)
@@ -46,7 +46,7 @@ Opening Streams
 ===============
 In most cases, you should use this API:
 
-PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode,
+PHPAPI php_stream *php_stream_open_wrapper(const char *path, const char *mode,
     int options, char **opened_path TSRMLS_DC);
 
 Where:
index 3e211fa54f9a2b646b7246db4ad0cde74c611e9e..a7d09630a26c7f92f0c3af36011d06defd910f5f 100644 (file)
@@ -1673,7 +1673,7 @@ CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
-CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) /* {{{ */
+CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC) /* {{{ */
 {
        cwd_state old_state;
        cwd_state new_state;
index 8aac4aa2671ec3c4c157999d1c20d587b036a946..72c44246705665fa3e571167f41f99175aab67b1 100644 (file)
@@ -161,7 +161,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC);
 CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC);
 CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
 CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
-CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
+CWD_API int virtual_rename(const char *oldname, const char *newname TSRMLS_DC);
 CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
 CWD_API int virtual_unlink(const char *path TSRMLS_DC);
index e7ab9bb3fe9e4f7252c18e600ac7308bf3933202..38d96f1e9b8f0360e7972c84f19a2ede16286a3f 100644 (file)
@@ -269,11 +269,11 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv
     return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
 }
 
-static inline char *
-zend_memnstr(char *haystack, char *needle, int needle_len, char *end)
+static inline const char *
+zend_memnstr(const char *haystack, const char *needle, int needle_len, char *end)
 {
-       char *p = haystack;
-       char ne = needle[needle_len-1];
+       const char *p = haystack;
+       const char ne = needle[needle_len-1];
 
        if (needle_len == 1) {
                return (char *)memchr(p, *needle, (end-p));
index abe84fc31605f3dcadf7e13588f8513638108a8f..4adaa47fa9873cab18e3021a39177566dba46993 100644 (file)
@@ -192,7 +192,7 @@ php_stream_ops php_stream_bz2io_ops = {
 
 /* {{{ Bzip2 stream openers */
 PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, 
-                                                                                                               char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC)
+                                                                                                               const char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC)
 {
        struct php_bz2_stream_data_t *self;
        
@@ -205,8 +205,8 @@ PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz,
 }
 
 PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
-                                                                                       char *path,
-                                                                                       char *mode,
+                                                                                       const char *path,
+                                                                                       const char *mode,
                                                                                        int options,
                                                                                        char **opened_path,
                                                                                        php_stream_context *context STREAMS_DC TSRMLS_DC)
index 8b12eca357d9912f67cf2b56a40d72fd8411a409..7bcffc1831e5378812da4e628916f02f17aa76e4 100644 (file)
@@ -47,8 +47,8 @@ extern zend_module_entry bz2_module_entry;
 #      define PHP_BZ2_API
 #endif
 
-PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC);
+PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
+PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC);
 
 #define php_stream_bz2open_from_BZFILE(bz, mode, innerstream)  _php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC TSRMLS_CC)
 #define php_stream_bz2open(wrapper, path, mode, options, opened_path)  _php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC TSRMLS_CC)
index 353adb98b972e3cf0461c0a7b0063ea861591fc3..799891ed13d895d9273290a07364c2dceb5e7b66 100644 (file)
@@ -497,7 +497,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
                case FILEINFO_MODE_FILE:
                {
                        /* determine if the file is a local file or remote URL */
-                       char *tmp2;
+                       const char *tmp2;
                        php_stream_wrapper *wrap;
                        php_stream_statbuf ssb;
 
index b1cb45db7645e683a0b636d9de8088e25b74f791..9ee4de25b7697936f307d559f66905b50cb7a8af 100644 (file)
@@ -292,7 +292,8 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
        php_stream_statbuf ssbuf;
        php_stream_context *context = NULL;
        php_stream_wrapper *wrapper = NULL;
-       char *resolved_path, *path_to_open = NULL;
+       char *resolved_path;
+       const char *path_to_open = NULL;
        void *ret_val = NULL;
        int isescaped=0;
        xmlURI *uri;
index e9a72e3f3e421e0e73f6e7c1f1d088bfb3c39e8c..85d20fd29707135c0663a615a27f9cefbce2283d 100644 (file)
@@ -309,7 +309,7 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
                php_stream_xport_crypto_param *cparam
                TSRMLS_DC)
 {
-       SSL_METHOD *method;
+       const SSL_METHOD *method;
        long ssl_ctx_options = SSL_OP_ALL;
        
        if (sslsock->ssl_handle) {
@@ -853,7 +853,7 @@ php_stream_ops php_openssl_socket_ops = {
        php_openssl_sockop_set_option,
 };
 
-static char * get_sni(php_stream_context *ctx, char *resourcename, long resourcenamelen, int is_persistent TSRMLS_DC) {
+static char * get_sni(php_stream_context *ctx, const char *resourcename, size_t resourcenamelen, int is_persistent TSRMLS_DC) {
 
        php_url *url;
 
@@ -900,8 +900,8 @@ static char * get_sni(php_stream_context *ctx, char *resourcename, long resource
        return NULL;
 }
 
-php_stream *php_openssl_ssl_socket_factory(const char *proto, long protolen,
-               char *resourcename, long resourcenamelen,
+php_stream *php_openssl_ssl_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)
index c29ca9d9683d52fe4850e75b7dfcef84d51b5c43..b090577306758f4e29d00d7bd12552da86cd8951 100644 (file)
@@ -319,7 +319,7 @@ PHAR_ADD_ENTRY:
 /**
  * Open a directory handle within a phar archive
  */
-php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
+php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
 {
        php_url *resource = NULL;
        php_stream *ret;
@@ -432,7 +432,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char
 /**
  * Make a new directory within a phar archive
  */
-int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
 {
        phar_entry_info entry, *e;
        phar_archive_data *phar = NULL;
@@ -564,7 +564,7 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, in
 /**
  * Remove a directory within a phar archive
  */
-int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
 {
        phar_entry_info *entry;
        phar_archive_data *phar = NULL;
index 9b07c9d799085f2ebad5a2a6b9f9169eecacb3cf..030fe6536e9133b59cacd93a20527e998791754f 100644 (file)
 /* $Id$ */
 
 BEGIN_EXTERN_C()
-int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC);
-int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC);
+int phar_wrapper_mkdir(php_stream_wrapper *wrapper, const char *url_from, int mode, int options, php_stream_context *context TSRMLS_DC);
+int phar_wrapper_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC);
 
 #ifdef PHAR_DIRSTREAM
-php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC);
+php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC);
 
 /* directory handlers */
 static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
@@ -33,7 +33,7 @@ static int    phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC);
 static int    phar_dir_flush(php_stream *stream TSRMLS_DC);
 static int    phar_dir_seek( php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC);
 #else
-php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
+php_stream* phar_wrapper_open_dir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
 #endif
 END_EXTERN_C()
 
index ec8e5fbde7521bb0b03975e5c086f4e10830b36f..e8d1139cfa8625fbd40b6af21d1a936723b2807e 100644 (file)
@@ -2251,13 +2251,13 @@ last_time:
  *
  * This is used by phar_parse_url()
  */
-int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */
+int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC) /* {{{ */
 {
        const char *ext_str;
 #ifdef PHP_WIN32
        char *save;
 #endif
-       int ext_len, free_filename = 0;
+       int ext_len;
 
        if (!strncasecmp(filename, "phar://", 7)) {
                filename += 7;
@@ -2266,7 +2266,6 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le
 
        ext_len = 0;
 #ifdef PHP_WIN32
-       free_filename = 1;
        save = filename;
        filename = estrndup(filename, filename_len);
        phar_unixify_path_separators(filename, filename_len);
@@ -2282,10 +2281,9 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le
 #endif
                        }
 
-                       if (free_filename) {
-                               efree(filename);
-                       }
-
+#ifdef PHP_WIN32
+                       efree(filename);
+#endif
                        return FAILURE;
                }
 
@@ -2308,9 +2306,9 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le
                *entry = estrndup("/", 1);
        }
 
-       if (free_filename) {
-               efree(filename);
-       }
+#ifdef PHP_WIN32
+       efree(filename);
+#endif
 
        return SUCCESS;
 }
index daa85f1b70f8bcb73d727d7e8b0bd57371ffc491..9b8d608207bc415ebf778c40087539ac01ca12fc 100644 (file)
@@ -690,11 +690,11 @@ int phar_entry_delref(phar_entry_data *idata TSRMLS_DC);
 
 phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len, char **error, int security TSRMLS_DC);
 phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security TSRMLS_DC);
-phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC);
-int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC);
+phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC);
+int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC);
 int phar_flush(phar_archive_data *archive, char *user_stub, long len, int convert, char **error TSRMLS_DC);
 int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC);
-int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC);
+int phar_split_fname(const char *filename, int filename_len, char **arch, int *arch_len, char **entry, int *entry_len, int executable, int for_create TSRMLS_DC);
 
 typedef enum {
        pcr_use_query,
index 401d81e109bcb3d17e4ebf291e1e81e020e2bfd7..d3d4cd655b33c8059eaf0cb3cda72b220a05a2a8 100644 (file)
@@ -56,7 +56,7 @@ php_stream_wrapper php_stream_phar_wrapper = {
 /**
  * Open a phar file for streams API
  */
-php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC) /* {{{ */
+php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC) /* {{{ */
 {
        php_url *resource;
        char *arch = NULL, *entry = NULL, *error;
@@ -155,7 +155,7 @@ php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode,
 /**
  * used for fopen('phar://...') and company
  */
-static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
+static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
 {
        phar_archive_data *phar;
        phar_entry_data *idata;
@@ -563,7 +563,7 @@ static int phar_stream_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
 /**
  * Stream wrapper stat implementation of stat()
  */
-static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags,
+static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags,
                                  php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) /* {{{ */
 {
        php_url *resource = NULL;
@@ -686,7 +686,7 @@ free_resource:
 /**
  * Unlink a file within a phar archive
  */
-static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
 {
        php_url *resource;
        char *internal_file, *error;
@@ -762,7 +762,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio
 }
 /* }}} */
 
-static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
+static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) /* {{{ */
 {
        php_url *resource_from, *resource_to;
        char *error;
index b22b67ab01749f489c9dfcc6f472c77b26403206..0155759d12989dd2e152b1c7fa501bdb9bf2221f 100644 (file)
 
 BEGIN_EXTERN_C()
 
-php_url* phar_parse_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC);
+php_url* phar_parse_url(php_stream_wrapper *wrapper, const char *filename, const char *mode, int options TSRMLS_DC);
 void phar_entry_remove(phar_entry_data *idata, char **error TSRMLS_DC);
 
-static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC);
-static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC);
-static int phar_wrapper_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC);
+static php_stream* phar_wrapper_open_url(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
+static int phar_wrapper_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC);
+static int phar_wrapper_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC);
+static int phar_wrapper_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC);
 
 /* file/stream handlers */
 static size_t phar_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
index 8348a47874eab369f3d79ab67bb78a08211b21ce..38aa549f00d57edc05b4aa3e0b423e0bfa18d242 100644 (file)
@@ -572,7 +572,7 @@ not_stream:
  * appended, truncated, or read.  For read, if the entry is marked unmodified, it is
  * assumed that the file pointer, if present, is opened for reading
  */
-int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
+int phar_get_entry_data(phar_entry_data **ret, char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
 {
        phar_archive_data *phar;
        phar_entry_info *entry;
@@ -733,7 +733,7 @@ really_get_entry:
 /**
  * Create a new dummy file slot within a writeable phar for a newly created file
  */
-phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
+phar_entry_data *phar_get_or_create_entry_data(char *fname, int fname_len, char *path, int path_len, const char *mode, char allow_dir, char **error, int security TSRMLS_DC) /* {{{ */
 {
        phar_archive_data *phar;
        phar_entry_info *entry, etemp;
index 106f5c1004ec9aa07f1d26aa0dfd1a1beca14856..c880eb3745ada9f2ffe796e00dfe628dc72d685e 100644 (file)
@@ -1284,7 +1284,7 @@ PHPAPI PHP_FUNCTION(fseek)
 */
 
 /* DEPRECATED APIs: Use php_stream_mkdir() instead */
-PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC)
+PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC)
 {
        int ret;
 
@@ -1299,7 +1299,7 @@ PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC)
        return ret;
 }
 
-PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC)
+PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC)
 {
        return php_mkdir_ex(dir, mode, REPORT_ERRORS TSRMLS_CC);
 }
@@ -1623,7 +1623,7 @@ PHP_FUNCTION(copy)
 
 /* {{{ php_copy_file
  */
-PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC)
+PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC)
 {
        return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC);
 }
@@ -1631,7 +1631,7 @@ PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC)
 
 /* {{{ php_copy_file_ex
  */
-PHPAPI int php_copy_file_ex(char *src, char *dest, int src_flg TSRMLS_DC)
+PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_flg TSRMLS_DC)
 {
        return php_copy_file_ctx(src, dest, 0, NULL TSRMLS_CC);
 }
@@ -1639,7 +1639,7 @@ PHPAPI int php_copy_file_ex(char *src, char *dest, int src_flg TSRMLS_DC)
 
 /* {{{ php_copy_file_ctx
  */
-PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC)
+PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC)
 {
        php_stream *srcstream = NULL, *deststream = NULL;
        int ret = FAILURE;
index 2bcdfd64bf5e684f64bb77ed25f6939cd00c2877..d6f142a7690d1311bf6620ebded9f60439ced421 100644 (file)
@@ -74,11 +74,11 @@ PHP_MINIT_FUNCTION(user_streams);
 
 PHPAPI int php_le_stream_context(TSRMLS_D);
 PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC);
-PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC);
-PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC);
-PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC);
-PHPAPI int php_mkdir_ex(char *dir, long mode, int options TSRMLS_DC);
-PHPAPI int php_mkdir(char *dir, long mode TSRMLS_DC);
+PHPAPI int php_copy_file(const char *src, const char *dest TSRMLS_DC);
+PHPAPI int php_copy_file_ex(const char *src, const char *dest, int src_chk TSRMLS_DC);
+PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php_stream_context *ctx TSRMLS_DC);
+PHPAPI int php_mkdir_ex(const char *dir, long mode, int options TSRMLS_DC);
+PHPAPI int php_mkdir(const char *dir, long mode TSRMLS_DC);
 PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC);
 PHPAPI int php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC);
 
@@ -121,7 +121,7 @@ typedef struct {
        long default_socket_timeout;
        char *user_agent; /* for the http wrapper */
        char *from_address; /* for the ftp and http wrappers */
-       char *user_stream_current_filename; /* for simple recursion protection */
+       const char *user_stream_current_filename; /* for simple recursion protection */
        php_stream_context *default_context;
        HashTable *stream_wrappers;                     /* per-request copy of url_stream_wrappers_hash */
        HashTable *stream_filters;                      /* per-request copy of stream_filters_hash */
index 2713d23f1d826db041d3d4678f18f98b8b403384..0b40e7319b3988d4221ea8b13ba7cfd20615f33a 100644 (file)
@@ -857,7 +857,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
                "dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
                "size", "atime", "mtime", "ctime", "blksize", "blocks"
        };
-       char *local;
+       const char *local;
        php_stream_wrapper *wrapper;
 
        if (!filename_length) {
index 86975d7f5b20bc1620d97a67c86373f6add49f5c..d04ef52be7494dabb6aca4eee1f04eecfae2595e 100644 (file)
@@ -130,8 +130,9 @@ static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *
 
 /* {{{ php_ftp_fopen_connect
  */
-static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context,
-                                                                        php_stream **preuseid, php_url **presource, int *puse_ssl, int *puse_ssl_on_data TSRMLS_DC)
+static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
+                                                                                char **opened_path, php_stream_context *context, php_stream **preuseid,
+                                                                                php_url **presource, int *puse_ssl, int *puse_ssl_on_data TSRMLS_DC)
 {
        php_stream *stream = NULL, *reuseid = NULL;
        php_url *resource = NULL;
@@ -410,7 +411,8 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_
 
 /* {{{ php_fopen_url_wrap_ftp
  */
-php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
+php_stream * php_stream_url_wrap_ftp(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 = NULL, *datastream = NULL;
        php_url *resource = NULL;
@@ -691,7 +693,8 @@ static php_stream_ops php_ftp_dirstream_ops = {
 
 /* {{{ php_stream_ftp_opendir
  */
-php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
+php_stream * php_stream_ftp_opendir(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, *reuseid, *datastream = NULL;
        php_ftp_dirstream_data *dirsdata;
@@ -780,7 +783,7 @@ opendir_errexit:
 
 /* {{{ php_stream_ftp_url_stat
  */
-static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC)
+static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC)
 {
        php_stream *stream = NULL;
        php_url *resource = NULL;
@@ -903,7 +906,7 @@ stat_errexit:
 
 /* {{{ php_stream_ftp_unlink
  */
-static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC)
+static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC)
 {
        php_stream *stream = NULL;
        php_url *resource = NULL;
@@ -953,7 +956,7 @@ unlink_errexit:
 
 /* {{{ php_stream_ftp_rename
  */
-static int php_stream_ftp_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC)
+static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC)
 {
        php_stream *stream = NULL;
        php_url *resource_from = NULL, *resource_to = NULL;
@@ -1032,7 +1035,7 @@ rename_errexit:
 
 /* {{{ php_stream_ftp_mkdir
  */
-static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, char *url, int mode, int options, php_stream_context *context TSRMLS_DC)
+static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC)
 {
        php_stream *stream = NULL;
        php_url *resource = NULL;
@@ -1126,7 +1129,7 @@ mkdir_errexit:
 
 /* {{{ php_stream_ftp_rmdir
  */
-static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC)
+static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC)
 {
        php_stream *stream = NULL;
        php_url *resource = NULL;
index b8676bbba4df642ff3ef827a46ddfdaac0d96686..ac6fdad4fef3aa7a889cbb481a6c1ecebca948a6 100644 (file)
@@ -84,7 +84,8 @@
 #define HTTP_WRAPPER_HEADER_INIT    1
 #define HTTP_WRAPPER_REDIRECTED     2
 
-php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
+php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
+                                                                               char **opened_path, php_stream_context *context, int redirect_max, int flags STREAMS_DC TSRMLS_DC) /* {{{ */
 {
        php_stream *stream = NULL;
        php_url *resource = NULL;
@@ -921,7 +922,7 @@ out:
 }
 /* }}} */
 
-php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
+php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
 {
        return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT STREAMS_CC TSRMLS_CC);
 }
index f8d7bda482385ab97657e3b028d668b3663b6777..0fb27baacd8e51f12d6945b9e5f1835120a864c2 100644 (file)
@@ -157,7 +157,8 @@ static void php_stream_apply_filter_list(php_stream *stream, char *filterlist, i
 }
 /* }}} */
 
-php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
+php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *path, const char *mode, int options,
+                                                                        char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */
 {
        int fd = -1;
        int mode_rw = 0;
index 5f78256bcb42388b7fe009d717ecd8b1517dad25..366a1295b3c2cc52f39d54b6f51cdc28c9a3cd0e 100644 (file)
@@ -23,8 +23,8 @@
 #ifndef PHP_FOPEN_WRAPPERS_H
 #define PHP_FOPEN_WRAPPERS_H
 
-php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-php_stream *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
+php_stream *php_stream_url_wrap_http(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 *php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
 extern PHPAPI php_stream_wrapper php_stream_http_wrapper;
 extern PHPAPI php_stream_wrapper php_stream_ftp_wrapper;
 extern php_stream_wrapper php_stream_php_wrapper;
index 7dd9ff09d0b5133fc32268178e2302924d68431c..dace407d14f31ff081b739600f2114a8aa06b0da 100644 (file)
@@ -81,8 +81,8 @@ typedef struct _ze_zip_object {
        int filename_len;
 } ze_zip_object;
 
-php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
-php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_DC TSRMLS_DC);
+php_stream *php_stream_zip_opener(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 *php_stream_zip_open(const char *filename, const char *path, const char *mode STREAMS_DC TSRMLS_DC);
 
 extern php_stream_wrapper php_stream_zip_wrapper;
 #endif
index 400edd6e6c0b9d46d66fc315429d1561cf9de34b..79b54cbbb0cdcf0dc28e34b73c8151a23656cee0 100644 (file)
@@ -185,7 +185,7 @@ php_stream_ops php_stream_zipio_ops = {
 };
 
 /* {{{ php_stream_zip_open */
-php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_DC TSRMLS_DC)
+php_stream *php_stream_zip_open(const char *filename, const char *path, const char *mode STREAMS_DC TSRMLS_DC)
 {
        struct zip_file *zf = NULL;
        int err = 0;
@@ -235,8 +235,8 @@ php_stream *php_stream_zip_open(char *filename, char *path, char *mode STREAMS_D
 
 /* {{{ php_stream_zip_opener */
 php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
-                                                                                       char *path,
-                                                                                       char *mode,
+                                                                                       const char *path,
+                                                                                       const char *mode,
                                                                                        int options,
                                                                                        char **opened_path,
                                                                                        php_stream_context *context STREAMS_DC TSRMLS_DC)
index 6b1d0cd80c5106c7d4c50f0a2c6c8d93076b2229..3e4b9381e7c81e69ca3d9d45b623b24a3619704b 100644 (file)
@@ -58,7 +58,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib)
     zend_bool handler_registered;
 ZEND_END_MODULE_GLOBALS(zlib);
 
-php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
+php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC);
 extern php_stream_ops php_stream_gzio_ops;
 extern php_stream_wrapper php_stream_gzip_wrapper;
 extern php_stream_filter_factory php_zlib_filter_factory;
index 1b00eb8713b9063135d57445c817ac9309e74dd0..2fd9dc7766ec954d46c8d9cfa34c225f16b6ab82 100644 (file)
@@ -106,7 +106,7 @@ php_stream_ops php_stream_gzio_ops = {
        NULL  /* set_option */
 };
 
-php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, char *path, char *mode, int options, 
+php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, 
                                                          char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC)
 {
        struct php_gz_stream_data_t *self;
index 6f11cf3f3254b841e04309ad4ea99abd2b461d4f..eb33ac7ba1264cb6cde27c908330f2ecbfcc693d 100644 (file)
@@ -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)) {
index 5acf942e434bbf39e52aff41b1f115acdaf8135d..c56014c62e17f022ebb9574ac2e530cc77cf1e82 100644 (file)
@@ -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)
index 9c051a59210ab004961ed12c49f50715ef949bd9..8c3836fea02a0466a02a490d774793173c7173c0 100644 (file)
@@ -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;
index 328d3be399018e7a0c343541cf22a0e2a006100b..90780ea78ffede0dcc3722bb9cf4d4721aa32fd7 100644 (file)
@@ -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 */
index d88b30c4791cf9bc5178a0ff9b494411919d21cd..6700df0b29a036bf72dae680767aed67c2058700 100644 (file)
@@ -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);
index c2d911032ef8a4f5080fcc48d889bcb3d5d7a4b7..52df73d731a449e77bb2eec2d1a4d2e4a277a7fc 100644 (file)
 # 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;
index 39df31a170503a3410d89b8f40ddb342479856be..949b827679ecdf2293dd40461afb64655a867553 100644 (file)
@@ -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;
index 823b8859bf3daef1a3652ab6ca03a5062f422986..d74f9fd04aa7554052de3b59407ebbd489500141 100644 (file)
@@ -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;
index c24bf97ce6e9e65f1985dcc76f8d42a3f25b9f2b..2d31074ded8076c41dc2e7a1a04944d51ab3e54d 100644 (file)
@@ -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,
index 69edbaafa91d4938623aa26dbb8526459b47e86d..1e626e4b4c779e7bd1d3fe4e6d6b490de7b152c2 100644 (file)
@@ -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;
index a9c050f2672d2873e3b8d1a9b16bdb46216c4430..4edc68b015f82a9f2a7521c4d490153a5809e5bc 100644 (file)
@@ -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)