From: Howard Chu Date: Fri, 30 Nov 2007 22:26:23 +0000 (+0000) Subject: Fix prev. Once more, with feeling. X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~374 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fab334d5f1f7014c8f32c87aac603ec181803f18;p=openldap Fix prev. Once more, with feeling. --- 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 );