summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy12
-rw-r--r--include/cipherpack/cipherpack.hpp26
m---------jaulib0
-rw-r--r--java/jni/cipherpack/Cipherpack.cxx5
-rw-r--r--java/jni/helper_base.cxx11
-rw-r--r--test/cipherpack/CMakeLists.txt3
6 files changed, 33 insertions, 24 deletions
diff --git a/.clang-tidy b/.clang-tidy
index d065b0f..407aca4 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,21 +1,23 @@
Checks: 'clang-diagnostic-*, clang-analyzer-*,
modernize-*, bugprone-*, performance-*,
- misc-include-cleaner,
+ -bugprone-reserved-identifier, -bugprone-easily-swappable-parameters, -bugprone-assignment-in-if-condition,
+ -bugprone-misplaced-widening-cast, -bugprone-branch-clone,
-clang-diagnostic-unknown-warning-option,
-clang-analyzer-security.insecureAPI.bzero,
+ -clang-analyzer-optin.core.EnumCastOutOfRange,
-modernize-use-auto, -modernize-use-nodiscard, -modernize-use-using, -modernize-use-trailing-return-type,
-modernize-avoid-c-arrays, -modernize-use-default-member-init, -modernize-return-braced-init-list,
-modernize-avoid-bind, -modernize-use-transparent-functors,
- -bugprone-reserved-identifier, -bugprone-easily-swappable-parameters, -bugprone-assignment-in-if-condition,
- -bugprone-misplaced-widening-cast, -bugprone-branch-clone'
+ -modernize-use-constraints,
+ -performance-avoid-endl, -performance-enum-size'
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment
value: 'true'
WarningsAsErrors: '*'
-HeaderFilterRegex: '(include/jau/[a-zA-Z0-0]*|include/jau/jni/[a-zA-Z0-0]*)\.hpp'
-AnalyzeTemporaryDtors: false
+HeaderFilterRegex: '(include/cipherpack/.*|jaulib/include/jau/[a-zA-Z0-0]*|jaulib/include/jau/jni/[a-zA-Z0-0]*)\.hpp'
+# AnalyzeTemporaryDtors: false
FormatStyle: none
InheritParentConfig: false
User: sven
diff --git a/include/cipherpack/cipherpack.hpp b/include/cipherpack/cipherpack.hpp
index dccf935..444517c 100644
--- a/include/cipherpack/cipherpack.hpp
+++ b/include/cipherpack/cipherpack.hpp
@@ -234,12 +234,12 @@ namespace cipherpack {
sym_enc_nonce_bytes(0)
{ }
- CryptoConfig(const std::string& pk_type_,
- const std::string& pk_fingerprt_hash_algo_,
- const std::string& pk_enc_padding_algo_,
- const std::string& pk_enc_hash_algo_,
- const std::string& pk_sign_algo_,
- const std::string& sym_enc_algo_,
+ CryptoConfig(const std::string& pk_type_, // NOLINT(modernize-pass-by-value)
+ const std::string& pk_fingerprt_hash_algo_, // NOLINT(modernize-pass-by-value)
+ const std::string& pk_enc_padding_algo_, // NOLINT(modernize-pass-by-value)
+ const std::string& pk_enc_hash_algo_, // NOLINT(modernize-pass-by-value)
+ const std::string& pk_sign_algo_, // NOLINT(modernize-pass-by-value)
+ const std::string& sym_enc_algo_, // NOLINT(modernize-pass-by-value)
const size_t sym_enc_nonce_bytes_) noexcept
: pk_type(pk_type_),
pk_fingerprt_hash_algo(pk_fingerprt_hash_algo_),
@@ -324,15 +324,15 @@ namespace cipherpack {
{ }
/** Complete ctor, denoting a complete package header, see @ref cipherpack_stream "Cipherpack Data Stream". */
- PackHeader(const std::string& _target_path,
+ PackHeader(const std::string& _target_path, // NOLINT(modernize-pass-by-value)
const uint64_t& _plaintext_size,
const jau::fraction_timespec& _ts_creation,
- const std::string& _subject,
- const std::string& _pversion, const std::string& _pversion_parent,
- const CryptoConfig& _crypto_cfg,
+ const std::string& _subject, // NOLINT(modernize-pass-by-value)
+ const std::string& _pversion, const std::string& _pversion_parent, // NOLINT(modernize-pass-by-value)
+ const CryptoConfig& _crypto_cfg, // NOLINT(modernize-pass-by-value)
const std::vector<uint8_t>& _sender_fingerprint,
const std::vector<std::vector<uint8_t>>& _recevr_fingerprints,
- const size_t _used_recevr_key_idx,
+ const ssize_t _used_recevr_key_idx,
const bool _valid)
: target_path_(_target_path),
plaintext_size_(_plaintext_size),
@@ -345,7 +345,7 @@ namespace cipherpack {
used_recevr_key_idx_(_used_recevr_key_idx),
plaintext_hash_algo_(),
plaintext_hash_(),
- valid_(_valid)
+ valid_(_valid && _used_recevr_key_idx >= 0)
{ }
/** Returns the designated target path for this plaintext message, see @ref cipherpack_stream "Cipherpack Data Stream". */
@@ -532,7 +532,7 @@ namespace cipherpack {
return true;
}
- ~CipherpackListener() noexcept override {}
+ ~CipherpackListener() noexcept override = default;
std::string toString() const noexcept override { return "CipherpackListener["+jau::to_hexstring(this)+"]"; }
diff --git a/jaulib b/jaulib
-Subproject e35c1f0276e785627634c08c8d6088a8e5bf1a3
+Subproject 0d6cd2d0e47099b428ca72f7ccb1d291011baa9
diff --git a/java/jni/cipherpack/Cipherpack.cxx b/java/jni/cipherpack/Cipherpack.cxx
index 218e271..42106c6 100644
--- a/java/jni/cipherpack/Cipherpack.cxx
+++ b/java/jni/cipherpack/Cipherpack.cxx
@@ -26,6 +26,7 @@
#include "org_cipherpack_Cipherpack_HashUtil.h"
// #define VERBOSE_ON 1
+#include <jau/basic_types.hpp>
#include <jau/debug.hpp>
#include "cipherpack/cipherpack.hpp"
@@ -127,11 +128,11 @@ jbyteArray Java_org_cipherpack_Cipherpack_00024HashUtil_calcImpl2(JNIEnv *env, j
const jau::fraction_i64 timeout = (int64_t)jtimeoutMS * 1_ms;
if( nullptr == jbytes_hashed ) {
- throw jau::IllegalArgumentException("bytes_hashed null", E_FILE_LINE);
+ throw jau::IllegalArgumentError("bytes_hashed null", E_FILE_LINE);
}
const size_t bh_size = env->GetArrayLength(jbytes_hashed);
if( 1 > bh_size ) {
- throw jau::IllegalArgumentException("bytes_hashed array size "+std::to_string(bh_size)+" < 1", E_FILE_LINE);
+ throw jau::IllegalArgumentError("bytes_hashed array size "+std::to_string(bh_size)+" < 1", E_FILE_LINE);
}
jau::jni::JNICriticalArray<uint64_t, jlongArray> criticalArray(env); // RAII - release
uint64_t * bh_ptr = criticalArray.get(jbytes_hashed, criticalArray.Mode::UPDATE_AND_RELEASE);
diff --git a/java/jni/helper_base.cxx b/java/jni/helper_base.cxx
index db55b6b..c6c0861 100644
--- a/java/jni/helper_base.cxx
+++ b/java/jni/helper_base.cxx
@@ -23,6 +23,7 @@
*/
#include <jni.h>
+#include <jau/basic_types.hpp>
#include <memory>
#include <stdexcept>
#include <vector>
@@ -42,15 +43,17 @@ void rethrow_and_raise_java_exception_impl(JNIEnv *env, const char* file, int li
jau::jni::raise_java_exception(env, e, file, line);
} catch (const jau::NullPointerException &e) {
jau::jni::raise_java_exception(env, e, file, line);
- } catch (const jau::IllegalArgumentException &e) {
+ } catch (const jau::IllegalArgumentError &e) {
jau::jni::raise_java_exception(env, e, file, line);
- } catch (const jau::IllegalStateException &e) {
+ } catch (const jau::IllegalStateError &e) {
jau::jni::raise_java_exception(env, e, file, line);
} catch (const jau::UnsupportedOperationException &e) {
jau::jni::raise_java_exception(env, e, file, line);
- } catch (const jau::IndexOutOfBoundsException &e) {
+ } catch (const jau::IndexOutOfBoundsError &e) {
jau::jni::raise_java_exception(env, e, file, line);
- } catch (const jau::RuntimeException &e) {
+ } catch (const jau::RuntimeExceptionBase &e) {
+ jau::jni::raise_java_exception(env, e, file, line);
+ } catch (const jau::ExceptionBase &e) {
jau::jni::raise_java_exception(env, e, file, line);
} catch (const std::bad_alloc &e) {
jau::jni::raise_java_exception(env, e, file, line);
diff --git a/test/cipherpack/CMakeLists.txt b/test/cipherpack/CMakeLists.txt
index baec9eb..18a29aa 100644
--- a/test/cipherpack/CMakeLists.txt
+++ b/test/cipherpack/CMakeLists.txt
@@ -15,5 +15,8 @@ foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} )
target_link_libraries(${name} cipherpack catch2)
add_dependencies(${name} cipherpack catch2)
add_test (NAME ${name} COMMAND ${name})
+ if(DEFINED CMAKE_CXX_CLANG_TIDY)
+ set_target_properties(${name} PROPERTIES CXX_CLANG_TIDY "${CMAKE_CXX_CLANG_TIDY};--checks;-bugprone-chained-comparison")
+ endif()
endforeach()