summaryrefslogtreecommitdiff
path: root/main/snprintf.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-08 19:47:30 +0000
committerMarcus Boerger <helly@php.net>2003-08-08 19:47:30 +0000
commit2ede480de2248684e6134621b9f2c6cf474bc73d (patch)
treed1d940049648da9dd2771d4fc50c837c9ca19ccb /main/snprintf.c
parentb1db823ad1968fa8845b1b9c40bd61b4b947bc65 (diff)
downloadphp-git-2ede480de2248684e6134621b9f2c6cf474bc73d.tar.gz
Bugfix #24063 (marcus/ilia)
Diffstat (limited to 'main/snprintf.c')
-rw-r--r--main/snprintf.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main/snprintf.c b/main/snprintf.c
index d2cd7d9674..bcd14f7036 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -344,9 +344,17 @@ ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
buf[0] = '\0';
return (buf);
}
- while (p <= p1 && p < &buf[NDIG]) {
+ if (p <= p1 && p < &buf[NDIG]) {
arg = modf(arg * 10, &fj);
- *p++ = (int) fj + '0';
+ if ((int)fj==10) {
+ *p++ = '1';
+ fj = 0;
+ *decpt = ++r2;
+ }
+ while (p <= p1 && p < &buf[NDIG]) {
+ *p++ = (int) fj + '0';
+ arg = modf(arg * 10, &fj);
+ }
}
if (p1 >= &buf[NDIG]) {
buf[NDIG - 1] = '\0';