diff options
Diffstat (limited to 'main/snprintf.c')
-rw-r--r-- | main/snprintf.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/main/snprintf.c b/main/snprintf.c index 914cac7133..0675538ac5 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -312,7 +312,7 @@ PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, c */ /* char * ap_php_conv_10() {{{ */ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, - register bool_int * is_negative, char *buf_end, register int *len) + register bool_int * is_negative, char *buf_end, register size_t *len) { register char *p = buf_end; register u_wide_int magnitude; @@ -370,7 +370,7 @@ char * ap_php_conv_10(register wide_int num, register bool_int is_unsigned, */ /* PHPAPI char * php_conv_fp() {{{ */ PHPAPI char * php_conv_fp(register char format, register double num, - boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, int *len) + boolean_e add_dp, int precision, char dec_point, bool_int * is_negative, char *buf, size_t *len) { register char *s = buf; register char *p, *p_orig; @@ -438,7 +438,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, if (format != 'F') { char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - int t_len; + size_t t_len; bool_int exponent_is_negative; *s++ = format; /* either e or E */ @@ -474,7 +474,7 @@ PHPAPI char * php_conv_fp(register char format, register double num, * which is a pointer to the END of the buffer + 1 (i.e. if the buffer * is declared as buf[ 100 ], buf_end should be &buf[ 100 ]) */ -char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register int *len) /* {{{ */ +char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format, char *buf_end, register size_t *len) /* {{{ */ { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -584,10 +584,11 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / char *sp; char *bep; int cc = 0; - int i; + size_t i; char *s = NULL; - int s_len, free_zcopy; + size_t s_len; + int free_zcopy; zval *zvp, zcopy; int min_width = 0; @@ -758,6 +759,10 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / modifier = LM_SIZE_T; #endif break; + case 'p': + fmt++; + modifier = LM_PHP_INT_T; + break; case 'h': fmt++; if (*fmt == 'h') { @@ -823,6 +828,9 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / i_num = (wide_int) va_arg(ap, ptrdiff_t); break; #endif + case LM_PHP_INT_T: + i_num = (wide_int) va_arg(ap, zend_ulong); + break; } /* * The rest also applies to other integer formats, so fall @@ -865,6 +873,9 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / i_num = (wide_int) va_arg(ap, ptrdiff_t); break; #endif + case LM_PHP_INT_T: + i_num = (wide_int) va_arg(ap, zend_long); + break; } } s = ap_php_conv_10(i_num, (*fmt) == 'u', &is_negative, @@ -911,6 +922,9 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / ui_num = (u_wide_int) va_arg(ap, ptrdiff_t); break; #endif + case LM_PHP_INT_T: + ui_num = (u_wide_int) va_arg(ap, zend_ulong); + break; } s = ap_php_conv_p2(ui_num, 3, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); FIX_PRECISION(adjust_precision, precision, s, s_len); @@ -950,6 +964,9 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) / ui_num = (u_wide_int) va_arg(ap, ptrdiff_t); break; #endif + case LM_PHP_INT_T: + ui_num = (u_wide_int) va_arg(ap, zend_ulong); + break; } s = ap_php_conv_p2(ui_num, 4, *fmt, &num_buf[NUM_BUF_SIZE], &s_len); FIX_PRECISION(adjust_precision, precision, s, s_len); |