diff options
| -rw-r--r-- | ports/avro-c/CONTROL | 4 | ||||
| -rw-r--r-- | ports/avro-c/portfile.cmake | 2 | ||||
| -rw-r--r-- | ports/avro-c/snappy.patch | 56 |
3 files changed, 59 insertions, 3 deletions
diff --git a/ports/avro-c/CONTROL b/ports/avro-c/CONTROL index 6dfdb7101..196c8936e 100644 --- a/ports/avro-c/CONTROL +++ b/ports/avro-c/CONTROL @@ -1,5 +1,5 @@ Source: avro-c -Version: 1.8.2-3 +Version: 1.8.2-4 Homepage: https://github.com/apache/avro Description: Apache Avro is a data serialization system -Build-Depends: jansson, liblzma, zlib +Build-Depends: jansson, liblzma, zlib, snappy diff --git a/ports/avro-c/portfile.cmake b/ports/avro-c/portfile.cmake index 23be8540e..0e74037fa 100644 --- a/ports/avro-c/portfile.cmake +++ b/ports/avro-c/portfile.cmake @@ -12,13 +12,13 @@ vcpkg_from_github( avro.patch avro-pr-217.patch fix-build-error.patch # Since jansson updated, use jansson::jansson instead of the macro ${JANSSON_LIBRARIES} + snappy.patch # https://github.com/apache/avro/pull/793 ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/lang/c PREFER_NINJA OPTIONS - -DCMAKE_DISABLE_FIND_PACKAGE_Snappy=ON ) vcpkg_install_cmake() diff --git a/ports/avro-c/snappy.patch b/ports/avro-c/snappy.patch new file mode 100644 index 000000000..60a40e300 --- /dev/null +++ b/ports/avro-c/snappy.patch @@ -0,0 +1,56 @@ +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");
|
