mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 00:29:00 +08:00
533b881fff
* Enable Snappy codec in Avro * Use _WIN32 macro (instead of WIN32) * Added reference to Avro PR * Increment version
57 lines
1.9 KiB
Diff
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
|
|
@@ -21,6 +21,9 @@
|
|
# if defined(__APPLE__)
|
|
# include <libkern/OSByteOrder.h>
|
|
# define __bswap_32 OSSwapInt32
|
|
+# 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");
|