From c4765dc10b93d556154b2930247abc42182ca4ec Mon Sep 17 00:00:00 2001 From: fyrz Date: Tue, 25 Nov 2014 20:29:52 +0100 Subject: [PATCH] [RocksJava] Fix precision problem in rocksjni --- java/rocksjni/backupablejni.cc | 5 +++-- java/rocksjni/restorejni.cc | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/java/rocksjni/backupablejni.cc b/java/rocksjni/backupablejni.cc index 83c641370..8007e2ce0 100644 --- a/java/rocksjni/backupablejni.cc +++ b/java/rocksjni/backupablejni.cc @@ -103,10 +103,11 @@ jintArray Java_org_rocksdb_BackupableDB_getCorruptedBackups( reinterpret_cast(jhandle)-> GetCorruptedBackups(&backup_ids); // store backupids in int array - const int kIdSize = backup_ids.size(); + const std::vector::size_type + kIdSize = backup_ids.size(); int int_backup_ids[kIdSize]; for (std::vector::size_type i = 0; - i != backup_ids.size(); i++) { + i != kIdSize; i++) { int_backup_ids[i] = backup_ids[i]; } // Store ints in java array diff --git a/java/rocksjni/restorejni.cc b/java/rocksjni/restorejni.cc index ad8749758..4fe747e10 100644 --- a/java/rocksjni/restorejni.cc +++ b/java/rocksjni/restorejni.cc @@ -156,10 +156,12 @@ jintArray Java_org_rocksdb_RestoreBackupableDB_getCorruptedBackups( reinterpret_cast(jhandle)-> GetCorruptedBackups(&backup_ids); // store backupids in int array - const int kIdSize = backup_ids.size(); + const std::vector::size_type + kIdSize = backup_ids.size(); + int int_backup_ids[kIdSize]; for (std::vector::size_type i = 0; - i != backup_ids.size(); i++) { + i != kIdSize; i++) { int_backup_ids[i] = backup_ids[i]; } // Store ints in java array