]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Fix Cppcheck warnings
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 19 Aug 2021 17:57:13 +0000 (19:57 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 19 Aug 2021 17:57:13 +0000 (19:57 +0200)
src/ResultRetriever.hpp
src/argprocessing.cpp
src/storage/secondary/RedisStorage.cpp

index a2ab439415a15f66694dd2c04cb255bc36a91279..4794afdef27364f67b6bdf280f7ae4bcf37adfab 100644 (file)
@@ -39,7 +39,7 @@ public:
 
 private:
   Context& m_ctx;
-  Result::FileType m_dest_file_type;
+  Result::FileType m_dest_file_type{};
   Fd m_dest_fd;
   std::string m_dest_path;
 
index e5b6f9cea2f8a84de2ca4b247c04bad9c7915ba3..c77dd1125031e2c4357f4eae7c3eb1668d1810ab 100644 (file)
@@ -341,7 +341,7 @@ process_arg(Context& ctx,
   // Some arguments that clang passes directly to cc1 (related to precompiled
   // headers) need the usual ccache handling. In those cases, the -Xclang
   // prefix is skipped and the cc1 argument is handled instead.
-  if (args[i] == "-Xclang" && i < args.size() - 1
+  if (args[i] == "-Xclang" && i + 1 < args.size()
       && (args[i + 1] == "-emit-pch" || args[i + 1] == "-emit-pth"
           || args[i + 1] == "-include-pch" || args[i + 1] == "-include-pth"
           || args[i + 1] == "-fno-pch-timestamp")) {
@@ -741,7 +741,7 @@ process_arg(Context& ctx,
 
   // In the "-Xclang -fcolor-diagnostics" form, -Xclang is skipped and the
   // -fcolor-diagnostics argument which is passed to cc1 is handled below.
-  if (args[i] == "-Xclang" && i < args.size() - 1
+  if (args[i] == "-Xclang" && i + 1 < args.size()
       && args[i + 1] == "-fcolor-diagnostics") {
     state.compiler_only_args_no_hash.push_back(args[i]);
     ++i;
index 8c12083cb7fbe4e2c4d05bfb14bfbd82aef15af4..c08fc06e0bb6cce34e74bc920c8f342ceac4a868 100644 (file)
@@ -280,16 +280,14 @@ RedisStorageBackend::authenticate(const Url& url)
   const auto password_username_pair = split_user_info(url.user_info());
   const auto& password = password_username_pair.first;
   if (password) {
-    decltype(redis_command("")) reply = nonstd::make_unexpected(Failure::error);
     const auto& username = password_username_pair.second;
     if (username) {
       LOG("Redis AUTH {} {}", *username, k_redacted_password);
-      reply = util::value_or_throw<Failed>(
+      util::value_or_throw<Failed>(
         redis_command("AUTH %s %s", username->c_str(), password->c_str()));
     } else {
       LOG("Redis AUTH {}", k_redacted_password);
-      reply = util::value_or_throw<Failed>(
-        redis_command("AUTH %s", password->c_str()));
+      util::value_or_throw<Failed>(redis_command("AUTH %s", password->c_str()));
     }
   }
 }