diff options
author | Nikita Popov <nikic@php.net> | 2014-08-25 21:21:16 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-08-25 21:52:18 +0200 |
commit | 6db293d5e043d35c281a6b11cb68460f5d7188a9 (patch) | |
tree | d1880c1810fe147de6ff7f8ff317b4ec300a518f /main/snprintf.c | |
parent | 7813d85d3d5901b24f77b63538eb6754e161f471 (diff) | |
parent | 455741fce3c4f4392deb97775cba7a39f6490271 (diff) | |
download | php-git-6db293d5e043d35c281a6b11cb68460f5d7188a9.tar.gz |
Merge remote-tracking branch 'php-src/master' into ast
Conflicts:
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_globals.h
Zend/zend_language_parser.y
Zend/zend_language_scanner.c
Zend/zend_language_scanner.l
Zend/zend_types.h
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); |