From fab334d5f1f7014c8f32c87aac603ec181803f18 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 30 Nov 2007 22:26:23 +0000 Subject: [PATCH] Fix prev. Once more, with feeling. --- libraries/liblutil/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 769a4db6bc..30738c869c 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -641,11 +641,13 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp ) } out = tmp + prev->bufsiz; - for ( i = -1; new ; i-- ) { + i = 0; + do { + i--; new += out[i]; out[i] = new & 0xff; new >>= 8; - } + } while ( new ); prev->beg = prev->bufsiz + i; prev->len = -i; AC_MEMCPY( prev->buf+prev->beg, tmp+prev->beg, prev->len ); -- 2.39.5