Fix Compilation errors when using IBM Java

Summary:
PR to fix this issue -> https://github.com/facebook/rocksdb/issues/1926
Closes https://github.com/facebook/rocksdb/pull/1965

Differential Revision: D4682411

Pulled By: siying

fbshipit-source-id: a519be1
This commit is contained in:
Ayappan 2017-03-22 18:05:39 -07:00 committed by Facebook Github Bot
parent f4fce4751e
commit 203136e793
6 changed files with 11 additions and 11 deletions

View file

@ -132,7 +132,7 @@ jbyteArray Java_org_rocksdb_RocksIterator_key0(
return nullptr;
}
env->SetByteArrayRegion(jkey, 0, static_cast<jsize>(key_slice.size()),
reinterpret_cast<const jbyte*>(key_slice.data()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(key_slice.data())));
return jkey;
}
@ -153,6 +153,6 @@ jbyteArray Java_org_rocksdb_RocksIterator_value0(
return nullptr;
}
env->SetByteArrayRegion(jkeyValue, 0, static_cast<jsize>(value_slice.size()),
reinterpret_cast<const jbyte*>(value_slice.data()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(value_slice.data())));
return jkeyValue;
}

View file

@ -2257,7 +2257,7 @@ class JniUtil {
}
env->SetByteArrayRegion(jbytes, 0, jlen,
reinterpret_cast<const jbyte*>(bytes.c_str()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(bytes.c_str())));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
env->DeleteLocalRef(jbytes);
@ -2384,7 +2384,7 @@ class JniUtil {
env->SetByteArrayRegion(
jbyte_string_ary, 0, str_len,
reinterpret_cast<const jbyte*>(str->c_str()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(str->c_str())));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
env->DeleteLocalRef(jbyte_string_ary);
@ -2509,7 +2509,7 @@ class JniUtil {
}
env->SetByteArrayRegion(jret_value, 0, static_cast<jsize>(value.size()),
reinterpret_cast<const jbyte*>(value.c_str()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(value.c_str())));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
if(jret_value != nullptr) {

View file

@ -702,7 +702,7 @@ jint rocksdb_get_helper(JNIEnv* env, rocksdb::DB* db,
const jint length = std::min(jval_len, cvalue_len);
env->SetByteArrayRegion(jval, jval_off, length,
reinterpret_cast<const jbyte*>(cvalue.c_str()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(cvalue.c_str())));
if(env->ExceptionCheck()) {
// exception thrown: OutOfMemoryError
*has_exception = true;
@ -843,7 +843,7 @@ jobjectArray multi_get_helper(JNIEnv* env, jobject jdb, rocksdb::DB* db,
}
env->SetByteArrayRegion(jentry_value, 0, static_cast<jsize>(jvalue_len),
reinterpret_cast<const jbyte*>(value->c_str()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(value->c_str())));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
env->DeleteLocalRef(jentry_value);
@ -1608,7 +1608,7 @@ jlongArray Java_org_rocksdb_RocksDB_iterators(
for (std::vector<rocksdb::Iterator*>::size_type i = 0;
i < iterators.size(); i++) {
env->SetLongArrayRegion(jLongArray, static_cast<jsize>(i), 1,
reinterpret_cast<const jlong*>(&iterators[i]));
const_cast<jlong*>(reinterpret_cast<const jlong*>(&iterators[i])));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
env->DeleteLocalRef(jLongArray);

View file

@ -185,7 +185,7 @@ jbyteArray Java_org_rocksdb_Slice_data0(
}
env->SetByteArrayRegion(data, 0, len,
reinterpret_cast<const jbyte*>(slice->data()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(slice->data())));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
env->DeleteLocalRef(data);

View file

@ -107,7 +107,7 @@ jbyteArray Java_org_rocksdb_WriteBatchTest_getContents(
}
env->SetByteArrayRegion(jstate, 0, static_cast<jsize>(state.size()),
reinterpret_cast<const jbyte*>(state.c_str()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(state.c_str())));
if(env->ExceptionCheck()) {
// exception thrown: ArrayIndexOutOfBoundsException
env->DeleteLocalRef(jstate);

View file

@ -286,7 +286,7 @@ jbyteArray WriteBatchHandlerJniCallback::sliceToJArray(const Slice& s) {
m_env->SetByteArrayRegion(
ja, 0, static_cast<jsize>(s.size()),
reinterpret_cast<const jbyte*>(s.data()));
const_cast<jbyte*>(reinterpret_cast<const jbyte*>(s.data())));
if(m_env->ExceptionCheck()) {
if(ja != nullptr) {
m_env->DeleteLocalRef(ja);