diff --git a/.clang-tidy b/.clang-tidy index 49bdf64..943c755 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ Checks: ' bugprone-*, -bugprone-branch-clone, -bugprone-macro-parentheses, + -bugprone-narrowing-conversions, -bugprone-unhandled-self-assignment, google-*, -google-build-using-namespace, @@ -24,10 +25,11 @@ Checks: ' -modernize-use-trailing-return-type, -modernize-use-using, performance-*, - -performance-inefficient-string-concatenation, + -performance-no-int-to-ptr, portability-*, readability-*, -readability-else-after-return, + -readability-function-cognitive-complexity, -readability-function-size, -readability-implicit-bool-conversion, -readability-inconsistent-declaration-parameter-name, diff --git a/src/curl_util.cpp b/src/curl_util.cpp index 38e5b12..93f008b 100644 --- a/src/curl_util.cpp +++ b/src/curl_util.cpp @@ -192,9 +192,11 @@ std::string get_canonical_headers(const struct curl_slist* list) // skip empty-value headers (as they are discarded by libcurl) continue; } - strhead = strkey + ":" + strval; + strhead = strkey; + strhead += ":"; + strhead += strval; }else{ - strhead = trim(lower(strhead)); + strhead = trim(lower(strhead)); } canonical_headers += strhead; canonical_headers += "\n"; @@ -221,9 +223,11 @@ std::string get_canonical_headers(const struct curl_slist* list, bool only_amz) // skip empty-value headers (as they are discarded by libcurl) continue; } - strhead = strkey + ":" + strval; + strhead = strkey; + strhead += ":"; + strhead += strval; }else{ - strhead = trim(lower(strhead)); + strhead = trim(lower(strhead)); } if(only_amz && strhead.substr(0, 5) != "x-amz"){ continue; diff --git a/src/s3fs.cpp b/src/s3fs.cpp index a984f2e..28c9a78 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -2699,7 +2699,7 @@ static int list_bucket(const char* path, S3ObjList& head, const char* delimiter, while(truncated){ // append parameters to query in alphabetical order - std::string each_query = ""; + std::string each_query; if(!next_continuation_token.empty()){ each_query += "continuation-token=" + urlEncode(next_continuation_token) + "&"; next_continuation_token = ""; diff --git a/src/string_util.cpp b/src/string_util.cpp index a33eb0d..e1f01fa 100644 --- a/src/string_util.cpp +++ b/src/string_util.cpp @@ -471,7 +471,7 @@ unsigned char* s3fs_decode64(const char* input, size_t* plength) // Base location for transform. The range 0xE000 - 0xF8ff // is a private range, se use the start of this range. -static unsigned int escape_base = 0xe000; +static const unsigned int escape_base = 0xe000; // encode bytes into wobbly utf8. // 'result' can be null. returns true if transform was needed.