mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
refactor: replace some C idioms with C++ ones (#5656)
* tidy up legecy practices * remove undefined std::ignore usage * avoid extra function stack level in daemon.cc
This commit is contained in:
@@ -66,10 +66,10 @@ void tr_locale_set_global(char const* locale_name) noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
std::ignore = std::locale::global(std::locale{ locale_name });
|
||||
std::locale::global(std::locale{ locale_name });
|
||||
|
||||
std::ignore = std::cout.imbue(std::locale{});
|
||||
std::ignore = std::cerr.imbue(std::locale{});
|
||||
std::cout.imbue(std::locale{});
|
||||
std::cerr.imbue(std::locale{});
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
@@ -274,7 +274,7 @@ double tr_getRatio(uint64_t numerator, uint64_t denominator)
|
||||
{
|
||||
if (denominator > 0)
|
||||
{
|
||||
return numerator / (double)denominator;
|
||||
return numerator / static_cast<double>(denominator);
|
||||
}
|
||||
|
||||
if (numerator > 0)
|
||||
@@ -717,7 +717,7 @@ char* formatter_get_size_str(formatter_units const& u, char* buf, uint64_t bytes
|
||||
unit = &u[3];
|
||||
}
|
||||
|
||||
double const value = double(bytes) / unit->value;
|
||||
double const value = static_cast<double>(bytes) / unit->value;
|
||||
auto const* const units = std::data(unit->name);
|
||||
|
||||
auto precision = int{};
|
||||
|
||||
Reference in New Issue
Block a user