}
} 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("] => ");
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);
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;
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;
}
}
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;
}
}
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:
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));
}
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);
}
#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
}
#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;
}
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;
}
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(", ");
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;
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));
}
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 :( */
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;
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;
}
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;
++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;
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);
}
}
/* $Id$ */
-#ifndef ZEND_INT_H
-#define ZEND_INT_H
+#ifndef ZEND_LONG_H
+#define ZEND_LONG_H
#include "main/php_stdint.h"
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
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
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
/* 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:
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;
Z_STRLEN_P(zendlval)--;
}
}
- *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8);
+ *t++ = (char) ZEND_STRTOL(octal_buf, NULL, 8);
} else {
*t++ = '\\';
*t++ = *s;
#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));
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 {
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 {
#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);
}
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;
Z_STRLEN_P(zendlval)--;
}
}
- *t++ = (char) ZEND_STRTOI(octal_buf, NULL, 8);
+ *t++ = (char) ZEND_STRTOL(octal_buf, NULL, 8);
} else {
*t++ = '\\';
*t++ = *s;
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 {
<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));
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 {
<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);
}
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':
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':
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); \
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;
}
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:
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: {
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 */
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);
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);
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 {
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 {
#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;
#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;
*
* 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)
{
}
if (lval) {
- *lval = ZEND_STRTOI(str, NULL, base);
+ *lval = ZEND_STRTOL(str, NULL, base);
}
return IS_LONG;
"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)++;
}
"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)--;
}
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));
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;
}
} 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);
&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);
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;
}
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;
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;
array_init(return_value);
- if (timestamp_begin == PHP_INT_MIN) {
+ if (timestamp_begin == ZEND_LONG_MIN) {
add_nominal();
begin = 0;
found = 1;
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) {
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. */
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) {
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;
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));
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;
}
}
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;
}
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)
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);
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
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;
}
(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]);
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)
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))
/*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),
}
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;
#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 *);
#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 \
#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) \
#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;
* 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;
}
* 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;
}
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];
}
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;
}
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;
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,
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;
}
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) {
* 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;
}
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;
}
* 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;
}
int clazz;
int swap;
struct stat st;
- php_off_t fsize;
+ zend_off_t fsize;
int flags = 0;
Elf32_Ehdr elf32hdr;
Elf64_Ehdr elf64hdr;
/*
* 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) {
#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 */
}
/* }}} */
-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;
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;
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;
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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);
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;
/* }}} */
/* {{{ _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];
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);
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);
/* }}} */
/* {{{ _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)
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);
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;
}
}
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;
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],
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;
}
}
} 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;
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],
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;
}
/* }}} */
/* {{{ _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;
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) {
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,
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;
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,
-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;
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;
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;
* 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++) {
}
}
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;
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);
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);
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);
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;
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)
#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
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);
#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 */ \
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)); \
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));
/* }}} */
/* 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)
}
/* }}} */
-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 */
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));
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))
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));
}
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 {
*/
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));
#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");
{
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;
}
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
}
#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
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);
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();
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];
{
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;
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);
}
H->pgoid = PQoidValue(res);
if (qs == PGRES_COMMAND_OK) {
- ZEND_ATOI(ret, PQcmdTuples(res));
+ ZEND_ATOL(ret, PQcmdTuples(res));
} else {
ret = Z_I(0);
}
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;
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);
}
}
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);
/* 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);
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;
}
} 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;
}
#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); \
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();
}
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);
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);
/**
* 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;
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
/* {{{ 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;
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;
/* 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)
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)
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;
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;
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;
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;
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);
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:
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;
}
}
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)) {
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;
}
/**
* 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);
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;
}
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;
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()
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) {
#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 */
}
/* }}} */
-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;
temp = 0;
}
- if (temp > eoffset + (php_off_t) entry->uncompressed_filesize) {
+ if (temp > eoffset + (zend_off_t) entry->uncompressed_filesize) {
return -1;
}
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;
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;
}
/* }}} */
#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;
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);
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;
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;
}
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;
}
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;
}
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;
}
/* 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");
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);
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");
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;
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;
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) {
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;
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;
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;
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;
}
/* 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:
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;
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;
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);
{
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);
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);
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 "
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]));
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));
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));
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;
}
};
/* }}} */
-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;
*/
/* }}} */
-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;
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 */
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));
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;
* 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;
}
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;
}
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;
}
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) {
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;
}
}
/* }}} */
-/* {{{ 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;
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
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);
/* 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));
/* 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;
/* 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];
/* 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;
/* 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;
/* 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];
/* 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]);
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;
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;
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;
}
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;
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) {
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;
{
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) {
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);
}
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));
}
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;
}
}
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++;
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);
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) {
#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 */
/* {{{ 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 */
/* {{{ 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;
/* {{{ 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;
{
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,
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)) {
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)) {
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 */
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)) {
*/
PHPAPI void php_statpage(TSRMLS_D)
{
- php_stat_t *pstat;
+ zend_stat_t *pstat;
pstat = sapi_get_stat(TSRMLS_C);
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;
}
}
- sscanf(hash, "$2y$" ZEND_INT_FMT "$", &cost);
+ sscanf(hash, "$2y$" ZEND_LONG_FMT "$", &cost);
if (cost != new_cost) {
RETURN_TRUE;
}
}
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();
}
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();
}
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;
}
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>");
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;
}
#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);
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);
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 */
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;
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;
}
}
* 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;
}
* 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++;
}
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++;
* 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;
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':
*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) {
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;
} 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);
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;
}
}
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
}
/* }}} */
-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";
if (start < 0) {
start = 0;
}
- } else if ((php_size_t)start > s11->len) {
+ } else if ((size_t)start > s11->len) {
RETURN_FALSE;
}
#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;
}
/* }}} */
* 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;
* 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;
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;
} 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 {
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 */
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 *));
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
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);
}
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;
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];
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;
/* {{{ 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;
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);
}
} 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);
/* {{{ 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)) {
/* }}} */
/* {{{ 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;
/* {{{ 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++) {
/* {{{ 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)) {
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;
/* {{{ 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;
/* {{{ 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++) {
/* {{{ 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) {
/* {{{ 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;
/* {{{ 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) {
/* {{{ 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);
}
/* {{{ 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;
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) {
/* {{{ 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);
}
/* {{{ 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. */
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;
* 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;
}
/* }}} */
-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);
}
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;
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;
}
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;
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;
/* 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;
}
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;
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;
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));
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 {
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 {
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;
#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;
}
/* }}} */
-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;
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);
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, ' ');
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));
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);
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, ' ');
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));
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:
{
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;
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;
}
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;
}
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;
}
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);
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);
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;
#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);
#include <locale.h>
#endif
#include "zend.h"
+#include "zend_types.h"
#include "zend_extensions.h"
#include "php_ini.h"
#include "php_globals.h"
{
zend_long i;
- ZEND_ATOI(i, new_value);
+ ZEND_ATOL(i, new_value);
if (i >= 0) {
EG(precision) = i;
return SUCCESS;
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);
{
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;
}
} 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;
}
/* {{{ 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);
}
/* {{{ 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);
*/
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;
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) {
/* {{{ 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);
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
# 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"
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);
/* 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)) {
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;
*/
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;
#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 {
}
/* 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);
/* 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;
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;
}
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));
}
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;
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);
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]")
}
/* }}} */
-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);
}
/* 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 */
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;
}
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;
}
/* 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("");
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) {
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) {
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';
*/
/* 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;
*/
/* 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;
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 */
* 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;
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;
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()
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
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;
/*
* 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);
}
/* }}} */
-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);
#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);
* 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) {
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
#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)
} 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];
/* 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;
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;
}
} 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);
}
#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;
/* 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;
}
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);
return tlen;
}
-static php_stat_t*
+static zend_stat_t*
php_apache_sapi_get_stat(TSRMLS_D)
{
php_struct *ctx = SG(server_context);
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);
}
}
#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) {
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) {
# 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));
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);
{
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);
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
#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");
/* 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);
}
}
#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;
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;
}
/* }}} */
-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) {
}
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;
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
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 {
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) {
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) {
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);
}
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;
}
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);
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;
}
-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) {
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 *,
glob_t *pglob;
size_t *limitp;
{
- php_stat_t sb;
+ zend_stat_t sb;
Char *p, *q;
int anymeta;
static int
g_lstat(fn, sb, pglob)
register Char *fn;
- php_stat_t *sb;
+ zend_stat_t *sb;
glob_t *pglob;
{
char buf[MAXPATHLEN];
static int
g_stat(fn, sb, pglob)
register Char *fn;
- php_stat_t *sb;
+ zend_stat_t *sb;
glob_t *pglob;
{
char buf[MAXPATHLEN];
# 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. */
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 */