From ff30c0211109e14b1f6918fcc6c2e2b98f863a1f Mon Sep 17 00:00:00 2001 From: Nghia Truong <7416935+ttnghia@users.noreply.github.com> Date: Tue, 23 Jul 2024 12:03:55 -0700 Subject: [PATCH] Fix compile warnings with `jni_utils.hpp` (#16336) This fixes the compiler warnings with `jni_utils.hpp`, removing some `const` qualifiers that are redundant. Closes https://github.com/rapidsai/cudf/issues/16335. Authors: - Nghia Truong (https://github.com/ttnghia) Approvers: - Jason Lowe (https://github.com/jlowe) URL: https://github.com/rapidsai/cudf/pull/16336 --- java/src/main/native/include/jni_utils.hpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/java/src/main/native/include/jni_utils.hpp b/java/src/main/native/include/jni_utils.hpp index ea04c1cda83..a3b4bfcb63e 100644 --- a/java/src/main/native/include/jni_utils.hpp +++ b/java/src/main/native/include/jni_utils.hpp @@ -284,7 +284,7 @@ class native_jArray { return data()[index]; } - const N_TYPE* const data() const + N_TYPE const* data() const { init_data_ptr(); return data_ptr; @@ -296,17 +296,15 @@ class native_jArray { return data_ptr; } - const N_TYPE* const begin() const { return data(); } + N_TYPE const* begin() const { return data(); } N_TYPE* begin() { return data(); } - const N_TYPE* const end() const { return data() + size(); } + N_TYPE const* end() const { return data() + size(); } N_TYPE* end() { return data() + size(); } - const J_ARRAY_TYPE get_jArray() const { return orig; } - - J_ARRAY_TYPE get_jArray() { return orig; } + J_ARRAY_TYPE get_jArray() const { return orig; } /** * @brief Conversion to std::vector @@ -430,9 +428,7 @@ class native_jpointerArray { T* const* begin() const { return data(); } T* const* end() const { return data() + size(); } - const jlongArray get_jArray() const { return wrapped.get_jArray(); } - - jlongArray get_jArray() { return wrapped.get_jArray(); } + jlongArray get_jArray() const { return wrapped.get_jArray(); } void assert_no_nulls() const { @@ -624,7 +620,7 @@ class native_jstring { return true; } - const jstring get_jstring() const { return orig; } + jstring get_jstring() const { return orig; } ~native_jstring() { @@ -753,13 +749,13 @@ class native_jstringArray { return cache[index]; } - char const** const as_c_array() const + char const** as_c_array() const { init_c_cache(); return c_cache.data(); } - const std::vector as_cpp_vector() const + std::vector as_cpp_vector() const { init_cpp_cache(); return cpp_cache;