]> git.sur5r.net Git - openldap/commitdiff
Fix prev. Once more, with feeling.
authorHoward Chu <hyc@openldap.org>
Fri, 30 Nov 2007 22:26:23 +0000 (22:26 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 30 Nov 2007 22:26:23 +0000 (22:26 +0000)
libraries/liblutil/utils.c

index 769a4db6bc3acdcd000dff2d0a626368cbbc2d69..30738c869c262a7c738d1e27575e01aaa5018ace 100644 (file)
@@ -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 );