diff options
131 files changed, 635 insertions, 643 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 36b09cebe3..413c799a37 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -174,7 +174,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, } } else { char key[25]; - snprintf(key, sizeof(key), ZEND_INT_FMT, num_key); + snprintf(key, sizeof(key), ZEND_LONG_FMT, num_key); ZEND_PUTS_EX(key); } ZEND_PUTS_EX("] => "); @@ -204,7 +204,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */ if (string_key) { ZEND_WRITE(string_key->val, string_key->len); } else { - zend_printf(ZEND_UINT_FMT, num_key); + zend_printf(ZEND_ULONG_FMT, num_key); } ZEND_PUTS("] => "); zend_print_flat_zval_r(tmp TSRMLS_CC); @@ -235,7 +235,7 @@ again: char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; int len; - len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(expr)); + len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_LONG_FMT, Z_RES_HANDLE_P(expr)); ZVAL_NEW_STR(expr_copy, zend_string_init(buf, len, 0)); } break; diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 27668e4888..41b0149038 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -430,11 +430,11 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons return "long"; } else if (type == IS_DOUBLE) { if (c == 'L') { - if (d > ZEND_INT_MAX) { - *p = ZEND_INT_MAX; + if (d > ZEND_LONG_MAX) { + *p = ZEND_LONG_MAX; break; - } else if (d < ZEND_INT_MIN) { - *p = ZEND_INT_MIN; + } else if (d < ZEND_LONG_MIN) { + *p = ZEND_LONG_MIN; break; } } @@ -446,11 +446,11 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons case IS_DOUBLE: if (c == 'L') { - if (Z_DVAL_P(arg) > ZEND_INT_MAX) { - *p = ZEND_INT_MAX; + if (Z_DVAL_P(arg) > ZEND_LONG_MAX) { + *p = ZEND_LONG_MAX; break; - } else if (Z_DVAL_P(arg) < ZEND_INT_MIN) { - *p = ZEND_INT_MIN; + } else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) { + *p = ZEND_LONG_MIN; break; } } @@ -1686,7 +1686,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC) result = zend_symtable_update(ht, STR_EMPTY_ALLOC(), value); break; case IS_RESOURCE: - zend_error(E_STRICT, "Resource ID#" ZEND_INT_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key)); + zend_error(E_STRICT, "Resource ID#" ZEND_LONG_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key)); result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value); break; case IS_FALSE: diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 55d9e57e3c..15c4d9e149 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1081,10 +1081,10 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { *dest = Z_LVAL_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { - if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_INT_MAX)) { - *dest = ZEND_INT_MAX; - } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_INT_MIN)) { - *dest = ZEND_INT_MIN; + if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) { + *dest = ZEND_LONG_MAX; + } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) { + *dest = ZEND_LONG_MIN; } else { *dest = zend_dval_to_lval(Z_DVAL_P(arg)); } @@ -1094,10 +1094,10 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { if (EXPECTED(type != 0)) { - if (strict && UNEXPECTED(d > ZEND_INT_MAX)) { - *dest = ZEND_INT_MAX; - } else if (strict && UNEXPECTED(d < ZEND_INT_MIN)) { - *dest = ZEND_INT_MIN; + if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) { + *dest = ZEND_LONG_MAX; + } else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) { + *dest = ZEND_LONG_MIN; } else { *dest = zend_dval_to_lval(d); } diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 13b6e17ce9..cace802579 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -1984,9 +1984,9 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D #endif HANDLE_UNBLOCK_INTERRUPTIONS(); #if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size); #else - zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size); + zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, size); #endif } @@ -2297,9 +2297,9 @@ realloc_segment: #endif HANDLE_UNBLOCK_INTERRUPTIONS(); #if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size); #else - zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size); + zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, size); #endif return NULL; } diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index dc4d0e126d..0adb3d2df5 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -438,7 +438,7 @@ ZEND_FUNCTION(func_get_arg) arg_count = ex->num_args; if (requested_offset >= arg_count) { - zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_INT_FMT " not passed to function", requested_offset); + zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_LONG_FMT " not passed to function", requested_offset); RETURN_FALSE; } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index efc5efae9f..ff408d0bfd 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -461,7 +461,7 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{ case IS_RESOURCE: { zend_long lval = Z_RES_HANDLE_P(arg); char s_tmp[MAX_LENGTH_OF_LONG + 1]; - int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ + int l_tmp = zend_sprintf(s_tmp, ZEND_LONG_FMT, lval); /* SAFE */ TRACE_APPEND_STR("Resource id #"); TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); @@ -470,7 +470,7 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{ case IS_LONG: { zend_long lval = Z_LVAL_P(arg); char s_tmp[MAX_LENGTH_OF_LONG + 1]; - int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ + int l_tmp = zend_sprintf(s_tmp, ZEND_LONG_FMT, lval); /* SAFE */ TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); break; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index b8ae88707b..8ae445284a 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1024,14 +1024,14 @@ num_index: if (retval == NULL) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: " ZEND_UINT_FMT, hval); + zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval); /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: " ZEND_UINT_FMT, hval); + zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval)); diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index c698ba759d..9dd5a4188d 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -431,7 +431,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab } ZVAL_COPY_VALUE(&p->val, pData); if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { - ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; + ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX; } return &p->val; } else { /* we have to keep the order :( */ @@ -461,7 +461,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab ht->nInternalPointer = h; } if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { - ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; + ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX; } p->h = h; p->key = NULL; @@ -491,7 +491,7 @@ convert_to_hash: ZVAL_COPY_VALUE(&p->val, pData); HANDLE_UNBLOCK_INTERRUPTIONS(); if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { - ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; + ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX; } return &p->val; } @@ -506,7 +506,7 @@ convert_to_hash: ht->nInternalPointer = idx; } if ((zend_long)h >= (zend_long)ht->nNextFreeElement) { - ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX; + ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX; } p = ht->arData + idx; p->h = h; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index b0a7d12988..42bacc5c16 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -268,11 +268,11 @@ static inline int _zend_handle_numeric_str(const char *key, size_t length, zend_ ++tmp; if (tmp == end) { if (*key == '-') { - if (*idx-1 > ZEND_INT_MAX) { /* overflow */ + if (*idx-1 > ZEND_LONG_MAX) { /* overflow */ return 0; } *idx = 0 - *idx; - } else if (*idx > ZEND_INT_MAX) { /* overflow */ + } else if (*idx > ZEND_LONG_MAX) { /* overflow */ return 0; } return 1; diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 1f07ac3d56..59c2776a85 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -360,9 +360,9 @@ ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{ ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length); if (ini_entry) { if (orig && ini_entry->modified) { - return (ini_entry->orig_value ? ZEND_STRTOI(ini_entry->orig_value, NULL, 0) : 0); + return (ini_entry->orig_value ? ZEND_STRTOL(ini_entry->orig_value, NULL, 0) : 0); } else { - return (ini_entry->value ? ZEND_STRTOI(ini_entry->value, NULL, 0) : 0); + return (ini_entry->value ? ZEND_STRTOL(ini_entry->value, NULL, 0) : 0); } } diff --git a/Zend/zend_int.h b/Zend/zend_int.h index dbeb144e54..f33b3ff8ec 100644 --- a/Zend/zend_int.h +++ b/Zend/zend_int.h @@ -19,8 +19,8 @@ /* $Id$ */ -#ifndef ZEND_INT_H -#define ZEND_INT_H +#ifndef ZEND_LONG_H +#define ZEND_LONG_H #include "main/php_stdint.h" @@ -37,8 +37,8 @@ typedef __int64 zend_long; typedef unsigned __int64 zend_ulong; typedef __int64 zend_off_t; -# define ZEND_INT_MAX _I64_MAX -# define ZEND_INT_MIN _I64_MIN +# 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 @@ -50,8 +50,8 @@ typedef __int64 zend_off_t; typedef int64_t zend_long; typedef uint64_t zend_ulong; typedef off_t zend_off_t; -# define ZEND_INT_MAX INT64_MAX -# define ZEND_INT_MIN INT64_MIN +# 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 @@ -64,8 +64,8 @@ typedef off_t zend_off_t; typedef long zend_long; typedef unsigned long zend_ulong; typedef long zend_off_t; -# define ZEND_INT_MAX LONG_MAX -# define ZEND_INT_MIN LONG_MIN +# 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 @@ -74,63 +74,63 @@ typedef long zend_off_t; /* conversion macros */ -#define ZEND_ITOA_BUF_LEN 65 +#define ZEND_LTOA_BUF_LEN 65 #ifdef ZEND_ENABLE_INT64 # ifdef PHP_WIN32 -# define ZEND_ITOA(i, s, len) _i64toa_s((i), (s), (len), 10) -# define ZEND_ATOI(i, s) i = _atoi64((s)) -# define ZEND_STRTOI(s0, s1, base) _strtoi64((s0), (s1), (base)) -# define ZEND_STRTOUI(s0, s1, base) _strtoui64((s0), (s1), (base)) -# define ZEND_INT_FMT "%I64d" -# define ZEND_UINT_FMT "%I64u" -# define ZEND_INT_FMT_SPEC "I64d" -# define ZEND_UINT_FMT_SPEC "I64u" -# define ZEND_STRTOI_PTR _strtoi64 -# define ZEND_STRTOUI_PTR _strtoui64 +# 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_ITOA(i, s, len) \ +# define ZEND_LTOA(i, s, len) \ do { \ int st = snprintf((s), (len), "%lld", (i)); \ (s)[st] = '\0'; \ } while (0) -# define ZEND_ATOI(i, s) (i) = atoll((s)) -# define ZEND_STRTOI(s0, s1, base) strtoll((s0), (s1), (base)) -# define ZEND_STRTOUI(s0, s1, base) strtoull((s0), (s1), (base)) -# define ZEND_INT_FMT "%" PRId64 -# define ZEND_UINT_FMT "%" PRIu64 -# define ZEND_INT_FMT_SPEC PRId64 -# define ZEND_UINT_FMT_SPEC PRIu64 -# define ZEND_STRTOI_PTR strtoll -# define ZEND_STRTOUI_PTR strtoull +# 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_STRTOI(s0, s1, base) strtol((s0), (s1), (base)) -# define ZEND_STRTOUI(s0, s1, base) strtoul((s0), (s1), (base)) +# 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_ITOA(i, s, len) _ltoa_s((i), (s), (len), 10) -# define ZEND_ATOI(i, s) i = atol((s)) +# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10) +# define ZEND_ATOL(i, s) i = atol((s)) # else -# define ZEND_ITOA(i, s, len) \ +# define ZEND_LTOA(i, s, len) \ do { \ int st = snprintf((s), (len), "%ld", (i)); \ (s)[st] = '\0'; \ } while (0) -# define ZEND_ATOI(i, s) (i) = atol((s)) +# define ZEND_ATOL(i, s) (i) = atol((s)) # endif -# define ZEND_INT_FMT "%ld" -# define ZEND_UINT_FMT "%lu" -# define ZEND_INT_FMT_SPEC "ld" -# define ZEND_UINT_FMT_SPEC "lu" -# define ZEND_STRTOI_PTR strtol -# define ZEND_STRTOUI_PTR strtoul +# 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_INT_H */ +#endif /* ZEND_LONG_H */ /* * Local variables: diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index 78be159db3..33dc6eed24 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -957,7 +957,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo hex_buf[1] = *(++s); Z_STRLEN_P(zendlval)--; } - *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16); + *t++ = (char) ZEND_STRTOL(hex_buf, NULL, 16); } else { *t++ = '\\'; *t++ = *s; @@ -978,7 +978,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo Z_STRLEN_P(zendlval)--; } } - *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8); + *t++ = (char) ZEND_STRTOL(octal_buf, NULL, 8); } else { *t++ = '\\'; *t++ = *s; @@ -2953,10 +2953,10 @@ yy173: #line 1537 "Zend/zend_language_scanner.l" { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0)); } else { errno = 0; - ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0)); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); @@ -3318,7 +3318,7 @@ yy200: if (len == 0) { ZVAL_LONG(zendlval, 0); } else { - ZVAL_LONG(zendlval, ZEND_STRTOI(bin, NULL, 2)); + ZVAL_LONG(zendlval, ZEND_STRTOL(bin, NULL, 2)); } return T_LNUMBER; } else { @@ -3353,7 +3353,7 @@ yy203: if (len == 0) { ZVAL_LONG(zendlval, 0); } else { - ZVAL_LONG(zendlval, ZEND_STRTOI(hex, NULL, 16)); + ZVAL_LONG(zendlval, ZEND_STRTOL(hex, NULL, 16)); } return T_LNUMBER; } else { @@ -7673,7 +7673,7 @@ yy839: #line 1578 "Zend/zend_language_scanner.l" { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { - ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 10)); + ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 10)); } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index b3462e7062..f4f327b7b6 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -955,7 +955,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo hex_buf[1] = *(++s); Z_STRLEN_P(zendlval)--; } - *t++ = (char) ZEND_STRTOI(hex_buf, NULL, 16); + *t++ = (char) ZEND_STRTOL(hex_buf, NULL, 16); } else { *t++ = '\\'; *t++ = *s; @@ -976,7 +976,7 @@ static void zend_scan_escape_string(zval *zendlval, char *str, int len, char quo Z_STRLEN_P(zendlval)--; } } - *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8); + *t++ = (char) ZEND_STRTOL(octal_buf, NULL, 8); } else { *t++ = '\\'; *t++ = *s; @@ -1525,7 +1525,7 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len == 0) { ZVAL_LONG(zendlval, 0); } else { - ZVAL_LONG(zendlval, ZEND_STRTOI(bin, NULL, 2)); + ZVAL_LONG(zendlval, ZEND_STRTOL(bin, NULL, 2)); } return T_LNUMBER; } else { @@ -1536,10 +1536,10 @@ NEWLINE ("\r"|"\n"|"\r\n") <ST_IN_SCRIPTING>{LNUM} { if (yyleng < MAX_LENGTH_OF_LONG - 1) { /* Won't overflow */ - ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0)); } else { errno = 0; - ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 0)); + ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 0)); if (errno == ERANGE) { /* Overflow */ if (yytext[0] == '0') { /* octal overflow */ ZVAL_DOUBLE(zendlval, zend_oct_strtod(yytext, NULL)); @@ -1566,7 +1566,7 @@ NEWLINE ("\r"|"\n"|"\r\n") if (len == 0) { ZVAL_LONG(zendlval, 0); } else { - ZVAL_LONG(zendlval, ZEND_STRTOI(hex, NULL, 16)); + ZVAL_LONG(zendlval, ZEND_STRTOL(hex, NULL, 16)); } return T_LNUMBER; } else { @@ -1577,7 +1577,7 @@ NEWLINE ("\r"|"\n"|"\r\n") <ST_VAR_OFFSET>[0]|([1-9][0-9]*) { /* Offset could be treated as a long */ if (yyleng < MAX_LENGTH_OF_LONG - 1 || (yyleng == MAX_LENGTH_OF_LONG - 1 && strcmp(yytext, long_min_digits) < 0)) { - ZVAL_LONG(zendlval, ZEND_STRTOI(yytext, NULL, 10)); + ZVAL_LONG(zendlval, ZEND_STRTOL(yytext, NULL, 10)); } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 025b56e3cd..6f826010b7 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -86,7 +86,7 @@ ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */ if (!str_len) { str_len = strlen(str); } - retval = ZEND_STRTOI(str, NULL, 0); + retval = ZEND_STRTOL(str, NULL, 0); if (str_len>0) { switch (str[str_len-1]) { case 'g': @@ -114,7 +114,7 @@ ZEND_API zend_long zend_atol(const char *str, int str_len) /* {{{ */ if (!str_len) { str_len = strlen(str); } - retval = ZEND_STRTOI(str, NULL, 0); + retval = ZEND_STRTOL(str, NULL, 0); if (str_len>0) { switch (str[str_len-1]) { case 'g': @@ -283,7 +283,7 @@ try_again: ZVAL_LONG(&holder, zend_dval_to_lval(Z_DVAL_P(op)));\ break; \ case IS_STRING: \ - ZVAL_LONG(&holder, ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10));\ + ZVAL_LONG(&holder, ZEND_STRTOL(Z_STRVAL_P(op), NULL, 10));\ break; \ case IS_ARRAY: \ ZVAL_LONG(&holder, zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); \ @@ -599,7 +599,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */ break; case IS_RESOURCE: { char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; - int len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(op)); + int len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_LONG_FMT, Z_RES_HANDLE_P(op)); ZVAL_NEW_STR(op, zend_string_init(buf, len, 0)); break; } @@ -800,7 +800,7 @@ try_again: case IS_DOUBLE: return zend_dval_to_lval(Z_DVAL_P(op)); case IS_STRING: - return ZEND_STRTOI(Z_STRVAL_P(op), NULL, 10); + return ZEND_STRTOL(Z_STRVAL_P(op), NULL, 10); case IS_ARRAY: return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1 : 0; case IS_OBJECT: @@ -879,7 +879,7 @@ try_again: char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; int len; - len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(op)); + len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_LONG_FMT, Z_RES_HANDLE_P(op)); return zend_string_init(buf, len, 0); } case IS_LONG: { @@ -1182,9 +1182,9 @@ ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; /* division by zero */ - } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_INT_MIN) { + } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN) { /* Prevent overflow error/crash */ - ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1); + ZVAL_DOUBLE(result, (double) ZEND_LONG_MIN / -1); return SUCCESS; } if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ @@ -2135,7 +2135,7 @@ ZEND_API int increment_function(zval *op1) /* {{{ */ try_again: switch (Z_TYPE_P(op1)) { case IS_LONG: - if (Z_LVAL_P(op1) == ZEND_INT_MAX) { + if (Z_LVAL_P(op1) == ZEND_LONG_MAX) { /* switch to double */ double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d+1); @@ -2156,7 +2156,7 @@ try_again: switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: zend_string_release(Z_STR_P(op1)); - if (lval == ZEND_INT_MAX) { + if (lval == ZEND_LONG_MAX) { /* switch to double */ double d = (double)lval; ZVAL_DOUBLE(op1, d+1); @@ -2206,7 +2206,7 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */ try_again: switch (Z_TYPE_P(op1)) { case IS_LONG: - if (Z_LVAL_P(op1) == ZEND_INT_MIN) { + if (Z_LVAL_P(op1) == ZEND_LONG_MIN) { double d = (double)Z_LVAL_P(op1); ZVAL_DOUBLE(op1, d-1); } else { @@ -2225,7 +2225,7 @@ try_again: switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { case IS_LONG: zend_string_release(Z_STR_P(op1)); - if (lval == ZEND_INT_MIN) { + if (lval == ZEND_LONG_MIN) { double d = (double)lval; ZVAL_DOUBLE(op1, d-1); } else { diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index fcf8ad42af..7e6e8b9772 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -76,7 +76,7 @@ END_EXTERN_C() #elif SIZEOF_ZEND_INT == 4 static zend_always_inline zend_long zend_dval_to_lval(double d) { - if (d > ZEND_INT_MAX || d < ZEND_INT_MIN) { + if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) { double two_pow_32 = pow(2., 32.), dmod; @@ -93,8 +93,8 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) #else static zend_always_inline zend_long zend_dval_to_lval(double d) { - /* >= as (double)ZEND_INT_MAX is outside signed range */ - if (d >= ZEND_INT_MAX || d < ZEND_INT_MIN) { + /* >= as (double)ZEND_LONG_MAX is outside signed range */ + if (d >= ZEND_LONG_MAX || d < ZEND_LONG_MIN) { double two_pow_64 = pow(2., 64.), dmod; @@ -127,7 +127,7 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) * * This variant also gives information if a string that represents an integer * could not be represented as such due to overflow. It writes 1 to oflow_info - * if the integer is larger than ZEND_INT_MAX and -1 if it's smaller than ZEND_INT_MIN. + * if the integer is larger than ZEND_LONG_MAX and -1 if it's smaller than ZEND_LONG_MIN. */ static inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info) { @@ -253,7 +253,7 @@ process_double: } if (lval) { - *lval = ZEND_STRTOI(str, NULL, base); + *lval = ZEND_STRTOL(str, NULL, base); } return IS_LONG; @@ -508,9 +508,9 @@ static zend_always_inline int fast_increment_function(zval *op1) "n"(ZVAL_OFFSETOF_TYPE) : "cc"); #else - if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_INT_MAX)) { + if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MAX)) { /* switch to double */ - ZVAL_DOUBLE(op1, (double)ZEND_INT_MAX + 1.0); + ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0); } else { Z_LVAL_P(op1)++; } @@ -550,9 +550,9 @@ static zend_always_inline int fast_decrement_function(zval *op1) "n"(ZVAL_OFFSETOF_TYPE) : "cc"); #else - if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_INT_MIN)) { + if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MIN)) { /* switch to double */ - ZVAL_DOUBLE(op1, (double)ZEND_INT_MIN - 1.0); + ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0); } else { Z_LVAL_P(op1)--; } @@ -760,9 +760,9 @@ static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *o zend_error(E_WARNING, "Division by zero"); ZVAL_BOOL(result, 0); return FAILURE; - } else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_INT_MIN)) { + } else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN)) { /* Prevent overflow error/crash */ - ZVAL_DOUBLE(result, (double) ZEND_INT_MIN / -1); + ZVAL_DOUBLE(result, (double) ZEND_LONG_MIN / -1); } else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) { /* integer */ ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); @@ -811,7 +811,7 @@ static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *o ZVAL_BOOL(result, 0); return FAILURE; } else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) { - /* Prevent overflow error/crash if op1==ZEND_INT_MIN */ + /* Prevent overflow error/crash if op1==ZEND_LONG_MIN */ ZVAL_LONG(result, 0); return SUCCESS; } diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c index 7696dbb93d..b2e8f40760 100644 --- a/ext/bz2/bz2.c +++ b/ext/bz2/bz2.c @@ -406,7 +406,7 @@ static PHP_FUNCTION(bzopen) } else if (Z_TYPE_P(file) == IS_RESOURCE) { /* If it is a resource, than its a stream resource */ php_socket_t fd; - php_size_t stream_mode_len; + size_t stream_mode_len; php_stream_from_zval(stream, file); stream_mode_len = strlen(stream->mode); diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index 585b207cde..4ec1ab3ba3 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -467,7 +467,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC) &pid, 0, &pos))) { char namebuf[32]; if (keytype == HASH_KEY_IS_LONG) { - snprintf(namebuf, sizeof(namebuf), ZEND_UINT_FMT, pid); + snprintf(namebuf, sizeof(namebuf), ZEND_ULONG_FMT, pid); name = zend_string_init(namebuf, strlen(namebuf), 0); } else { zend_string_addref(name); diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index 26bf8f5686..65029e7d1c 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -182,7 +182,7 @@ zend_long timelib_date_to_int(timelib_time *d, int *error) ts = d->sse; - if (ts < PHP_INT_MIN || ts > PHP_INT_MAX) { + if (ts < ZEND_LONG_MIN || ts > ZEND_LONG_MAX) { if (error) { *error = 1; } diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e8e135d83a..e8c8aac06a 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1454,7 +1454,7 @@ PHP_FUNCTION(strtotime) now = timelib_time_ctor(); initial_ts = emalloc(25); - snprintf(initial_ts, 24, "@" ZEND_INT_FMT " UTC", preset_ts); + snprintf(initial_ts, 24, "@" ZEND_LONG_FMT " UTC", preset_ts); t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); /* we ignore the error here, as this should never fail */ timelib_update_ts(t, tzi); now->tz_info = tzi; @@ -3840,7 +3840,7 @@ PHP_FUNCTION(timezone_transitions_get) zval *object, element; php_timezone_obj *tzobj; unsigned int i, begin = 0, found; - zend_long timestamp_begin = PHP_INT_MIN, timestamp_end = PHP_INT_MAX; + zend_long timestamp_begin = ZEND_LONG_MIN, timestamp_end = ZEND_LONG_MAX; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ll", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { RETURN_FALSE; @@ -3873,7 +3873,7 @@ PHP_FUNCTION(timezone_transitions_get) array_init(return_value); - if (timestamp_begin == PHP_INT_MIN) { + if (timestamp_begin == ZEND_LONG_MIN) { add_nominal(); begin = 0; found = 1; @@ -4248,8 +4248,8 @@ static zend_string *date_interval_format(char *format, int format_len, timelib_r case 'I': length = slprintf(buffer, 32, "%02d", (int) t->i); break; case 'i': length = slprintf(buffer, 32, "%d", (int) t->i); break; - case 'S': length = slprintf(buffer, 32, "%02" ZEND_INT_FMT_SPEC, (zend_long) t->s); break; - case 's': length = slprintf(buffer, 32, ZEND_INT_FMT, (zend_long) t->s); break; + case 'S': length = slprintf(buffer, 32, "%02" ZEND_LONG_FMT_SPEC, (zend_long) t->s); break; + case 's': length = slprintf(buffer, 32, ZEND_LONG_FMT, (zend_long) t->s); break; case 'a': { if ((int) t->days != -99999) { diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 3c3c64398c..6438623525 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3847,7 +3847,7 @@ static int exif_discard_imageinfo(image_info_type *ImageInfo) static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC) { int ret; - php_stat_t st; + zend_stat_t st; zend_string *base; /* Start with an empty image information structure. */ diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 4ba687f4d3..db309de181 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -480,7 +480,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime case FILEINFO_MODE_STREAM: { php_stream *stream; - php_off_t streampos; + zend_off_t streampos; php_stream_from_zval_no_verify(stream, what); if (!stream) { diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index b3b1f746d4..41a3ac5239 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -1145,7 +1145,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) uint32_t i, j; size_t files = 0, maxfiles = 0; char **filearr = NULL; - php_stat_t st; + zend_stat_t st; struct magic_map *map; struct magic_entry_set mset[MAGIC_SETS]; php_stream *dir; @@ -2698,7 +2698,7 @@ internal_loaded: if (NULL != fn) { nentries = (uint32_t)(st.sb.st_size / sizeof(struct magic)); entries = (uint32_t)(st.sb.st_size / sizeof(struct magic)); - if ((php_off_t)(entries * sizeof(struct magic)) != st.sb.st_size) { + if ((zend_off_t)(entries * sizeof(struct magic)) != st.sb.st_size) { file_error(ms, 0, "Size of `%s' %llu is not a multiple of %zu", dbname, (unsigned long long)st.sb.st_size, sizeof(struct magic)); @@ -2788,7 +2788,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) assert(nm + sizeof(ar) < m); - if (php_stream_seek(stream,(php_off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) { + if (php_stream_seek(stream,(zend_off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) { file_error(ms, errno, "error seeking `%s'", dbname); goto out; } diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c index 93cc231884..45ad6e3e57 100644 --- a/ext/fileinfo/libmagic/cdf.c +++ b/ext/fileinfo/libmagic/cdf.c @@ -291,11 +291,11 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h, } static ssize_t -cdf_read(const cdf_info_t *info, php_off_t off, void *buf, size_t len) +cdf_read(const cdf_info_t *info, zend_off_t off, void *buf, size_t len) { size_t siz = (size_t)off + len; - if ((php_off_t)(off + len) != (php_off_t)siz) { + if ((zend_off_t)(off + len) != (zend_off_t)siz) { errno = EINVAL; return -1; } @@ -308,7 +308,7 @@ cdf_read(const cdf_info_t *info, php_off_t off, void *buf, size_t len) if (info->i_fd == -1) return -1; - if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (php_off_t)-1) + if (FINFO_LSEEK_FUNC(info->i_fd, off, SEEK_SET) == (zend_off_t)-1) return -1; if (FINFO_READ_FUNC(info->i_fd, buf, len) != (ssize_t)len) @@ -323,7 +323,7 @@ cdf_read_header(const cdf_info_t *info, cdf_header_t *h) char buf[512]; (void)memcpy(cdf_bo.s, "\01\02\03\04", 4); - if (cdf_read(info, (php_off_t)0, buf, sizeof(buf)) == -1) + if (cdf_read(info, (zend_off_t)0, buf, sizeof(buf)) == -1) return -1; cdf_unpack_header(h, buf); cdf_swap_header(h); @@ -357,7 +357,7 @@ cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len, size_t ss = CDF_SEC_SIZE(h); size_t pos = CDF_SEC_POS(h, id); assert(ss == len); - return cdf_read(info, (php_off_t)pos, ((char *)buf) + offs, len); + return cdf_read(info, (zend_off_t)pos, ((char *)buf) + offs, len); } ssize_t diff --git a/ext/fileinfo/libmagic/compress.c b/ext/fileinfo/libmagic/compress.c index 613fc6a3d2..0da5a3e6ce 100644 --- a/ext/fileinfo/libmagic/compress.c +++ b/ext/fileinfo/libmagic/compress.c @@ -300,7 +300,7 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf, return -1; } (void)close(tfd); - if (FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -406,7 +406,7 @@ uncompressbuf(struct magic_set *ms, int fd, size_t method, (void) close(0); if (fd != -1) { (void) dup(fd); - (void) FINFO_LSEEK_FUNC(0, (php_off_t)0, SEEK_SET); + (void) FINFO_LSEEK_FUNC(0, (zend_off_t)0, SEEK_SET); } else { (void) dup(fdin[0]); (void) close(fdin[0]); diff --git a/ext/fileinfo/libmagic/elfclass.h b/ext/fileinfo/libmagic/elfclass.h index 889ff6263e..bfacceb88a 100644 --- a/ext/fileinfo/libmagic/elfclass.h +++ b/ext/fileinfo/libmagic/elfclass.h @@ -37,7 +37,7 @@ case ET_CORE: flags |= FLAGS_IS_CORE; if (dophn_core(ms, clazz, swap, fd, - (php_off_t)elf_getu(swap, elfhdr.e_phoff), + (zend_off_t)elf_getu(swap, elfhdr.e_phoff), elf_getu16(swap, elfhdr.e_phnum), (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags) == -1) @@ -47,7 +47,7 @@ case ET_EXEC: case ET_DYN: if (dophn_exec(ms, clazz, swap, fd, - (php_off_t)elf_getu(swap, elfhdr.e_phoff), + (zend_off_t)elf_getu(swap, elfhdr.e_phoff), elf_getu16(swap, elfhdr.e_phnum), (size_t)elf_getu16(swap, elfhdr.e_phentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_shnum)) @@ -56,7 +56,7 @@ /*FALLTHROUGH*/ case ET_REL: if (doshn(ms, clazz, swap, fd, - (php_off_t)elf_getu(swap, elfhdr.e_shoff), + (zend_off_t)elf_getu(swap, elfhdr.e_shoff), elf_getu16(swap, elfhdr.e_shnum), (size_t)elf_getu16(swap, elfhdr.e_shentsize), fsize, &flags, elf_getu16(swap, elfhdr.e_machine), diff --git a/ext/fileinfo/libmagic/fsmagic.c b/ext/fileinfo/libmagic/fsmagic.c index f945d06a8b..a7b420ff5d 100644 --- a/ext/fileinfo/libmagic/fsmagic.c +++ b/ext/fileinfo/libmagic/fsmagic.c @@ -90,7 +90,7 @@ handle_mime(struct magic_set *ms, int mime, const char *str) } protected int -file_fsmagic(struct magic_set *ms, const char *fn, php_stat_t *sb, php_stream *stream) +file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb, php_stream *stream) { int ret, did = 0; int mime = ms->flags & MAGIC_MIME; diff --git a/ext/fileinfo/libmagic/readelf.c b/ext/fileinfo/libmagic/readelf.c index ec316b6bbd..3b0aae54c1 100644 --- a/ext/fileinfo/libmagic/readelf.c +++ b/ext/fileinfo/libmagic/readelf.c @@ -42,13 +42,13 @@ FILE_RCSID("@(#)$File: readelf.c,v 1.99 2013/11/05 15:44:01 christos Exp $") #include "magic.h" #ifdef ELFCORE -private int dophn_core(struct magic_set *, int, int, int, php_off_t, int, size_t, - php_off_t, int *); +private int dophn_core(struct magic_set *, int, int, int, zend_off_t, int, size_t, + zend_off_t, int *); #endif private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t, - php_off_t, int *, int); + zend_off_t, int *, int); private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, - php_off_t, int *, int); + zend_off_t, int *, int); private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int, int, size_t, int *); @@ -144,7 +144,7 @@ getu64(int swap, uint64_t value) #define xsh_size (size_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, sh32.sh_size) \ : elf_getu64(swap, sh64.sh_size)) -#define xsh_offset (php_off_t)(clazz == ELFCLASS32 \ +#define xsh_offset (zend_off_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, sh32.sh_offset) \ : elf_getu64(swap, sh64.sh_offset)) #define xsh_type (clazz == ELFCLASS32 \ @@ -162,13 +162,13 @@ getu64(int swap, uint64_t value) #define xph_type (clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_type) \ : elf_getu32(swap, ph64.p_type)) -#define xph_offset (php_off_t)(clazz == ELFCLASS32 \ +#define xph_offset (zend_off_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_offset) \ : elf_getu64(swap, ph64.p_offset)) #define xph_align (size_t)((clazz == ELFCLASS32 \ - ? (php_off_t) (ph32.p_align ? \ + ? (zend_off_t) (ph32.p_align ? \ elf_getu32(swap, ph32.p_align) : 4) \ - : (php_off_t) (ph64.p_align ? \ + : (zend_off_t) (ph64.p_align ? \ elf_getu64(swap, ph64.p_align) : 4))) #define xph_filesz (size_t)((clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_filesz) \ @@ -293,8 +293,8 @@ private const char os_style_names[][8] = { #define FLAGS_IS_CORE 0x10 private int -dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, - int num, size_t size, php_off_t fsize, int *flags) +dophn_core(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off, + int num, size_t size, zend_off_t fsize, int *flags) { Elf32_Phdr ph32; Elf64_Phdr ph64; @@ -312,7 +312,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, * Loop through all the program headers. */ for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -334,7 +334,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, * This is a PT_NOTE section; loop through all the notes * in the section. */ - if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -917,7 +917,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, Elf64_Shdr sh64; int stripped = 1; void *nbuf; - php_off_t noff, coff, name_off; + zend_off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */ char name[50]; @@ -929,7 +929,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, } for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -959,8 +959,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, switch (xsh_type) { case SHT_NOTE: nbuf = emalloc((size_t)xsh_size); - if ((noff = FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET)) == - (php_off_t)-1) { + if ((noff = FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET)) == + (zend_off_t)-1) { file_badread(ms); efree(nbuf); return -1; @@ -974,7 +974,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, noff = 0; for (;;) { - if (noff >= (php_off_t)xsh_size) + if (noff >= (zend_off_t)xsh_size) break; noff = donote(ms, nbuf, (size_t)noff, (size_t)xsh_size, clazz, swap, 4, @@ -985,8 +985,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, efree(nbuf); break; case SHT_SUNW_cap: - if (FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET) == - (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET) == + (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -996,7 +996,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, Elf64_Cap cap64; char cbuf[/*CONSTCOND*/ MAX(sizeof cap32, sizeof cap64)]; - if ((coff += xcap_sizeof) > (php_off_t)xsh_size) + if ((coff += xcap_sizeof) > (zend_off_t)xsh_size) break; if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) != (ssize_t)xcap_sizeof) { @@ -1099,8 +1099,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, * otherwise it's statically linked. */ private int -dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, - int num, size_t size, php_off_t fsize, int *flags, int sh_num) +dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off, + int num, size_t size, zend_off_t fsize, int *flags, int sh_num) { Elf32_Phdr ph32; Elf64_Phdr ph64; @@ -1117,7 +1117,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, } for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -1161,7 +1161,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, * This is a PT_NOTE section; loop through all the notes * in the section. */ - if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -1204,7 +1204,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, int clazz; int swap; struct stat st; - php_off_t fsize; + zend_off_t fsize; int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; @@ -1227,7 +1227,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, /* * If we cannot seek, it must be a pipe, socket or fifo. */ - if((FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) && (errno == ESPIPE)) + if((FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) && (errno == ESPIPE)) fd = file_pipe2file(ms, fd, buf, nbytes); if (fstat(fd, &st) == -1) { diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 7d3721237a..e5e9be249d 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -77,7 +77,7 @@ static const filter_list_entry filter_list[] = { #define PARSE_SESSION 6 #endif -static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC); +static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC); static unsigned int php_sapi_filter_init(TSRMLS_D); /* {{{ arginfo */ @@ -402,7 +402,7 @@ static void php_zval_filter(zval *value, zend_long filter, zend_long flags, zval } /* }}} */ -static unsigned int php_sapi_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC) /* {{{ */ +static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC) /* {{{ */ { zval new_var, raw_var; zval *array_ptr = NULL, *orig_array_ptr = NULL; diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 914d85e3e7..cbefae9d70 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -115,9 +115,9 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, zend_long while (str < end) { if (*str >= '0' && *str <= '9') { digit = (*(str++) - '0'); - if ( (!sign) && ctx_value <= (PHP_INT_MAX-digit)/10 ) { + if ( (!sign) && ctx_value <= (ZEND_LONG_MAX-digit)/10 ) { ctx_value = (ctx_value * 10) + digit; - } else if ( sign && ctx_value >= (PHP_INT_MIN+digit)/10) { + } else if ( sign && ctx_value >= (ZEND_LONG_MIN+digit)/10) { ctx_value = (ctx_value * 10) - digit; } else { return -1; diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 45c6ffed10..27051677c9 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -624,7 +624,7 @@ ftp_alloc(ftpbuf_t *ftp, const zend_long size, zend_string **response) return 0; } - snprintf(buffer, sizeof(buffer) - 1, ZEND_INT_FMT, size); + snprintf(buffer, sizeof(buffer) - 1, ZEND_LONG_FMT, size); if (!ftp_putcmd(ftp, "ALLO", buffer)) { return 0; @@ -811,7 +811,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, ftp->data = data; if (resumepos > 0) { - snprintf(arg, sizeof(arg), ZEND_INT_FMT, resumepos); + snprintf(arg, sizeof(arg), ZEND_LONG_FMT, resumepos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -903,7 +903,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, z ftp->data = data; if (startpos > 0) { - snprintf(arg, sizeof(arg), ZEND_INT_FMT, startpos); + snprintf(arg, sizeof(arg), ZEND_LONG_FMT, startpos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -1729,7 +1729,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ } if (resumepos>0) { - snprintf(arg, sizeof(arg), ZEND_INT_FMT, resumepos); + snprintf(arg, sizeof(arg), ZEND_LONG_FMT, resumepos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } @@ -1843,7 +1843,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type goto bail; } if (startpos > 0) { - snprintf(arg, sizeof(arg), ZEND_INT_FMT, startpos); + snprintf(arg, sizeof(arg), ZEND_LONG_FMT, startpos); if (!ftp_putcmd(ftp, "REST", arg)) { goto bail; } diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 1af01ef265..ac03aa87ee 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -619,12 +619,12 @@ PHP_FUNCTION(hash_pbkdf2) } if (iterations <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: " ZEND_INT_FMT, iterations); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iterations must be a positive integer: " ZEND_LONG_FMT, iterations); RETURN_FALSE; } if (length < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: " ZEND_INT_FMT, length); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length); RETURN_FALSE; } diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index b38d755701..d8d132578f 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -196,13 +196,13 @@ static php_iconv_err_t _php_iconv_appendc(smart_str *d, const char c, iconv_t cd static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, const char *in_charset TSRMLS_DC); -static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc); +static php_iconv_err_t _php_iconv_strlen(size_t *pretval, const char *str, size_t nbytes, const char *enc); static php_iconv_err_t _php_iconv_substr(smart_str *pretval, const char *str, size_t nbytes, zend_long offset, zend_long len, const char *enc); -static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, zend_long offset, const char *enc); +static php_iconv_err_t _php_iconv_strpos(size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, zend_long offset, const char *enc); -static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc); +static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc); static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode); @@ -435,9 +435,9 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c char *p = strstr(get_output_encoding(TSRMLS_C), "//"); if (p) { - len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (php_size_t) strlen(mimetype), mimetype, (php_size_t)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C)); + len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, (size_t)(p - get_output_encoding(TSRMLS_C)), get_output_encoding(TSRMLS_C)); } else { - len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (php_size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C)); + len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C)); } if (content_type && SUCCESS == sapi_add_header(content_type, len, 0)) { SG(sapi_headers).send_default_content_type = 0; @@ -721,7 +721,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, /* }}} */ /* {{{ _php_iconv_strlen() */ -static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, size_t nbytes, const char *enc) +static php_iconv_err_t _php_iconv_strlen(size_t *pretval, const char *str, size_t nbytes, const char *enc) { char buf[GENERIC_SUPERSET_NBYTES*2]; @@ -735,9 +735,9 @@ static php_iconv_err_t _php_iconv_strlen(php_size_t *pretval, const char *str, s char *out_p; size_t out_left; - php_size_t cnt; + size_t cnt; - *pretval = (php_size_t)-1; + *pretval = (size_t)-1; cd = iconv_open(GENERIC_SUPERSET_NAME, enc); @@ -820,7 +820,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, char *out_p; size_t out_left; - php_size_t cnt; + size_t cnt; zend_long total_len; err = _php_iconv_strlen(&total_len, str, nbytes, enc); @@ -951,7 +951,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, /* }}} */ /* {{{ _php_iconv_strpos() */ -static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, +static php_iconv_err_t _php_iconv_strpos(size_t *pretval, const char *haystk, size_t haystk_nbytes, const char *ndl, size_t ndl_nbytes, zend_long offset, const char *enc) @@ -968,15 +968,15 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, char *out_p; size_t out_left; - php_size_t cnt; + size_t cnt; zend_string *ndl_buf; const char *ndl_buf_p; size_t ndl_buf_left; - php_size_t match_ofs; + size_t match_ofs; - *pretval = (php_size_t)-1; + *pretval = (size_t)-1; err = php_iconv_string(ndl, ndl_nbytes, &ndl_buf, GENERIC_SUPERSET_NAME, enc); @@ -1006,7 +1006,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, ndl_buf_p = ndl_buf->val; ndl_buf_left = ndl_buf->len; - match_ofs = (php_size_t)-1; + match_ofs = (size_t)-1; for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) { size_t prev_in_left; @@ -1039,9 +1039,9 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, } } if (offset >= 0) { - if (cnt >= (php_size_t)offset) { + if (cnt >= (size_t)offset) { if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) { - if (match_ofs == (php_size_t)-1) { + if (match_ofs == (size_t)-1) { match_ofs = cnt; } ndl_buf_p += GENERIC_SUPERSET_NBYTES; @@ -1051,11 +1051,11 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, break; } } else { - php_size_t i, j, lim; + size_t i, j, lim; i = 0; j = GENERIC_SUPERSET_NBYTES; - lim = (php_size_t)(ndl_buf_p - ndl_buf->val); + lim = (size_t)(ndl_buf_p - ndl_buf->val); while (j < lim) { if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i], @@ -1074,7 +1074,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, ndl_buf_p = &ndl_buf->val[i]; ndl_buf_left = ndl_buf->len - i; } else { - match_ofs = (php_size_t)-1; + match_ofs = (size_t)-1; ndl_buf_p = ndl_buf->val; ndl_buf_left = ndl_buf->len; } @@ -1082,7 +1082,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, } } else { if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) { - if (match_ofs == (php_size_t)-1) { + if (match_ofs == (size_t)-1) { match_ofs = cnt; } ndl_buf_p += GENERIC_SUPERSET_NBYTES; @@ -1094,11 +1094,11 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, match_ofs = -1; } } else { - php_size_t i, j, lim; + size_t i, j, lim; i = 0; j = GENERIC_SUPERSET_NBYTES; - lim = (php_size_t)(ndl_buf_p - ndl_buf->val); + lim = (size_t)(ndl_buf_p - ndl_buf->val); while (j < lim) { if (_php_iconv_memequal(&ndl_buf->val[j], &ndl_buf->val[i], @@ -1117,7 +1117,7 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, ndl_buf_p = &ndl_buf->val[i]; ndl_buf_left = ndl_buf->len - i; } else { - match_ofs = (php_size_t)-1; + match_ofs = (size_t)-1; ndl_buf_p = ndl_buf->val; ndl_buf_left = ndl_buf->len; } @@ -1136,11 +1136,11 @@ static php_iconv_err_t _php_iconv_strpos(php_size_t *pretval, /* }}} */ /* {{{ _php_iconv_mime_encode() */ -static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, php_size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc) +static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc) { php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); - php_size_t char_cnt = 0; + size_t char_cnt = 0; size_t out_charset_len; size_t lfchars_len; char *buf = NULL; @@ -2039,7 +2039,7 @@ PHP_FUNCTION(iconv_strlen) php_iconv_err_t err; - php_size_t retval; + size_t retval; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|s", &str, &charset, &charset_len) == FAILURE) { @@ -2112,7 +2112,7 @@ PHP_FUNCTION(iconv_strpos) php_iconv_err_t err; - php_size_t retval; + size_t retval; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ls", &haystk, &ndl, @@ -2138,7 +2138,7 @@ PHP_FUNCTION(iconv_strpos) offset, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) { + if (err == PHP_ICONV_ERR_SUCCESS && retval != (size_t)-1) { RETVAL_LONG((zend_long)retval); } else { RETVAL_FALSE; @@ -2157,7 +2157,7 @@ PHP_FUNCTION(iconv_strrpos) php_iconv_err_t err; - php_size_t retval; + size_t retval; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|s", &haystk, &ndl, @@ -2178,7 +2178,7 @@ PHP_FUNCTION(iconv_strrpos) -1, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset TSRMLS_CC); - if (err == PHP_ICONV_ERR_SUCCESS && retval != (php_size_t)-1) { + if (err == PHP_ICONV_ERR_SUCCESS && retval != (size_t)-1) { RETVAL_LONG((zend_long)retval); } else { RETVAL_FALSE; @@ -2347,7 +2347,7 @@ PHP_FUNCTION(iconv_mime_decode_headers) int charset_len = 0; zend_long mode = 0; char *enc_str_tmp; - php_size_t enc_str_len_tmp; + size_t enc_str_len_tmp; php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; @@ -2510,7 +2510,7 @@ PHP_FUNCTION(iconv_set_encoding) PHP_FUNCTION(iconv_get_encoding) { char *type = "all"; - php_size_t type_len = sizeof("all")-1; + size_t type_len = sizeof("all")-1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) == FAILURE) return; diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c index 34668bb5a8..db9e41f887 100644 --- a/ext/intl/collator/collator_is_numeric.c +++ b/ext/intl/collator/collator_is_numeric.c @@ -184,7 +184,7 @@ static zend_long collator_u_strtol(nptr, endptr, base) * Set any if any `digits' consumed; make it negative to indicate * overflow. */ - cutoff = neg ? -(zend_ulong)PHP_INT_MIN : PHP_INT_MAX; + cutoff = neg ? -(zend_ulong)ZEND_LONG_MIN : ZEND_LONG_MAX; cutlim = cutoff % (zend_ulong)base; cutoff /= (zend_ulong)base; for (acc = 0, any = 0;; c = *s++) { @@ -208,7 +208,7 @@ static zend_long collator_u_strtol(nptr, endptr, base) } } if (any < 0) { - acc = neg ? PHP_INT_MIN : PHP_INT_MAX; + acc = neg ? ZEND_LONG_MIN : ZEND_LONG_MAX; errno = ERANGE; } else if (neg) acc = -acc; diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c index 12c9465bc3..fa06648331 100644 --- a/ext/intl/formatter/formatter_parse.c +++ b/ext/intl/formatter/formatter_parse.c @@ -86,7 +86,7 @@ PHP_FUNCTION( numfmt_parse ) break; case FORMAT_TYPE_INT64: val64 = unum_parseInt64(FORMATTER_OBJECT(nfo), sstr, sstr_len, position_p, &INTL_DATA_ERROR_CODE(nfo)); - if(val64 > ZEND_INT_MAX || val64 < ZEND_INT_MIN) { + if(val64 > ZEND_LONG_MAX || val64 < ZEND_LONG_MIN) { RETVAL_DOUBLE(val64); } else { RETVAL_LONG((zend_long)val64); diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 50527b7f06..466db01731 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -663,7 +663,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval **args, UCh case Formattable::kInt64: aInt64 = fargs[i].getInt64(); - if(aInt64 > PHP_INT_MAX || aInt64 < -PHP_INT_MAX) { + if(aInt64 > ZEND_LONG_MAX || aInt64 < -ZEND_LONG_MAX) { ZVAL_DOUBLE(&(*args)[i], (double)aInt64); } else { ZVAL_LONG(&(*args)[i], (zend_long)aInt64); diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 71e6ac4aac..b029a83f63 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -241,9 +241,9 @@ PHP_MINFO_FUNCTION(ldap) php_info_print_table_row(2, "RCS Version", "$Id$"); if (LDAPG(max_links) == -1) { - snprintf(tmp, 31, ZEND_INT_FMT "/unlimited", LDAPG(num_links)); + snprintf(tmp, 31, ZEND_LONG_FMT "/unlimited", LDAPG(num_links)); } else { - snprintf(tmp, 31, ZEND_INT_FMT "/" ZEND_INT_FMT, LDAPG(num_links), LDAPG(max_links)); + snprintf(tmp, 31, ZEND_LONG_FMT "/" ZEND_LONG_FMT, LDAPG(num_links), LDAPG(max_links)); } php_info_print_table_row(2, "Total Links", tmp); diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c index 786825b35e..92e7327787 100644 --- a/ext/mbstring/mb_gpc.c +++ b/ext/mbstring/mb_gpc.c @@ -197,7 +197,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i char *strtok_buf = NULL, **val_list = NULL; zval *array_ptr = (zval *) arg; int n, num, *len_list = NULL; - php_size_t val_len, new_val_len; + size_t val_len, new_val_len; mbfl_string string, resvar, resval; const mbfl_encoding *from_encoding = NULL; mbfl_encoding_detector *identd = NULL; diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 4276537368..2bc488fe23 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -686,9 +686,9 @@ PHP_MINFO_FUNCTION(mysql) php_info_print_table_start(); php_info_print_table_header(2, "MySQL Support", "enabled"); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MySG(num_persistent)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MySG(num_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MySG(num_links)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MySG(num_links)); php_info_print_table_row(2, "Active Links", buf); php_info_print_table_row(2, "Client API version", mysql_get_client_info()); #if !defined (PHP_WIN32) && !defined (NETWARE) && !defined(MYSQL_USE_MYSQLND) @@ -821,7 +821,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) #endif hashed_details = zend_string_alloc(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0) + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_LONG - 1, 0); - hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_" ZEND_INT_FMT, SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags); + hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_" ZEND_LONG_FMT, SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags); } /* We cannot use mysql_port anymore in windows, need to use diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 0ac8f2757b..2c5a4bc662 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -976,11 +976,11 @@ PHP_MINFO_FUNCTION(mysqli) php_info_print_table_start(); php_info_print_table_header(2, "MysqlI Support", "enabled"); php_info_print_table_row(2, "Client API library version", mysql_get_client_info()); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MyG(num_active_persistent)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MyG(num_active_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MyG(num_inactive_persistent)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MyG(num_inactive_persistent)); php_info_print_table_row(2, "Inactive Persistent Links", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MyG(num_links)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MyG(num_links)); php_info_print_table_row(2, "Active Links", buf); #if !defined(MYSQLI_USE_MYSQLND) php_info_print_table_row(2, "Client API header version", MYSQL_SERVER_VERSION); diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h index c00e4b84e9..b240cfab09 100644 --- a/ext/mysqli/mysqli_priv.h +++ b/ext/mysqli/mysqli_priv.h @@ -98,7 +98,7 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry * TSRMLS_DC #define MYSQLI_RETURN_LONG_INT(__val) \ { \ - if ((__val) < PHP_INT_MAX) { \ + if ((__val) < ZEND_LONG_MAX) { \ RETURN_LONG((zend_long) (__val)); \ } else { \ /* always used with my_ulonglong -> %llu */ \ diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index 49ecab0add..c1fa0a17d6 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -81,7 +81,7 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \ ZVAL_NULL(retval);\ } else {\ l = (__ret_type)__int_func(p);\ - if (l < PHP_INT_MAX) {\ + if (l < ZEND_LONG_MAX) {\ ZVAL_LONG(retval, (zend_long) l);\ } else { \ ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \ @@ -167,7 +167,7 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) return retval; } - if (rc < PHP_INT_MAX) { + if (rc < ZEND_LONG_MAX) { ZVAL_LONG(retval, (zend_long) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); @@ -221,18 +221,18 @@ static zval *link_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) /* }}} */ /* link properties */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID)) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) /* {{{ property link_stat_read */ static zval *link_stat_read(mysqli_object *obj, zval *retval TSRMLS_DC) @@ -310,8 +310,8 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC) } /* }}} */ -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) /* statement properties */ @@ -354,7 +354,7 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC) return retval; } - if (rc < PHP_INT_MAX) { + if (rc < ZEND_LONG_MAX) { ZVAL_LONG(retval, (zend_long) rc); } else { ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc)); @@ -407,9 +407,9 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC) MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_UINT_FMT) -MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_UINT_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT) +MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED)) diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index c05d8af8b1..de7c8c7023 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -2124,11 +2124,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * return 0; } - major = ZEND_STRTOI(p, &p, 10); + major = ZEND_STRTOL(p, &p, 10); p += 1; /* consume the dot */ - minor = ZEND_STRTOI(p, &p, 10); + minor = ZEND_STRTOL(p, &p, 10); p += 1; /* consume the dot */ - patch = ZEND_STRTOI(p, &p, 10); + patch = ZEND_STRTOL(p, &p, 10); return (zend_ulong)(major * Z_I(10000) + (zend_ulong)(minor * Z_I(100) + patch)); } diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index c669706917..cfe6f26280 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -636,7 +636,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX We do transformation here, which will be used later when sending types. The code later relies on this. */ - if (Z_DVAL(tmp_data_copy) > PHP_INT_MAX || Z_DVAL(tmp_data_copy) < PHP_INT_MIN) { + if (Z_DVAL(tmp_data_copy) > ZEND_LONG_MAX || Z_DVAL(tmp_data_copy) < ZEND_LONG_MIN) { stmt->send_types_to_server = *resend_types_next_time = 1; convert_to_string_ex(tmp_data); } else { diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index c42059c641..5af676d02f 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -1731,7 +1731,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer, */ p -= len; if (Z_TYPE_P(current_field) == IS_LONG) { - bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_LVAL_P(current_field)); + bit_area += 1 + sprintf((char *)start, ZEND_LONG_FMT, Z_LVAL_P(current_field)); ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1); } else if (Z_TYPE_P(current_field) == IS_STRING){ memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field)); diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index ff532a6105..15d572793b 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -138,11 +138,11 @@ PHP_MINFO_FUNCTION(mysqlnd) #else "not supported"); #endif - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MYSQLND_G(net_cmd_buffer_size)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MYSQLND_G(net_cmd_buffer_size)); php_info_print_table_row(2, "Command buffer size", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MYSQLND_G(net_read_buffer_size)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MYSQLND_G(net_read_buffer_size)); php_info_print_table_row(2, "Read buffer size", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, MYSQLND_G(net_read_timeout)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MYSQLND_G(net_read_timeout)); php_info_print_table_row(2, "Read timeout", buf); php_info_print_table_row(2, "Collecting statistics", MYSQLND_G(collect_statistics)? "Yes":"No"); php_info_print_table_row(2, "Collecting memory statistics", MYSQLND_G(collect_memory_statistics)? "Yes":"No"); @@ -208,7 +208,7 @@ static PHP_INI_MH(OnUpdateNetCmdBufferSize) { zend_long long_value; - ZEND_ATOI(long_value, new_value); + ZEND_ATOL(long_value, new_value); if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) { return FAILURE; } diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 3912b52b13..0b873a0b33 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -841,9 +841,9 @@ PHP_MINFO_FUNCTION(odbc) php_info_print_table_start(); php_info_print_table_header(2, "ODBC Support", "enabled"); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, ODBCG(num_persistent)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ODBCG(num_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, ODBCG(num_links)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ODBCG(num_links)); php_info_print_table_row(2, "Active Links", buf); php_info_print_table_row(2, "ODBC library", PHP_ODBC_TYPE); #ifndef PHP_WIN32 diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c index c9cfc03f00..2a386b812b 100644 --- a/ext/opcache/zend_accelerator_debug.c +++ b/ext/opcache/zend_accelerator_debug.c @@ -57,7 +57,7 @@ void zend_accel_error(int type, const char *format, ...) } #ifdef ZTS - fprintf(fLog, "%s (" ZEND_UINT_FMT "): ", time_string, (zend_ulong)tsrm_thread_id()); + fprintf(fLog, "%s (" ZEND_ULONG_FMT "): ", time_string, (zend_ulong)tsrm_thread_id()); #else fprintf(fLog, "%s (%d): ", time_string, getpid()); #endif diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index b97e56ac5b..86411af7be 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -411,7 +411,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS) php_info_print_table_row(2, "Cache hits", buf); snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses)); php_info_print_table_row(2, "Cache misses", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory)); php_info_print_table_row(2, "Used memory", buf); snprintf(buf, sizeof(buf), "%pd", zend_shared_alloc_get_free_memory()); php_info_print_table_row(2, "Free memory", buf); diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index fbe83a5f8a..584b87d68e 100755 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2193,7 +2193,7 @@ static X509_STORE * setup_verify(zval * calist TSRMLS_DC) X509_LOOKUP * dir_lookup, * file_lookup; int ndirs = 0, nfiles = 0; zval * item; - php_stat_t sb; + zend_stat_t sb; store = X509_STORE_new(); diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index bb2f808cbc..936428ad7b 100644 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -331,7 +331,7 @@ PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */ p = &buffer[sizeof(buffer)-1]; *p = '\0'; - while ((pdo_uint64_t)i64 > (pdo_uint64_t)PHP_INT_MAX) { + while ((pdo_uint64_t)i64 > (pdo_uint64_t)ZEND_LONG_MAX) { pdo_uint64_t quo = (pdo_uint64_t)i64 / (unsigned int)10; unsigned int rem = (unsigned int)(i64 - quo*10U); *--p = digit_vec[rem]; diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 4045a20cee..175e52885d 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -544,7 +544,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ { struct pdo_column_data *col; char *value = NULL; - php_size_t value_len = 0; + size_t value_len = 0; int caller_frees = 0; int type, new_type; diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index f8e43391f2..fe23e5fac2 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -151,8 +151,8 @@ static int pgsql_lob_flush(php_stream *stream TSRMLS_DC) return 0; } -static int pgsql_lob_seek(php_stream *stream, php_off_t offset, int whence, - php_off_t *newoffset TSRMLS_DC) +static int pgsql_lob_seek(php_stream *stream, zend_off_t offset, int whence, + zend_off_t *newoffset TSRMLS_DC) { struct pdo_pgsql_lob_self *self = (struct pdo_pgsql_lob_self*)stream->abstract; int pos = lo_lseek(self->conn, self->lfd, offset, whence); @@ -307,7 +307,7 @@ static zend_long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq } H->pgoid = PQoidValue(res); if (qs == PGRES_COMMAND_OK) { - ZEND_ATOI(ret, PQcmdTuples(res)); + ZEND_ATOL(ret, PQcmdTuples(res)); } else { ret = Z_I(0); } @@ -354,7 +354,7 @@ static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned if (H->pgoid == InvalidOid) { return NULL; } - *len = spprintf(&id, 0, ZEND_INT_FMT, (zend_long) H->pgoid); + *len = spprintf(&id, 0, ZEND_LONG_FMT, (zend_long) H->pgoid); } else { PGresult *res; ExecStatusType status; @@ -910,7 +910,7 @@ static PHP_METHOD(PDO, pgsqlLOBCreate) lfd = lo_creat(H->server, INV_READ|INV_WRITE); if (lfd != InvalidOid) { - zend_string *buf = strpprintf(0, ZEND_UINT_FMT, (zend_long) lfd); + zend_string *buf = strpprintf(0, ZEND_ULONG_FMT, (zend_long) lfd); RETURN_STR(buf); } diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index f50e95e6be..7a315c7f08 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -230,7 +230,7 @@ stmt_retry: } if (status == PGRES_COMMAND_OK) { - ZEND_ATOI(stmt->row_count, PQcmdTuples(S->result)); + ZEND_ATOL(stmt->row_count, PQcmdTuples(S->result)); H->pgoid = PQoidValue(S->result); } else { stmt->row_count = (zend_long)PQntuples(S->result); @@ -256,14 +256,14 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * /* decode name from $1, $2 into 0, 1 etc. */ if (param->name) { if (param->name->val[0] == '$') { - ZEND_ATOI(param->paramno, param->name->val + 1); + ZEND_ATOL(param->paramno, param->name->val + 1); } else { /* resolve parameter name to rewritten name */ char *namevar; if (stmt->bound_param_map && (namevar = zend_hash_find_ptr(stmt->bound_param_map, param->name)) != NULL) { - ZEND_ATOI(param->paramno, namevar + 1); + ZEND_ATOL(param->paramno, namevar + 1); param->paramno--; } else { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", param->name->val TSRMLS_CC); @@ -519,7 +519,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulon switch (cols[colno].param_type) { case PDO_PARAM_INT: - ZEND_ATOI(S->cols[colno].intval, *ptr); + ZEND_ATOL(S->cols[colno].intval, *ptr); *ptr = (char *) &(S->cols[colno].intval); *len = sizeof(zend_long); break; diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index 739bcc6de8..feaff73b94 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -118,7 +118,7 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d } } else { convert_to_int(parameter); -#if PHP_INT_MAX > 2147483647 +#if ZEND_LONG_MAX > 2147483647 if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(parameter))) { return 1; } diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index ad75b23312..03a4051efb 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -66,9 +66,9 @@ #define PGSQL_MAX_LENGTH_OF_LONG 30 #define PGSQL_MAX_LENGTH_OF_DOUBLE 60 -#if PHP_INT_MAX < UINT_MAX +#if ZEND_LONG_MAX < UINT_MAX #define PGSQL_RETURN_OID(oid) do { \ - if (oid > PHP_INT_MAX) { \ + if (oid > ZEND_LONG_MAX) { \ smart_str s = {0}; \ smart_str_append_unsigned(&s, oid); \ smart_str_0(&s); \ @@ -1254,9 +1254,9 @@ PHP_MINFO_FUNCTION(pgsql) php_info_print_table_row(2, "SSL support", "disabled"); #endif #endif /* HAVE_PG_CONFIG_H */ - snprintf(buf, sizeof(buf), ZEND_INT_FMT, PGG(num_persistent)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_persistent)); php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), ZEND_INT_FMT, PGG(num_links)); + snprintf(buf, sizeof(buf), ZEND_LONG_FMT, PGG(num_links)); php_info_print_table_row(2, "Active Links", buf); php_info_print_table_end(); @@ -2412,8 +2412,8 @@ PHP_FUNCTION(pg_field_table) } if (return_oid) { -#if UINT_MAX > PHP_INT_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ - if (oid > PHP_INT_MAX) { +#if UINT_MAX > ZEND_LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ + if (oid > ZEND_LONG_MAX) { smart_str oidstr = {0}; smart_str_append_unsigned(&oidstr, oid); smart_str_0(&oidstr); @@ -2514,8 +2514,8 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ case PHP_PG_FIELD_TYPE_OID: oid = PQftype(pgsql_result, field); -#if UINT_MAX > PHP_INT_MAX - if (oid > PHP_INT_MAX) { +#if UINT_MAX > ZEND_LONG_MAX + if (oid > ZEND_LONG_MAX) { smart_str s = {0}; smart_str_append_unsigned(&s, oid); smart_str_0(&s); diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index 238698022f..b8875891b0 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -58,7 +58,7 @@ static int phar_dir_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{ /** * Used for seeking on a phar directory handle */ -static int phar_dir_seek(php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC) /* {{{ */ +static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */ { HashTable *data = (HashTable *)stream->abstract; diff --git a/ext/phar/dirstream.h b/ext/phar/dirstream.h index 27d236aca4..f9a300a63c 100644 --- a/ext/phar/dirstream.h +++ b/ext/phar/dirstream.h @@ -31,7 +31,7 @@ static size_t phar_dir_write(php_stream *stream, const char *buf, size_t count T static size_t phar_dir_read( php_stream *stream, char *buf, size_t count TSRMLS_DC); 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, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC); +static int phar_dir_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC); #else 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 diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index 99bc98bc5b..6347c72f40 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -433,7 +433,7 @@ skip_phar: /* {{{ php_stat */ -static void phar_fancy_stat(php_stat_t *stat_sb, int type, zval *return_value TSRMLS_DC) +static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value TSRMLS_DC) { zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev, stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks; @@ -611,7 +611,7 @@ static void phar_file_stat(const char *filename, php_stat_len filename_length, i if (!IS_ABSOLUTE_PATH(filename, filename_length) && !strstr(filename, "://")) { char *arch, *entry, *fname; int arch_len, entry_len, fname_len; - php_stat_t sb = {0}; + zend_stat_t sb = {0}; phar_entry_info *data = NULL; phar_archive_data *phar; diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 1e184b8362..2fd46b9621 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -771,7 +771,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char /* be ignored on reading because it is being generated anyways. */ if (manifest_flags & PHAR_HDR_SIGNATURE) { char sig_buf[8], *sig_ptr = sig_buf; - php_off_t read_len; + zend_off_t read_len; size_t end_of_phar; if (-1 == php_stream_seek(fp, -8, SEEK_END) @@ -792,7 +792,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char case PHAR_SIG_OPENSSL: { php_uint32 signature_len; char *sig; - php_off_t whence; + zend_off_t whence; /* we store the signature followed by the signature length */ if (-1 == php_stream_seek(fp, -12, SEEK_CUR) @@ -2542,7 +2542,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv int halt_offset, restore_alias_len, global_flags = 0, closeoldfile; char *pos, has_dirs = 0; char manifest[18], entry_buffer[24]; - php_off_t manifest_ftell; + zend_off_t manifest_ftell; zend_long offset; size_t wrote; php_uint32 manifest_len, mytime, loc, new_manifest_count; diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 1bfd827fc0..77df0a71c2 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -415,7 +415,7 @@ static inline void phar_set_pharufp(phar_archive_data *phar, php_stream *fp TSRM PHAR_GLOBALS->cached_fp[phar->phar_pos].ufp = fp; } -static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, php_off_t offset TSRMLS_DC) +static inline void phar_set_fp_type(phar_entry_info *entry, enum phar_fp_type type, zend_off_t offset TSRMLS_DC) { phar_entry_fp_info *data; @@ -437,7 +437,7 @@ static inline enum phar_fp_type phar_get_fp_type(phar_entry_info *entry TSRMLS_D return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].manifest[entry->manifest_pos].fp_type; } -static inline php_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC) +static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry TSRMLS_DC) { if (!entry->is_persistent) { return entry->offset; @@ -466,9 +466,9 @@ typedef struct _phar_entry_data { phar_archive_data *phar; php_stream *fp; /* stream position proxy, allows multiple open streams referring to the same fp */ - php_off_t position; + zend_off_t position; /* for copies of the phar fp, defines where 0 is */ - php_off_t zero; + zend_off_t zero; unsigned int for_write:1; unsigned int is_zip:1; unsigned int is_tar:1; @@ -564,7 +564,7 @@ char *phar_fix_filepath(char *path, int *new_len, int use_cwd TSRMLS_DC); phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error TSRMLS_DC); int phar_parse_metadata(char **buffer, zval *metadata, int zip_metadata_len TSRMLS_DC); void destroy_phar_manifest_entry(zval *zv); -int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_t position, int follow_links TSRMLS_DC); +int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links TSRMLS_DC); php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC); int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error TSRMLS_DC); int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TSRMLS_DC); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 1f88cae7e0..b0123f30df 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -155,7 +155,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char zend_op_array *new_op_array; zval result; php_stream *fp; - php_off_t position; + zend_off_t position; switch (code) { case PHAR_MIME_PHPS: @@ -211,7 +211,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char if (got > 0) { PHPWRITE(buf, got); position += got; - if (position == (php_off_t) info->uncompressed_filesize) { + if (position == (zend_off_t) info->uncompressed_filesize) { break; } } @@ -1940,7 +1940,7 @@ PHP_METHOD(Phar, isFileFormat) static int phar_copy_file_contents(phar_entry_info *entry, php_stream *fp TSRMLS_DC) /* {{{ */ { char *error; - php_off_t offset; + zend_off_t offset; phar_entry_info *link; if (FAILURE == phar_open_entry_fp(entry, &error, 1 TSRMLS_CC)) { diff --git a/ext/phar/stream.c b/ext/phar/stream.c index d50982babe..eb2fa607ee 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -377,7 +377,7 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML got = php_stream_read(data->fp, buf, MIN(count, entry->uncompressed_filesize - data->position)); data->position = php_stream_tell(data->fp) - data->zero; - stream->eof = (data->position == (php_off_t) entry->uncompressed_filesize); + stream->eof = (data->position == (zend_off_t) entry->uncompressed_filesize); return got; } @@ -386,12 +386,12 @@ static size_t phar_stream_read(php_stream *stream, char *buf, size_t count TSRML /** * Used for fseek($fp) on a phar file handle */ -static int phar_stream_seek(php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC) /* {{{ */ +static int phar_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC) /* {{{ */ { phar_entry_data *data = (phar_entry_data *)stream->abstract; phar_entry_info *entry; int res; - php_off_t temp; + zend_off_t temp; if (data->internal_file->link) { entry = phar_get_link_source(data->internal_file TSRMLS_CC); @@ -412,7 +412,7 @@ static int phar_stream_seek(php_stream *stream, php_off_t offset, int whence, ph default: temp = 0; } - if (temp > data->zero + (php_off_t) entry->uncompressed_filesize) { + if (temp > data->zero + (zend_off_t) entry->uncompressed_filesize) { *newoffset = -1; return -1; } @@ -440,7 +440,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun return -1; } data->position = php_stream_tell(data->fp); - if (data->position > (php_off_t)data->internal_file->uncompressed_filesize) { + if (data->position > (zend_off_t)data->internal_file->uncompressed_filesize) { data->internal_file->uncompressed_filesize = data->position; } data->internal_file->compressed_filesize = data->internal_file->uncompressed_filesize; diff --git a/ext/phar/stream.h b/ext/phar/stream.h index 20cf68d9d7..0171010179 100644 --- a/ext/phar/stream.h +++ b/ext/phar/stream.h @@ -34,7 +34,7 @@ static size_t phar_stream_write(php_stream *stream, const char *buf, size_t coun static size_t phar_stream_read( php_stream *stream, char *buf, size_t count TSRMLS_DC); static int phar_stream_close(php_stream *stream, int close_handle TSRMLS_DC); static int phar_stream_flush(php_stream *stream TSRMLS_DC); -static int phar_stream_seek( php_stream *stream, php_off_t offset, int whence, php_off_t *newoffset TSRMLS_DC); +static int phar_stream_seek( php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC); static int phar_stream_stat( php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC); END_EXTERN_C() diff --git a/ext/phar/tar.c b/ext/phar/tar.c index fa97b73a44..985abd14a9 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -256,7 +256,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, phar_tar_number(hdr->size, sizeof(hdr->size)); if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) { - php_off_t curloc; + zend_off_t curloc; if (size > 511) { if (error) { diff --git a/ext/phar/util.c b/ext/phar/util.c index 19aa03f9cc..e550b9fbcf 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -38,7 +38,7 @@ #include <openssl/ssl.h> #include <openssl/pkcs12.h> #else -static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); +static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC); #endif /* for links to relative location, prepend cwd of the entry */ @@ -117,10 +117,10 @@ php_stream *phar_get_efp(phar_entry_info *entry, int follow_links TSRMLS_DC) /* } /* }}} */ -int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_t position, int follow_links TSRMLS_DC) /* {{{ */ +int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links TSRMLS_DC) /* {{{ */ { php_stream *fp = phar_get_efp(entry, follow_links TSRMLS_CC); - php_off_t temp, eoffset; + zend_off_t temp, eoffset; if (!fp) { return -1; @@ -154,7 +154,7 @@ int phar_seek_efp(phar_entry_info *entry, php_off_t offset, int whence, php_off_ temp = 0; } - if (temp > eoffset + (php_off_t) entry->uncompressed_filesize) { + if (temp > eoffset + (zend_off_t) entry->uncompressed_filesize) { return -1; } @@ -693,7 +693,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS php_stream_filter *filter; phar_archive_data *phar = entry->phar; char *filtername; - php_off_t loc; + zend_off_t loc; php_stream *ufp; phar_entry_data dummy; @@ -786,7 +786,7 @@ int phar_open_entry_fp(phar_entry_info *entry, char **error, int follow_links TS php_stream_flush(ufp); php_stream_filter_remove(filter, 1 TSRMLS_CC); - if (php_stream_tell(ufp) - loc != (php_off_t) entry->uncompressed_filesize) { + if (php_stream_tell(ufp) - loc != (zend_off_t) entry->uncompressed_filesize) { spprintf(error, 4096, "phar error: internal corruption of phar \"%s\" (actual filesize mismatch on file \"%s\")", phar->fname, entry->filename); return FAILURE; } @@ -1388,7 +1388,7 @@ static int phar_hex_str(const char *digest, size_t digest_len, char **signature /* }}} */ #ifndef PHAR_HAVE_OPENSSL -static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */ +static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, int key_len, char **signature, int *signature_len TSRMLS_DC) /* {{{ */ { zend_fcall_info fci; zend_fcall_info_cache fcc; @@ -1479,7 +1479,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, php_off_t e int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error TSRMLS_DC) /* {{{ */ { int read_size, len; - php_off_t read_len; + zend_off_t read_len; unsigned char buf[1024]; php_stream_rewind(fp); @@ -1576,7 +1576,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while (read_size && (len = php_stream_read(fp, (char*)buf, read_size)) > 0) { EVP_VerifyUpdate (&md_ctx, buf, len); - read_len -= (php_off_t)len; + read_len -= (zend_off_t)len; if (read_len < read_size) { read_size = (int)read_len; @@ -1616,7 +1616,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_SHA512Update(&context, buf, len); - read_len -= (php_off_t)len; + read_len -= (zend_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } @@ -1649,7 +1649,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_SHA256Update(&context, buf, len); - read_len -= (php_off_t)len; + read_len -= (zend_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } @@ -1690,7 +1690,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_SHA1Update(&context, buf, len); - read_len -= (php_off_t)len; + read_len -= (zend_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } @@ -1723,7 +1723,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_typ while ((len = php_stream_read(fp, (char*)buf, read_size)) > 0) { PHP_MD5Update(&context, buf, len); - read_len -= (php_off_t)len; + read_len -= (zend_off_t)len; if (read_len < read_size) { read_size = (int)read_len; } diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 81d7a0b8b9..a314498813 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -338,7 +338,7 @@ foundit: /* add each central directory item to the manifest */ for (i = 0; i < PHAR_GET_16(locator.count); ++i) { phar_zip_central_dir_file zipentry; - php_off_t beforeus = php_stream_tell(fp); + zend_off_t beforeus = php_stream_tell(fp); if (sizeof(zipentry) != php_stream_read(fp, (char *) &zipentry, sizeof(zipentry))) { PHAR_ZIP_FAIL("unable to read central directory entry, truncated"); @@ -393,7 +393,7 @@ foundit: if (entry.filename_len == sizeof(".phar/signature.bin")-1 && !strncmp(entry.filename, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) { size_t read; php_stream *sigfile; - php_off_t now; + zend_off_t now; char *sig; now = php_stream_tell(fp); @@ -448,7 +448,7 @@ foundit: phar_add_virtual_dirs(mydata, entry.filename, entry.filename_len TSRMLS_CC); if (PHAR_GET_16(zipentry.extra_len)) { - php_off_t loc = php_stream_tell(fp); + zend_off_t loc = php_stream_tell(fp); if (FAILURE == phar_zip_process_extra(fp, &entry, PHAR_GET_16(zipentry.extra_len) TSRMLS_CC)) { pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("Unable to process extra field header for file in central directory"); @@ -537,7 +537,7 @@ foundit: if (!actual_alias && entry.filename_len == sizeof(".phar/alias.txt")-1 && !strncmp(entry.filename, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) { php_stream_filter *filter; - php_off_t saveloc; + zend_off_t saveloc; /* verify local file header */ phar_zip_file_header local; @@ -790,7 +790,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg TSRMLS_D phar_zip_central_dir_file central; struct _phar_zip_pass *p; php_uint32 newcrc32; - php_off_t offset; + zend_off_t offset; int not_really_modified = 0; p = (struct _phar_zip_pass*) arg; @@ -1108,7 +1108,7 @@ static int phar_zip_applysignature(phar_archive_data *phar, struct _phar_zip_pas char *signature, sigbuf[8]; phar_entry_info entry = {0}; php_stream *newfile; - php_off_t tell, st; + zend_off_t tell, st; newfile = php_stream_fopen_tmpfile(); if (newfile == NULL) { diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 45e27a96ab..b5c9354c87 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -187,7 +187,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) DIR *dir; char dentry[sizeof(struct dirent) + MAXPATHLEN]; struct dirent *entry = (struct dirent *) &dentry; - php_stat_t sbuf; + zend_stat_t sbuf; char buf[MAXPATHLEN]; time_t now; int nrdels = 0; @@ -238,7 +238,7 @@ static int ps_files_cleanup_dir(const char *dirname, int maxlifetime TSRMLS_DC) static int ps_files_key_exists(ps_files *data, const char *key TSRMLS_DC) { char buf[MAXPATHLEN]; - php_stat_t sbuf; + zend_stat_t sbuf; if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) { return FAILURE; @@ -283,7 +283,7 @@ PS_OPEN_FUNC(files) if (argc > 1) { errno = 0; - dirdepth = (size_t) ZEND_STRTOI(argv[0], NULL, 10); + dirdepth = (size_t) ZEND_STRTOL(argv[0], NULL, 10); if (errno == ERANGE) { php_error(E_WARNING, "The first parameter in session.save_path is invalid"); return FAILURE; @@ -292,7 +292,7 @@ PS_OPEN_FUNC(files) if (argc > 2) { errno = 0; - filemode = ZEND_STRTOI(argv[1], NULL, 8); + filemode = ZEND_STRTOL(argv[1], NULL, 8); if (errno == ERANGE || filemode < 0 || filemode > 07777) { php_error(E_WARNING, "The second parameter in session.save_path is invalid"); return FAILURE; diff --git a/ext/session/session.c b/ext/session/session.c index 58bfc33d2d..af1d50c255 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -305,7 +305,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ } /* maximum 15+19+19+10 bytes */ - spprintf(&buf, 0, "%.15s%ld" ZEND_INT_FMT "%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (zend_long)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10); + spprintf(&buf, 0, "%.15s%ld" ZEND_LONG_FMT "%0.8F", remote_addr ? remote_addr : "", tv.tv_sec, (zend_long)tv.tv_usec, php_combined_lcg(TSRMLS_C) * 10); switch (PS(hash_func)) { case PS_HASH_FUNC_MD5: @@ -712,7 +712,7 @@ static PHP_INI_MH(OnUpdateHashFunc) /* {{{ */ PS(hash_ops) = NULL; #endif - val = ZEND_STRTOI(new_value, &endptr, 10); + val = ZEND_STRTOL(new_value, &endptr, 10); if (endptr && (*endptr == '\0')) { /* Numeric value */ PS(hash_func) = val ? 1 : 0; @@ -1148,7 +1148,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */ static inline void last_modified(TSRMLS_D) /* {{{ */ { const char *path; - php_stat_t sb; + zend_stat_t sb; char buf[MAX_STR + 1]; path = SG(request_info).path_translated; @@ -1178,7 +1178,7 @@ CACHE_LIMITER_FUNC(public) /* {{{ */ strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now); ADD_HEADER(buf); - snprintf(buf, sizeof(buf) , "Cache-Control: public, max-age=" ZEND_INT_FMT, PS(cache_expire) * 60); /* SAFE */ + snprintf(buf, sizeof(buf) , "Cache-Control: public, max-age=" ZEND_LONG_FMT, PS(cache_expire) * 60); /* SAFE */ ADD_HEADER(buf); last_modified(TSRMLS_C); @@ -1189,7 +1189,7 @@ CACHE_LIMITER_FUNC(private_no_expire) /* {{{ */ { char buf[MAX_STR + 1]; - snprintf(buf, sizeof(buf), "Cache-Control: private, max-age=" ZEND_INT_FMT ", pre-check=" ZEND_INT_FMT, PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */ + snprintf(buf, sizeof(buf), "Cache-Control: private, max-age=" ZEND_LONG_FMT ", pre-check=" ZEND_LONG_FMT, PS(cache_expire) * 60, PS(cache_expire) * 60); /* SAFE */ ADD_HEADER(buf); last_modified(TSRMLS_C); diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 4a7edb417f..09958ac51f 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -631,7 +631,7 @@ try_again: unsigned char hash[16]; PHP_MD5Init(&md5ctx); - snprintf(cnonce, sizeof(cnonce), ZEND_INT_FMT, php_rand(TSRMLS_C)); + snprintf(cnonce, sizeof(cnonce), ZEND_LONG_FMT, php_rand(TSRMLS_C)); PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, strlen(cnonce)); PHP_MD5Final(hash, &md5ctx); make_digest(cnonce, hash); diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 24e636b0ef..018605fb75 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -300,7 +300,7 @@ PHP_FUNCTION(socket_cmsg_space) return; } - if (entry->var_el_size > 0 && n > (PHP_INT_MAX - (zend_long)entry->size - + if (entry->var_el_size > 0 && n > (ZEND_LONG_MAX - (zend_long)entry->size - (zend_long)CMSG_SPACE(0) - 15L) / entry->var_el_size) { /* the -15 is to account for any padding CMSG_SPACE may add after the data */ php_error_docref0(NULL TSRMLS_CC, E_WARNING, "The value for the " diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 1bafae2d06..129997e799 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -719,7 +719,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s for (i = 0; i < argc; i++) { switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: -#if PHP_INT_MAX > 2147483647 +#if ZEND_LONG_MAX > 2147483647 ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int64(argv[i])); #else ZVAL_LONG(&zargs[i + is_agg], sqlite3_value_int(argv[i])); @@ -765,7 +765,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s if (!Z_ISUNDEF(retval)) { switch (Z_TYPE(retval)) { case IS_LONG: -#if PHP_INT_MAX > 2147483647 +#if ZEND_LONG_MAX > 2147483647 sqlite3_result_int64(context, Z_LVAL(retval)); #else sqlite3_result_int(context, Z_LVAL(retval)); @@ -1496,7 +1496,7 @@ PHP_METHOD(sqlite3stmt, execute) switch (param->type) { case SQLITE_INTEGER: convert_to_int(parameter); -#if PHP_INT_MAX > 2147483647 +#if ZEND_LONG_MAX > 2147483647 sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); #else sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(parameter)); diff --git a/ext/standard/array.c b/ext/standard/array.c index 4baaf83b20..2663b404ac 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4247,7 +4247,7 @@ PHP_FUNCTION(array_product) if (Z_TYPE(entry_n) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) { dval = (double)Z_LVAL_P(return_value) * (double)Z_LVAL(entry_n); - if ( (double)PHP_INT_MIN <= dval && dval <= (double)PHP_INT_MAX ) { + if ( (double)ZEND_LONG_MIN <= dval && dval <= (double)ZEND_LONG_MAX ) { Z_LVAL_P(return_value) *= Z_LVAL(entry_n); continue; } diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 370e1b2d90..544514161b 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -53,7 +53,7 @@ static const short base64_reverse_table[256] = { }; /* }}} */ -PHPAPI zend_string *php_base64_encode(const unsigned char *str, php_size_t length) /* {{{ */ +PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) /* {{{ */ { const unsigned char *current = str; unsigned char *p; @@ -131,13 +131,13 @@ void php_base64_init(void) */ /* }}} */ -PHPAPI zend_string *php_base64_decode(const unsigned char *str, php_size_t length) /* {{{ */ +PHPAPI zend_string *php_base64_decode(const unsigned char *str, size_t length) /* {{{ */ { return php_base64_decode_ex(str, length, 0); } /* }}} */ -PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, php_size_t length, zend_bool strict) /* {{{ */ +PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) /* {{{ */ { const unsigned char *current = str; int ch, i = 0, j = 0, k; diff --git a/ext/standard/base64.h b/ext/standard/base64.h index dd07db56e1..43324e4911 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -24,9 +24,9 @@ PHP_FUNCTION(base64_decode); PHP_FUNCTION(base64_encode); -PHPAPI extern zend_string *php_base64_encode(const unsigned char *, php_size_t); -PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, php_size_t, zend_bool); -PHPAPI extern zend_string *php_base64_decode(const unsigned char *, php_size_t); +PHPAPI extern zend_string *php_base64_encode(const unsigned char *, size_t); +PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, size_t, zend_bool); +PHPAPI extern zend_string *php_base64_decode(const unsigned char *, size_t); #endif /* BASE64_H */ diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index 95df4bdc59..e53f488805 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -372,7 +372,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(sha256_rounds_prefix) - 1; char *endp; - zend_ulong srounds = ZEND_STRTOUI(num, &endp, 10); + zend_ulong srounds = ZEND_STRTOUL(num, &endp, 10); if (*endp == '$') { salt = endp + 1; rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX)); diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index 411abf64e6..a673bfac1c 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -405,7 +405,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(sha512_rounds_prefix) - 1; char *endp; - zend_ulong srounds = ZEND_STRTOUI(num, &endp, 10); + zend_ulong srounds = ZEND_STRTOUL(num, &endp, 10); if (*endp == '$') { salt = endp + 1; diff --git a/ext/standard/dir.c b/ext/standard/dir.c index ff4a3bbc75..4d96384e9c 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -524,7 +524,7 @@ no_results: * able to filter directories out. */ if (flags & GLOB_ONLYDIR) { - php_stat_t s; + zend_stat_t s; if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) { continue; diff --git a/ext/standard/file.c b/ext/standard/file.c index e2a63ceef8..28fc790ea9 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -552,7 +552,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 " ZEND_INT_FMT " in the stream", offset); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_LONG_FMT " in the stream", offset); php_stream_close(stream); RETURN_FALSE; } @@ -628,13 +628,13 @@ PHP_FUNCTION(file_put_contents) switch (Z_TYPE_P(data)) { case IS_RESOURCE: { - php_size_t len; + size_t len; if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, &len) != SUCCESS) { ret_ok = 0; } else { - if (len > PHP_INT_MAX) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %zu to " ZEND_INT_FMT " bytes", len, PHP_INT_MAX); - len = PHP_INT_MAX; + if (len > ZEND_LONG_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "content truncated from %zu to " ZEND_LONG_FMT " bytes", len, ZEND_LONG_MAX); + len = ZEND_LONG_MAX; } numbytes = len; } @@ -659,7 +659,7 @@ PHP_FUNCTION(file_put_contents) case IS_ARRAY: if (zend_hash_num_elements(Z_ARRVAL_P(data))) { - php_size_t bytes_written; + size_t bytes_written; zval *tmp; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(data), tmp) { @@ -732,7 +732,7 @@ PHP_FUNCTION(file) return; } if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "'" ZEND_INT_FMT "' flag is not supported", flags); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'" ZEND_LONG_FMT "' flag is not supported", flags); RETURN_FALSE; } @@ -1888,8 +1888,8 @@ PHP_FUNCTION(fputcsv) } /* }}} */ -/* {{{ PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ -PHPAPI php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) +/* {{{ PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) */ +PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC) { int count, i = 0, ret; zval *field_tmp; diff --git a/ext/standard/file.h b/ext/standard/file.h index e29d4b3c73..4551d5ec44 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -80,7 +80,7 @@ PHPAPI int php_copy_file_ctx(const char *src, const char *dest, int src_chk, php PHPAPI int php_mkdir_ex(const char *dir, zend_long mode, int options TSRMLS_DC); PHPAPI int php_mkdir(const char *dir, zend_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 php_size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); +PHPAPI size_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, char enclosure, char escape_char TSRMLS_DC); #define META_DEF_BUFSIZE 8192 diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index c0ea9bc056..a081fdf4f0 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -1223,7 +1223,7 @@ PHP_FUNCTION(realpath_cache_get) array_init(&entry); /* bucket->key is unsigned long */ - if (ZEND_INT_MAX >= bucket->key) { + if (ZEND_LONG_MAX >= bucket->key) { add_assoc_long(&entry, "key", bucket->key); } else { add_assoc_double(&entry, "key", (double)bucket->key); diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index a445625297..587474346a 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -52,7 +52,7 @@ static char HEXCHARS[] = "0123456789ABCDEF"; /* php_spintf_appendchar() {{{ */ inline static void -php_sprintf_appendchar(zend_string **buffer, php_size_t *pos, char add TSRMLS_DC) +php_sprintf_appendchar(zend_string **buffer, size_t *pos, char add TSRMLS_DC) { if (!*buffer || (*pos + 1) >= (*buffer)->len) { PRINTF_DEBUG(("%s(): ereallocing buffer to %d bytes\n", get_active_function_name(TSRMLS_C), (*buffer)->len)); @@ -65,14 +65,14 @@ php_sprintf_appendchar(zend_string **buffer, php_size_t *pos, char add TSRMLS_DC /* php_spintf_appendstring() {{{ */ inline static void -php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add, - php_size_t min_width, php_size_t max_width, char padding, - php_size_t alignment, php_size_t len, int neg, int expprec, int always_sign) +php_sprintf_appendstring(zend_string **buffer, size_t *pos, char *add, + size_t min_width, size_t max_width, char padding, + size_t alignment, size_t len, int neg, int expprec, int always_sign) { - register php_size_t npad; - php_size_t req_size; - php_size_t copy_len; - php_size_t m_width; + register size_t npad; + size_t req_size; + size_t copy_len; + size_t m_width; copy_len = (expprec ? MIN(max_width, len) : len); npad = (min_width < copy_len) ? 0 : min_width - copy_len; @@ -122,8 +122,8 @@ php_sprintf_appendstring(zend_string **buffer, php_size_t *pos, char *add, /* php_spintf_appendint() {{{ */ inline static void -php_sprintf_appendint(zend_string **buffer, php_size_t *pos, zend_long number, - php_size_t width, char padding, php_size_t alignment, +php_sprintf_appendint(zend_string **buffer, size_t *pos, zend_long number, + size_t width, char padding, size_t alignment, int always_sign) { char numbuf[NUM_BUF_SIZE]; @@ -166,9 +166,9 @@ php_sprintf_appendint(zend_string **buffer, php_size_t *pos, zend_long number, /* php_spintf_appenduint() {{{ */ inline static void -php_sprintf_appenduint(zend_string **buffer, php_size_t *pos, +php_sprintf_appenduint(zend_string **buffer, size_t *pos, zend_ulong number, - php_size_t width, char padding, php_size_t alignment) + size_t width, char padding, size_t alignment) { char numbuf[NUM_BUF_SIZE]; register zend_ulong magn, nmagn; @@ -198,17 +198,17 @@ php_sprintf_appenduint(zend_string **buffer, php_size_t *pos, /* php_spintf_appenddouble() {{{ */ inline static void -php_sprintf_appenddouble(zend_string **buffer, php_size_t *pos, +php_sprintf_appenddouble(zend_string **buffer, size_t *pos, double number, - php_size_t width, char padding, - php_size_t alignment, int precision, + size_t width, char padding, + size_t alignment, int precision, int adjust, char fmt, int always_sign TSRMLS_DC) { char num_buf[NUM_BUF_SIZE]; char *s = NULL; - php_size_t s_len = 0; + size_t s_len = 0; int is_negative = 0; #ifdef HAVE_LOCALE_H struct lconv *lconv; @@ -290,8 +290,8 @@ php_sprintf_appenddouble(zend_string **buffer, php_size_t *pos, /* php_spintf_appendd2n() {{{ */ inline static void -php_sprintf_append2n(zend_string **buffer, php_size_t *pos, zend_long number, - php_size_t width, char padding, php_size_t alignment, int n, +php_sprintf_append2n(zend_string **buffer, size_t *pos, zend_long number, + size_t width, char padding, size_t alignment, int n, char *chartable, int expprec) { char numbuf[NUM_BUF_SIZE]; @@ -321,11 +321,11 @@ php_sprintf_append2n(zend_string **buffer, php_size_t *pos, zend_long number, /* php_spintf_getnumber() {{{ */ inline static int -php_sprintf_getnumber(char *buffer, php_size_t *pos) +php_sprintf_getnumber(char *buffer, size_t *pos) { char *endptr; - register zend_long num = ZEND_STRTOI(&buffer[*pos], &endptr, 10); - register php_size_t i = 0; + register zend_long num = ZEND_STRTOL(&buffer[*pos], &endptr, 10); + register size_t i = 0; if (endptr != NULL) { i = (endptr - &buffer[*pos]); @@ -371,7 +371,7 @@ php_formatted_print(int param_count, int use_array, int format_offset TSRMLS_DC) zval *newargs = NULL; zval *args, *z_format; int argc; - php_size_t size = 240, inpos = 0, outpos = 0, temppos; + size_t size = 240, inpos = 0, outpos = 0, temppos; int alignment, currarg, adjusting, argnum, width, precision; char *format, padding; zend_string *result; @@ -678,7 +678,7 @@ PHP_FUNCTION(vsprintf) PHP_FUNCTION(user_printf) { zend_string *result; - php_size_t rlen; + size_t rlen; if ((result=php_formatted_print(ZEND_NUM_ARGS(), 0, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; @@ -694,7 +694,7 @@ PHP_FUNCTION(user_printf) PHP_FUNCTION(vprintf) { zend_string *result; - php_size_t rlen; + size_t rlen; if ((result=php_formatted_print(ZEND_NUM_ARGS(), 1, 0 TSRMLS_CC))==NULL) { RETURN_FALSE; diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 741e71aa84..319a0437d6 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -52,11 +52,11 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) } if (persistent) { - spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_INT_FMT, host, port); + spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port); } if (port > 0) { - hostname_len = spprintf(&hostname, 0, "%s:" ZEND_INT_FMT, host, port); + hostname_len = spprintf(&hostname, 0, "%s:" ZEND_LONG_FMT, host, port); } else { hostname_len = host_len; hostname = host; @@ -83,7 +83,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) efree(hostname); } if (stream == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:" ZEND_INT_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to connect to %s:" ZEND_LONG_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : errstr->val); } if (hashkey) { diff --git a/ext/standard/html.c b/ext/standard/html.c index a2c7c29990..a9e5fbfe9d 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -804,7 +804,7 @@ static inline int process_numeric_entity(const char **buf, unsigned *code_point) return FAILURE; } - code_l = ZEND_STRTOI(*buf, &endptr, hexadecimal ? 16 : 10); + code_l = ZEND_STRTOL(*buf, &endptr, hexadecimal ? 16 : 10); /* we're guaranteed there were valid digits, so *endptr > buf */ *buf = endptr; diff --git a/ext/standard/link_win32.c b/ext/standard/link_win32.c index f0875d8ee5..07466d2966 100644 --- a/ext/standard/link_win32.c +++ b/ext/standard/link_win32.c @@ -88,7 +88,7 @@ PHP_FUNCTION(linkinfo) { char *link; int link_len; - php_stat_t sb; + zend_stat_t sb; int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &link, &link_len) == FAILURE) { diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 1b0e2e37b6..e45f9f7c90 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -285,9 +285,9 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char f = php_basename(tmp, strlen(tmp), NULL, 0 TSRMLS_CC); if (headers != NULL) { - spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_INT_FMT ":%s\n%s", php_getuid(TSRMLS_C), f->val, headers); + spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s\n%s", php_getuid(TSRMLS_C), f->val, headers); } else { - spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_INT_FMT ":%s", php_getuid(TSRMLS_C), f->val); + spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(TSRMLS_C), f->val); } zend_string_release(f); } diff --git a/ext/standard/math.c b/ext/standard/math.c index f9d144e295..8a99faa665 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -286,8 +286,8 @@ PHP_FUNCTION(abs) if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(fabs(Z_DVAL_P(value))); } else if (Z_TYPE_P(value) == IS_LONG) { - if (Z_LVAL_P(value) == ZEND_INT_MIN) { - RETURN_DOUBLE(-(double)ZEND_INT_MIN); + if (Z_LVAL_P(value) == ZEND_LONG_MIN) { + RETURN_DOUBLE(-(double)ZEND_LONG_MIN); } else { RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value)); } @@ -959,7 +959,7 @@ PHPAPI zend_long _php_math_basetolong(zval *arg, int base) TSRMLS_FETCH(); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number '%s' is too big to fit in long", s); - return ZEND_INT_MAX; + return ZEND_LONG_MAX; } } @@ -987,8 +987,8 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) s = Z_STRVAL_P(arg); - cutoff = ZEND_INT_MAX / base; - cutlim = ZEND_INT_MAX % base; + cutoff = ZEND_LONG_MAX / base; + cutlim = ZEND_LONG_MAX % base; for (i = Z_STRLEN_P(arg); i > 0; i--) { c = *s++; @@ -1431,7 +1431,7 @@ PHP_FUNCTION(intdiv) if (divisor == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero"); RETURN_BOOL(0); - } else if (divisor == -1 && numerator == PHP_INT_MIN) { + } else if (divisor == -1 && numerator == ZEND_LONG_MIN) { /* Prevent overflow error/crash We don't return a float here as that violates function contract */ RETURN_LONG(0); diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 1a1b9d335b..68161da326 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -81,7 +81,7 @@ PHP_NAMED_FUNCTION(php_if_md5_file) unsigned char buf[1024]; unsigned char digest[16]; PHP_MD5_CTX context; - php_size_t n; + size_t n; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index d2c3ebf9c4..f2feb72ebf 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -25,7 +25,7 @@ #include "php.h" #include "php_metaphone.h" -static int metaphone(unsigned char *word, php_size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional); +static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional); /* {{{ proto string metaphone(string text[, int phones]) Break english phrases down into their phonemes */ @@ -165,11 +165,11 @@ static char Lookahead(char *word, int how_far) /* {{{ metaphone */ -static int metaphone(unsigned char *word, php_size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional) +static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional) { int w_idx = 0; /* point in the phonization we're at. */ int p_idx = 0; /* end of the phoned phrase */ - php_size_t max_buffer_len = 0; /* maximum length of the destination buffer */ + size_t max_buffer_len = 0; /* maximum length of the destination buffer */ /*-- Parameter checks --*/ /* Negative phoneme length is meaningless */ diff --git a/ext/standard/pack.c b/ext/standard/pack.c index f82e4a394c..59f878e217 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -84,7 +84,7 @@ static int little_endian_long_map[4]; /* {{{ php_pack */ -static void php_pack(zval *val, php_size_t size, int *map, char *output) +static void php_pack(zval *val, size_t size, int *map, char *output) { int i; char *v; @@ -480,7 +480,7 @@ PHP_FUNCTION(pack) /* {{{ php_unpack */ -static zend_long php_unpack(char *data, php_size_t size, int issigned, int *map) +static zend_long php_unpack(char *data, size_t size, int issigned, int *map) { zend_long result; char *cresult = (char *) &result; @@ -514,7 +514,7 @@ PHP_FUNCTION(unpack) { char *format, *input; zend_string *formatarg, *inputarg; - php_size_t formatlen, inputpos, inputlen; + size_t formatlen, inputpos, inputlen; int i; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS", &formatarg, @@ -661,7 +661,7 @@ PHP_FUNCTION(unpack) switch ((int) type) { case 'a': { /* a will not strip any trailing whitespace or null padding */ - php_size_t len = inputlen - inputpos; /* Remaining string */ + size_t len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -676,7 +676,7 @@ PHP_FUNCTION(unpack) case 'A': { /* A will strip any trailing whitespace */ char padn = '\0'; char pads = ' '; char padt = '\t'; char padc = '\r'; char padl = '\n'; - php_size_t len = inputlen - inputpos; /* Remaining string */ + size_t len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ if ((size >= 0) && (len > size)) { @@ -703,7 +703,7 @@ PHP_FUNCTION(unpack) case 'Z': { /* Z will strip everything after the first null character */ char pad = '\0'; - php_size_t s, + size_t s, len = inputlen - inputpos; /* Remaining string */ /* If size was given take minimum of len and size */ @@ -727,11 +727,11 @@ PHP_FUNCTION(unpack) case 'h': case 'H': { - php_size_t len = (inputlen - inputpos) * 2; /* Remaining */ + size_t len = (inputlen - inputpos) * 2; /* Remaining */ int nibbleshift = (type == 'h') ? 0 : 4; int first = 1; char *buf; - php_size_t ipos, opos; + size_t ipos, opos; /* If size was given take minimum of len and size */ if (size >= 0 && len > (size * 2)) { diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index d2b3cd1ce4..61a4ae6ec2 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -59,7 +59,7 @@ */ PHPAPI void php_statpage(TSRMLS_D) { - php_stat_t *pstat; + zend_stat_t *pstat; pstat = sapi_get_stat(TSRMLS_C); diff --git a/ext/standard/password.c b/ext/standard/password.c index 4010f6a04c..73d468d126 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -196,7 +196,7 @@ PHP_FUNCTION(password_get_info) case PHP_PASSWORD_BCRYPT: { zend_long cost = PHP_PASSWORD_BCRYPT_COST; - sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost); + sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost); add_assoc_long(&options, "cost", cost); } break; @@ -253,7 +253,7 @@ PHP_FUNCTION(password_needs_rehash) } } - sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost); + sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost); if (cost != new_cost) { RETURN_TRUE; } @@ -336,7 +336,7 @@ PHP_FUNCTION(password_hash) } if (cost < 4 || cost > 31) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_INT_FMT, cost); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost); RETURN_NULL(); } @@ -348,7 +348,7 @@ PHP_FUNCTION(password_hash) break; case PHP_PASSWORD_UNKNOWN: default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: " ZEND_INT_FMT, algo); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown password hashing algorithm: " ZEND_LONG_FMT, algo); RETURN_NULL(); } diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 5280a4f014..7b52494688 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -190,7 +190,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa max_memory = PHP_STREAM_MAX_MEM; if (!strncasecmp(path, "/maxmemory:", 11)) { path += 11; - max_memory = ZEND_STRTOI(path, NULL, 10); + max_memory = ZEND_STRTOL(path, NULL, 10); if (max_memory < 0) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Max memory must be >= 0"); return NULL; @@ -304,7 +304,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa } start = &path[3]; - fildes_ori = ZEND_STRTOI(start, &end, 10); + fildes_ori = ZEND_STRTOL(start, &end, 10); if (end == start || *end != '\0') { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "php://fd/ stream must be specified in the form php://fd/<orig fd>"); @@ -326,7 +326,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa fd = dup(fildes_ori); if (fd == -1) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, - "Error duping file descriptor " ZEND_INT_FMT "; possibly it doesn't exist: " + "Error duping file descriptor " ZEND_LONG_FMT "; possibly it doesn't exist: " "[%d]: %s", fildes_ori, errno, strerror(errno)); return NULL; } @@ -380,7 +380,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa #if defined(S_IFSOCK) && !defined(WIN32) && !defined(__BEOS__) do { - php_stat_t st; + zend_stat_t st; memset(&st, 0, sizeof(st)); if (php_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { stream = php_stream_sock_open_from_socket(fd, NULL); diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index f2cb5c1755..e0ffff5e23 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -120,23 +120,23 @@ PHPAPI struct lconv *localeconv_r(struct lconv *out); PHPAPI char *php_strtoupper(char *s, size_t len); PHPAPI char *php_strtolower(char *s, size_t len); -PHPAPI char *php_strtr(char *str, php_size_t len, char *str_from, char *str_to, php_size_t trlen); -PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free TSRMLS_DC); -PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int freeit, char *what, php_size_t wlength TSRMLS_DC); -PHPAPI void php_stripslashes(char *str, php_size_t *len TSRMLS_DC); -PHPAPI void php_stripcslashes(char *str, php_size_t *len); +PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen); +PHPAPI zend_string *php_addslashes(char *str, size_t length, int should_free TSRMLS_DC); +PHPAPI zend_string *php_addcslashes(const char *str, size_t length, int freeit, char *what, size_t wlength TSRMLS_DC); +PHPAPI void php_stripslashes(char *str, size_t *len TSRMLS_DC); +PHPAPI void php_stripcslashes(char *str, size_t *len); PHPAPI zend_string *php_basename(const char *s, size_t len, char *suffix, size_t sufflen TSRMLS_DC); PHPAPI size_t php_dirname(char *str, size_t len); PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len); -PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, char *needle, - php_size_t needle_len, char *str, php_size_t str_len, int case_sensitivity, php_size_t *replace_count); -PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *needle, - php_size_t needle_len, char *str, php_size_t str_len); -PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC); -PHPAPI size_t php_strip_tags(char *rbuf, php_size_t len, int *state, char *allow, php_size_t allow_len); -PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len, zend_bool allow_tag_spaces); -PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count); -PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result); +PHPAPI zend_string *php_str_to_str_ex(char *haystack, size_t length, char *needle, + size_t needle_len, char *str, size_t str_len, int case_sensitivity, size_t *replace_count); +PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char *needle, + size_t needle_len, char *str, size_t str_len); +PHPAPI char *php_trim(char *c, size_t len, char *what, size_t what_len, zval *return_value, int mode TSRMLS_DC); +PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *state, char *allow, size_t allow_len); +PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len, zend_bool allow_tag_spaces); +PHPAPI size_t php_char_to_str_ex(char *str, size_t len, char from, char *to, size_t to_len, zval *result, int case_sensitivity, size_t *replace_count); +PHPAPI size_t php_char_to_str(char *str, size_t len, char from, char *to, size_t to_len, zval *result); PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC); PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, zend_long limit); diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h index 670fa3f63e..f1dda2de45 100644 --- a/ext/standard/php_uuencode.h +++ b/ext/standard/php_uuencode.h @@ -24,8 +24,8 @@ PHP_FUNCTION(convert_uudecode); PHP_FUNCTION(convert_uuencode); -PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len); -PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len); +PHPAPI zend_string *php_uudecode(char *src, size_t src_len); +PHPAPI zend_string *php_uuencode(char *src, size_t src_len); #endif /* PHP_UUENCODE_H */ diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index b2186b5ed1..8abccaf820 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -204,7 +204,7 @@ PHP_FUNCTION(quoted_printable_decode) zend_string *arg1; char *str_in; zend_string *str_out; - php_size_t i = 0, j = 0, k; + size_t i = 0, j = 0, k; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &arg1) == FAILURE) { return; diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 8cff654c3f..fdc86632cd 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -318,7 +318,7 @@ PHP_FUNCTION(mt_rand) if (zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { return; } else if (max < min) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(" ZEND_INT_FMT ") is smaller than min(" ZEND_INT_FMT ")", max, min); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(" ZEND_LONG_FMT ") is smaller than min(" ZEND_LONG_FMT ")", max, min); RETURN_FALSE; } } diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 935ead4161..7ae0df6df5 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -356,7 +356,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) * must not be a mixture of XPG3 specs and non-XPG3 specs * in the same format string. */ - value = ZEND_STRTOUI(format-1, &end, 10); + value = ZEND_STRTOUL(format-1, &end, 10); if (*end != '$') { goto notXpg; } @@ -403,7 +403,7 @@ xpgCheckDone: * Parse any width specifier. */ if (isdigit(UCHAR(*ch))) { - value = ZEND_STRTOUI(format-1, &format, 10); + value = ZEND_STRTOUL(format-1, &format, 10); flags |= SCAN_WIDTH; ch = format++; } @@ -708,7 +708,7 @@ literal: flags |= SCAN_SUPPRESS; ch = format++; } else if ( isdigit(UCHAR(*ch))) { - value = ZEND_STRTOUI(format-1, &end, 10); + value = ZEND_STRTOUL(format-1, &end, 10); if (*end == '$') { format = end+1; ch = format++; @@ -720,7 +720,7 @@ literal: * Parse any width specifier. */ if ( isdigit(UCHAR(*ch))) { - width = ZEND_STRTOUI(format-1, &format, 10); + width = ZEND_STRTOUL(format-1, &format, 10); ch = format++; } else { width = 0; @@ -756,29 +756,29 @@ literal: case 'D': op = 'i'; base = 10; - fn = (zend_long (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOL_PTR; break; case 'i': op = 'i'; base = 0; - fn = (zend_long (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOL_PTR; break; case 'o': op = 'i'; base = 8; - fn = (zend_long (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOL_PTR; break; case 'x': case 'X': op = 'i'; base = 16; - fn = (zend_long (*)())ZEND_STRTOI_PTR; + fn = (zend_long (*)())ZEND_STRTOL_PTR; break; case 'u': op = 'i'; base = 10; flags |= SCAN_UNSIGNED; - fn = (zend_long (*)())ZEND_STRTOUI_PTR; + fn = (zend_long (*)())ZEND_STRTOUL_PTR; break; case 'f': @@ -1051,7 +1051,7 @@ addToInt: *end = '\0'; value = (zend_long) (*fn)(buf, NULL, base); if ((flags & SCAN_UNSIGNED) && (value < 0)) { - snprintf(buf, sizeof(buf), ZEND_UINT_FMT, value); /* INTL: ISO digit */ + snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value); /* INTL: ISO digit */ if (numVars && objIndex >= argCount) { break; } else if (numVars) { diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index 4e8c68f13b..2f596eed44 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -180,7 +180,7 @@ PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context) context. */ PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, - php_size_t inputLen) + size_t inputLen) { unsigned int i, index, partLen; diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h index 72c793f656..f852386a62 100644 --- a/ext/standard/sha1.h +++ b/ext/standard/sha1.h @@ -31,7 +31,7 @@ typedef struct { } PHP_SHA1_CTX; PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *); -PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, php_size_t); +PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t); PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *); PHPAPI void make_sha1_digest(char *sha1str, unsigned char *digest); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 5585b8e73d..a0448803f4 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -458,7 +458,7 @@ PHP_FUNCTION(stream_copy_to_stream) php_stream_from_zval(dest, zdest); if (pos > 0 && php_stream_seek(src, pos, SEEK_SET) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_INT_FMT " in the stream", pos); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position " ZEND_LONG_FMT " in the stream", pos); RETURN_FALSE; } @@ -1374,7 +1374,7 @@ PHP_FUNCTION(stream_set_chunk_size) } if (csize <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given " ZEND_INT_FMT, csize); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "The chunk size must be a positive integer, given " ZEND_LONG_FMT, csize); RETURN_FALSE; } /* stream.chunk_size is actually a size_t, but php_stream_set_option diff --git a/ext/standard/string.c b/ext/standard/string.c index 7e6543555b..325c66affa 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -115,7 +115,7 @@ void register_string_constants(INIT_FUNC_ARGS) } /* }}} */ -int php_tag_find(char *tag, php_size_t len, char *set); +int php_tag_find(char *tag, size_t len, char *set); /* this is read-only, so it's ok */ static char hexconvtab[] = "0123456789abcdef"; @@ -300,7 +300,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / if (start < 0) { start = 0; } - } else if ((php_size_t)start > s11->len) { + } else if ((size_t)start > s11->len) { RETURN_FALSE; } @@ -692,7 +692,7 @@ PHP_FUNCTION(nl_langinfo) #endif break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '" ZEND_INT_FMT "' is not valid", item); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Item '" ZEND_LONG_FMT "' is not valid", item); RETURN_FALSE; } /* }}} */ @@ -729,7 +729,7 @@ PHP_FUNCTION(strcoll) * it needs to be incrementing. * Returns: FAILURE/SUCCESS whether the input was correct (i.e. no range errors) */ -static inline int php_charmask(unsigned char *input, php_size_t len, char *mask TSRMLS_DC) +static inline int php_charmask(unsigned char *input, size_t len, char *mask TSRMLS_DC) { unsigned char *end; unsigned char c; @@ -778,7 +778,7 @@ static inline int php_charmask(unsigned char *input, php_size_t len, char *mask * mode 3 : trim left and right * what indicates which chars are to be trimmed. NULL->default (' \t\n\r\v\0') */ -PHPAPI char *php_trim(char *c, php_size_t len, char *what, php_size_t what_len, zval *return_value, int mode TSRMLS_DC) +PHPAPI char *php_trim(char *c, size_t len, char *what, size_t what_len, zval *return_value, int mode TSRMLS_DC) { register zend_long i; int trimmed = 0; @@ -873,7 +873,7 @@ PHP_FUNCTION(ltrim) PHP_FUNCTION(wordwrap) { zend_string *text, *breakchar = NULL, *breakchar_save = NULL; - php_size_t newtextlen, chk; + size_t newtextlen, chk; size_t alloced; zend_long current = 0, laststart = 0, lastspace = 0; zend_long linelength = 75; @@ -933,7 +933,7 @@ PHP_FUNCTION(wordwrap) } else { /* Multiple character line break or forced cut */ if (linelength > 0) { - chk = (php_size_t)(text->len/linelength + 1); + chk = (size_t)(text->len/linelength + 1); newtext = zend_string_alloc(chk * breakchar->len + text->len, 0); alloced = text->len + chk * breakchar->len + 1; } else { @@ -948,9 +948,9 @@ PHP_FUNCTION(wordwrap) laststart = lastspace = 0; for (current = 0; current < text->len; current++) { if (chk <= 0) { - alloced += (php_size_t) (((text->len - current + 1)/linelength + 1) * breakchar->len) + 1; + alloced += (size_t) (((text->len - current + 1)/linelength + 1) * breakchar->len) + 1; newtext = zend_string_realloc(newtext, alloced, 0); - chk = (php_size_t) ((text->len - current)/linelength) + 1; + chk = (size_t) ((text->len - current)/linelength) + 1; } /* when we hit an existing break, copy to new buffer, and * fix up laststart and lastspace */ @@ -1061,7 +1061,7 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu by doing nothing we return empty array */ } else { - php_size_t allocated = EXPLODE_ALLOC_STEP, found = 0; + size_t allocated = EXPLODE_ALLOC_STEP, found = 0; zend_long i, to_return; char **positions = emalloc(allocated * sizeof(char *)); @@ -1091,7 +1091,7 @@ PHPAPI void php_explode_negative_limit(zval *delim, zval *str, zval *return_valu PHP_FUNCTION(explode) { zend_string *str, *delim; - zend_long limit = PHP_INT_MAX; /* No limit */ + zend_long limit = ZEND_LONG_MAX; /* No limit */ zval zdelim, zstr; #ifndef FAST_ZPP @@ -1173,7 +1173,7 @@ again: case IS_DOUBLE: { char *stmp; - php_size_t str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_P(tmp)); + size_t str_len = spprintf(&stmp, 0, "%.*G", (int) EG(precision), Z_DVAL_P(tmp)); smart_str_appendl(&implstr, stmp, str_len); efree(stmp); } @@ -1702,7 +1702,7 @@ PHP_FUNCTION(stristr) zval *needle; zend_string *haystack; char *found = NULL; - php_size_t found_offset; + size_t found_offset; char *haystack_dup; char needle_char[2]; zend_bool part = 0; @@ -1922,7 +1922,7 @@ PHP_FUNCTION(strrpos) zval *zneedle; char *needle; zend_string *haystack; - php_size_t needle_len; + size_t needle_len; zend_long offset = 0; char *p, *e, ord_needle[2]; @@ -2005,7 +2005,7 @@ PHP_FUNCTION(strripos) zval *zneedle; char *needle; zend_string *haystack; - php_size_t needle_len; + size_t needle_len; zend_long offset = 0; char *p, *e, ord_needle[2]; char *needle_dup, *haystack_dup; @@ -2138,12 +2138,12 @@ PHP_FUNCTION(strrchr) /* {{{ php_chunk_split */ -static zend_string *php_chunk_split(char *src, php_size_t srclen, char *end, php_size_t endlen, php_size_t chunklen) +static zend_string *php_chunk_split(char *src, size_t srclen, char *end, size_t endlen, size_t chunklen) { char *p, *q; - php_size_t chunks; /* complete chunks! */ - php_size_t restlen; - php_size_t out_len; + size_t chunks; /* complete chunks! */ + size_t restlen; + size_t out_len; zend_string *dest; chunks = srclen / chunklen; @@ -2359,7 +2359,7 @@ PHP_FUNCTION(substr_replace) if (Z_TYPE_P(str) != IS_ARRAY) { if (Z_TYPE_P(from) != IS_ARRAY) { - php_size_t repl_len = 0; + size_t repl_len = 0; f = Z_LVAL_P(from); @@ -2418,7 +2418,7 @@ PHP_FUNCTION(substr_replace) } } else { /* str is array of strings */ zend_string *str_index = NULL; - php_size_t result_len; + size_t result_len; zend_ulong num_index; array_init(return_value); @@ -2778,9 +2778,9 @@ PHP_FUNCTION(ucwords) /* {{{ php_strtr */ -PHPAPI char *php_strtr(char *str, php_size_t len, char *str_from, char *str_to, php_size_t trlen) +PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen) { - php_size_t i; + size_t i; unsigned char xlat[256]; if ((trlen < 1) || (len < 1)) { @@ -2811,14 +2811,14 @@ static int php_strtr_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ /* }}} */ /* {{{ php_strtr_array */ -static void php_strtr_array(zval *return_value, char *str, php_size_t slen, HashTable *pats TSRMLS_DC) +static void php_strtr_array(zval *return_value, char *str, size_t slen, HashTable *pats TSRMLS_DC) { zend_ulong num_key; zend_string *str_key; - php_size_t len, pos, found; + size_t len, pos, found; int num_keys = 0; - php_size_t minlen = 128*1024; - php_size_t maxlen = 0; + size_t minlen = 128*1024; + size_t maxlen = 0; HashTable str_hash, num_hash; zval *entry, tmp, dummy; char *key; @@ -3038,12 +3038,12 @@ PHP_FUNCTION(strrev) /* {{{ php_similar_str */ -static void php_similar_str(const char *txt1, php_size_t len1, const char *txt2, php_size_t len2, php_size_t *pos1, php_size_t *pos2, php_size_t *max) +static void php_similar_str(const char *txt1, size_t len1, const char *txt2, size_t len2, size_t *pos1, size_t *pos2, size_t *max) { char *p, *q; char *end1 = (char *) txt1 + len1; char *end2 = (char *) txt2 + len2; - php_size_t l; + size_t l; *max = 0; for (p = (char *) txt1; p < end1; p++) { @@ -3061,10 +3061,10 @@ static void php_similar_str(const char *txt1, php_size_t len1, const char *txt2, /* {{{ php_similar_char */ -static php_size_t php_similar_char(const char *txt1, php_size_t len1, const char *txt2, php_size_t len2) +static size_t php_similar_char(const char *txt1, size_t len1, const char *txt2, size_t len2) { - php_size_t sum; - php_size_t pos1 = 0, pos2 = 0, max; + size_t sum; + size_t pos1 = 0, pos2 = 0, max; php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); if ((sum = max)) { @@ -3089,7 +3089,7 @@ PHP_FUNCTION(similar_text) zend_string *t1, *t2; zval *percent = NULL; int ac = ZEND_NUM_ARGS(); - php_size_t sim; + size_t sim; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|z/", &t1, &t2, &percent) == FAILURE) { return; @@ -3120,10 +3120,10 @@ PHP_FUNCTION(similar_text) /* {{{ php_stripslashes * * be careful, this edits the string in-place */ -PHPAPI void php_stripslashes(char *str, php_size_t *len TSRMLS_DC) +PHPAPI void php_stripslashes(char *str, size_t *len TSRMLS_DC) { char *s, *t; - php_size_t l; + size_t l; if (len != NULL) { l = *len; @@ -3257,10 +3257,10 @@ char *php_strerror(int errnum) /* {{{ php_stripcslashes */ -PHPAPI void php_stripcslashes(char *str, php_size_t *len) +PHPAPI void php_stripcslashes(char *str, size_t *len) { char *source, *target, *end; - php_size_t nlen = *len, i; + size_t nlen = *len, i; char numtmp[4]; for (source=str, end=str+nlen, target=str; source < end; source++) { @@ -3320,13 +3320,13 @@ PHPAPI void php_stripcslashes(char *str, php_size_t *len) /* {{{ php_addcslashes */ -PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int should_free, char *what, php_size_t wlength TSRMLS_DC) +PHPAPI zend_string *php_addcslashes(const char *str, size_t length, int should_free, char *what, size_t wlength TSRMLS_DC) { char flags[256]; char *source, *target; char *end; char c; - php_size_t newlen; + size_t newlen; zend_string *new_str = zend_string_alloc(4 * (length? length : (length = strlen(str))), 0); if (!wlength) { @@ -3370,7 +3370,7 @@ PHPAPI zend_string *php_addcslashes(const char *str, php_size_t length, int shou /* {{{ php_addslashes */ -PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free TSRMLS_DC) +PHPAPI zend_string *php_addslashes(char *str, size_t length, int should_free TSRMLS_DC) { /* maximum string length, worst case situation */ char *source, *target; @@ -3423,10 +3423,10 @@ PHPAPI zend_string *php_addslashes(char *str, php_size_t length, int should_free /* {{{ php_char_to_str_ex */ -PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result, int case_sensitivity, php_size_t *replace_count) +PHPAPI size_t php_char_to_str_ex(char *str, size_t len, char from, char *to, size_t to_len, zval *result, int case_sensitivity, size_t *replace_count) { - php_size_t char_count = 0; - php_size_t replaced = 0; + size_t char_count = 0; + size_t replaced = 0; char *source, *target, *tmp, *source_end=str+len, *tmp_end = NULL; if (case_sensitivity) { @@ -3496,7 +3496,7 @@ PHPAPI php_size_t php_char_to_str_ex(char *str, php_size_t len, char from, char /* {{{ php_char_to_str */ -PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to, php_size_t to_len, zval *result) +PHPAPI size_t php_char_to_str(char *str, size_t len, char from, char *to, size_t to_len, zval *result) { return php_char_to_str_ex(str, len, from, to, to_len, result, 1, NULL); } @@ -3504,8 +3504,8 @@ PHPAPI php_size_t php_char_to_str(char *str, php_size_t len, char from, char *to /* {{{ php_str_to_str_ex */ -PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, - char *needle, php_size_t needle_len, char *str, php_size_t str_len, int case_sensitivity, php_size_t *replace_count) +PHPAPI zend_string *php_str_to_str_ex(char *haystack, size_t length, + char *needle, size_t needle_len, char *str, size_t str_len, int case_sensitivity, size_t *replace_count) { zend_string *new_str; @@ -3551,7 +3551,7 @@ PHPAPI zend_string *php_str_to_str_ex(char *haystack, php_size_t length, if (str_len < needle_len) { new_str = zend_string_alloc(length, 0); } else { - php_size_t count = 0; + size_t count = 0; char *o, *n, *endp; if (case_sensitivity) { @@ -3669,7 +3669,7 @@ nothing_todo: /* {{{ php_str_to_str */ -PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *needle, php_size_t needle_len, char *str, php_size_t str_len) +PHPAPI zend_string *php_str_to_str(char *haystack, size_t length, char *needle, size_t needle_len, char *str, size_t str_len) { return php_str_to_str_ex(haystack, length, needle, needle_len, str, str_len, 1, NULL); } @@ -3677,14 +3677,14 @@ PHPAPI zend_string *php_str_to_str(char *haystack, php_size_t length, char *need /* {{{ php_str_replace_in_subject */ -static void php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity, php_size_t *replace_count TSRMLS_DC) +static void php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity, size_t *replace_count TSRMLS_DC) { zval *search_entry, *replace_entry = NULL, temp_result, tmp_subject; char *replace_value = NULL; - php_size_t replace_len = 0; + size_t replace_len = 0; HashPosition pos; /* Make sure we're dealing with strings. */ @@ -4073,7 +4073,7 @@ PHP_FUNCTION(nl2br) char *tmp; zend_string *str; char *end, *target; - php_size_t repl_cnt = 0; + size_t repl_cnt = 0; zend_bool is_xhtml = 1; zend_string *result; @@ -4341,7 +4341,7 @@ PHP_FUNCTION(parse_str) * 0 start tag * 1 first non-whitespace char seen */ -int php_tag_find(char *tag, php_size_t len, char *set) { +int php_tag_find(char *tag, size_t len, char *set) { char c, *n, *t; int state=0, done=0; char *norm; @@ -4396,7 +4396,7 @@ int php_tag_find(char *tag, php_size_t len, char *set) { } /* }}} */ -PHPAPI php_size_t php_strip_tags(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len) /* {{{ */ +PHPAPI size_t php_strip_tags(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len) /* {{{ */ { return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0); } @@ -4422,7 +4422,7 @@ PHPAPI php_size_t php_strip_tags(char *rbuf, php_size_t len, int *stateptr, char swm: Added ability to strip <?xml tags without assuming it PHP code. */ -PHPAPI size_t php_strip_tags_ex(char *rbuf, php_size_t len, int *stateptr, char *allow, php_size_t allow_len, zend_bool allow_tag_spaces) +PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, char *allow, size_t allow_len, zend_bool allow_tag_spaces) { char *tbuf, *buf, *p, *tp, *rp, c, lc; int br, i=0, depth=0, in_q = 0; @@ -4779,8 +4779,8 @@ PHP_FUNCTION(count_chars) unsigned char *buf; int inx; char retstr[256]; - php_size_t retlen=0; - php_size_t tmp = 0; + size_t retlen=0; + size_t tmp = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &input, &mymode) == FAILURE) { return; @@ -5007,7 +5007,7 @@ PHP_FUNCTION(substr_count) } if (offset > haystack_len) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value " ZEND_INT_FMT " exceeds string length", offset); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value " ZEND_LONG_FMT " exceeds string length", offset); RETURN_FALSE; } p += offset; @@ -5019,7 +5019,7 @@ PHP_FUNCTION(substr_count) RETURN_FALSE; } if (length > (haystack_len - offset)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value " ZEND_INT_FMT " exceeds string length", length); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value " ZEND_LONG_FMT " exceeds string length", length); RETURN_FALSE; } endp = p + length; @@ -5253,7 +5253,7 @@ PHP_FUNCTION(str_word_count) /* nothing to be done */ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value " ZEND_INT_FMT, type); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format value " ZEND_LONG_FMT, type); RETURN_FALSE; } @@ -5350,7 +5350,7 @@ PHP_FUNCTION(str_split) zend_string *str; zend_long split_length = 1; char *p; - php_size_t n_reg_segments; + size_t n_reg_segments; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|l", &str, &split_length) == FAILURE) { return; @@ -5419,7 +5419,7 @@ PHP_FUNCTION(substr_compare) zend_string *s1, *s2; zend_long offset, len=0; zend_bool cs=0; - php_size_t cmp_len; + size_t cmp_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SSl|lb", &s1, &s2, &offset, &len, &cs) == FAILURE) { RETURN_FALSE; @@ -5444,7 +5444,7 @@ PHP_FUNCTION(substr_compare) RETURN_FALSE; } - cmp_len = (php_size_t) (len ? len : MAX(s2->len, (s1->len - offset))); + cmp_len = (size_t) (len ? len : MAX(s2->len, (s1->len - offset))); if (!cs) { RETURN_LONG(zend_binary_strncmp(s1->val + offset, (s1->len - offset), s2->val, s2->len, cmp_len)); diff --git a/ext/standard/url.c b/ext/standard/url.c index 47b3a793d9..6534d7a034 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -189,7 +189,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) zend_long port; memcpy(port_buf, p, (pp - p)); port_buf[pp - p] = '\0'; - port = ZEND_STRTOI(port_buf, NULL, 10); + port = ZEND_STRTOL(port_buf, NULL, 10); if (port > 0 && port <= 65535) { ret->port = (unsigned short) port; } else { @@ -283,7 +283,7 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length) zend_long port; memcpy(port_buf, p, (e - p)); port_buf[e - p] = '\0'; - port = ZEND_STRTOI(port_buf, NULL, 10); + port = ZEND_STRTOL(port_buf, NULL, 10); if (port > 0 && port <= 65535) { ret->port = (unsigned short)port; } else { @@ -416,7 +416,7 @@ PHP_FUNCTION(parse_url) if (resource->fragment != NULL) RETVAL_STRING(resource->fragment); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier " ZEND_INT_FMT, key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL component identifier " ZEND_LONG_FMT, key); RETVAL_FALSE; } goto done; diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index d296df360e..40ab379a30 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -65,9 +65,9 @@ #define PHP_UU_DEC(c) (((c) - ' ') & 077) -PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */ +PHPAPI zend_string *php_uuencode(char *src, size_t src_len) /* {{{ */ { - php_size_t len = 45; + size_t len = 45; char *p, *s, *e, *ee; zend_string *dest; @@ -127,9 +127,9 @@ PHPAPI zend_string *php_uuencode(char *src, php_size_t src_len) /* {{{ */ } /* }}} */ -PHPAPI zend_string *php_uudecode(char *src, php_size_t src_len) /* {{{ */ +PHPAPI zend_string *php_uudecode(char *src, size_t src_len) /* {{{ */ { - php_size_t len, total_len=0; + size_t len, total_len=0; char *s, *e, *p, *ee; zend_string *dest; diff --git a/ext/standard/var.c b/ext/standard/var.c index d18c754480..b5ece11332 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -57,7 +57,7 @@ static uint zend_obj_num_elements(HashTable *ht) static void php_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ - php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ php_printf("%*c[\"", level + 1, ' '); PHPWRITE(key->val, key->len); @@ -72,7 +72,7 @@ static void php_object_property_dump(zval *zv, zend_ulong index, zend_string *ke const char *prop_name, *class_name; if (key == NULL) { /* numeric key */ - php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ int unmangle = zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); @@ -120,7 +120,7 @@ again: php_printf("%sNULL\n", COMMON); break; case IS_LONG: - php_printf("%sint(" ZEND_INT_FMT ")\n", COMMON, Z_LVAL_P(struc)); + php_printf("%sint(" ZEND_LONG_FMT ")\n", COMMON, Z_LVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); @@ -230,7 +230,7 @@ PHP_FUNCTION(var_dump) static void zval_array_element_dump(zval *zv, zend_ulong index, zend_string *key, int level TSRMLS_DC) /* {{{ */ { if (key == NULL) { /* numeric key */ - php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ php_printf("%*c[\"", level + 1, ' '); PHPWRITE(key->val, key->len); @@ -245,7 +245,7 @@ static void zval_object_property_dump(zval *zv, zend_ulong index, zend_string *k const char *prop_name, *class_name; if (key == NULL) { /* numeric key */ - php_printf("%*c[" ZEND_INT_FMT "]=>\n", level + 1, ' ', index); + php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index); } else { /* string key */ zend_unmangle_property_name(key->val, key->len, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); @@ -291,7 +291,7 @@ again: php_printf("%sNULL\n", COMMON); break; case IS_LONG: - php_printf("%slong(" ZEND_INT_FMT ")\n", COMMON, Z_LVAL_P(struc)); + php_printf("%slong(" ZEND_LONG_FMT ")\n", COMMON, Z_LVAL_P(struc)); break; case IS_DOUBLE: php_printf("%sdouble(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc)); @@ -354,7 +354,7 @@ again: break; case IS_RESOURCE: { const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc) TSRMLS_CC); - php_printf("%sresource(" ZEND_INT_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc)); + php_printf("%sresource(" ZEND_LONG_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc)); break; } case IS_REFERENCE: @@ -456,7 +456,7 @@ PHPAPI void php_var_export_ex(zval *struc, int level, smart_str *buf TSRMLS_DC) { HashTable *myht; char *tmp_str; - php_size_t tmp_len; + size_t tmp_len; zend_string *class_name; zend_string *ztmp, *ztmp2; zend_ulong index; @@ -1031,7 +1031,7 @@ PHP_FUNCTION(unserialize) PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_dtor(return_value); if (!EG(exception)) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_INT_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len); } RETURN_FALSE; } diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index 1520b66947..027fd33108 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -635,7 +635,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i dir_len = php_dirname(file_dirname, strlen(source)); if (dir_len > 0) { - php_stat_t buf; + zend_stat_t buf; if (php_sys_stat(file_dirname, &buf) != 0) { xmlFreeURI(uri); return NULL; diff --git a/main/SAPI.c b/main/SAPI.c index fbfca51743..acf884a842 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -290,7 +290,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data) } if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds " ZEND_INT_FMT " bytes", SG(post_max_size)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds " ZEND_LONG_FMT " bytes", SG(post_max_size)); break; } diff --git a/main/SAPI.h b/main/SAPI.h index 0654cd6c7f..d4bc075f84 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -228,7 +228,7 @@ struct _sapi_module_struct { int (*activate)(TSRMLS_D); int (*deactivate)(TSRMLS_D); - php_size_t (*ub_write)(const char *str, php_size_t str_length TSRMLS_DC); + size_t (*ub_write)(const char *str, size_t str_length TSRMLS_DC); void (*flush)(void *server_context TSRMLS_DC); zend_stat_t *(*get_stat)(TSRMLS_D); char *(*getenv)(char *name, size_t name_len TSRMLS_DC); @@ -239,7 +239,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); - php_size_t (*read_post)(char *buffer, php_size_t count_bytes TSRMLS_DC); + size_t (*read_post)(char *buffer, size_t count_bytes TSRMLS_DC); char *(*read_cookies)(TSRMLS_D); void (*register_server_variables)(zval *track_vars_array TSRMLS_DC); @@ -266,7 +266,7 @@ struct _sapi_module_struct { int (*get_target_uid)(uid_t * TSRMLS_DC); int (*get_target_gid)(gid_t * TSRMLS_DC); - unsigned int (*input_filter)(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC); + unsigned int (*input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC); void (*ini_defaults)(HashTable *configuration_hash); int phpinfo_as_text; @@ -300,7 +300,7 @@ struct _sapi_post_entry { #define SAPI_POST_HANDLER_FUNC(post_handler) void post_handler(char *content_type_dup, void *arg TSRMLS_DC) #define SAPI_TREAT_DATA_FUNC(treat_data) void treat_data(int arg, char *str, zval* destArray TSRMLS_DC) -#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, php_size_t val_len, php_size_t *new_val_len TSRMLS_DC) +#define SAPI_INPUT_FILTER_FUNC(input_filter) unsigned int input_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len TSRMLS_DC) BEGIN_EXTERN_C() SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data); diff --git a/main/main.c b/main/main.c index fb84e1f8a6..66cbe2bcbd 100644 --- a/main/main.c +++ b/main/main.c @@ -53,6 +53,7 @@ #include <locale.h> #endif #include "zend.h" +#include "zend_types.h" #include "zend_extensions.h" #include "php_ini.h" #include "php_globals.h" @@ -162,7 +163,7 @@ static PHP_INI_MH(OnSetPrecision) { zend_long i; - ZEND_ATOI(i, new_value); + ZEND_ATOL(i, new_value); if (i >= 0) { EG(precision) = i; return SUCCESS; @@ -281,7 +282,7 @@ static void php_binary_init(TSRMLS_D) if ((envpath = getenv("PATH")) != NULL) { char *search_dir, search_path[MAXPATHLEN]; char *last = NULL; - php_stat_t s; + zend_stat_t s; path = estrdup(envpath); search_dir = php_strtok_r(path, ":", &last); @@ -318,11 +319,11 @@ static PHP_INI_MH(OnUpdateTimeout) { if (stage==PHP_INI_STAGE_STARTUP) { /* Don't set a timeout on startup, only per-request */ - ZEND_ATOI(EG(timeout_seconds), new_value); + ZEND_ATOL(EG(timeout_seconds), new_value); return SUCCESS; } zend_unset_timeout(TSRMLS_C); - ZEND_ATOI(EG(timeout_seconds), new_value); + ZEND_ATOL(EG(timeout_seconds), new_value); zend_set_timeout(EG(timeout_seconds), 0); return SUCCESS; } @@ -349,7 +350,7 @@ static int php_get_display_errors_mode(char *value, int value_length) } else if (value_length == 6 && !strcasecmp(value, "stdout")) { mode = PHP_DISPLAY_ERRORS_STDOUT; } else { - ZEND_ATOI(mode, value); + ZEND_ATOL(mode, value); if (mode && mode != PHP_DISPLAY_ERRORS_STDOUT && mode != PHP_DISPLAY_ERRORS_STDERR) { mode = PHP_DISPLAY_ERRORS_STDOUT; } @@ -709,7 +710,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC) /* {{{ php_write wrapper for modules to use PHPWRITE */ -PHPAPI php_size_t php_write(void *buf, php_size_t size TSRMLS_DC) +PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC) { return PHPWRITE(buf, size); } @@ -717,12 +718,12 @@ PHPAPI php_size_t php_write(void *buf, php_size_t size TSRMLS_DC) /* {{{ php_printf */ -PHPAPI php_size_t php_printf(const char *format, ...) +PHPAPI size_t php_printf(const char *format, ...) { va_list args; - php_size_t ret; + size_t ret; char *buffer; - php_size_t size; + size_t size; TSRMLS_FETCH(); va_start(args, format); @@ -1265,7 +1266,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ */ PHPAPI char *php_get_current_user(TSRMLS_D) { - php_stat_t *pstat; + zend_stat_t *pstat; if (SG(request_info).current_user) { return SG(request_info).current_user; @@ -1337,7 +1338,7 @@ PHP_FUNCTION(set_time_limit) return; } - new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_INT_FMT, new_timeout); + new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout); key = zend_string_init("max_execution_time", sizeof("max_execution_time")-1, 0); if (zend_alter_ini_entry_ex(key, new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { @@ -1923,7 +1924,7 @@ PHPAPI void php_com_initialize(TSRMLS_D) /* {{{ php_output_wrapper */ -static php_size_t php_output_wrapper(const char *str, php_size_t str_length) +static size_t php_output_wrapper(const char *str, size_t str_length) { TSRMLS_FETCH(); return php_output_write(str, str_length TSRMLS_CC); @@ -2211,8 +2212,8 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", PHP_INT_MAX, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MIN", PHP_INT_MIN, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", ZEND_LONG_MAX, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MIN", ZEND_LONG_MIN, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", SIZEOF_ZEND_INT, CONST_PERSISTENT | CONST_CS); #ifdef PHP_WIN32 diff --git a/main/php.h b/main/php.h index fc105386db..8ee83e424d 100644 --- a/main/php.h +++ b/main/php.h @@ -66,15 +66,6 @@ # define PHP_EOL "\n" #endif -#define php_size_t size_t -#define zend_long zend_long -#define zend_ulong zend_ulong -#define php_off_t zend_off_t -#define PHP_INT_MAX ZEND_INT_MAX -#define PHP_INT_MIN ZEND_INT_MIN -#define PHP_UINT_MAX ZEND_UINT_MAX -#define PHP_SIZE_MAX ZEND_SIZE_MAX - #ifdef NETWARE /* For php_get_uname() function */ #define PHP_UNAME "NetWare" @@ -289,8 +280,8 @@ ssize_t pread(int, void *, size_t, off64_t); BEGIN_EXTERN_C() void phperror(char *error); -PHPAPI php_size_t php_write(void *buf, php_size_t size TSRMLS_DC); -PHPAPI php_size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, +PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC); +PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); PHPAPI int php_get_module_initialized(void); PHPAPI void php_log_err(char *log_message TSRMLS_DC); diff --git a/main/php_ini.c b/main/php_ini.c index 8621af24d7..c94e412094 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -545,7 +545,7 @@ int php_init_config(TSRMLS_D) /* Check if php_ini_file_name is a file and can be opened */ if (php_ini_file_name && php_ini_file_name[0]) { - php_stat_t statbuf; + zend_stat_t statbuf; if (!VCWD_STAT(php_ini_file_name, &statbuf)) { if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) { @@ -614,7 +614,7 @@ int php_init_config(TSRMLS_D) if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) { struct dirent **namelist; int ndir, i; - php_stat_t sb; + zend_stat_t sb; char ini_file[MAXPATHLEN]; char *p; zend_file_handle fh2; @@ -744,7 +744,7 @@ void php_ini_register_extensions(TSRMLS_D) */ PHPAPI int php_parse_user_ini_file(const char *dirname, char *ini_filename, HashTable *target_hash TSRMLS_DC) { - php_stat_t sb; + zend_stat_t sb; char ini_file[MAXPATHLEN]; zend_file_handle fh; diff --git a/main/php_streams.h b/main/php_streams.h index 229f8f49e0..1daa0d9d67 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -106,11 +106,11 @@ typedef struct _php_stream_filter php_stream_filter; #ifdef _WIN64 # define php_fstat _fstat64 # define php_stat_fn _stat64 -typedef struct __stat64 php_stat_t; +typedef struct __stat64 zend_stat_t; #else # define php_fstat fstat # define php_stat_fn stat -typedef struct stat php_stat_t; +typedef struct stat zend_stat_t; #endif typedef struct _php_stream_statbuf { diff --git a/main/php_variables.c b/main/php_variables.c index a455b1b790..37af78b98d 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -43,7 +43,7 @@ PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_arra } /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *strval, php_size_t str_len, zval *track_vars_array TSRMLS_DC) +PHPAPI void php_register_variable_safe(char *var, char *strval, size_t str_len, zval *track_vars_array TSRMLS_DC) { zval new_entry; assert(strval != NULL); @@ -141,7 +141,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars /* do not output the error message to the screen, this helps us to to avoid "information disclosure" */ if (!PG(display_errors)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variable nesting level exceeded " ZEND_INT_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variable nesting level exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level)); } free_alloca(var_orig, use_heap); return; @@ -246,7 +246,7 @@ static zend_bool add_post_var(zval *arr, post_var_data_t *var, zend_bool eof TSR char *ksep, *vsep; size_t klen, vlen; /* FIXME: string-size_t */ - php_size_t new_vlen; + size_t new_vlen; if (var->ptr >= var->end) { return 0; @@ -442,13 +442,13 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } if (++count > PG(max_input_vars)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_INT_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); break; } if (val) { /* have a value */ - php_size_t val_len; - php_size_t new_val_len; + size_t val_len; + size_t new_val_len; *val++ = '\0'; php_url_decode(var, strlen(var)); @@ -459,8 +459,8 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) } efree(val); } else { - php_size_t val_len; - php_size_t new_val_len; + size_t val_len; + size_t new_val_len; php_url_decode(var, strlen(var)); val_len = 0; diff --git a/main/php_variables.h b/main/php_variables.h index c33308b5a2..70f5e1dc7f 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -38,7 +38,7 @@ void php_startup_auto_globals(TSRMLS_D); extern PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC); PHPAPI void php_register_variable(char *var, char *val, zval *track_vars_array TSRMLS_DC); /* binary-safe version */ -PHPAPI void php_register_variable_safe(char *var, char *val, php_size_t val_len, zval *track_vars_array TSRMLS_DC); +PHPAPI void php_register_variable_safe(char *var, char *val, size_t val_len, zval *track_vars_array TSRMLS_DC); PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC); PHPAPI int php_hash_environment(TSRMLS_D); diff --git a/main/rfc1867.c b/main/rfc1867.c index 263c214af3..0f2941ef98 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -58,7 +58,7 @@ static php_rfc1867_basename_t php_rfc1867_basename = NULL; PHPAPI int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra TSRMLS_DC) = NULL; -static void safe_php_register_variable(char *var, char *strval, php_size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); +static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC); /* The longest property name we use in an uploaded file array */ #define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") @@ -161,7 +161,7 @@ static zend_bool is_protected_variable(char *varname TSRMLS_DC) /* {{{ */ } /* }}} */ -static void safe_php_register_variable(char *var, char *strval, php_size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ +static void safe_php_register_variable(char *var, char *strval, size_t val_len, zval *track_vars_array, zend_bool override_protection TSRMLS_DC) /* {{{ */ { if (override_protection || !is_protected_variable(var TSRMLS_CC)) { php_register_variable_safe(var, strval, val_len, track_vars_array TSRMLS_CC); @@ -611,9 +611,9 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne } /* read until a boundary condition */ -static int multipart_buffer_read(multipart_buffer *self, char *buf, php_size_t bytes, int *end TSRMLS_DC) +static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end TSRMLS_DC) { - php_size_t len, max; + size_t len, max; char *bound; /* fill buffer if needed */ @@ -657,7 +657,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, php_size_t b XXX: this is horrible memory-usage-wise, but we only expect to do this on small pieces of form data. */ -static char *multipart_buffer_read_body(multipart_buffer *self, php_size_t *len TSRMLS_DC) +static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len TSRMLS_DC) { char buf[FILLUNIT], *out=NULL; int total_bytes=0, read_bytes=0; @@ -714,7 +714,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ } if (SG(post_max_size) > 0 && SG(request_info).content_length > SG(post_max_size)) { - sapi_module.sapi_error(E_WARNING, "POST Content-Length of " ZEND_INT_FMT " bytes exceeds the limit of " ZEND_INT_FMT " bytes", SG(request_info).content_length, SG(post_max_size)); + sapi_module.sapi_error(E_WARNING, "POST Content-Length of " ZEND_LONG_FMT " bytes exceeds the limit of " ZEND_LONG_FMT " bytes", SG(request_info).content_length, SG(post_max_size)); return; } @@ -850,9 +850,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ /* Normal form variable, safe to read all data into memory */ if (!filename && param) { - php_size_t value_len; + size_t value_len; char *value = multipart_buffer_read_body(mbuff, &value_len TSRMLS_CC); - php_size_t new_val_len; /* Dummy variable */ + size_t new_val_len; /* Dummy variable */ if (!value) { value = estrdup(""); @@ -889,7 +889,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ safe_php_register_variable(param, value, new_val_len, array_ptr, 0 TSRMLS_CC); } else { if (count == PG(max_input_vars) + 1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_INT_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); } if (php_rfc1867_callback != NULL) { @@ -1036,12 +1036,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (PG(upload_max_filesize) > 0 && (zend_long)(total_bytes+blen) > PG(upload_max_filesize)) { #if DEBUG_FILE_UPLOAD - sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of " ZEND_INT_FMT " bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename); + sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of " ZEND_LONG_FMT " bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename); #endif cancel_upload = UPLOAD_ERROR_A; } else if (max_file_size && ((zend_long)(total_bytes+blen) > max_file_size)) { #if DEBUG_FILE_UPLOAD - sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_INT_FMT " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename); + sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_LONG_FMT " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename); #endif cancel_upload = UPLOAD_ERROR_B; } else if (blen > 0) { @@ -1230,7 +1230,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (cancel_upload) { ZVAL_LONG(&file_size, 0); } else { - if (total_bytes > ZEND_INT_MAX) { + if (total_bytes > ZEND_LONG_MAX) { #ifdef PHP_WIN32 if (_i64toa_s(total_bytes, file_size_buf, 65, 10)) { file_size_buf[0] = '0'; diff --git a/main/snprintf.c b/main/snprintf.c index 8f32f3977d..0675538ac5 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -312,7 +312,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c */ /* char * ap_php_conv_10() {{{ */ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register php_size_t *len) + register bool_int * is_negative, char *buf_end, register size_t *len) { register char *p = buf_end; register u_wide_int magnitude; @@ -370,7 +370,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, */ /* PHPAPI char * php_conv_fp() {{{ */ PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, php_size_t *len) + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, size_t *len) { register char *s = buf; register char *p, *p_orig; @@ -438,7 +438,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, if (format != 'F') { char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - php_size_t t_len; + size_t t_len; bool_int exponent_is_negative; *s++ = format; /* either e or E */ @@ -474,7 +474,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ -char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register php_size_t *len) /* {{{ */ +char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register size_t *len) /* {{{ */ { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -584,10 +584,10 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / char *sp; char *bep; int cc = 0; - php_size_t i; + size_t i; char *s = NULL; - php_size_t s_len; + size_t s_len; int free_zcopy; zval *zvp, zcopy; diff --git a/main/snprintf.h b/main/snprintf.h index ae179cf6f5..6cef41f3f4 100644 --- a/main/snprintf.h +++ b/main/snprintf.h @@ -87,7 +87,7 @@ PHPAPI int ap_php_asprintf(char **buf, const char *format, ...); PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3); PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf); PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, php_size_t *len); + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, size_t *len); END_EXTERN_C() @@ -154,10 +154,10 @@ typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; extern char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register php_size_t *len); + register bool_int * is_negative, char *buf_end, register size_t *len); extern char * ap_php_conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register php_size_t *len); + char format, char *buf_end, register size_t *len); /* The maximum precision that's allowed for float conversion. Does not include * decimal separator, exponent, sign, terminator. Currently does not affect diff --git a/main/spprintf.c b/main/spprintf.c index 0194722418..67ab15dce5 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -198,7 +198,7 @@ static size_t strnlen(const char *s, size_t maxlen) { static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt, va_list ap) /* {{{ */ { char *s = NULL; - php_size_t s_len; + size_t s_len; int free_zcopy; zval *zvp, zcopy; @@ -819,10 +819,10 @@ skip_output: /* * This is the general purpose conversion function. */ -PHPAPI php_size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */ +PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */ { smart_string buf = {0}; - php_size_t result; + size_t result; xbuf_format_converter(&buf, 1, format, ap); @@ -844,9 +844,9 @@ PHPAPI php_size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_ } /* }}} */ -PHPAPI php_size_t spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ +PHPAPI size_t spprintf(char **pbuf, size_t max_len, const char *format, ...) /* {{{ */ { - php_size_t cc; + size_t cc; va_list ap; va_start(ap, format); diff --git a/main/spprintf.h b/main/spprintf.h index 612bcbf5db..1e4782843f 100644 --- a/main/spprintf.h +++ b/main/spprintf.h @@ -37,9 +37,9 @@ There is also snprintf: See difference explained in snprintf.h #include "snprintf.h" BEGIN_EXTERN_C() -PHPAPI php_size_t spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); +PHPAPI size_t spprintf( char **pbuf, size_t max_len, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); -PHPAPI php_size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); +PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) PHP_ATTRIBUTE_FORMAT(printf, 3, 0); PHPAPI zend_string *vstrpprintf(size_t max_len, const char *format, va_list ap); diff --git a/main/streams/cast.c b/main/streams/cast.c index d26ceceeef..cb4f081655 100644 --- a/main/streams/cast.c +++ b/main/streams/cast.c @@ -334,7 +334,7 @@ exit_success: * will be accessing the stream. Emit a warning so that the end-user will * know that they should try something else */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_INT_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, ZEND_LONG_FMT " bytes of buffered data lost during stream conversion!", (zend_long)(stream->writepos - stream->readpos)); } if (castas == PHP_STREAM_AS_STDIO && ret) { diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index d9f058e3cc..23c017eaa1 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -138,7 +138,7 @@ typedef struct { HANDLE file_mapping; #endif - php_stat_t sb; + zend_stat_t sb; } php_stdio_stream_data; #define PHP_STDIOP_GET_FD(anfd, data) anfd = (data)->file ? fileno((data)->file) : (data)->fd @@ -1102,7 +1102,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f #ifndef PHP_WIN32 # ifdef EXDEV if (errno == EXDEV) { - php_stat_t sb; + zend_stat_t sb; if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) { if (VCWD_STAT(url_from, &sb) == 0) { # if !defined(TSRM_WIN32) && !defined(NETWARE) @@ -1165,7 +1165,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i } else { /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ char *e; - php_stat_t sb; + zend_stat_t sb; int dir_len = strlen(dir); int offset = 0; char buf[MAXPATHLEN]; diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 6561febec4..26a956c362 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -617,7 +617,7 @@ static size_t php_userstreamop_write(php_stream *stream, const char *buf, size_t /* don't allow strange buffer overruns due to bogus return */ if (didwrite > count) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " written, " ZEND_INT_FMT " max)", + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_WRITE " wrote " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " written, " ZEND_LONG_FMT " max)", us->wrapper->classname, (zend_long)(didwrite - count), (zend_long)didwrite, (zend_long)count); didwrite = count; @@ -654,7 +654,7 @@ static size_t php_userstreamop_read(php_stream *stream, char *buf, size_t count convert_to_string(&retval); didread = Z_STRLEN(retval); if (didread > count) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_INT_FMT " bytes more data than requested (" ZEND_INT_FMT " read, " ZEND_INT_FMT " max) - excess data will be lost", + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_READ " - read " ZEND_LONG_FMT " bytes more data than requested (" ZEND_LONG_FMT " read, " ZEND_LONG_FMT " max) - excess data will be lost", us->wrapper->classname, (zend_long)(didread - count), (zend_long)didread, (zend_long)count); didread = count; } diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 25059afe32..fc13cdf2e4 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -102,7 +102,7 @@ retry: } while (err == EINTR); } estr = php_socket_strerror(err, NULL, 0); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_INT_FMT " bytes failed with errno=%ld %s", + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%ld %s", (zend_long)count, err, estr); efree(estr); } diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 10b4186306..f1033c9539 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -43,7 +43,7 @@ typedef struct php_struct { #if defined(NETWARE) && defined(CLIB_STAT_PATCH) struct stat_libc finfo; #else - php_stat_t finfo; + zend_stat_t finfo; #endif /* Whether or not we've processed PHP in the output filters yet. */ int request_processed; diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 669f25f786..d39a25a74e 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -72,8 +72,8 @@ /* A way to specify the location of the php.ini dir in an apache directive */ char *apache2_php_ini_path_override = NULL; -static php_size_t -php_apache_sapi_ub_write(const char *str, php_size_t str_length TSRMLS_DC) +static size_t +php_apache_sapi_ub_write(const char *str, size_t str_length TSRMLS_DC) { request_rec *r; php_struct *ctx; @@ -181,7 +181,7 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) } static apr_size_t -php_apache_sapi_read_post(char *buf, php_size_t count_bytes TSRMLS_DC) +php_apache_sapi_read_post(char *buf, size_t count_bytes TSRMLS_DC) { apr_size_t len, tlen=0; php_struct *ctx = SG(server_context); @@ -212,7 +212,7 @@ php_apache_sapi_read_post(char *buf, php_size_t count_bytes TSRMLS_DC) return tlen; } -static php_stat_t* +static zend_stat_t* php_apache_sapi_get_stat(TSRMLS_D) { php_struct *ctx = SG(server_context); @@ -270,18 +270,18 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC) php_struct *ctx = SG(server_context); const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env); char *key, *val; - php_size_t new_val_len; + size_t new_val_len; APR_ARRAY_FOREACH_OPEN(arr, key, val) if (!val) { val = ""; } - if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (php_size_t *)&new_val_len TSRMLS_CC)) { + if (sapi_module.input_filter(PARSE_SERVER, key, &val, strlen(val), (size_t *)&new_val_len TSRMLS_CC)) { php_register_variable_safe(key, val, new_val_len, track_vars_array TSRMLS_CC); } APR_ARRAY_FOREACH_CLOSE() - if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (php_size_t *)&new_val_len TSRMLS_CC)) { + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &ctx->r->uri, strlen(ctx->r->uri), (size_t *)&new_val_len TSRMLS_CC)) { php_register_variable_safe("PHP_SELF", ctx->r->uri, new_val_len, track_vars_array TSRMLS_CC); } } diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index ca2c99263a..d02e0c6171 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -287,10 +287,10 @@ static inline size_t sapi_cgi_single_write(const char *str, uint str_length TSRM #endif } -static php_size_t sapi_cgi_ub_write(const char *str, php_size_t str_length TSRMLS_DC) +static size_t sapi_cgi_ub_write(const char *str, size_t str_length TSRMLS_DC) { const char *ptr = str; - php_size_t remaining = str_length; + size_t remaining = str_length; size_t ret; while (remaining > 0) { @@ -306,10 +306,10 @@ static php_size_t sapi_cgi_ub_write(const char *str, php_size_t str_length TSRML return str_length; } -static php_size_t sapi_fcgi_ub_write(const char *str, php_size_t str_length TSRMLS_DC) +static size_t sapi_fcgi_ub_write(const char *str, size_t str_length TSRMLS_DC) { const char *ptr = str; - php_size_t remaining = str_length; + size_t remaining = str_length; fcgi_request *request = (fcgi_request*) SG(server_context); while (remaining > 0) { @@ -505,9 +505,9 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) # define STDIN_FILENO 0 #endif -static php_size_t sapi_cgi_read_post(char *buffer, php_size_t count_bytes TSRMLS_DC) +static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) { - php_size_t read_bytes = 0; + size_t read_bytes = 0; int tmp_read_bytes; count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes)); @@ -521,9 +521,9 @@ static php_size_t sapi_cgi_read_post(char *buffer, php_size_t count_bytes TSRMLS return read_bytes; } -static php_size_t sapi_fcgi_read_post(char *buffer, php_size_t count_bytes TSRMLS_DC) +static size_t sapi_fcgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) { - php_size_t read_bytes = 0; + size_t read_bytes = 0; int tmp_read_bytes; fcgi_request *request = (fcgi_request*) SG(server_context); size_t remaining = SG(request_info).content_length - SG(read_post_bytes); @@ -622,7 +622,7 @@ static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, uns { zval *array_ptr = (zval*)arg; int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))?PARSE_ENV:PARSE_SERVER; - php_size_t new_val_len; + size_t new_val_len; if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len TSRMLS_CC)) { php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); @@ -658,7 +658,7 @@ static void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC) static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) { - php_size_t php_self_len; + size_t php_self_len; char *php_self; /* In CGI mode, we consider the environment to be a part of the server @@ -1184,7 +1184,7 @@ static void init_request_info(fcgi_request *request TSRMLS_DC) #endif if (CGIG(fix_pathinfo)) { - php_stat_t st; + zend_stat_t st; char *real_path = NULL; char *env_redirect_url = CGI_GETENV("REDIRECT_URL"); char *env_document_root = CGI_GETENV("DOCUMENT_ROOT"); @@ -2416,7 +2416,7 @@ consult the installation file that came with this distribution, or visit \n\ /* handle situations where line is terminated by \r\n */ if (c == '\r') { if (php_stream_getc((php_stream*)file_handle.handle.stream.handle) != '\n') { - php_off_t pos = php_stream_tell((php_stream*)file_handle.handle.stream.handle); + zend_off_t pos = php_stream_tell((php_stream*)file_handle.handle.stream.handle); php_stream_seek((php_stream*)file_handle.handle.stream.handle, pos - 1, SEEK_SET); } } diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h index 8840ac01cc..b04f6c91f0 100644 --- a/sapi/cli/cli.h +++ b/sapi/cli/cli.h @@ -30,11 +30,11 @@ #endif -extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length TSRMLS_DC); +extern PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRMLS_DC); typedef struct { - php_size_t (*cli_shell_write)(const char *str, php_size_t str_length TSRMLS_DC); - php_size_t (*cli_shell_ub_write)(const char *str, php_size_t str_length TSRMLS_DC); + size_t (*cli_shell_write)(const char *str, size_t str_length TSRMLS_DC); + size_t (*cli_shell_ub_write)(const char *str, size_t str_length TSRMLS_DC); int (*cli_shell_run)(TSRMLS_D); } cli_shell_callbacks_t; diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index c51e5a8ce2..5847849e89 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -252,16 +252,16 @@ static inline int sapi_cli_select(int fd TSRMLS_DC) return ret != -1; } -PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */ +PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */ { #ifdef PHP_WRITE_STDOUT zend_long ret; #else - php_size_t ret; + size_t ret; #endif if (cli_shell_callbacks.cli_shell_write) { - php_size_t shell_wrote; + size_t shell_wrote; shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length TSRMLS_CC); if (shell_wrote > -1) { return shell_wrote; @@ -285,10 +285,10 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, php_size_t str_length } /* }}} */ -static php_size_t sapi_cli_ub_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */ +static size_t sapi_cli_ub_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */ { const char *ptr = str; - php_size_t remaining = str_length; + size_t remaining = str_length; size_t ret; if (!str_length) { @@ -296,7 +296,7 @@ static php_size_t sapi_cli_ub_write(const char *str, php_size_t str_length TSRML } if (cli_shell_callbacks.cli_shell_ub_write) { - php_size_t ub_wrote; + size_t ub_wrote; ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length TSRMLS_CC); if (ub_wrote > -1) { return ub_wrote; @@ -338,7 +338,7 @@ static char *script_filename = ""; static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ */ { - php_size_t len; + size_t len; char *docroot = ""; /* In CGI mode, we consider the environment to be a part of the server diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 889b4f2fd4..6f7f34e7ba 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -139,7 +139,7 @@ typedef struct php_cli_server_request { size_t content_len; const char *ext; size_t ext_len; - php_stat_t sb; + zend_stat_t sb; } php_cli_server_request; typedef struct php_cli_server_chunk { @@ -539,7 +539,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */ return SUCCESS; } /* }}} */ -static php_size_t sapi_cli_server_ub_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */ +static size_t sapi_cli_server_ub_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (!client) { @@ -619,7 +619,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ return val; } /* }}} */ -static php_size_t sapi_cli_server_read_post(char *buf, php_size_t count_bytes TSRMLS_DC) /* {{{ */ +static size_t sapi_cli_server_read_post(char *buf, size_t count_bytes TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (client->request.content) { @@ -635,7 +635,7 @@ static php_size_t sapi_cli_server_read_post(char *buf, php_size_t count_bytes TS static void sapi_cli_server_register_variable(zval *track_vars_array, const char *key, const char *val TSRMLS_DC) /* {{{ */ { char *new_val = (char *)val; - php_size_t new_val_len; + size_t new_val_len; if (sapi_module.input_filter(PARSE_SERVER, (char*)key, &new_val, strlen(val), &new_val_len TSRMLS_CC)) { php_register_variable_safe((char *)key, new_val, new_val_len, track_vars_array TSRMLS_CC); } @@ -1377,7 +1377,7 @@ static void php_cli_server_request_dtor(php_cli_server_request *req) /* {{{ */ static void php_cli_server_request_translate_vpath(php_cli_server_request *request, const char *document_root, size_t document_root_len) /* {{{ */ { - php_stat_t sb; + zend_stat_t sb; static const char *index_files[] = { "index.php", "index.html", NULL }; char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1); char *p = buf, *prev_path = NULL, *q, *vpath; @@ -2487,7 +2487,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ } if (document_root) { - php_stat_t sb; + zend_stat_t sb; if (php_stat_fn(document_root, &sb)) { fprintf(stderr, "Directory %s does not exist.\n", document_root); diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index 8f2e9be312..230b3a649d 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -44,7 +44,7 @@ static int php_embed_deactivate(TSRMLS_D) return SUCCESS; } -static inline size_t php_embed_single_write(const char *str, php_size_t str_length) +static inline size_t php_embed_single_write(const char *str, size_t str_length) { #ifdef PHP_WRITE_STDOUT zend_long ret; @@ -61,10 +61,10 @@ static inline size_t php_embed_single_write(const char *str, php_size_t str_leng } -static php_size_t php_embed_ub_write(const char *str, php_size_t str_length TSRMLS_DC) +static size_t php_embed_ub_write(const char *str, size_t str_length TSRMLS_DC) { const char *ptr = str; - php_size_t remaining = str_length; + size_t remaining = str_length; size_t ret; while (remaining > 0) { diff --git a/win32/glob.c b/win32/glob.c index 95160f9963..74882ac7d6 100644 --- a/win32/glob.c +++ b/win32/glob.c @@ -146,10 +146,10 @@ typedef char Char; static int compare(const void *, const void *); static int g_Ctoc(const Char *, char *, u_int); -static int g_lstat(Char *, php_stat_t *, glob_t *); +static int g_lstat(Char *, zend_stat_t *, glob_t *); static DIR *g_opendir(Char *, glob_t *); static Char *g_strchr(Char *, int); -static int g_stat(Char *, php_stat_t *, glob_t *); +static int g_stat(Char *, zend_stat_t *, glob_t *); static int glob0(const Char *, glob_t *); static int glob1(Char *, Char *, glob_t *, size_t *); static int glob2(Char *, Char *, Char *, Char *, Char *, Char *, @@ -559,7 +559,7 @@ glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern, glob_t *pglob; size_t *limitp; { - php_stat_t sb; + zend_stat_t sb; Char *p, *q; int anymeta; @@ -856,7 +856,7 @@ g_opendir(str, pglob) static int g_lstat(fn, sb, pglob) register Char *fn; - php_stat_t *sb; + zend_stat_t *sb; glob_t *pglob; { char buf[MAXPATHLEN]; @@ -871,7 +871,7 @@ g_lstat(fn, sb, pglob) static int g_stat(fn, sb, pglob) register Char *fn; - php_stat_t *sb; + zend_stat_t *sb; glob_t *pglob; { char buf[MAXPATHLEN]; diff --git a/win32/glob.h b/win32/glob.h index a03fda9199..63b8fc2f67 100644 --- a/win32/glob.h +++ b/win32/glob.h @@ -47,7 +47,7 @@ # include <sys/cdefs.h> #endif -php_stat_t; +zend_stat_t; typedef struct { int gl_pathc; /* Count of total paths so far. */ int gl_matchc; /* Count of paths matching pattern. */ @@ -65,8 +65,8 @@ typedef struct { void (*gl_closedir)(void *); struct dirent *(*gl_readdir)(void *); void *(*gl_opendir)(const char *); - int (*gl_lstat)(const char *, php_stat_t *); - int (*gl_stat)(const char *, php_stat_t *); + int (*gl_lstat)(const char *, zend_stat_t *); + int (*gl_stat)(const char *, zend_stat_t *); } glob_t; /* Flags */ |