From f85f99bf6976236c27f2560a52fc53939ab742dc Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 25 Aug 2016 18:16:26 +0100 Subject: [PATCH] Fix the Windows build of RocksDB Java. Similar to https://github.com/facebook/rocksdb/issues/1220 (#1284) --- java/rocksjni/options.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 47ea19819..ebe38342c 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -2170,7 +2170,7 @@ jintArray Java_org_rocksdb_Options_maxBytesForLevelMultiplierAdditional( const size_t size = mbflma.size(); - jint additionals[size]; + jint* additionals = new jint[size]; for (size_t i = 0; i < size; i++) { additionals[i] = reinterpret_cast(mbflma[i]); } @@ -2178,6 +2178,9 @@ jintArray Java_org_rocksdb_Options_maxBytesForLevelMultiplierAdditional( jsize jlen = static_cast(size); jintArray result = env->NewIntArray(jlen); env->SetIntArrayRegion(result, 0, jlen, additionals); + + delete [] additionals; + return result; } @@ -3477,7 +3480,7 @@ jintArray Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplierAdditio const size_t size = mbflma.size(); - jint additionals[size]; + jint* additionals = new jint[size]; for (size_t i = 0; i < size; i++) { additionals[i] = reinterpret_cast(mbflma[i]); } @@ -3486,6 +3489,9 @@ jintArray Java_org_rocksdb_ColumnFamilyOptions_maxBytesForLevelMultiplierAdditio jintArray result; result = env->NewIntArray(jlen); env->SetIntArrayRegion(result, 0, jlen, additionals); + + delete [] additionals; + return result; }