Rename read_length to read_uint16, and add a read_uint8.
authorSteinar H. Gunderson <sesse@debian.org>
Sat, 3 Jan 2009 11:30:49 +0000 (12:30 +0100)
committerSteinar H. Gunderson <sesse@debian.org>
Sat, 3 Jan 2009 11:30:49 +0000 (12:30 +0100)
dehuff.c
input.c
input.h

index b44218d..af16b51 100644 (file)
--- a/dehuff.c
+++ b/dehuff.c
@@ -8,7 +8,7 @@
 
 void read_huffman_tables(huffman_tables_t* dst, input_func_t* input_func, void* userdata)
 {
-       size_t len = read_length(input_func, userdata);
+       size_t len = read_uint16(input_func, userdata);
        assert(len > 2);
        len -= 2;
 
diff --git a/input.c b/input.c
index 2d80457..6bcfd3a 100644 (file)
--- a/input.c
+++ b/input.c
@@ -27,7 +27,14 @@ void reliable_read(raw_input_func_t* input_func, void* userdata, uint8_t* buf, s
        }
 }
 
-uint16_t read_length(raw_input_func_t* input_func, void* userdata)
+uint8_t read_uint8(raw_input_func_t* input_func, void* userdata)
+{
+       uint8_t ret;
+       reliable_read(input_func, userdata, &ret, 1);
+       return ret;
+}
+
+uint16_t read_uint16(raw_input_func_t* input_func, void* userdata)
 {
        uint8_t buf[2];
        reliable_read(input_func, userdata, buf, 2);
diff --git a/input.h b/input.h
index be60c5a..b57c814 100644 (file)
--- a/input.h
+++ b/input.h
@@ -14,6 +14,8 @@ typedef ssize_t (input_func_t)(void*, uint8_t*, size_t);
 typedef ssize_t (raw_input_func_t)(void*, uint8_t*, size_t);
 
 void reliable_read(raw_input_func_t* input_func, void* userdata, uint8_t* buf, size_t len);
-uint16_t read_length(raw_input_func_t* input_func, void* userdata);
+
+uint8_t read_uint8(raw_input_func_t* input_func, void* userdata);
+uint16_t read_uint16(raw_input_func_t* input_func, void* userdata);
 
 #endif /* !defined(_INPUT_H) */