helly Thu Jul 17 17:26:25 2003 EDT Modified files: /php-src/main snprintf.c Log: Fix text output of numbers with absolute exponent greater than or equal 80. # # Probably not last conclusion on wisdom. But i looked up current apache # sources and they have the same error and so this must do the trick. # Index: php-src/main/snprintf.c diff -u php-src/main/snprintf.c:1.24 php-src/main/snprintf.c:1.25 --- php-src/main/snprintf.c:1.24 Sun Jun 29 21:03:21 2003 +++ php-src/main/snprintf.c Thu Jul 17 17:26:25 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: snprintf.c,v 1.24 2003/06/30 01:03:21 iliaa Exp $ */ +/* $Id: snprintf.c,v 1.25 2003/07/17 21:26:25 helly Exp $ */ /* ==================================================================== * Copyright (c) 1995-1998 The Apache Group. All rights reserved. @@ -152,6 +152,8 @@ return (p); } +/* If you change this value then also change bug24640.phpt. + */ #define NDIG 80 @@ -291,6 +293,7 @@ ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf) { register int r2; + int mvl; double fi, fj; register char *p, *p1; @@ -310,9 +313,16 @@ */ if (fi != 0) { p1 = &buf[NDIG]; - while (p1 > &buf[0] && fi != 0) { + while (fi != 0) { fj = modf(fi / 10, &fi); - *--p1 = (int) ((fj + .03) * 10) + '0'; + if (p1 > &buf[0]) { + *--p1 = (int) ((fj + .03) * 10) + '0'; + } else { + mvl = NDIG - ndigits; + memmove(&buf[mvl], &buf[0], NDIG-mvl-1); + p1 += mvl; + *--p1 = (int) ((fj + .03) * 10) + '0'; + } r2++; } while (p1 < &buf[NDIG])
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php