fixup! refactor: use smaller integral types in some structs (#3005) (#3096)

fix GTK client file progress % regression

Fixes #3063.
This commit is contained in:
Charles Kerr 2022-05-16 09:06:18 -05:00 committed by GitHub
parent 2293f4336a
commit e286e45ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -157,10 +157,10 @@ bool refreshFilesForeach(
auto const old_size = iter->get_value(file_cols.size);
auto new_enabled = int{};
auto new_have = old_have;
auto new_have = decltype(old_have){};
auto new_priority = int{};
auto new_progress = int{};
auto new_size = old_size;
auto new_size = decltype(old_have){};
if (is_file)
{
@ -170,7 +170,7 @@ bool refreshFilesForeach(
new_enabled = file.wanted;
new_priority = file.priority;
new_have = file.have;
new_progress = std::clamp(int(100 * file.progress), 0, 100);
new_progress = file.progress;
}
else
{
@ -183,10 +183,10 @@ bool refreshFilesForeach(
for (auto const& child : iter->children())
{
int64_t const child_size = child[file_cols.size];
int64_t const child_have = child[file_cols.have];
int const child_priority = child[file_cols.priority];
int const child_enabled = child[file_cols.enabled];
auto const child_size = child[file_cols.size];
auto const child_have = child[file_cols.have];
auto const child_priority = child[file_cols.priority];
auto const child_enabled = child[file_cols.enabled];
if ((child_enabled != false) && (child_enabled != NOT_SET))
{
@ -213,9 +213,11 @@ bool refreshFilesForeach(
}
}
new_progress = new_size != 0 ? (int)(100.0 * new_have / new_size) : 1;
new_progress = new_size != 0 ? static_cast<int>(100.0 * new_have / new_size) : 1;
}
new_progress = std::clamp(new_progress, 0, 100);
if (new_priority != old_priority || new_enabled != old_enabled)
{
/* Changing a value in the sort column can trigger a resort