2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Replaced snap util function with std::clamp.

This commit is contained in:
23rd
2021-01-23 06:29:50 +03:00
parent 4895e5e110
commit dd01ece14a
44 changed files with 193 additions and 92 deletions

View File

@@ -1053,7 +1053,7 @@ bool ReadSetting(
stream >> v;
if (!CheckStreamStatus(stream)) return false;
Core::App().settings().setSongVolume(snap(v / 1e6, 0., 1.));
Core::App().settings().setSongVolume(std::clamp(v / 1e6, 0., 1.));
context.legacyRead = true;
} break;
@@ -1062,7 +1062,7 @@ bool ReadSetting(
stream >> v;
if (!CheckStreamStatus(stream)) return false;
Core::App().settings().setVideoVolume(snap(v / 1e6, 0., 1.));
Core::App().settings().setVideoVolume(std::clamp(v / 1e6, 0., 1.));
context.legacyRead = true;
} break;

View File

@@ -80,7 +80,7 @@ QString StateDescription(const BlobState &state, tr::phrase<> activeText) {
return activeText(tr::now);
}, [](const Loading &data) {
const auto percent = (data.size > 0)
? snap((data.already * 100) / float64(data.size), 0., 100.)
? std::clamp((data.already * 100) / float64(data.size), 0., 100.)
: 0.;
return tr::lng_emoji_set_loading(
tr::now,