]> git.sesse.net Git - fjl/blobdiff - dehuff.c
Fix signedness warnings.
[fjl] / dehuff.c
index dd5c57dd940368f2f23481d909ac871d829e6f0a..a7254692dd4f90deae10bc2fb571baf9952f26bb 100644 (file)
--- 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;