From a0cc5d84be8d991c3c863bb89343243c9505f3fa Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 2 Feb 2014 10:15:14 +1100 Subject: [PATCH] Add explicit casts to make clang support easier - see #755 --- native/compile-native.sh | 2 +- native/src/main/c/NativeCipherImpl.c | 4 ++-- native/src/main/resources/native-cipher.so | Bin 8277 -> 8277 bytes 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/native/compile-native.sh b/native/compile-native.sh index 99ba41d2..ecfd206a 100755 --- a/native/compile-native.sh +++ b/native/compile-native.sh @@ -1,3 +1,3 @@ #!/bin/sh -gcc -shared -fPIC -O3 -Werror -I/usr/lib/jvm/default-java/include/ src/main/c/NativeCipherImpl.c -o src/main/resources/native-cipher.so -lcrypto +gcc -shared -fPIC -O3 -Werror -I$JAVA_HOME/include/ src/main/c/NativeCipherImpl.c -o src/main/resources/native-cipher.so -lcrypto diff --git a/native/src/main/c/NativeCipherImpl.c b/native/src/main/c/NativeCipherImpl.c index 41884025..6e35aa68 100644 --- a/native/src/main/c/NativeCipherImpl.c +++ b/native/src/main/c/NativeCipherImpl.c @@ -11,7 +11,7 @@ jlong Java_net_md_15_bungee_NativeCipherImpl_init AES_KEY *aes_key = malloc(sizeof(AES_KEY)); jboolean isKeyCopy; - BYTE *key_bytes = (*env)->GetByteArrayElements(env, key, &isKeyCopy); + BYTE *key_bytes = (BYTE*)(*env)->GetByteArrayElements(env, key, &isKeyCopy); int key_length = (*env)->GetArrayLength(env, key) * 8; // in bits AES_set_encrypt_key(key_bytes, key_length, aes_key); @@ -37,7 +37,7 @@ void Java_net_md_15_bungee_NativeCipherImpl_cipher BYTE *output = (BYTE*) out; jboolean isCopy; - BYTE *iv_bytes = (*env)->GetByteArrayElements(env, iv, &isCopy); + BYTE *iv_bytes = (BYTE*)(*env)->GetByteArrayElements(env, iv, &isCopy); AES_cfb8_encrypt( input, // input buffer diff --git a/native/src/main/resources/native-cipher.so b/native/src/main/resources/native-cipher.so index 262be07b10cba6dcb019406ebf12adfc6b8fdaca..03d70f6d70920cc175577d79108a1e12fdec506d 100755 GIT binary patch delta 40 ycmV+@0N4N3K-EC7*Z~ywL-?Nw2!~j6w!Ibw-|5?1hd08r>;Z-j0XegC5aJJ$5fYpL delta 40 ycmV+@0N4N3K-EC7*Z~x@;Z-j0XVaB5aJJc`Vlh#