diff --git a/src/gzip_compress.c b/src/gzip_compress.c index eea49f3..30f48e9 100644 --- a/src/gzip_compress.c +++ b/src/gzip_compress.c @@ -32,7 +32,7 @@ gzip_compress(struct deflate_compressor *c, const void *in, size_t in_size, /* FLG */ *out_next++ = 0; /* MTIME */ - put_unaligned_u32_be(GZIP_MTIME_UNAVAILABLE, out_next); + put_unaligned_u32_le(GZIP_MTIME_UNAVAILABLE, out_next); out_next += 4; /* XFL */ xfl = 0; @@ -53,11 +53,11 @@ gzip_compress(struct deflate_compressor *c, const void *in, size_t in_size, out_next += deflate_size; /* CRC32 */ - put_unaligned_u32_be(crc32(in, in_size), out_next); + put_unaligned_u32_le(crc32(in, in_size), out_next); out_next += 4; /* ISIZE */ - put_unaligned_u32_be(in_size, out_next); + put_unaligned_u32_le(in_size, out_next); out_next += 4; return out_next - (u8 *)out; diff --git a/src/gzip_decompress.c b/src/gzip_decompress.c index 6b03f70..0c9bb60 100644 --- a/src/gzip_decompress.c +++ b/src/gzip_decompress.c @@ -43,7 +43,7 @@ gzip_decompress(struct deflate_decompressor *d, /* Extra field */ if (flg & GZIP_FEXTRA) { - u16 xlen = get_unaligned_u16_be(in_next); + u16 xlen = get_unaligned_u16_le(in_next); in_next += 2; if (in_end - in_next < (u32)xlen + GZIP_FOOTER_SIZE) @@ -87,12 +87,12 @@ gzip_decompress(struct deflate_decompressor *d, in_next = in_end - GZIP_FOOTER_SIZE; /* CRC32 */ - if (crc32(out, out_nbytes) != get_unaligned_u32_be(in_next)) + if (crc32(out, out_nbytes) != get_unaligned_u32_le(in_next)) return false; in_next += 4; /* ISIZE */ - if ((u32)out_nbytes != get_unaligned_u32_be(in_next)) + if ((u32)out_nbytes != get_unaligned_u32_le(in_next)) return false; return true;