mirror of
https://github.com/transmission/transmission.git
synced 2025-12-19 18:08:31 +00:00
refactor: sonarcloud "use if init" statements (#2587)
This commit is contained in:
@@ -271,29 +271,25 @@ bool is_valid_eta(int t)
|
||||
|
||||
int compare_eta(int a, int b)
|
||||
{
|
||||
int ret;
|
||||
|
||||
bool const a_valid = is_valid_eta(a);
|
||||
bool const b_valid = is_valid_eta(b);
|
||||
|
||||
if (!a_valid && !b_valid)
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
else if (!a_valid)
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
else if (!b_valid)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = a < b ? 1 : -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
if (!a_valid)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!b_valid)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return a < b ? 1 : -1;
|
||||
}
|
||||
|
||||
int compare_double(double a, double b)
|
||||
@@ -1319,24 +1315,20 @@ namespace
|
||||
|
||||
int gtr_compare_double(double const a, double const b, int decimal_places)
|
||||
{
|
||||
int ret;
|
||||
auto const ia = int64_t(a * pow(10, decimal_places));
|
||||
auto const ib = int64_t(b * pow(10, decimal_places));
|
||||
|
||||
if (ia < ib)
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
else if (ia > ib)
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
if (ia > ib)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void update_foreach(Gtk::TreeModel::Row const& row)
|
||||
|
||||
Reference in New Issue
Block a user