2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45: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

@@ -893,7 +893,7 @@ float64 DocumentData::progress() const {
if (uploadingData->size > 0) {
const auto result = float64(uploadingData->offset)
/ uploadingData->size;
return snap(result, 0., 1.);
return std::clamp(result, 0., 1.);
}
return 0.;
}

View File

@@ -350,7 +350,7 @@ TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now) {
crl::time OnlineChangeTimeout(TimeId online, TimeId now) {
const auto result = OnlinePhraseChangeInSeconds(online, now);
Assert(result >= 0);
return snap(
return std::clamp(
result * crl::time(1000),
kMinOnlineChangeTimeout,
kMaxOnlineChangeTimeout);

View File

@@ -166,7 +166,7 @@ float64 PhotoData::progress() const {
if (uploadingData->size > 0) {
const auto result = float64(uploadingData->offset)
/ uploadingData->size;
return snap(result, 0., 1.);
return std::clamp(result, 0., 1.);
}
return 0.;
}