com php-src: define platform dependent zend_off_t: Zend /zend_int.h Zend/zend_language_scanner.c ext/stan dard/file.c ext/standard/filters.c
ext/standard/image .c ext/standard/math.c ext/standard/php_fopen_wrapp er.c ext/standard/streamsfuncs.c main/SAPI.h main/p hp_streams.h main/rfc1867.c
main/rfc186 7.h main/streams/cast.c main/streams/glob_wrapper .c main/streams/memory.c main/streams/mmap.c main/s treams/php_stream_mmap.h
main/streams/plain_wrapper .

From: Date: Mon, 11 Nov 2013 23:24:52 +0000
Subject: com php-src: define platform dependent zend_off_t: Zend /zend_int.h Zend/zend_language_scanner.c ext/stan dard/file.c ext/standard/filters.c
ext/standard/image .c ext/standard/math.c ext/standard/php_fopen_wrapp er.c ext/standard/streamsfuncs.c main/SAPI.h main/p hp_streams.h main/rfc1867.c
main/rfc186 7.h main/streams/cast.c main/streams/glob_wrapper .c main/streams/memory.c main/streams/mmap.c main/s treams/php_stream_mmap.h
main/streams/plain_wrapper .
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-73936@lists.php.net to get a copy of this message
Commit: f90fe17424199aa8614857ebcaf5aac142ac8092 Author: Anatol Belski <ab@php.net> Tue, 12 Nov 2013 00:24:52 +0100 Parents: 570b1041e9002dd993dcf738c005deeb5d7da0f4 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f90fe17424199aa8614857ebcaf5aac142ac8092 Log: define platform dependent zend_off_t Changed paths: M Zend/zend_int.h M Zend/zend_language_scanner.c M ext/standard/file.c M ext/standard/filters.c M ext/standard/image.c M ext/standard/math.c M ext/standard/php_fopen_wrapper.c M ext/standard/streamsfuncs.c M main/SAPI.h M main/php_streams.h M main/rfc1867.c M main/rfc1867.h M main/streams/cast.c M main/streams/glob_wrapper.c M main/streams/memory.c M main/streams/mmap.c M main/streams/php_stream_mmap.h M main/streams/plain_wrapper.c M main/streams/streams.c M main/streams/userspace.c

diff --git a/Zend/zend_int.h b/Zend/zend_int.h index ae15ce7..fe94420 100644 --- a/Zend/zend_int.h +++ b/Zend/zend_int.h @@ -15,6 +15,7 @@ # ifdef _WIN64 typedef __int64 zend_int_t; typedef unsigned __int64 zend_uint_t; +typedef __int64 zend_off_t; # define ZEND_INT_MAX _I64_MAX # define ZEND_INT_MIN _I64_MIN # define ZEND_UINT_MAX _UI64_MAX @@ -25,6 +26,7 @@ typedef unsigned __int64 zend_uint_t; # if defined(__LP64__) || defined(_LP64) typedef int64_t zend_int_t; typedef uint64_t zend_uint_t; +typedef off_t zend_off_t; # define ZEND_INT_MAX INT64_MAX # define ZEND_INT_MIN INT64_MIN # define ZEND_UINT_MAX UINT64_MAX @@ -36,6 +38,7 @@ typedef uint64_t zend_uint_t; #else typedef long zend_int_t; typedef unsigned long zend_uint_t; +typedef off_t zend_off_t; # define ZEND_INT_MAX LONG_MAX # define ZEND_INT_MIN LONG_MIN # define ZEND_UINT_MAX ULONG_MAX diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index fe7ec74..ff344a5 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -49,7 +49,7 @@ #include "zend_API.h" #include "zend_strtod.h" #include "zend_exceptions.h" -#include "zend_virtual_cwd.h" +#include "zend_virtual_cwd.h" #include "tsrm_config_common.h" #define YYCTYPE unsigned char diff --git a/ext/standard/file.c b/ext/standard/file.c index 7b6d8dc..d288983 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -549,7 +549,7 @@ PHP_FUNCTION(file_get_contents) } if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the stream", offset); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", offset); php_stream_close(stream); RETURN_FALSE; } diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 0c3817d..e7ae99a 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -1854,7 +1854,7 @@ static php_stream_filter_factory strfilter_convert_factory = { typedef struct _php_consumed_filter_data { int persistent; size_t consumed; - off_t offset; + zend_off_t offset; } php_consumed_filter_data; static php_stream_filter_status_t consumed_filter_filter( diff --git a/ext/standard/image.c b/ext/standard/image.c index 6bc134c..ca89916 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -420,7 +420,7 @@ static unsigned int php_next_marker(php_stream * stream, int last_marker, int co * skip over a variable-length block; assumes proper length marker */ static int php_skip_variable(php_stream * stream TSRMLS_DC) { - off_t length = ((unsigned int)php_read2(stream TSRMLS_CC)); + zend_off_t length = ((unsigned int)php_read2(stream TSRMLS_CC)); if (length < 2) { return 0; diff --git a/ext/standard/math.c b/ext/standard/math.c index dc7855a..2631233 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -526,7 +526,7 @@ PHP_FUNCTION(asinh) PHP_FUNCTION(acosh) { double num; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) { return; } diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 0adb1e0..31fc21b 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -65,7 +65,7 @@ php_stream_ops php_stream_output_ops = { typedef struct php_stream_input { /* {{{ */ php_stream **body_ptr; - off_t position; + zend_off_t position; } php_stream_input_t; /* }}} */ @@ -118,7 +118,7 @@ static int php_stream_input_flush(php_stream *stream TSRMLS_DC) /* {{{ */ } /* }}} */ -static int php_stream_input_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) /* {{{ */ +static int php_stream_input_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */ { php_stream_input_t *input = stream->abstract; diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index e401aa2..f679ffe 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -418,7 +418,7 @@ PHP_FUNCTION(stream_get_contents) if (desiredpos >= 0) { zend_str_size seek_res = 0; - off_t position; + zend_off_t position; position = php_stream_tell(stream); if (position >= 0 && desiredpos > position) { diff --git a/main/SAPI.h b/main/SAPI.h index 55fd386..6138cae 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -237,7 +237,7 @@ struct _sapi_module_struct { int (*send_headers)(sapi_headers_struct *sapi_headers TSRMLS_DC); void (*send_header)(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC); - int (*read_post)(char *buffer, uint count_bytes TSRMLS_DC); + zend_str_size_int (*read_post)(char *buffer, uint count_bytes TSRMLS_DC); char *(*read_cookies)(TSRMLS_D); void (*register_server_variables)(zval *track_vars_array TSRMLS_DC); diff --git a/main/php_streams.h b/main/php_streams.h index c9732b4..a87f3ac 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -123,7 +123,7 @@ typedef struct _php_stream_ops { const char *label; /* label for this ops structure */ /* these are optional */ - int (*seek)(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC); + int (*seek)(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC); int (*cast)(php_stream *stream, int castas, void **ret TSRMLS_DC); int (*stat)(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); int (*set_option)(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC); @@ -211,11 +211,11 @@ struct _php_stream { int flags; /* PHP_STREAM_FLAG_XXX */ /* buffer */ - off_t position; /* of underlying stream */ + zend_off_t position; /* of underlying stream */ unsigned char *readbuf; size_t readbuflen; - off_t readpos; - off_t writepos; + zend_off_t readpos; + zend_off_t writepos; /* how much data to read when filling buffer */ size_t chunk_size; @@ -283,11 +283,11 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options TSRMLS_DC); #define php_stream_close(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC) #define php_stream_pclose(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE_PERSISTENT TSRMLS_CC) -PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC); +PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TSRMLS_DC); #define php_stream_rewind(stream) _php_stream_seek((stream), 0L, SEEK_SET TSRMLS_CC) #define php_stream_seek(stream, offset, whence) _php_stream_seek((stream), (offset), (whence) TSRMLS_CC) -PHPAPI off_t _php_stream_tell(php_stream *stream TSRMLS_DC); +PHPAPI zend_off_t _php_stream_tell(php_stream *stream TSRMLS_DC); #define php_stream_tell(stream) _php_stream_tell((stream) TSRMLS_CC) PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC); diff --git a/main/rfc1867.c b/main/rfc1867.c index 8dedee6..3c9e160 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -786,7 +786,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ char buff[FILLUNIT]; char *cd = NULL, *param = NULL, *filename = NULL, *tmp = NULL; size_t blen = 0, wlen = 0; - off_t offset; + zend_off_t offset; zend_llist_clean(&header); diff --git a/main/rfc1867.h b/main/rfc1867.h index 8a502c4..0a1b244 100644 --- a/main/rfc1867.h +++ b/main/rfc1867.h @@ -51,7 +51,7 @@ typedef struct _multipart_event_file_start { typedef struct _multipart_event_file_data { size_t post_bytes_processed; - off_t offset; + zend_off_t offset; char *data; size_t length; size_t *newlength; diff --git a/main/streams/cast.c b/main/streams/cast.c index bf96d3c..a41e006 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -76,7 +76,7 @@ static int stream_cookie_writer(void *cookie, const char *buffer, int size) return php_stream_write((php_stream *)cookie, (char *)buffer, size); } -static PHP_FPOS_T stream_cookie_seeker(void *cookie, off_t position, int whence) +static PHP_FPOS_T stream_cookie_seeker(void *cookie, zend_off_t position, int whence) { TSRMLS_FETCH(); @@ -114,7 +114,7 @@ static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence) { TSRMLS_FETCH(); - *position = php_stream_seek((php_stream *)cookie, (off_t)*position, whence); + *position = php_stream_seek((php_stream *)cookie, (zend_off_t)*position, whence); if (*position == -1) { return -1; @@ -122,7 +122,7 @@ static int stream_cookie_seeker(void *cookie, __off64_t *position, int whence) return 0; } # else -static int stream_cookie_seeker(void *cookie, off_t position, int whence) +static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence) { TSRMLS_FETCH(); @@ -206,7 +206,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show if (ret && castas != PHP_STREAM_AS_FD_FOR_SELECT) { php_stream_flush(stream); if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) { - off_t dummy; + zend_off_t dummy; stream->ops->seek(stream, stream->position, SEEK_SET, &dummy TSRMLS_CC); stream->readpos = stream->writepos = 0; @@ -246,7 +246,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show } if (*ret != NULL) { - off_t pos; + zend_off_t pos; stream->fclose_stdiocast = PHP_STREAM_FCLOSE_FOPENCOOKIE; diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c index a9e1bb2..b84272a 100644 --- a/main/streams/glob_wrapper.c +++ b/main/streams/glob_wrapper.c @@ -180,7 +180,7 @@ static int php_glob_stream_close(php_stream *stream, int close_handle TSRMLS_DC) } /* {{{ */ -static int php_glob_stream_rewind(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) /* {{{ */ +static int php_glob_stream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) /* {{{ */ { glob_s_t *pglob = (glob_s_t *)stream->abstract; diff --git a/main/streams/memory.c b/main/streams/memory.c index ba51136..bb5dc6a 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -127,7 +127,7 @@ static int php_stream_memory_flush(php_stream *stream TSRMLS_DC) /* {{{ */ -static int php_stream_memory_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_stream_memory_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); @@ -439,7 +439,7 @@ static int php_stream_temp_flush(php_stream *stream TSRMLS_DC) /* {{{ */ -static int php_stream_temp_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_stream_temp_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { php_stream_temp_data *ts = (php_stream_temp_data*)stream->abstract; int ret; @@ -465,7 +465,7 @@ static int php_stream_temp_cast(php_stream *stream, int castas, void **ret TSRML php_stream *file; size_t memsize; char *membuf; - off_t pos; + zend_off_t pos; assert(ts != NULL); @@ -572,7 +572,7 @@ PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char { php_stream *stream; php_stream_temp_data *ts; - off_t newoffs; + zend_off_t newoffs; if ((stream = php_stream_temp_create_rel(mode, max_memory_usage)) != NULL) { if (length) { @@ -606,7 +606,7 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con php_stream_temp_data *ts; char *comma, *semi, *sep, *key; size_t mlen, dlen, plen, vlen; - off_t newoffs; + zend_off_t newoffs; zval *meta = NULL; int base64 = 0; zend_str_size_int ilen; diff --git a/main/streams/mmap.c b/main/streams/mmap.c index 4f9388c..537f070 100644 --- a/main/streams/mmap.c +++ b/main/streams/mmap.c @@ -51,7 +51,7 @@ PHPAPI int _php_stream_mmap_unmap(php_stream *stream TSRMLS_DC) return php_stream_set_option(stream, PHP_STREAM_OPTION_MMAP_API, PHP_STREAM_MMAP_UNMAP, NULL) == PHP_STREAM_OPTION_RETURN_OK ? 1 : 0; } -PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, off_t readden TSRMLS_DC) +PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden TSRMLS_DC) { int ret = 1; diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h index 7895ac6..0386406 100644 --- a/main/streams/php_stream_mmap.h +++ b/main/streams/php_stream_mmap.h @@ -74,7 +74,7 @@ PHPAPI char *_php_stream_mmap_range(php_stream *stream, size_t offset, size_t le PHPAPI int _php_stream_mmap_unmap(php_stream *stream TSRMLS_DC); #define php_stream_mmap_unmap(stream) _php_stream_mmap_unmap((stream) TSRMLS_CC) -PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, off_t readden TSRMLS_DC); +PHPAPI int _php_stream_mmap_unmap_ex(php_stream *stream, zend_off_t readden TSRMLS_DC); #define php_stream_mmap_unmap_ex(stream, readden) _php_stream_mmap_unmap_ex((stream), (readden) TSRMLS_CC) END_EXTERN_C() diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index bd92c03..9821d04 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -258,7 +258,7 @@ PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const cha } else { stream->position = lseek(self->fd, 0, SEEK_CUR); #ifdef ESPIPE - if (stream->position == (off_t)-1 && errno == ESPIPE) { + if (stream->position == (zend_off_t)-1 && errno == ESPIPE) { stream->position = 0; stream->flags |= PHP_STREAM_FLAG_NO_SEEK; self->is_pipe = 1; @@ -455,7 +455,7 @@ static int php_stdiop_flush(php_stream *stream TSRMLS_DC) return 0; } -static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC) +static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) { php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; int ret; @@ -468,10 +468,10 @@ static int php_stdiop_seek(php_stream *stream, off_t offset, int whence, off_t * } if (data->fd >= 0) { - off_t result; + zend_off_t result; result = lseek(data->fd, offset, whence); - if (result == (off_t)-1) + if (result == (zend_off_t)-1) return -1; *newoffset = result; @@ -841,7 +841,7 @@ static int php_plain_files_dirstream_close(php_stream *stream, int close_handle return closedir((DIR *)stream->abstract); } -static int php_plain_files_dirstream_rewind(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_plain_files_dirstream_rewind(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { rewinddir((DIR *)stream->abstract); return 0; diff --git a/main/streams/streams.c b/main/streams/streams.c index 8dc3628..6e97740 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -585,7 +585,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D /* allocate a buffer for reading chunks */ chunk_buf = emalloc(stream->chunk_size); - while (!stream->eof && !err_flag && (stream->writepos - stream->readpos < (off_t)size)) { + while (!stream->eof && !err_flag && (stream->writepos - stream->readpos < (zend_off_t)size)) { size_t justread = 0; int flags; php_stream_bucket *bucket; @@ -671,7 +671,7 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D } else { /* is there enough data in the buffer ? */ - if (stream->writepos - stream->readpos < (off_t)size) { + if (stream->writepos - stream->readpos < (zend_off_t)size) { size_t justread = 0; /* reduce buffer memory consumption if possible, to avoid a realloc */ @@ -1261,12 +1261,12 @@ PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char *fmt, return count; } -PHPAPI off_t _php_stream_tell(php_stream *stream TSRMLS_DC) +PHPAPI zend_off_t _php_stream_tell(php_stream *stream TSRMLS_DC) { return stream->position; } -PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC) +PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence TSRMLS_DC) { if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { /* flush to commit data written to the fopencookie FILE* */ @@ -2119,7 +2119,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod } if (stream && stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && strchr(mode, 'a') && stream->position == 0) { - off_t newpos = 0; + zend_off_t newpos = 0; /* if opened for append, we need to revise our idea of the initial file position */ if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos TSRMLS_CC)) { diff --git a/main/streams/userspace.c b/main/streams/userspace.c index fd43b52..ff24c3a 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -796,7 +796,7 @@ static int php_userstreamop_flush(php_stream *stream TSRMLS_DC) return call_result; } -static int php_userstreamop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_userstreamop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { zval func_name; zval *retval = NULL; @@ -1572,7 +1572,7 @@ static int php_userstreamop_closedir(php_stream *stream, int close_handle TSRMLS return 0; } -static int php_userstreamop_rewinddir(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC) +static int php_userstreamop_rewinddir(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC) { zval func_name; zval *retval = NULL;
« previous php.cvs (#73936) next »