diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2019-09-21 16:55:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-21 16:55:59 (GMT) |
commit | d5ceafd4118c88e2372b0ccb35f8352f25f172a1 (patch) | |
tree | 9e781487d4edb42d1c90d5709f1eacc1558bd5e6 | |
parent | 804d47cf78b36edc05e29aa89e64d72b53200aeb (diff) | |
parent | c5a83c1a48722108460f8542d92703fd5f59e296 (diff) | |
download | lz4-d5ceafd4118c88e2372b0ccb35f8352f25f172a1.zip lz4-d5ceafd4118c88e2372b0ccb35f8352f25f172a1.tar.gz lz4-d5ceafd4118c88e2372b0ccb35f8352f25f172a1.tar.bz2 |
Merge pull request #793 from nigeltao/dev
Have read_variable_length use fixed size types
-rw-r--r-- | lib/lz4.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -249,6 +249,10 @@ static int g_debuglog_enable = 1; typedef uint64_t U64; typedef uintptr_t uptrval; #else +# include <limits.h> +# if UINT_MAX != 4294967295UL +# error "LZ4 code (when not C++ or C99) assumes that sizeof(int) == 4" +# endif typedef unsigned char BYTE; typedef unsigned short U16; typedef unsigned int U32; @@ -1625,8 +1629,8 @@ typedef enum { loop_error = -2, initial_error = -1, ok = 0 } variable_length_err LZ4_FORCE_INLINE unsigned read_variable_length(const BYTE**ip, const BYTE* lencheck, int loop_check, int initial_check, variable_length_error* error) { - unsigned length = 0; - unsigned s; + U32 length = 0; + U32 s; if (initial_check && unlikely((*ip) >= lencheck)) { /* overflow detection */ *error = initial_error; return length; |