]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | diff -ru b/c/src/codec.c a/lang/c/src/codec.c |
2 | --- b/lang/c/src/codec.c 2020-01-23 16:18:15.119970300 +0200 | |
3 | +++ a/lang/c/src/codec.c 2020-01-23 19:31:41.679834300 +0200 | |
4 | @@ -24,6 +24,9 @@ | |
5 | # elif defined(__FreeBSD__) | |
6 | # include <sys/endian.h> | |
7 | # define __bswap_32 bswap32 | |
8 | +# elif defined(_WIN32) | |
9 | +# include <stdlib.h> | |
10 | +# define __bswap_32 _byteswap_ulong | |
11 | # else | |
12 | # include <byteswap.h> | |
13 | # endif | |
14 | @@ -115,14 +118,14 @@ | |
15 | return 1; | |
16 | } | |
17 | ||
18 | - if (snappy_compress(data, len, c->block_data, &outlen) != SNAPPY_OK) | |
19 | + if (snappy_compress((const char *)data, len, (char*)c->block_data, &outlen) != SNAPPY_OK) | |
20 | { | |
21 | avro_set_error("Error compressing block with Snappy"); | |
22 | return 1; | |
23 | } | |
24 | ||
25 | - crc = __bswap_32(crc32(0, data, len)); | |
26 | - memcpy(c->block_data+outlen, &crc, 4); | |
27 | + crc = __bswap_32(crc32(0, (const Bytef *)data, len)); | |
28 | + memcpy((char*)c->block_data+outlen, &crc, 4); | |
29 | c->used_size = outlen+4; | |
30 | ||
31 | return 0; | |
32 | @@ -133,7 +136,7 @@ | |
33 | uint32_t crc; | |
34 | size_t outlen; | |
35 | ||
36 | - if (snappy_uncompressed_length(data, len-4, &outlen) != SNAPPY_OK) { | |
37 | + if (snappy_uncompressed_length((const char*)data, len-4, &outlen) != SNAPPY_OK) { | |
38 | avro_set_error("Uncompressed length error in snappy"); | |
39 | return 1; | |
40 | } | |
41 | @@ -152,13 +155,13 @@ | |
42 | return 1; | |
43 | } | |
44 | ||
45 | - if (snappy_uncompress(data, len-4, c->block_data, &outlen) != SNAPPY_OK) | |
46 | + if (snappy_uncompress((const char*)data, len-4, (char*)c->block_data, &outlen) != SNAPPY_OK) | |
47 | { | |
48 | avro_set_error("Error uncompressing block with Snappy"); | |
49 | return 1; | |
50 | } | |
51 | ||
52 | - crc = __bswap_32(crc32(0, c->block_data, outlen)); | |
53 | + crc = __bswap_32(crc32(0, (const Bytef *)c->block_data, outlen)); | |
54 | if (memcmp(&crc, (char*)data+len-4, 4)) | |
55 | { | |
56 | avro_set_error("CRC32 check failure uncompressing block with Snappy"); |