com php-src: master renames phase 4: Zend/zend_int.h Zend /zend_long.h Zend/zend_operators.c Zend/zend_stri ng.h Zend/zend_types.h
Zend/zend_virtual_cwd.c ext/standard/php_fopen_wrapper.c main/php_streams .h main/streams/plain_wrapper.c main/streams/xp_soc ket.c
sapi/cli/php_cli_server.c
| From: | Anatol Belski | Date: | Mon, 25 Aug 2014 18:57:25 +0000 |
| Subject: | com php-src: master renames phase 4: Zend/zend_int.h Zend /zend_long.h Zend/zend_operators.c Zend/zend_stri ng.h Zend/zend_types.h Zend/zend_virtual_cwd.c ext/standard/php_fopen_wrapper.c main/php_streams .h main/streams/plain_wrapper.c main/streams/xp_soc ket.c sapi/cli/php_cli_server.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80850@lists.php.net to get a copy of this message | ||
Commit: 455741fce3c4f4392deb97775cba7a39f6490271
Author: Anatol Belski <ab@php.net> Mon, 25 Aug 2014 20:57:25 +0200
Parents: 54102822583912de26bb6c7cc2d0c609952a4775
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=455741fce3c4f4392deb97775cba7a39f6490271
Log:
master renames phase 4
Changed paths:
D Zend/zend_int.h
A Zend/zend_long.h
M Zend/zend_operators.c
M Zend/zend_string.h
M Zend/zend_types.h
M Zend/zend_virtual_cwd.c
M ext/standard/php_fopen_wrapper.c
M main/php_streams.h
M main/streams/plain_wrapper.c
M main/streams/xp_socket.c
M sapi/cli/php_cli_server.c
diff --git a/Zend/zend_int.h b/Zend/zend_int.h deleted file mode 100644 index f33b3ff..0000000 --- a/Zend/zend_int.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Anatol Belski <ab@php.net> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - -#ifndef ZEND_LONG_H -#define ZEND_LONG_H - -#include "main/php_stdint.h" - -/* This is the heart of the whole int64 enablement in zval. Based on this - macros the size_t datatype is handled, see zend_types.h */ -#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) -# define ZEND_ENABLE_INT64 1 -#endif - -/* Integer types or the old bad long. */ -#ifdef ZEND_ENABLE_INT64 -# ifdef ZEND_WIN32 -# ifdef _WIN64 -typedef __int64 zend_long; -typedef unsigned __int64 zend_ulong; -typedef __int64 zend_off_t; -# define ZEND_LONG_MAX _I64_MAX -# define ZEND_LONG_MIN _I64_MIN -# define ZEND_UINT_MAX _UI64_MAX -# define Z_I(i) i##i64 -# define Z_UI(i) i##Ui64 -# else -# error Cant enable 64 bit integers on non 64 bit platform -# endif -# else -# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) -typedef int64_t zend_long; -typedef uint64_t zend_ulong; -typedef off_t zend_off_t; -# define ZEND_LONG_MAX INT64_MAX -# define ZEND_LONG_MIN INT64_MIN -# define ZEND_UINT_MAX UINT64_MAX -# define Z_I(i) i##LL -# define Z_UI(i) i##ULL -# else -# error Cant enable 64 bit integers on non 64 bit platform -# endif -# endif -# define SIZEOF_ZEND_INT 8 -#else -typedef long zend_long; -typedef unsigned long zend_ulong; -typedef long zend_off_t; -# define ZEND_LONG_MAX LONG_MAX -# define ZEND_LONG_MIN LONG_MIN -# define ZEND_UINT_MAX ULONG_MAX -# define Z_I(i) i##L -# define Z_UI(i) i##UL -# define SIZEOF_ZEND_INT SIZEOF_LONG -#endif - - -/* conversion macros */ -#define ZEND_LTOA_BUF_LEN 65 - -#ifdef ZEND_ENABLE_INT64 -# ifdef PHP_WIN32 -# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10) -# define ZEND_ATOL(i, s) i = _atoi64((s)) -# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base)) -# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base)) -# define ZEND_LONG_FMT "%I64d" -# define ZEND_ULONG_FMT "%I64u" -# define ZEND_LONG_FMT_SPEC "I64d" -# define ZEND_ULONG_FMT_SPEC "I64u" -# define ZEND_STRTOL_PTR _strtoi64 -# define ZEND_STRTOUL_PTR _strtoui64 -# define ZEND_ABS _abs64 -# else -# define ZEND_LTOA(i, s, len) \ - do { \ - int st = snprintf((s), (len), "%lld", (i)); \ - (s)[st] = '\0'; \ - } while (0) -# define ZEND_ATOL(i, s) (i) = atoll((s)) -# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base)) -# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base)) -# define ZEND_LONG_FMT "%" PRId64 -# define ZEND_ULONG_FMT "%" PRIu64 -# define ZEND_LONG_FMT_SPEC PRId64 -# define ZEND_ULONG_FMT_SPEC PRIu64 -# define ZEND_STRTOL_PTR strtoll -# define ZEND_STRTOUL_PTR strtoull -# define ZEND_ABS llabs -# endif -#else -# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base)) -# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base)) -# ifdef PHP_WIN32 -# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10) -# define ZEND_ATOL(i, s) i = atol((s)) -# else -# define ZEND_LTOA(i, s, len) \ - do { \ - int st = snprintf((s), (len), "%ld", (i)); \ - (s)[st] = '\0'; \ - } while (0) -# define ZEND_ATOL(i, s) (i) = atol((s)) -# endif -# define ZEND_LONG_FMT "%ld" -# define ZEND_ULONG_FMT "%lu" -# define ZEND_LONG_FMT_SPEC "ld" -# define ZEND_ULONG_FMT_SPEC "lu" -# define ZEND_STRTOL_PTR strtol -# define ZEND_STRTOUL_PTR strtoul -# define ZEND_ABS abs -#endif - - -#endif /* ZEND_LONG_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_long.h b/Zend/zend_long.h new file mode 100644 index 0000000..34441c6 --- /dev/null +++ b/Zend/zend_long.h @@ -0,0 +1,141 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Anatol Belski <ab@php.net> | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + + +#ifndef ZEND_LONG_H +#define ZEND_LONG_H + +#include "main/php_stdint.h" + +/* This is the heart of the whole int64 enablement in zval. Based on this + macros the size_t datatype is handled, see zend_types.h */ +#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) +# define ZEND_ENABLE_INT64 1 +#endif + +/* Integer types or the old bad long. */ +#ifdef ZEND_ENABLE_INT64 +# ifdef ZEND_WIN32 +# ifdef _WIN64 +typedef __int64 zend_long; +typedef unsigned __int64 zend_ulong; +typedef __int64 zend_off_t; +# define ZEND_LONG_MAX _I64_MAX +# define ZEND_LONG_MIN _I64_MIN +# define ZEND_ULONG_MAX _UI64_MAX +# define Z_I(i) i##i64 +# define Z_UL(i) i##Ui64 +# else +# error Cant enable 64 bit integers on non 64 bit platform +# endif +# else +# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) +typedef int64_t zend_long; +typedef uint64_t zend_ulong; +typedef off_t zend_off_t; +# define ZEND_LONG_MAX INT64_MAX +# define ZEND_LONG_MIN INT64_MIN +# define ZEND_ULONG_MAX UINT64_MAX +# define Z_I(i) i##LL +# define Z_UL(i) i##ULL +# else +# error Cant enable 64 bit integers on non 64 bit platform +# endif +# endif +# define SIZEOF_ZEND_INT 8 +#else +typedef long zend_long; +typedef unsigned long zend_ulong; +typedef long zend_off_t; +# define ZEND_LONG_MAX LONG_MAX +# define ZEND_LONG_MIN LONG_MIN +# define ZEND_ULONG_MAX ULONG_MAX +# define Z_I(i) i##L +# define Z_UL(i) i##UL +# define SIZEOF_ZEND_INT SIZEOF_LONG +#endif + + +/* conversion macros */ +#define ZEND_LTOA_BUF_LEN 65 + +#ifdef ZEND_ENABLE_INT64 +# ifdef PHP_WIN32 +# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10) +# define ZEND_ATOL(i, s) i = _atoi64((s)) +# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base)) +# define ZEND_LONG_FMT "%I64d" +# define ZEND_ULONG_FMT "%I64u" +# define ZEND_LONG_FMT_SPEC "I64d" +# define ZEND_ULONG_FMT_SPEC "I64u" +# define ZEND_STRTOL_PTR _strtoi64 +# define ZEND_STRTOUL_PTR _strtoui64 +# define ZEND_ABS _abs64 +# else +# define ZEND_LTOA(i, s, len) \ + do { \ + int st = snprintf((s), (len), "%lld", (i)); \ + (s)[st] = '\0'; \ + } while (0) +# define ZEND_ATOL(i, s) (i) = atoll((s)) +# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base)) +# define ZEND_LONG_FMT "%" PRId64 +# define ZEND_ULONG_FMT "%" PRIu64 +# define ZEND_LONG_FMT_SPEC PRId64 +# define ZEND_ULONG_FMT_SPEC PRIu64 +# define ZEND_STRTOL_PTR strtoll +# define ZEND_STRTOUL_PTR strtoull +# define ZEND_ABS llabs +# endif +#else +# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base)) +# ifdef PHP_WIN32 +# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10) +# define ZEND_ATOL(i, s) i = atol((s)) +# else +# define ZEND_LTOA(i, s, len) \ + do { \ + int st = snprintf((s), (len), "%ld", (i)); \ + (s)[st] = '\0'; \ + } while (0) +# define ZEND_ATOL(i, s) (i) = atol((s)) +# endif +# define ZEND_LONG_FMT "%ld" +# define ZEND_ULONG_FMT "%lu" +# define ZEND_LONG_FMT_SPEC "ld" +# define ZEND_ULONG_FMT_SPEC "lu" +# define ZEND_STRTOL_PTR strtol +# define ZEND_STRTOUL_PTR strtoul +# define ZEND_ABS abs +#endif + + +#endif /* ZEND_LONG_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 6f82601..8aa3808 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2461,7 +2461,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { -#if ZEND_UINT_MAX == 0xFFFFFFFF +#if ZEND_ULONG_MAX == 0xFFFFFFFF if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) || (oflow1 == -1 && dval1 < -9007199254740991.))) { diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 0d13575..6f27625 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -244,7 +244,7 @@ static zend_always_inline void zend_string_release(zend_string *s) static inline zend_ulong zend_inline_hash_func(const char *str, size_t len) { - register zend_ulong hash = Z_UI(5381); + register zend_ulong hash = Z_UL(5381); /* variant with the hash unrolled eight times */ for (; len >= 8; len -= 8) { diff --git a/Zend/zend_types.h b/Zend/zend_types.h index bb47f82..a76704b 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -22,7 +22,7 @@ #ifndef ZEND_TYPES_H #define ZEND_TYPES_H -#include "zend_int.h" +#include "zend_long.h" #ifdef WORDS_BIGENDIAN # define ZEND_ENDIAN_LOHI(lo, hi) hi; lo; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index a31f40b..665829d 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -593,8 +593,8 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len TSRML return 0; } - for (h = Z_UI(2166136261); bucket_key < e;) { - h *= Z_UI(16777619); + for (h = Z_UL(2166136261); bucket_key < e;) { + h *= Z_UL(16777619); h ^= *bucket_key++; } HeapFree(GetProcessHeap(), 0, (LPVOID)bucket_key_start); @@ -607,8 +607,8 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* { register zend_ulong h; const char *e = path + path_len; - for (h = Z_UI(2166136261); path < e;) { - h *= Z_UI(16777619); + for (h = Z_UL(2166136261); path < e;) { + h *= Z_UL(16777619); h ^= *path++; } diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 7b52494..3859e5b 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -382,7 +382,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa do { zend_stat_t st; memset(&st, 0, sizeof(st)); - if (php_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { + if (zend_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { stream = php_stream_sock_open_from_socket(fd, NULL); if (stream) { stream->ops = &php_stream_socket_ops; diff --git a/main/php_streams.h b/main/php_streams.h index 1daa0d9..ad9ea92 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -26,6 +26,8 @@ #endif #include <sys/types.h> #include <sys/stat.h> +#include "zend.h" +#include "zend_stream.h" BEGIN_EXTERN_C() PHPAPI int php_file_le_stream(void); @@ -103,16 +105,6 @@ typedef struct _php_stream_filter php_stream_filter; #include "streams/php_stream_context.h" #include "streams/php_stream_filter_api.h" -#ifdef _WIN64 -# define php_fstat _fstat64 -# define php_stat_fn _stat64 -typedef struct __stat64 zend_stat_t; -#else -# define php_fstat fstat -# define php_stat_fn stat -typedef struct stat zend_stat_t; -#endif - typedef struct _php_stream_statbuf { zend_stat_t sb; /* regular info */ /* extended info to go here some day: content-type etc. etc. */ diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 23c017e..36b5664 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -149,7 +149,7 @@ static int do_fstat(php_stdio_stream_data *d, int force) int r; PHP_STDIOP_GET_FD(fd, d); - r = php_fstat(fd, &d->sb); + r = zend_fstat(fd, &d->sb); d->cached_fstat = r == 0; return r; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index fc13cdf..1211151 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -237,7 +237,7 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC #if ZEND_WIN32 return 0; #else - return php_fstat(sock->socket, &ssb->sb); + return zend_fstat(sock->socket, &ssb->sb); #endif } diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 6f7f34e..88a1010 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1414,7 +1414,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque *p = '\0'; q = p; while (q > buf) { - if (!php_stat_fn(buf, &sb)) { + if (!zend_stat(buf, &sb)) { if (sb.st_mode & S_IFDIR) { const char **file = index_files; if (q[-1] != DEFAULT_SLASH) { @@ -1423,7 +1423,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque while (*file) { size_t l = strlen(*file); memmove(q, *file, l + 1); - if (!php_stat_fn(buf, &sb) && (sb.st_mode & S_IFREG)) { + if (!zend_stat(buf, &sb) && (sb.st_mode & S_IFREG)) { q += l; break; } @@ -2489,7 +2489,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ if (document_root) { zend_stat_t sb; - if (php_stat_fn(document_root, &sb)) { + if (zend_stat(document_root, &sb)) { fprintf(stderr, "Directory %s does not exist.\n", document_root); return 1; }
diff --git a/Zend/zend_int.h b/Zend/zend_int.h deleted file mode 100644 index f33b3ff..0000000 --- a/Zend/zend_int.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Anatol Belski <ab@php.net> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - - -#ifndef ZEND_LONG_H -#define ZEND_LONG_H - -#include "main/php_stdint.h" - -/* This is the heart of the whole int64 enablement in zval. Based on this - macros the size_t datatype is handled, see zend_types.h */ -#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) -# define ZEND_ENABLE_INT64 1 -#endif - -/* Integer types or the old bad long. */ -#ifdef ZEND_ENABLE_INT64 -# ifdef ZEND_WIN32 -# ifdef _WIN64 -typedef __int64 zend_long; -typedef unsigned __int64 zend_ulong; -typedef __int64 zend_off_t; -# define ZEND_LONG_MAX _I64_MAX -# define ZEND_LONG_MIN _I64_MIN -# define ZEND_UINT_MAX _UI64_MAX -# define Z_I(i) i##i64 -# define Z_UI(i) i##Ui64 -# else -# error Cant enable 64 bit integers on non 64 bit platform -# endif -# else -# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) -typedef int64_t zend_long; -typedef uint64_t zend_ulong; -typedef off_t zend_off_t; -# define ZEND_LONG_MAX INT64_MAX -# define ZEND_LONG_MIN INT64_MIN -# define ZEND_UINT_MAX UINT64_MAX -# define Z_I(i) i##LL -# define Z_UI(i) i##ULL -# else -# error Cant enable 64 bit integers on non 64 bit platform -# endif -# endif -# define SIZEOF_ZEND_INT 8 -#else -typedef long zend_long; -typedef unsigned long zend_ulong; -typedef long zend_off_t; -# define ZEND_LONG_MAX LONG_MAX -# define ZEND_LONG_MIN LONG_MIN -# define ZEND_UINT_MAX ULONG_MAX -# define Z_I(i) i##L -# define Z_UI(i) i##UL -# define SIZEOF_ZEND_INT SIZEOF_LONG -#endif - - -/* conversion macros */ -#define ZEND_LTOA_BUF_LEN 65 - -#ifdef ZEND_ENABLE_INT64 -# ifdef PHP_WIN32 -# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10) -# define ZEND_ATOL(i, s) i = _atoi64((s)) -# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base)) -# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base)) -# define ZEND_LONG_FMT "%I64d" -# define ZEND_ULONG_FMT "%I64u" -# define ZEND_LONG_FMT_SPEC "I64d" -# define ZEND_ULONG_FMT_SPEC "I64u" -# define ZEND_STRTOL_PTR _strtoi64 -# define ZEND_STRTOUL_PTR _strtoui64 -# define ZEND_ABS _abs64 -# else -# define ZEND_LTOA(i, s, len) \ - do { \ - int st = snprintf((s), (len), "%lld", (i)); \ - (s)[st] = '\0'; \ - } while (0) -# define ZEND_ATOL(i, s) (i) = atoll((s)) -# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base)) -# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base)) -# define ZEND_LONG_FMT "%" PRId64 -# define ZEND_ULONG_FMT "%" PRIu64 -# define ZEND_LONG_FMT_SPEC PRId64 -# define ZEND_ULONG_FMT_SPEC PRIu64 -# define ZEND_STRTOL_PTR strtoll -# define ZEND_STRTOUL_PTR strtoull -# define ZEND_ABS llabs -# endif -#else -# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base)) -# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base)) -# ifdef PHP_WIN32 -# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10) -# define ZEND_ATOL(i, s) i = atol((s)) -# else -# define ZEND_LTOA(i, s, len) \ - do { \ - int st = snprintf((s), (len), "%ld", (i)); \ - (s)[st] = '\0'; \ - } while (0) -# define ZEND_ATOL(i, s) (i) = atol((s)) -# endif -# define ZEND_LONG_FMT "%ld" -# define ZEND_ULONG_FMT "%lu" -# define ZEND_LONG_FMT_SPEC "ld" -# define ZEND_ULONG_FMT_SPEC "lu" -# define ZEND_STRTOL_PTR strtol -# define ZEND_STRTOUL_PTR strtoul -# define ZEND_ABS abs -#endif - - -#endif /* ZEND_LONG_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/Zend/zend_long.h b/Zend/zend_long.h new file mode 100644 index 0000000..34441c6 --- /dev/null +++ b/Zend/zend_long.h @@ -0,0 +1,141 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2013 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Anatol Belski <ab@php.net> | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + + +#ifndef ZEND_LONG_H +#define ZEND_LONG_H + +#include "main/php_stdint.h" + +/* This is the heart of the whole int64 enablement in zval. Based on this + macros the size_t datatype is handled, see zend_types.h */ +#if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64) +# define ZEND_ENABLE_INT64 1 +#endif + +/* Integer types or the old bad long. */ +#ifdef ZEND_ENABLE_INT64 +# ifdef ZEND_WIN32 +# ifdef _WIN64 +typedef __int64 zend_long; +typedef unsigned __int64 zend_ulong; +typedef __int64 zend_off_t; +# define ZEND_LONG_MAX _I64_MAX +# define ZEND_LONG_MIN _I64_MIN +# define ZEND_ULONG_MAX _UI64_MAX +# define Z_I(i) i##i64 +# define Z_UL(i) i##Ui64 +# else +# error Cant enable 64 bit integers on non 64 bit platform +# endif +# else +# if defined(__X86_64__) || defined(__LP64__) || defined(_LP64) +typedef int64_t zend_long; +typedef uint64_t zend_ulong; +typedef off_t zend_off_t; +# define ZEND_LONG_MAX INT64_MAX +# define ZEND_LONG_MIN INT64_MIN +# define ZEND_ULONG_MAX UINT64_MAX +# define Z_I(i) i##LL +# define Z_UL(i) i##ULL +# else +# error Cant enable 64 bit integers on non 64 bit platform +# endif +# endif +# define SIZEOF_ZEND_INT 8 +#else +typedef long zend_long; +typedef unsigned long zend_ulong; +typedef long zend_off_t; +# define ZEND_LONG_MAX LONG_MAX +# define ZEND_LONG_MIN LONG_MIN +# define ZEND_ULONG_MAX ULONG_MAX +# define Z_I(i) i##L +# define Z_UL(i) i##UL +# define SIZEOF_ZEND_INT SIZEOF_LONG +#endif + + +/* conversion macros */ +#define ZEND_LTOA_BUF_LEN 65 + +#ifdef ZEND_ENABLE_INT64 +# ifdef PHP_WIN32 +# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10) +# define ZEND_ATOL(i, s) i = _atoi64((s)) +# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base)) +# define ZEND_LONG_FMT "%I64d" +# define ZEND_ULONG_FMT "%I64u" +# define ZEND_LONG_FMT_SPEC "I64d" +# define ZEND_ULONG_FMT_SPEC "I64u" +# define ZEND_STRTOL_PTR _strtoi64 +# define ZEND_STRTOUL_PTR _strtoui64 +# define ZEND_ABS _abs64 +# else +# define ZEND_LTOA(i, s, len) \ + do { \ + int st = snprintf((s), (len), "%lld", (i)); \ + (s)[st] = '\0'; \ + } while (0) +# define ZEND_ATOL(i, s) (i) = atoll((s)) +# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base)) +# define ZEND_LONG_FMT "%" PRId64 +# define ZEND_ULONG_FMT "%" PRIu64 +# define ZEND_LONG_FMT_SPEC PRId64 +# define ZEND_ULONG_FMT_SPEC PRIu64 +# define ZEND_STRTOL_PTR strtoll +# define ZEND_STRTOUL_PTR strtoull +# define ZEND_ABS llabs +# endif +#else +# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base)) +# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base)) +# ifdef PHP_WIN32 +# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10) +# define ZEND_ATOL(i, s) i = atol((s)) +# else +# define ZEND_LTOA(i, s, len) \ + do { \ + int st = snprintf((s), (len), "%ld", (i)); \ + (s)[st] = '\0'; \ + } while (0) +# define ZEND_ATOL(i, s) (i) = atol((s)) +# endif +# define ZEND_LONG_FMT "%ld" +# define ZEND_ULONG_FMT "%lu" +# define ZEND_LONG_FMT_SPEC "ld" +# define ZEND_ULONG_FMT_SPEC "lu" +# define ZEND_STRTOL_PTR strtol +# define ZEND_STRTOUL_PTR strtoul +# define ZEND_ABS abs +#endif + + +#endif /* ZEND_LONG_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 6f82601..8aa3808 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2461,7 +2461,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */ if ((ret1=is_numeric_string_ex(Z_STRVAL_P(s1), Z_STRLEN_P(s1), &lval1, &dval1, 0, &oflow1)) && (ret2=is_numeric_string_ex(Z_STRVAL_P(s2), Z_STRLEN_P(s2), &lval2, &dval2, 0, &oflow2))) { -#if ZEND_UINT_MAX == 0xFFFFFFFF +#if ZEND_ULONG_MAX == 0xFFFFFFFF if (oflow1 != 0 && oflow1 == oflow2 && dval1 - dval2 == 0. && ((oflow1 == 1 && dval1 > 9007199254740991. /*0x1FFFFFFFFFFFFF*/) || (oflow1 == -1 && dval1 < -9007199254740991.))) { diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 0d13575..6f27625 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -244,7 +244,7 @@ static zend_always_inline void zend_string_release(zend_string *s) static inline zend_ulong zend_inline_hash_func(const char *str, size_t len) { - register zend_ulong hash = Z_UI(5381); + register zend_ulong hash = Z_UL(5381); /* variant with the hash unrolled eight times */ for (; len >= 8; len -= 8) { diff --git a/Zend/zend_types.h b/Zend/zend_types.h index bb47f82..a76704b 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -22,7 +22,7 @@ #ifndef ZEND_TYPES_H #define ZEND_TYPES_H -#include "zend_int.h" +#include "zend_long.h" #ifdef WORDS_BIGENDIAN # define ZEND_ENDIAN_LOHI(lo, hi) hi; lo; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index a31f40b..665829d 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -593,8 +593,8 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len TSRML return 0; } - for (h = Z_UI(2166136261); bucket_key < e;) { - h *= Z_UI(16777619); + for (h = Z_UL(2166136261); bucket_key < e;) { + h *= Z_UL(16777619); h ^= *bucket_key++; } HeapFree(GetProcessHeap(), 0, (LPVOID)bucket_key_start); @@ -607,8 +607,8 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* { register zend_ulong h; const char *e = path + path_len; - for (h = Z_UI(2166136261); path < e;) { - h *= Z_UI(16777619); + for (h = Z_UL(2166136261); path < e;) { + h *= Z_UL(16777619); h ^= *path++; } diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 7b52494..3859e5b 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -382,7 +382,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa do { zend_stat_t st; memset(&st, 0, sizeof(st)); - if (php_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { + if (zend_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { stream = php_stream_sock_open_from_socket(fd, NULL); if (stream) { stream->ops = &php_stream_socket_ops; diff --git a/main/php_streams.h b/main/php_streams.h index 1daa0d9..ad9ea92 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -26,6 +26,8 @@ #endif #include <sys/types.h> #include <sys/stat.h> +#include "zend.h" +#include "zend_stream.h" BEGIN_EXTERN_C() PHPAPI int php_file_le_stream(void); @@ -103,16 +105,6 @@ typedef struct _php_stream_filter php_stream_filter; #include "streams/php_stream_context.h" #include "streams/php_stream_filter_api.h" -#ifdef _WIN64 -# define php_fstat _fstat64 -# define php_stat_fn _stat64 -typedef struct __stat64 zend_stat_t; -#else -# define php_fstat fstat -# define php_stat_fn stat -typedef struct stat zend_stat_t; -#endif - typedef struct _php_stream_statbuf { zend_stat_t sb; /* regular info */ /* extended info to go here some day: content-type etc. etc. */ diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 23c017e..36b5664 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -149,7 +149,7 @@ static int do_fstat(php_stdio_stream_data *d, int force) int r; PHP_STDIOP_GET_FD(fd, d); - r = php_fstat(fd, &d->sb); + r = zend_fstat(fd, &d->sb); d->cached_fstat = r == 0; return r; diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index fc13cdf..1211151 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -237,7 +237,7 @@ static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC #if ZEND_WIN32 return 0; #else - return php_fstat(sock->socket, &ssb->sb); + return zend_fstat(sock->socket, &ssb->sb); #endif } diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 6f7f34e..88a1010 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -1414,7 +1414,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque *p = '\0'; q = p; while (q > buf) { - if (!php_stat_fn(buf, &sb)) { + if (!zend_stat(buf, &sb)) { if (sb.st_mode & S_IFDIR) { const char **file = index_files; if (q[-1] != DEFAULT_SLASH) { @@ -1423,7 +1423,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque while (*file) { size_t l = strlen(*file); memmove(q, *file, l + 1); - if (!php_stat_fn(buf, &sb) && (sb.st_mode & S_IFREG)) { + if (!zend_stat(buf, &sb) && (sb.st_mode & S_IFREG)) { q += l; break; } @@ -2489,7 +2489,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ if (document_root) { zend_stat_t sb; - if (php_stat_fn(document_root, &sb)) { + if (zend_stat(document_root, &sb)) { fprintf(stderr, "Directory %s does not exist.\n", document_root); return 1; }