Skip to content

Commit

Permalink
Fix API compatibility. Proper type declaration in C++.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhubner committed Oct 30, 2023
1 parent 5afba39 commit fd627e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions java/rocksjni/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3936,7 +3936,7 @@ jint Java_org_rocksdb_Options_memtableMaxRangeDeletions(JNIEnv*, jobject,
jlongArray Java_org_rocksdb_Options_tablePropertiesCollectorFactory(
JNIEnv* env, jclass, jlong jhandle) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle);
const auto size = opt->table_properties_collector_factories.size();
const size_t size = opt->table_properties_collector_factories.size();
jlongArray retVal = env->NewLongArray(static_cast<jsize>(size));
if (retVal == nullptr) {
// exception thrown: OutOfMemoryError
Expand All @@ -3948,7 +3948,7 @@ jlongArray Java_org_rocksdb_Options_tablePropertiesCollectorFactory(
return nullptr;
}

for (int i = 0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
auto* wrapper = new TablePropertiesCollectorFactoriesJniWrapper();
wrapper->table_properties_collector_factories =
opt->table_properties_collector_factories[i];
Expand All @@ -3966,7 +3966,7 @@ jlongArray Java_org_rocksdb_Options_tablePropertiesCollectorFactory(
void Java_org_rocksdb_Options_setTablePropertiesCollectorFactory(
JNIEnv* env, jclass, jlong jhandle, jlongArray j_factory_handlers) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle);
const auto size = env->GetArrayLength(j_factory_handlers);
const jsize size = env->GetArrayLength(j_factory_handlers);

jlong* buf = env->GetLongArrayElements(j_factory_handlers, NULL);
if (buf == nullptr) {
Expand All @@ -3975,7 +3975,7 @@ void Java_org_rocksdb_Options_setTablePropertiesCollectorFactory(
}

opt->table_properties_collector_factories.clear();
for (int i = 0; i < size; i++) {
for (jsize i = 0; i < size; i++) {
auto* wrapper =
reinterpret_cast<TablePropertiesCollectorFactoriesJniWrapper*>(buf[i]);
opt->table_properties_collector_factories.emplace_back(
Expand Down
2 changes: 1 addition & 1 deletion java/src/test/java/org/rocksdb/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,7 @@ public void tablePropertiesCollectorFactory() {
try (final Options options = new Options()) {
try (TablePropertiesCollectorFactory collectorFactory =
TablePropertiesCollectorFactory.NewCompactOnDeletionCollectorFactory(10, 10, 1.0)) {
List<TablePropertiesCollectorFactory> factories = List.of(collectorFactory);
List<TablePropertiesCollectorFactory> factories = Arrays.asList(collectorFactory);
options.setTablePropertiesCollectorFactory(factories);
}
List<TablePropertiesCollectorFactory> factories = options.tablePropertiesCollectorFactory();
Expand Down

0 comments on commit fd627e1

Please sign in to comment.