diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-12 00:52:41 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2020-09-12 00:52:41 +0100 |
commit | 6fc69c5d349b2954fdd0d241d1f3d0836676e557 (patch) | |
tree | 29b6c847ab98d7ea923a16e64ea956eacb40642b | |
parent | 13ab608a4bb4b6093c6095a2a0b975a3572855c2 (diff) | |
download | pack-6fc69c5d349b2954fdd0d241d1f3d0836676e557.tar.gz pack-6fc69c5d349b2954fdd0d241d1f3d0836676e557.tar.xz pack-6fc69c5d349b2954fdd0d241d1f3d0836676e557.zip |
unpack: Make input buffer const
-rw-r--r-- | pack.h | 2 | ||||
-rw-r--r-- | unpack.c | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -20,7 +20,7 @@ extern enum pack_trace { PACK_TRACE_ALL, } pack_trace; -enum pack_status unpack(void *buf, size_t size, const char *fmt, ...); +enum pack_status unpack(const void *buf, size_t size, const char *fmt, ...); const char *pack_strerror(enum pack_status status); @@ -54,7 +54,7 @@ static type convert_ieee754b##total(uintmax_t b) \ GEN_CONV_IEEE754B(float, 32, 8, 23) GEN_CONV_IEEE754B(double, 64, 11, 52) -static uintmax_t read_val(unsigned char *buf, size_t size, enum endian e) +static uintmax_t read_val(const unsigned char *buf, size_t size, enum endian e) { uintmax_t val = 0; @@ -65,10 +65,10 @@ static uintmax_t read_val(unsigned char *buf, size_t size, enum endian e) return val; } -enum pack_status unpack(void *buf_, size_t size, const char *fmt, ...) +enum pack_status unpack(const void *buf_, size_t size, const char *fmt, ...) { enum endian endianness = BIG; - unsigned char *buf = buf_; + const unsigned char *buf = buf_; size_t offset = 0; va_list ap; |