uint64_decimal() incorrectly output 0 as "" instead of "0". This only affected
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 25 Nov 2004 13:40:01 +0000 (13:40 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 25 Nov 2004 13:40:01 +0000 (13:40 +0000)
PSFTP's "reput" chat. Spotted by Greg Parker.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4904 cda61777-01e9-0310-a592-d414129be87e

int64.c

diff --git a/int64.c b/int64.c
index 7997114..8a1cda1 100644 (file)
--- a/int64.c
+++ b/int64.c
@@ -36,11 +36,11 @@ void uint64_decimal(uint64 x, char *buffer)
     int start = 20;
     int d;
 
-    while (x.hi || x.lo) {
+    do {
        x = uint64_div10(x, &d);
        assert(start > 0);
        buf[--start] = d + '0';
-    }
+    } while (x.hi || x.lo);
 
     memcpy(buffer, buf + start, sizeof(buf) - start);
     buffer[sizeof(buf) - start] = '\0';