#include <stdlib.h>
#include <assert.h>
+#include "bytesource.h"
#include "dehuff.h"
void reliable_read(raw_input_func_t* input_func, void* userdata, uint8_t* buf, size_t len)
{
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
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;