mirror of
https://github.com/transmission/transmission.git
synced 2025-12-26 13:21:44 +00:00
fix: sonarcloud warnings (#2804)
* fix: break will never be executed * refactor: compile the name fallback string * fix: replace redundant type with auto * fix: use init-statement to reduce variable scope * fix: implicit conversion loses precision * fix: use in-class initializer * fix: make variable a pointer-to-const * fix: local variable name shadows class variable * fix: implicit conversion may lose precision
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include <event2/buffer.h>
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/compile.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
@@ -248,7 +250,7 @@ void tr_logAddMessage(char const* file, int line, tr_log_level level, std::strin
|
||||
if (std::empty(name))
|
||||
{
|
||||
auto const base = tr_sys_path_basename(file);
|
||||
name_fallback = fmt::format("{}:{}", !std::empty(base) ? base : "?", line);
|
||||
name_fallback = fmt::format(FMT_COMPILE("{}:{}"), !std::empty(base) ? base : "?", line);
|
||||
name = name_fallback;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user