From 67cb7ca758b9b632ca6956dc26d2ef20d1ee627b Mon Sep 17 00:00:00 2001 From: fyrz Date: Wed, 26 Nov 2014 20:51:50 +0100 Subject: [PATCH] [RocksJava] Fixed MacOS build of RocksJava There were still some precision loss problems remainging in RocksJava. This pull request resolve these. --- java/rocksjni/backupablejni.cc | 7 +++++-- java/rocksjni/restorejni.cc | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/java/rocksjni/backupablejni.cc b/java/rocksjni/backupablejni.cc index 8007e2ce0..d26e46e88 100644 --- a/java/rocksjni/backupablejni.cc +++ b/java/rocksjni/backupablejni.cc @@ -112,8 +112,11 @@ jintArray Java_org_rocksdb_BackupableDB_getCorruptedBackups( } // Store ints in java array jintArray ret_backup_ids; - ret_backup_ids = env->NewIntArray(kIdSize); - env->SetIntArrayRegion(ret_backup_ids, 0, kIdSize, int_backup_ids); + // Its ok to loose precision here (64->32) + jsize ret_backup_ids_size = static_cast(kIdSize); + ret_backup_ids = env->NewIntArray(ret_backup_ids_size); + env->SetIntArrayRegion(ret_backup_ids, 0, ret_backup_ids_size, + int_backup_ids); return ret_backup_ids; } diff --git a/java/rocksjni/restorejni.cc b/java/rocksjni/restorejni.cc index 4fe747e10..a2341632b 100644 --- a/java/rocksjni/restorejni.cc +++ b/java/rocksjni/restorejni.cc @@ -166,8 +166,11 @@ jintArray Java_org_rocksdb_RestoreBackupableDB_getCorruptedBackups( } // Store ints in java array jintArray ret_backup_ids; - ret_backup_ids = env->NewIntArray(kIdSize); - env->SetIntArrayRegion(ret_backup_ids, 0, kIdSize, int_backup_ids); + // Its ok to loose precision here (64->32) + jsize ret_backup_ids_size = static_cast(kIdSize); + ret_backup_ids = env->NewIntArray(ret_backup_ids_size); + env->SetIntArrayRegion(ret_backup_ids, 0, ret_backup_ids_size, + int_backup_ids); return ret_backup_ids; }