vcpkg/ports/avro-c/snappy-pr-793.patch
Michael Spector b5e59140cb
Upgrade Avro to 1.9.2 release (#10380)
* Upgrade Avro to 1.9.2 release

* Apply CR fixes

* Applied CR recommendations
2020-03-18 23:06:04 -07:00

57 lines
1.9 KiB
Diff

diff -ru b/c/src/codec.c a/lang/c/src/codec.c
--- b/lang/c/src/codec.c 2020-01-23 16:18:15.119970300 +0200
+++ a/lang/c/src/codec.c 2020-01-23 19:31:41.679834300 +0200
@@ -24,6 +24,9 @@
# elif defined(__FreeBSD__)
# include <sys/endian.h>
# define __bswap_32 bswap32
+# elif defined(_WIN32)
+# include <stdlib.h>
+# define __bswap_32 _byteswap_ulong
# else
# include <byteswap.h>
# endif
@@ -115,14 +118,14 @@
return 1;
}
- if (snappy_compress(data, len, c->block_data, &outlen) != SNAPPY_OK)
+ if (snappy_compress((const char *)data, len, (char*)c->block_data, &outlen) != SNAPPY_OK)
{
avro_set_error("Error compressing block with Snappy");
return 1;
}
- crc = __bswap_32(crc32(0, data, len));
- memcpy(c->block_data+outlen, &crc, 4);
+ crc = __bswap_32(crc32(0, (const Bytef *)data, len));
+ memcpy((char*)c->block_data+outlen, &crc, 4);
c->used_size = outlen+4;
return 0;
@@ -133,7 +136,7 @@
uint32_t crc;
size_t outlen;
- if (snappy_uncompressed_length(data, len-4, &outlen) != SNAPPY_OK) {
+ if (snappy_uncompressed_length((const char*)data, len-4, &outlen) != SNAPPY_OK) {
avro_set_error("Uncompressed length error in snappy");
return 1;
}
@@ -152,13 +155,13 @@
return 1;
}
- if (snappy_uncompress(data, len-4, c->block_data, &outlen) != SNAPPY_OK)
+ if (snappy_uncompress((const char*)data, len-4, (char*)c->block_data, &outlen) != SNAPPY_OK)
{
avro_set_error("Error uncompressing block with Snappy");
return 1;
}
- crc = __bswap_32(crc32(0, c->block_data, outlen));
+ crc = __bswap_32(crc32(0, (const Bytef *)c->block_data, outlen));
if (memcmp(&crc, (char*)data+len-4, 4))
{
avro_set_error("CRC32 check failure uncompressing block with Snappy");