diff --git a/CHANGES b/CHANGES index 946b852..b1a5fdb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ 0.6: changed name to libowfat + fixed fmt_ulong (did not output 0 correctly) 0.5: made subdirectories for the different libraries. diff --git a/fmt/fmt_ulong.c b/fmt/fmt_ulong.c index 572c1d3..712e502 100644 --- a/fmt/fmt_ulong.c +++ b/fmt/fmt_ulong.c @@ -1,11 +1,11 @@ #include "fmt.h" unsigned int fmt_ulong(char *dest,unsigned long i) { - register unsigned long len,tmp; + register unsigned long len,tmp,len2; /* first count the number of bytes needed */ for (len=1, tmp=i; tmp>9; ++len) tmp/=10; if (dest) - for (tmp=i, dest+=len; tmp; tmp/=10) + for (tmp=i, dest+=len, len2=len+1; --len2; tmp/=10) *--dest = (tmp%10)+'0'; return len; }