]> mj.ucw.cz Git - libucw.git/commitdiff
ff-varints: Fixed really silly bug in handling fastbufs.
authorTomas Valla <tom@ucw.cz>
Sat, 20 Jul 2013 10:00:17 +0000 (12:00 +0200)
committerTomas Valla <tom@ucw.cz>
Sat, 20 Jul 2013 10:00:17 +0000 (12:00 +0200)
Commit d7762233d87dfea537c963e813daba8fa72bf2be from MD2.

ucw/ff-varint.h

index 3228fbfa017c3c90a37a329713d84482d5871fd4..2913267943ba9fad97cc186993ac7f9151caa175 100644 (file)
@@ -26,8 +26,8 @@ static inline u64 bget_varint_repl(struct fastbuf *b, u64 repl)
        if (bavailr(b) >= 1) {
                l = varint_len(*b->bptr);
                if (bavailr(b) >= l) {
-                       b->bptr += l;
                        varint_get(b->bptr, &repl);
+                       b->bptr += l;
                        return repl;
                }
        }
@@ -38,7 +38,7 @@ static inline u64 bget_varint_repl(struct fastbuf *b, u64 repl)
  * Reads u64 encoded as varint from the fastbuf b.
  * If the read is unsuccessful, returns ~0LLU.
  **/
-static inline int bget_varint(struct fastbuf *b)
+static inline u64 bget_varint(struct fastbuf *b)
 {
        return bget_varint_repl(b, ~0LLU);
 }