X-Git-Url: https://git.sesse.net/?p=fjl;a=blobdiff_plain;f=dehuff.c;fp=dehuff.c;h=a7254692dd4f90deae10bc2fb571baf9952f26bb;hp=dd5c57dd940368f2f23481d909ac871d829e6f0a;hb=f6111465adacc2840f4cd25d55b3017cbf0593b2;hpb=4ccaf2a2ac9f78dcaaa1ba4a093b1ece3f915c94 diff --git a/dehuff.c b/dehuff.c index dd5c57d..a725469 100644 --- a/dehuff.c +++ b/dehuff.c @@ -9,7 +9,7 @@ void reliable_read(raw_input_func_t* input_func, void* userdata, uint8_t* buf, s { while (len > 0) { ssize_t bytes_read = input_func(userdata, buf, len); - assert(bytes_read <= len); + assert(bytes_read <= (ssize_t)len); // TODO: We need better error handling here. setjmp()/longjmp() // should hopefully do the trick, but we need to take care for @@ -159,7 +159,7 @@ unsigned read_huffman_symbol_slow_path(const struct huffman_table* table, unsigned code = read_bits(source, 1); int i = 0; - while (code > table->maxcode[i] || table->maxcode[i] == -1) { + while (table->maxcode[i] == -1 || code > (unsigned)table->maxcode[i]) { possibly_refill(source, 1); code = (code << 1) | read_bits(source, 1); ++i;