From fed7278fcd4fb85bc7b691e6918ce6ff6f933d52 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Tue, 13 Aug 2013 17:00:54 +0900 Subject: [PATCH] Fix #29. Need to recreate native libraries for all OSes --- .../java/org/xerial/snappy/SnappyNative.cpp | 13 +++++++++++++ .../java/org/xerial/snappy/SnappyNative.h | 8 ++++++++ .../java/org/xerial/snappy/SnappyNative.java | 2 ++ .../native/Mac/x86_64/libsnappyjava.jnilib | Bin 48156 -> 48244 bytes 4 files changed, 23 insertions(+) diff --git a/src/main/java/org/xerial/snappy/SnappyNative.cpp b/src/main/java/org/xerial/snappy/SnappyNative.cpp index f3d1f51..78af982 100755 --- a/src/main/java/org/xerial/snappy/SnappyNative.cpp +++ b/src/main/java/org/xerial/snappy/SnappyNative.cpp @@ -270,6 +270,19 @@ JNIEXPORT jboolean JNICALL Java_org_xerial_snappy_SnappyNative_isValidCompressed return ret; } +JNIEXPORT jboolean JNICALL Java_org_xerial_snappy_SnappyNative_isValidCompressedBuffer__JJJ + (JNIEnv * env, jobject self, jlong inputAddr, jlong offset, jlong length) +{ + if(inputAddr == 0) { + // out of memory + throw_exception(env, self, 4); + return 0; + } + bool ret = snappy::IsValidCompressedBuffer((char*) (inputAddr + offset), (size_t) length); + return ret; +} + + JNIEXPORT void JNICALL Java_org_xerial_snappy_SnappyNative_arrayCopy (JNIEnv * env, jobject self, jobject input, jint offset, jint length, jobject output, jint output_offset) { diff --git a/src/main/java/org/xerial/snappy/SnappyNative.h b/src/main/java/org/xerial/snappy/SnappyNative.h index 477d30a..d1f3e58 100755 --- a/src/main/java/org/xerial/snappy/SnappyNative.h +++ b/src/main/java/org/xerial/snappy/SnappyNative.h @@ -111,6 +111,14 @@ JNIEXPORT jboolean JNICALL Java_org_xerial_snappy_SnappyNative_isValidCompressed JNIEXPORT jboolean JNICALL Java_org_xerial_snappy_SnappyNative_isValidCompressedBuffer__Ljava_lang_Object_2II (JNIEnv *, jobject, jobject, jint, jint); +/* + * Class: org_xerial_snappy_SnappyNative + * Method: isValidCompressedBuffer + * Signature: (JJJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_xerial_snappy_SnappyNative_isValidCompressedBuffer__JJJ + (JNIEnv *, jobject, jlong, jlong, jlong); + /* * Class: org_xerial_snappy_SnappyNative * Method: arrayCopy diff --git a/src/main/java/org/xerial/snappy/SnappyNative.java b/src/main/java/org/xerial/snappy/SnappyNative.java index 7e9dbb2..b95e213 100755 --- a/src/main/java/org/xerial/snappy/SnappyNative.java +++ b/src/main/java/org/xerial/snappy/SnappyNative.java @@ -76,6 +76,8 @@ public class SnappyNative public native boolean isValidCompressedBuffer(Object input, int offset, int len) throws IOException; + public native boolean isValidCompressedBuffer(long inputAddr, long offset, long len) throws IOException; + public native void arrayCopy(Object src, int offset, int byteLength, Object dest, int dOffset) throws IOException; public void throw_error(int errorCode) throws IOException { diff --git a/src/main/resources/org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib b/src/main/resources/org/xerial/snappy/native/Mac/x86_64/libsnappyjava.jnilib index 392e03b036c2d524c3d42248fcb1ae9c03fc01bf..b9a2085626ceb0272f3ce6ad4e56e07dfae347e6 100755 GIT binary patch delta 7193 zcmbtZdt6l2_TT5oz>E&@khcPZ@=#EiK^~%pO!+w2AU;q*KvB#nZ>a@8QNzKjAj5kg7ym`y+BQccBPml2tqPNFnWu~QAT4Sjf(~A0ao8Q`J9mM8y|NEVfv%hPt?^)UyK!ec^LqV&K&cq}fD5u8XkJYY3F6JisIl4XmyuCP4Avx=Qxg zA?p0M))Bj3>1=BqQW4-3b%9y+MA-ugxjsM+Y*Tr(PZ+RO^efjA#o7qV;fm@R&1h7# z9gLMhv1hQx2Q^>(h4WB-)?voRaA!m{M~pNe48dOr{=!|OU)i=MWy*%kUwj(_etEpT z%QHj^Splku;F~U&akeYQr-3n_Nal)p0EIb{<(kx>8q^4-0gKIrIOW;aDQZbLpKY0< zE;KGEK4DW_mZ7&~@hZN4>xp||^Ay_&#b>I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