Re: [AD] [AL] Leading zero in textprintf()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thu, Feb 03, 2000 at 12:24:31PM -0500, Damian Yerrick wrote:
> /*   B U G   A L E R T !

Hey, calm down. :)  Well spotted, here's a patch.  Apply it from
Allegro's directory with the `-p 1' option.  The fix is simple,
so let me know if you (or anyone else) doesn't know how to apply
patches.

George

--- allegro-3.9.31/src/unicode.c.old	Sun Jan 30 21:49:02 2000
+++ allegro-3.9.31/src/unicode.c	Thu Feb  3 19:59:42 2000
@@ -2225,10 +2225,10 @@
    int i = 0;
    int len;
 
-   do {
-      tmp[i++] = (int)fmod(val, 10);
+   while ((i < 512) && ((tmp[i] = (int)fmod(val, 10)) != 0)) {
+      i++;
       val /= 10;
-   } while ((val > 0.95) && (i < 512));
+   }
 
    for (len=i; len<precision; len++)
       *buf += usetc(*buf, '0');


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/