summaryrefslogtreecommitdiff
path: root/ext/standard/scanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/scanf.c')
-rw-r--r--ext/standard/scanf.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index f5f97161f2..815d7c7290 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -356,7 +356,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs)
* must not be a mixture of XPG3 specs and non-XPG3 specs
* in the same format string.
*/
- value = strtoul(format-1, &end, 10);
+ value = ZEND_STRTOUI(format-1, &end, 10);
if (*end != '$') {
goto notXpg;
}
@@ -403,7 +403,7 @@ xpgCheckDone:
* Parse any width specifier.
*/
if (isdigit(UCHAR(*ch))) {
- value = strtoul(format-1, &format, 10);
+ value = ZEND_STRTOUI(format-1, &format, 10);
flags |= SCAN_WIDTH;
ch = format++;
}
@@ -582,7 +582,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
{
int numVars, nconversions, totalVars = -1;
int i, result;
- long value;
+ php_int_t value;
int objIndex;
char *end, *baseString;
zval *current;
@@ -590,7 +590,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
int base = 0;
int underflow = 0;
size_t width;
- long (*fn)() = NULL;
+ php_int_t (*fn)() = NULL;
char *ch, sch;
int flags;
char buf[64]; /* Temporary buffer to hold scanned number
@@ -708,7 +708,7 @@ literal:
flags |= SCAN_SUPPRESS;
ch = format++;
} else if ( isdigit(UCHAR(*ch))) {
- value = strtoul(format-1, &end, 10);
+ value = ZEND_STRTOUI(format-1, &end, 10);
if (*end == '$') {
format = end+1;
ch = format++;
@@ -720,7 +720,7 @@ literal:
* Parse any width specifier.
*/
if ( isdigit(UCHAR(*ch))) {
- width = strtoul(format-1, &format, 10);
+ width = ZEND_STRTOUI(format-1, &format, 10);
ch = format++;
} else {
width = 0;
@@ -744,9 +744,9 @@ literal:
} else if (numVars) {
current = Z_REFVAL(args[objIndex++]);
zval_ptr_dtor(current);
- ZVAL_LONG(current, (long)(string - baseString) );
+ ZVAL_INT(current, (php_int_t)(string - baseString) );
} else {
- add_index_long(return_value, objIndex++, string - baseString);
+ add_index_int(return_value, objIndex++, string - baseString);
}
}
nconversions++;
@@ -756,29 +756,29 @@ literal:
case 'D':
op = 'i';
base = 10;
- fn = (long (*)())strtol;
+ fn = (php_int_t (*)())ZEND_STRTOI_PTR;
break;
case 'i':
op = 'i';
base = 0;
- fn = (long (*)())strtol;
+ fn = (php_int_t (*)())ZEND_STRTOI_PTR;
break;
case 'o':
op = 'i';
base = 8;
- fn = (long (*)())strtol;
+ fn = (php_int_t (*)())ZEND_STRTOI_PTR;
break;
case 'x':
case 'X':
op = 'i';
base = 16;
- fn = (long (*)())strtol;
+ fn = (php_int_t (*)())ZEND_STRTOI_PTR;
break;
case 'u':
op = 'i';
base = 10;
flags |= SCAN_UNSIGNED;
- fn = (long (*)())strtoul;
+ fn = (php_int_t (*)())ZEND_STRTOUI_PTR;
break;
case 'f':
@@ -1049,9 +1049,9 @@ addToInt:
*/
if (!(flags & SCAN_SUPPRESS)) {
*end = '\0';
- value = (long) (*fn)(buf, NULL, base);
+ value = (php_int_t) (*fn)(buf, NULL, base);
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
- snprintf(buf, sizeof(buf), "%lu", value); /* INTL: ISO digit */
+ snprintf(buf, sizeof(buf), ZEND_UINT_FMT, value); /* INTL: ISO digit */
if (numVars && objIndex >= argCount) {
break;
} else if (numVars) {
@@ -1068,9 +1068,9 @@ addToInt:
} else if (numVars) {
current = Z_REFVAL(args[objIndex++]);
zval_ptr_dtor(current);
- ZVAL_LONG(current, value);
+ ZVAL_INT(current, value);
} else {
- add_index_long(return_value, objIndex++, value);
+ add_index_int(return_value, objIndex++, value);
}
}
}
@@ -1190,8 +1190,8 @@ done:
scan_set_error_return( numVars, return_value );
result = SCAN_ERROR_EOF;
} else if (numVars) {
- convert_to_long(return_value );
- Z_LVAL_P(return_value) = nconversions;
+ convert_to_int(return_value );
+ Z_IVAL_P(return_value) = nconversions;
} else if (nconversions < totalVars) {
/* TODO: not all elements converted. we need to prune the list - cc */
}
@@ -1203,7 +1203,7 @@ done:
static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */
{
if (numVars) {
- ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */
+ ZVAL_INT(return_value, SCAN_ERROR_EOF); /* EOF marker */
} else {
/* convert_to_null calls destructor */
convert_to_null(return_value);