Skip to content

Commit

Permalink
Fix the deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
luben committed Jun 6, 2021
1 parent ba58d1f commit 184563a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jniUseCpp11 := false
jniCppExtensions := Seq("c")

jniGccFlags ++= Seq(
"-std=c99", "-Wundef", "-Wshadow", "-Wcast-align", "-Wstrict-prototypes", "-Wno-unused-variable", "-Wno-deprecated-declarations",
"-std=c99", "-Wundef", "-Wshadow", "-Wcast-align", "-Wstrict-prototypes", "-Wno-unused-variable",
"-Wpointer-arith", "-DZSTD_LEGACY_SUPPORT=4", "-DZSTD_MULTITHREAD=1", "-lpthread", "-flto", "-static-libgcc"
)

Expand Down
7 changes: 5 additions & 2 deletions src/main/native/jni_directbuffercompress_zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ JNIEXPORT jint JNICALL Java_com_github_luben_zstd_ZstdDirectBufferCompressingStr
produced_id = (*env)->GetFieldID(env, clazz, "produced", "I");
void *dict_buff = (*env)->GetPrimitiveArrayCritical(env, dict, NULL);
if (dict_buff == NULL) goto E1;
result = ZSTD_initCStream_usingDict((ZSTD_CStream *)(intptr_t) stream, dict_buff, dict_size, level);
ZSTD_CCtx_reset((ZSTD_CStream *)(intptr_t) stream, ZSTD_reset_session_only);
ZSTD_CCtx_setParameter((ZSTD_CStream *)(intptr_t) stream, ZSTD_c_compressionLevel, level);
result = ZSTD_CCtx_loadDictionary((ZSTD_CStream *)(intptr_t) stream, dict_buff, dict_size);
(*env)->ReleasePrimitiveArrayCritical(env, dict, dict_buff, JNI_ABORT);
E1:
return result;
Expand All @@ -83,7 +85,8 @@ JNIEXPORT jint JNICALL Java_com_github_luben_zstd_ZstdDirectBufferCompressingStr
jfieldID compress_dict = (*env)->GetFieldID(env, dict_clazz, "nativePtr", "J");
ZSTD_CDict* cdict = (ZSTD_CDict*)(intptr_t)(*env)->GetLongField(env, dict, compress_dict);
if (cdict == NULL) return ZSTD_error_dictionary_wrong;
return ZSTD_initCStream_usingCDict((ZSTD_CStream *)(intptr_t) stream, cdict);
ZSTD_CCtx_reset((ZSTD_CStream *)(intptr_t) stream, ZSTD_reset_session_only);
return ZSTD_CCtx_refCDict((ZSTD_CStream *)(intptr_t) stream, cdict);
}

/*
Expand Down

0 comments on commit 184563a

Please sign in to comment.