lz4/fpga_compress: avoid alignment problems

fpga_compress.c:176:32: warning: cast from 'char *' to 'int *' increases required alignment from 1 to 4 [-Wcast-align]
        const int cmp_bytes = *(int*)(compressed_fpga_stream.next_in);
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Philippe Teuwen 2020-06-07 13:10:59 +02:00
parent df9f34ba2b
commit ef6b775f9f

View file

@ -173,7 +173,8 @@ static int zlib_decompress(FILE *infile, FILE *outfile) {
int total_size = 0;
while (compressed_fpga_stream.avail_in > 0) {
const int cmp_bytes = *(int*)(compressed_fpga_stream.next_in);
int cmp_bytes;
memcpy(&cmp_bytes, compressed_fpga_stream.next_in, sizeof(int));
compressed_fpga_stream.next_in += 4;
compressed_fpga_stream.avail_in -= cmp_bytes + 4;
const int decBytes = LZ4_decompress_safe_continue(compressed_fpga_stream.lz4StreamDecode, compressed_fpga_stream.next_in, outbuf, cmp_bytes, FPGA_RING_BUFFER_BYTES);