From e431d2b869d7ef71de51ce352671a6f2aba31e2a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 20 Oct 2020 05:46:28 +0200 Subject: Use -Wshadow: Shadowing (or local scope override) often causing sloppy bugs, avoid. --- include/jau/function_def.hpp | 8 ++++---- include/jau/jni/helper_jni.hpp | 4 ++-- include/jau/jni/jni_mem.hpp | 18 +++++++++--------- java/jni/jni_mem.cxx | 8 ++++---- src/environment.cpp | 10 +++++----- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/jau/function_def.hpp b/include/jau/function_def.hpp index d5242af..d1184c3 100644 --- a/include/jau/function_def.hpp +++ b/include/jau/function_def.hpp @@ -221,13 +221,13 @@ namespace jau { public: /** Utilizes copy-ctor from 'const I& _data' */ - CaptureInvocationFunc(const I& _data, R(*_function)(I&, A...), bool dataIsIdentity) noexcept - : data(_data), function(_function), dataIsIdentity(dataIsIdentity) { + CaptureInvocationFunc(const I& _data, R(*_function)(I&, A...), bool dataIsIdentity_) noexcept + : data(_data), function(_function), dataIsIdentity(dataIsIdentity_) { } /** Utilizes move-ctor from moved 'I&& _data' */ - CaptureInvocationFunc(I&& _data, R(*_function)(I&, A...), bool dataIsIdentity) noexcept - : data(std::move(_data)), function(_function), dataIsIdentity(dataIsIdentity) { + CaptureInvocationFunc(I&& _data, R(*_function)(I&, A...), bool dataIsIdentity_) noexcept + : data(std::move(_data)), function(_function), dataIsIdentity(dataIsIdentity_) { } int getType() const noexcept override { return 3; } diff --git a/include/jau/jni/helper_jni.hpp b/include/jau/jni/helper_jni.hpp index 582f355..c8a7393 100644 --- a/include/jau/jni/helper_jni.hpp +++ b/include/jau/jni/helper_jni.hpp @@ -159,8 +159,8 @@ namespace jau { } return true; } - JavaGlobalObj(jobject obj, jmethodID mNotifyDeleted) noexcept - : javaObjectRef(obj), mNotifyDeleted(mNotifyDeleted) { } + JavaGlobalObj(jobject obj, jmethodID mNotifyDeleted_) noexcept + : javaObjectRef(obj), mNotifyDeleted(mNotifyDeleted_) { } JavaGlobalObj(const JavaGlobalObj &o) noexcept = default; JavaGlobalObj(JavaGlobalObj &&o) noexcept = default; diff --git a/include/jau/jni/jni_mem.hpp b/include/jau/jni/jni_mem.hpp index 1bf2f7c..12ee82e 100644 --- a/include/jau/jni/jni_mem.hpp +++ b/include/jau/jni/jni_mem.hpp @@ -144,7 +144,7 @@ private: jboolean isCopy = false; public: - JNICriticalArray(JNIEnv *env) : env(env) {} + JNICriticalArray(JNIEnv *env_val) : env(env_val) {} JNICriticalArray(const JNICriticalArray &o) = delete; JNICriticalArray(JNICriticalArray &&o) = delete; @@ -174,16 +174,16 @@ public: /** * Acquired the primitive array. */ - T* get(U jarray, Mode mode=UPDATE_AND_RELEASE) { - if( nullptr == jarray ) { + T* get(U jarray_val, Mode mode_val=UPDATE_AND_RELEASE) { + if( nullptr == jarray_val ) { return nullptr; } - T* narray = static_cast( env->GetPrimitiveArrayCritical(jarray, &isCopy) ); - if( nullptr != narray ) { - this->mode = mode; - this->jarray = jarray; - this->narray = narray; - return narray; + T* _narray = static_cast( env->GetPrimitiveArrayCritical(jarray_val, &isCopy) ); + if( nullptr != _narray ) { + this->mode = mode_val; + this->jarray = jarray_val; + this->narray = _narray; + return _narray; } return nullptr; } diff --git a/java/jni/jni_mem.cxx b/java/jni/jni_mem.cxx index 49516a4..981c6e5 100644 --- a/java/jni/jni_mem.cxx +++ b/java/jni/jni_mem.cxx @@ -95,12 +95,12 @@ JNIGlobalRef::JNIGlobalRef() noexcept { DBG_JNI_PRINT("JNIGlobalRef::def_ctor nullptr"); } -JNIGlobalRef::JNIGlobalRef(jobject object) { - if( nullptr == object ) { +JNIGlobalRef::JNIGlobalRef(jobject _object) { + if( nullptr == _object ) { throw jau::RuntimeException("JNIGlobalRef ctor null jobject", E_FILE_LINE); } - this->object = jni_env->NewGlobalRef(object); - DBG_JNI_PRINT("JNIGlobalRef::def_ctor %p -> %p", object, this->object); + this->object = jni_env->NewGlobalRef(_object); + DBG_JNI_PRINT("JNIGlobalRef::def_ctor %p -> %p", _object, this->object); } JNIGlobalRef::JNIGlobalRef(const JNIGlobalRef &o) { diff --git a/src/environment.cpp b/src/environment.cpp index 551b96f..84e4b1d 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -228,10 +228,10 @@ bool environment::getExplodingPropertiesImpl(const std::string & root_prefix_dom return true; } -environment::environment(const std::string & root_prefix_domain) noexcept -: root_prefix_domain(root_prefix_domain), - debug( getExplodingPropertiesImpl(root_prefix_domain, root_prefix_domain+".debug") ), - debug_jni( getBooleanProperty(root_prefix_domain+".debug.jni", false) ), - verbose( getExplodingPropertiesImpl(root_prefix_domain, root_prefix_domain+".verbose") || environment::debug ) +environment::environment(const std::string & root_prefix_domain_) noexcept +: root_prefix_domain(root_prefix_domain_), + debug( getExplodingPropertiesImpl(root_prefix_domain_, root_prefix_domain_+".debug") ), + debug_jni( getBooleanProperty(root_prefix_domain_+".debug.jni", false) ), + verbose( getExplodingPropertiesImpl(root_prefix_domain_, root_prefix_domain_+".verbose") || environment::debug ) { } -- cgit v1.2.3