com php-src: Drop the VC6 portable version of strtoi64, as it is no longer needed: win32/build/config.w32 win32/php_strtoi64.h win32/strtoi64.c
| From: | Kalle Sommer Nielsen | Date: | Sun, 29 Mar 2015 05:49:35 +0000 |
| Subject: | com php-src: Drop the VC6 portable version of strtoi64, as it is no longer needed: win32/build/config.w32 win32/php_strtoi64.h win32/strtoi64.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85908@lists.php.net to get a copy of this message | ||
Commit: 60cbef19a2230a2861ddb61a2806c5a83a8d1e82
Author: Kalle Sommer Nielsen <kalle@php.net> Sun, 29 Mar 2015 07:49:35 +0200
Parents: 88b9d485d6ec19cb1a38456775962208e7c39c9a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=60cbef19a2230a2861ddb61a2806c5a83a8d1e82
Log:
Drop the VC6 portable version of strtoi64, as it is no longer needed
Changed paths:
M win32/build/config.w32
D win32/php_strtoi64.h
D win32/strtoi64.c
Diff:
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index f58ca8d..ad3209f 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -155,10 +155,6 @@ ADD_SOURCES("main", "main.c snprintf.c spprintf.c getopt.c
fopen_wrappers.c \
ADD_FLAG("CFLAGS_BD_MAIN", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
-// Newer versions have it
-if (VS_TOOLSET && VCVERS <= 1300) {
- ADD_SOURCES("win32", "strtoi64.c");
-}
if (VS_TOOLSET && VCVERS >= 1400 || !VS_TOOLSET) {
AC_DEFINE('HAVE_STRNLEN', 1);
}
diff --git a/win32/php_strtoi64.h b/win32/php_strtoi64.h
deleted file mode 100644
index 633ecb1..0000000
--- a/win32/php_strtoi64.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#if _MSC_VERS <= 1300
-#include "php.h"
-#include "php_stdint.h"
-
-PHPAPI int64_t _strtoi64(const char *nptr, char **endptr, int base);
-#define _strtoui64 _strtoi64
-#endif
diff --git a/win32/strtoi64.c b/win32/strtoi64.c
deleted file mode 100644
index 689cc09..0000000
--- a/win32/strtoi64.c
+++ /dev/null
@@ -1,122 +0,0 @@
-#if _MSC_VERS <= 1300
-#include "php_strtoi64.h"
-/*
- From APR, apr_strings.c
- See http://www.apache.org/licenses/LICENSE-2.0
-*/
-
-PHPAPI int64_t _strtoi64(const char *nptr, char **endptr, int base)
-{
- const char *s;
- int64_t acc;
- int64_t val;
- int neg, any;
- char c;
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- s = nptr;
- do {
- c = *s++;
- } while (isspace((unsigned char)c));
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else {
- neg = 0;
- if (c == '+') {
- c = *s++;
- }
- }
-
- if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s
== 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0) {
- base = c == '0' ? 8 : 10;
- }
- acc = any = 0;
- if (base < 2 || base > 36) {
- errno = EINVAL;
- if (endptr != NULL) {
- *endptr = (char *)(any ? s - 1 : nptr);
- }
- return acc;
- }
-
- /* The classic bsd implementation requires div/mod operators
- * to compute a cutoff. Benchmarking proves that iss very, very
- * evil to some 32 bit processors. Instead, look for underflow
- * in both the mult and add/sub operation. Unlike the bsd impl,
- * we also work strictly in a signed int64 word as we haven't
- * implemented the unsigned type in win32.
- *
- * Set 'any' if any `digits' consumed; make it negative to indicate
- * overflow.
- */
- val = 0;
- for ( ; ; c = *s++) {
- if (c >= '0' && c <= '9')
- c -= '0';
-
-#if (('Z' - 'A') == 25)
- else if (c >= 'A' && c <= 'Z')
- c -= 'A' - 10;
- else if (c >= 'a' && c <= 'z')
- c -= 'a' - 10;
-#elif APR_CHARSET_EBCDIC
- else if (c >= 'A' && c <= 'I')
- c -= 'A' - 10;
- else if (c >= 'J' && c <= 'R')
- c -= 'J' - 19;
- else if (c >= 'S' && c <= 'Z')
- c -= 'S' - 28;
- else if (c >= 'a' && c <= 'i')
- c -= 'a' - 10;
- else if (c >= 'j' && c <= 'r')
- c -= 'j' - 19;
- else if (c >= 's' && c <= 'z')
- c -= 'z' - 28;
-#else
-# error "CANNOT COMPILE apr_strtoi64(), only ASCII and EBCDIC supported"
-#endif
- else {
- break;
- }
-
- if (c >= base) {
- break;
- }
-
- val *= base;
- if ( (any < 0) /* already noted an over/under flow - short circuit */
- || (neg && (val > acc || (val -= c) > acc)) /* underflow */
- || (val < acc || (val += c) < acc)) { /* overflow */
- any = -1; /* once noted, over/underflows never go away */
-#ifdef APR_STRTOI64_OVERFLOW_IS_BAD_CHAR
- break;
-#endif
- } else {
- acc = val;
- any = 1;
- }
- }
-
- if (any < 0) {
- acc = neg ? INT64_MIN : INT64_MAX;
- errno = ERANGE;
- } else if (!any) {
- errno = EINVAL;
- }
-
- if (endptr != NULL) {
- *endptr = (char *)(any ? s - 1 : nptr);
- }
- return (acc);
-}
-#endif