From 543231c9f262de4a4e30795694286aea97cdecb7 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 9 Nov 2020 21:15:20 +0900 Subject: [PATCH] Address warnings from clang-tidy 11 (#1470) --- .clang-tidy | 4 ++++ src/curl.cpp | 4 ++-- src/fdcache_entity.cpp | 4 ++-- src/fdcache_stat.cpp | 2 +- src/s3fs_logger.cpp | 4 +--- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 7d1255b..49bdf64 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ Checks: ' bugprone-*, -bugprone-branch-clone, -bugprone-macro-parentheses, + -bugprone-unhandled-self-assignment, google-*, -google-build-using-namespace, -google-readability-casting, @@ -11,6 +12,7 @@ Checks: ' -google-runtime-int, -google-runtime-references, misc-*, + -misc-no-recursion, -misc-redundant-expression, -misc-unused-parameters, modernize-*, @@ -22,11 +24,13 @@ Checks: ' -modernize-use-trailing-return-type, -modernize-use-using, performance-*, + -performance-inefficient-string-concatenation, portability-*, readability-*, -readability-else-after-return, -readability-function-size, -readability-implicit-bool-conversion, + -readability-inconsistent-declaration-parameter-name, -readability-isolate-declaration, -readability-magic-numbers, -readability-named-parameter, diff --git a/src/curl.cpp b/src/curl.cpp index 963fbb8..fc9c3d3 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -1854,10 +1854,10 @@ int S3fsCurl::RawCurlDebugFunc(CURL* hcurl, curl_infotype type, char* data, size // Methods for S3fsCurl //------------------------------------------------------------------- S3fsCurl::S3fsCurl(bool ahbe) : - hCurl(NULL), type(REQTYPE_UNSET), path(""), base_path(""), saved_path(""), url(""), requestHeaders(NULL), + hCurl(NULL), type(REQTYPE_UNSET), requestHeaders(NULL), LastResponseCode(S3FSCURL_RESPONSECODE_NOTSET), postdata(NULL), postdata_remaining(0), is_use_ahbe(ahbe), retry_count(0), b_infile(NULL), b_postdata(NULL), b_postdata_remaining(0), b_partdata_startpos(0), b_partdata_size(0), - b_ssekey_pos(-1), b_ssevalue(""), b_ssetype(sse_type_t::SSE_DISABLE), op(""), query_string(""), + b_ssekey_pos(-1), b_ssetype(sse_type_t::SSE_DISABLE), sem(NULL), completed_tids_lock(NULL), completed_tids(NULL), fpLazySetup(NULL) { } diff --git a/src/fdcache_entity.cpp b/src/fdcache_entity.cpp index 60ffe27..9811258 100644 --- a/src/fdcache_entity.cpp +++ b/src/fdcache_entity.cpp @@ -95,8 +95,8 @@ ino_t FdEntity::GetInode(int fd) //------------------------------------------------ FdEntity::FdEntity(const char* tpath, const char* cpath) : is_lock_init(false), refcnt(0), path(SAFESTRPTR(tpath)), - fd(-1), pfile(NULL), inode(0), size_orgmeta(0), upload_id(""), mp_start(0), mp_size(0), - cachepath(SAFESTRPTR(cpath)), mirrorpath(""), is_meta_pending(false), holding_mtime(-1) + fd(-1), pfile(NULL), inode(0), size_orgmeta(0), mp_start(0), mp_size(0), + cachepath(SAFESTRPTR(cpath)), is_meta_pending(false), holding_mtime(-1) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); diff --git a/src/fdcache_stat.cpp b/src/fdcache_stat.cpp index 995d757..dc324ef 100644 --- a/src/fdcache_stat.cpp +++ b/src/fdcache_stat.cpp @@ -163,7 +163,7 @@ bool CacheFileStat::RenameCacheFileStat(const char* oldpath, const char* newpath //------------------------------------------------ // CacheFileStat methods //------------------------------------------------ -CacheFileStat::CacheFileStat(const char* tpath) : path(""), fd(-1) +CacheFileStat::CacheFileStat(const char* tpath) : fd(-1) { if(tpath && '\0' != tpath[0]){ SetPath(tpath, true); diff --git a/src/s3fs_logger.cpp b/src/s3fs_logger.cpp index 86055fd..0a70c3e 100644 --- a/src/s3fs_logger.cpp +++ b/src/s3fs_logger.cpp @@ -180,9 +180,7 @@ bool S3fsLog::LowSetLogfile(const char* pfile) fclose(newfp); return false; } - if(S3fsLog::plogfile){ - delete S3fsLog::plogfile; - } + delete S3fsLog::plogfile; S3fsLog::plogfile = new std::string(pfile); } return true;