]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fix Compilation errors when using IBM Java
authorAyappan <ayappap2@in.ibm.com>
Thu, 23 Mar 2017 01:05:39 +0000 (18:05 -0700)
committerSagar Vemuri <svemuri@fb.com>
Fri, 19 May 2017 18:14:08 +0000 (11:14 -0700)
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

java/rocksjni/iterator.cc
java/rocksjni/portal.h
java/rocksjni/rocksjni.cc
java/rocksjni/slice.cc
java/rocksjni/write_batch_test.cc
java/rocksjni/writebatchhandlerjnicallback.cc

index 43f4b027ffd83c1d4e376f226deb04518262a825..860c265301276ce51eacad494677216630b8ac37 100644 (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;
 }
index 87b00cc7c23da4c837e4270ad914e709f596bb9d..62ab2f99c083c2ffe60decd01360d98aaf9cf370 100644 (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) {
index 044cccbf70d7dc1a6022d01db281bbabbeb82cad..b7c83db492c7a16f48d6686d0e06a2a1c12674a9 100644 (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);
index d485b2b7f6b61be8f37a0189914a5e810bd78fed..a630e9990f60691b9ab6de3b9637421e7351b266 100644 (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);
index 2d83910a3efd75dad44a99232193f395fed5c857..254374c3b1e756b8aabece314589e196073e5385 100644 (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);
index 7ef45a25c05905464e9cb258d71453ab46ca1949..2be225b2eb00b95eee369acdd7dc12a7a26ba324 100644 (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);