mirror of
https://github.com/transmission/transmission
synced 2024-12-22 15:54:57 +00:00
Fix issues reported by hicpp
clang-tidy checks (GTK client) (#4711)
* Fix `hicpp-vararg` clang-tidy issues * Fix `hicpp-explicit-conversions` clang-tidy issues * Fix `hicpp-signed-bitwise` clang-tidy issues * Enable the rest of `hicpp` clang-tidy checks
This commit is contained in:
parent
3c11b36bc3
commit
fbb98ada4a
5 changed files with 9 additions and 7 deletions
|
@ -10,6 +10,7 @@ Checks: >
|
|||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
hicpp-*,
|
||||
misc-*,
|
||||
modernize-*,
|
||||
-modernize-use-trailing-return-type,
|
||||
|
|
|
@ -23,13 +23,14 @@ class Flags
|
|||
{
|
||||
public:
|
||||
using FlagType = T;
|
||||
using ValueType = std::underlying_type_t<FlagType>;
|
||||
using ValueType = std::make_unsigned_t<std::underlying_type_t<FlagType>>;
|
||||
|
||||
static_assert(std::is_enum_v<FlagType> && !std::is_convertible_v<FlagType, ValueType>);
|
||||
|
||||
public:
|
||||
constexpr Flags() noexcept = default;
|
||||
|
||||
// NOLINTNEXTLINE(hicpp-explicit-conversions)
|
||||
constexpr Flags(FlagType flag) noexcept
|
||||
{
|
||||
set(flag);
|
||||
|
|
|
@ -17,7 +17,7 @@ class Session;
|
|||
class FreeSpaceLabel : public Gtk::Label
|
||||
{
|
||||
public:
|
||||
FreeSpaceLabel(Glib::RefPtr<Session> const& core, std::string_view dir = {});
|
||||
explicit FreeSpaceLabel(Glib::RefPtr<Session> const& core, std::string_view dir = {});
|
||||
FreeSpaceLabel(
|
||||
BaseObjectType* cast_item,
|
||||
Glib::RefPtr<Gtk::Builder> const& builder,
|
||||
|
|
|
@ -58,7 +58,7 @@ unsigned int build_torrent_trackers_hash(tr_torrent const& torrent)
|
|||
{
|
||||
for (auto const ch : std::string_view{ tr_torrentTracker(&torrent, i).announce })
|
||||
{
|
||||
hash = (hash << 4) ^ (hash >> 28) ^ ch;
|
||||
hash = (hash << 4U) ^ (hash >> 28U) ^ static_cast<unsigned char>(ch);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,19 +86,19 @@ char const* const speed_T_str = N_("TB/s");
|
|||
|
||||
void gtr_message(std::string const& message)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||
// NOLINTNEXTLINE(*-vararg)
|
||||
g_message("%s", message.c_str());
|
||||
}
|
||||
|
||||
void gtr_warning(std::string const& message)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||
// NOLINTNEXTLINE(*-vararg)
|
||||
g_warning("%s", message.c_str());
|
||||
}
|
||||
|
||||
void gtr_error(std::string const& message)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||
// NOLINTNEXTLINE(*-vararg)
|
||||
g_error("%s", message.c_str());
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ Glib::SignalProxy<TrObjectSignalNotifyCallback> gtr_object_signal_notify(Glib::O
|
|||
|
||||
void gtr_object_notify_emit(Glib::ObjectBase& object)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||
// NOLINTNEXTLINE(*-vararg)
|
||||
g_signal_emit_by_name(object.gobj(), "notify", nullptr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue