Re: cvs: php4 /ext/standard formatted_print.c
| From: | derick@php.net | Date: | Sun, 16 Jun 2002 19:51:00 +0000 |
| Subject: | Re: cvs: php4 /ext/standard formatted_print.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-12381@lists.php.net to get a copy of this message | ||
On Sun, 16 Jun 2002, Hartmut Holzgraefe wrote:
> hholzgra Sun Jun 16 09:14:21 2002 EDT
>
> Modified files:
> /php4/ext/standard formatted_print.c
> Log:
> make sprinf() locale-aware (Bug# 12647)
This breaks the build for me (because decimal_point doesn't exist in
compiler_globals).
Derick
>
>
> Index: php4/ext/standard/formatted_print.c
> diff -u php4/ext/standard/formatted_print.c:1.47 php4/ext/standard/formatted_print.c:1.48
> --- php4/ext/standard/formatted_print.c:1.47 Fri Mar 22 04:09:18 2002
> +++ php4/ext/standard/formatted_print.c Sun Jun 16 09:14:21 2002
> @@ -16,7 +16,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: formatted_print.c,v 1.47 2002/03/22 09:09:18 derick Exp $ */
> +/* $Id: formatted_print.c,v 1.48 2002/06/16 13:14:21 hholzgra Exp $ */
>
> #include <math.h> /* modf() */
> #include "php.h"
> @@ -274,6 +274,15 @@
> char *cvt;
> register int i = 0, j = 0;
> int sign, decpt;
> +#ifdef HAVE_LOCALECONV
> + char decimal_point;
> + TSRMLS_FETCH();
> +
> + decimal_point = CG(decimal_point);
> +#else
> +#define decimal_point '.'
> +#endif
> +
>
> PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d,
> %c)\n",
> *buffer, pos, size, number, width, padding, alignment, fmt));
> @@ -308,7 +317,7 @@
> numbuf[i++] = '0';
> if (precision > 0) {
> int k = precision;
> - numbuf[i++] = '.';
> + numbuf[i++] = decimal_point;
> while ((decpt++ < 0) && k--) {
> numbuf[i++] = '0';
> }
> @@ -317,12 +326,12 @@
> while (decpt-- > 0)
> numbuf[i++] = cvt[j++];
> if (precision > 0)
> - numbuf[i++] = '.';
> + numbuf[i++] = decimal_point;
> }
> } else {
> numbuf[i++] = cvt[j++];
> if (precision > 0)
> - numbuf[i++] = '.';
> + numbuf[i++] = decimal_point;
> }
>
> while (cvt[j]) {
> @@ -336,6 +345,9 @@
> }
> php_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding,
> alignment, i, sign, 0);
> +#ifndef HAVE_LOCALECONV
> +#undef decimal_point
> +#endif
> }
>
>
> @@ -583,7 +595,7 @@
>
> case 'e':
> case 'f':
> - /* XXX not done */
> + /* XXX not done */ /* ??? WTF? 'g' missing or what? (hartmut) */
> convert_to_double_ex(args[argnum]);
> php_sprintf_appenddouble(&result, &outpos, &size,
> Z_DVAL_PP(args[argnum]),
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
---------------------------------------------------------------------------
Did I help you? http://www.jdimedia.nl/derick/link.php?url=giftlist
Frequent ranting: http://www.jdimedia.nl/derick/
---------------------------------------------------------------------------
PHP: Scripting the Web - derick@php.net
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---------------------------------------------------------------------------