From 8745f013ffba029e22f68dfd8903d22938b4494b Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Tue, 26 Jul 2016 13:18:31 -0700 Subject: [PATCH] [Fix java build] Stop using non standard std::make_unique Summary: std::make_unique is not standard and not always available, remove it Test Plan: Run "make clean jclean rocksdbjava jtest -j8" on my mac Reviewers: yhchiang, yiwu, sdong, andrewkr Reviewed By: andrewkr Subscribers: andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D61143 --- java/rocksjni/options.cc | 3 ++- java/rocksjni/rocksjni.cc | 3 ++- java/rocksjni/ttl.cc | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 4385085d0..c66620da2 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -1104,7 +1104,8 @@ std::vector rocksdb_compression_vector_helper( */ jbyteArray rocksdb_compression_list_helper(JNIEnv* env, std::vector compressionLevels) { - std::unique_ptr jbuf = std::make_unique(compressionLevels.size()); + std::unique_ptr jbuf = + std::unique_ptr(new jbyte[compressionLevels.size()]); for (std::vector::size_type i = 0; i != compressionLevels.size(); i++) { jbuf[i] = compressionLevels[i]; diff --git a/java/rocksjni/rocksjni.cc b/java/rocksjni/rocksjni.cc index 6c064fd6d..4c6817863 100644 --- a/java/rocksjni/rocksjni.cc +++ b/java/rocksjni/rocksjni.cc @@ -115,7 +115,8 @@ jlongArray rocksdb_open_helper(JNIEnv* env, jlong jopt_handle, // check if open operation was successful if (s.ok()) { jsize resultsLen = 1 + len_cols; //db handle + column family handles - std::unique_ptr results = std::make_unique(resultsLen); + std::unique_ptr results = + std::unique_ptr(new jlong[resultsLen]); results[0] = reinterpret_cast(db); for(int i = 1; i <= len_cols; i++) { results[i] = reinterpret_cast(handles[i - 1]); diff --git a/java/rocksjni/ttl.cc b/java/rocksjni/ttl.cc index 8dc7280f0..6b39252f1 100644 --- a/java/rocksjni/ttl.cc +++ b/java/rocksjni/ttl.cc @@ -96,7 +96,8 @@ jlongArray // check if open operation was successful if (s.ok()) { jsize resultsLen = 1 + len_cols; //db handle + column family handles - std::unique_ptr results = std::make_unique(resultsLen); + std::unique_ptr results = + std::unique_ptr(new jlong[resultsLen]); results[0] = reinterpret_cast(db); for(int i = 1; i <= len_cols; i++) { results[i] = reinterpret_cast(handles[i - 1]);