diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h index e77320894..b996f0214 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h @@ -121,29 +121,44 @@ private: int section = 0; int index = 0; bool overDelete = false; + + inline bool operator==(OverSticker other) const { + return (section == other.section) + && (index == other.index) + && (overDelete == other.overDelete); + } + inline bool operator!=(OverSticker other) const { + return !(*this == other); + } }; struct OverSet { int section = 0; + + inline bool operator==(OverSet other) const { + return (section == other.section); + } + inline bool operator!=(OverSet other) const { + return !(*this == other); + } }; struct OverButton { int section = 0; + + inline bool operator==(OverButton other) const { + return (section == other.section); + } + inline bool operator!=(OverButton other) const { + return !(*this == other); + } }; struct OverGroupAdd { + inline bool operator==(OverGroupAdd other) const { + return true; + } + inline bool operator!=(OverGroupAdd other) const { + return !(*this == other); + } }; - friend inline bool operator==(OverSticker a, OverSticker b) { - return (a.section == b.section) - && (a.index == b.index) - && (a.overDelete == b.overDelete); - } - friend inline bool operator==(OverSet a, OverSet b) { - return (a.section == b.section); - } - friend inline bool operator==(OverButton a, OverButton b) { - return (a.section == b.section); - } - friend inline bool operator==(OverGroupAdd a, OverGroupAdd b) { - return true; - } using OverState = std::variant< v::null_t, OverSticker, diff --git a/Telegram/SourceFiles/core/core_cloud_password.cpp b/Telegram/SourceFiles/core/core_cloud_password.cpp index e076ac646..576285f13 100644 --- a/Telegram/SourceFiles/core/core_cloud_password.cpp +++ b/Telegram/SourceFiles/core/core_cloud_password.cpp @@ -202,7 +202,7 @@ CloudPasswordAlgo ValidateNewCloudPasswordAlgo(CloudPasswordAlgo &&parsed) { if (!v::is(parsed)) { return v::null; } - auto &value = std::get(parsed); + auto &value = v::get(parsed); const auto already = value.salt1.size(); value.salt1.resize(already + kAdditionalSalt); bytes::set_random(bytes::make_span(value.salt1).subspan(already)); @@ -273,7 +273,7 @@ SecureSecretAlgo ValidateNewSecureSecretAlgo(SecureSecretAlgo &&parsed) { if (!v::is(parsed)) { return v::null; } - auto &value = std::get(parsed); + auto &value = v::get(parsed); const auto already = value.salt.size(); value.salt.resize(already + kAdditionalSalt); bytes::set_random(bytes::make_span(value.salt).subspan(already)); @@ -317,4 +317,4 @@ CloudPasswordState ParseCloudPasswordState( return result; } -} // namespace Core \ No newline at end of file +} // namespace Core diff --git a/Telegram/SourceFiles/data/data_cloud_file.cpp b/Telegram/SourceFiles/data/data_cloud_file.cpp index 63aba99fb..aa5bfa6c3 100644 --- a/Telegram/SourceFiles/data/data_cloud_file.cpp +++ b/Telegram/SourceFiles/data/data_cloud_file.cpp @@ -177,7 +177,7 @@ void UpdateCloudFile( auto cacheBytes = !data.bytes.isEmpty() ? data.bytes : v::is(file.location.file().data) - ? std::get(file.location.file().data).bytes + ? v::get(file.location.file().data).bytes : QByteArray(); if (!cacheBytes.isEmpty()) { if (const auto cacheKey = data.location.file().cacheKey()) { diff --git a/Telegram/SourceFiles/data/data_photo.cpp b/Telegram/SourceFiles/data/data_photo.cpp index cee9f857b..254417ed2 100644 --- a/Telegram/SourceFiles/data/data_photo.cpp +++ b/Telegram/SourceFiles/data/data_photo.cpp @@ -448,7 +448,7 @@ auto PhotoData::createStreamingLoader( return v::is(videoLocation().file().data) ? std::make_unique( &session().downloader(), - std::get(videoLocation().file().data), + v::get(videoLocation().file().data), videoByteSize(), origin) : nullptr; diff --git a/Telegram/SourceFiles/data/data_replies_list.cpp b/Telegram/SourceFiles/data/data_replies_list.cpp index 5105d3295..62104e616 100644 --- a/Telegram/SourceFiles/data/data_replies_list.cpp +++ b/Telegram/SourceFiles/data/data_replies_list.cpp @@ -102,8 +102,8 @@ bool RepliesList::buildFromData(not_null viewer) { const auto i = around ? ranges::lower_bound(_list, around, std::greater<>()) : end(_list); - const auto availableBefore = (end(_list) - i); - const auto availableAfter = (i - begin(_list)); + const auto availableBefore = int(end(_list) - i); + const auto availableAfter = int(i - begin(_list)); const auto useBefore = std::min(availableBefore, viewer->limitBefore + 1); const auto useAfter = std::min(availableAfter, viewer->limitAfter); const auto slice = &viewer->slice; diff --git a/Telegram/SourceFiles/data/data_shared_media.h b/Telegram/SourceFiles/data/data_shared_media.h index f98c31679..c73de5bb7 100644 --- a/Telegram/SourceFiles/data/data_shared_media.h +++ b/Telegram/SourceFiles/data/data_shared_media.h @@ -120,7 +120,7 @@ public: key.peerId, key.migratedPeerId, v::is(key.universalId) - ? std::get(key.universalId) + ? v::get(key.universalId) : ServerMaxMsgId - 1 }; } @@ -165,7 +165,7 @@ private: ? ComputeId(key.peerId, *messageId) : ComputeId(key.migratedPeerId, ServerMaxMsgId + *messageId); } - return std::get>(key.universalId); + return v::get>(key.universalId); } bool isolatedInSlice() const { diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index e072619d7..ba9074d5a 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -1095,7 +1095,7 @@ auto HtmlWriter::Wrap::pushMessage( if (!serviceText.isEmpty()) { const auto &content = message.action.content; const auto photo = v::is(content) - ? &std::get(content).photo + ? &v::get(content).photo : nullptr; return { info, pushServiceMessage( message.id, diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp index 1549cefb0..8c5079832 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_file.cpp @@ -326,7 +326,7 @@ void File::Context::readNextPacket() { } else { // Still trying to read by drain. Assert(v::is(result)); - Assert(std::get(result).code() == AVERROR_EOF); + Assert(v::get(result).code() == AVERROR_EOF); processQueuedPackets(SleepPolicy::Allowed); if (!finished()) { handleEndOfFile(); diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp index d7d0b38a1..f18f6a288 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_loader_mtproto.cpp @@ -31,7 +31,7 @@ LoaderMtproto::LoaderMtproto( } Storage::Cache::Key LoaderMtproto::baseCacheKey() const { - return std::get( + return v::get( location().data ).bigFileBaseCacheKey(); } diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 9e922cee8..d5743d6a8 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -1624,7 +1624,7 @@ Data::FileOrigin OverlayWidget::fileOrigin(const Entity &entity) const { } else if (!v::is>(entity.data)) { return Data::FileOrigin(); } - const auto photo = std::get>(entity.data); + const auto photo = v::get>(entity.data); if (_user) { return Data::FileOriginUserPhoto(_user->bareId(), photo->id); } else if (_peer && _peer->userpicPhotoId() == photo->id) { diff --git a/Telegram/SourceFiles/ui/image/image_location.cpp b/Telegram/SourceFiles/ui/image/image_location.cpp index 5a872490f..dea8c72b5 100644 --- a/Telegram/SourceFiles/ui/image/image_location.cpp +++ b/Telegram/SourceFiles/ui/image/image_location.cpp @@ -682,7 +682,7 @@ std::optional StorageImageLocation::FromSerialized( QByteArray DownloadLocation::serialize() const { if (!valid() || v::is(data)) { - return std::get(data).serialize(); + return v::get(data).serialize(); } auto result = QByteArray(); auto buffer = QBuffer(&result); @@ -719,7 +719,7 @@ QByteArray DownloadLocation::serialize() const { int DownloadLocation::serializeSize() const { if (!valid() || v::is(data)) { - return std::get(data).serializeSize(); + return v::get(data).serializeSize(); } auto result = sizeof(quint16) + sizeof(quint8) + sizeof(quint8); v::match(data, [&](const StorageFileLocation &data) { @@ -812,7 +812,7 @@ DownloadLocation DownloadLocation::convertToModern( if (!v::is(data)) { return *this; } - auto &file = std::get(data); + auto &file = v::get(data); return DownloadLocation{ file.convertToModern(type, id, accessHash) }; } @@ -838,7 +838,7 @@ Storage::Cache::Key DownloadLocation::cacheKey() const { Storage::Cache::Key DownloadLocation::bigFileBaseCacheKey() const { return v::is(data) - ? std::get(data).bigFileBaseCacheKey() + ? v::get(data).bigFileBaseCacheKey() : Storage::Cache::Key(); } @@ -858,7 +858,7 @@ bool DownloadLocation::valid() const { bool DownloadLocation::isLegacy() const { return v::is(data) - ? std::get(data).isLegacy() + ? v::get(data).isLegacy() : false; } @@ -866,14 +866,14 @@ QByteArray DownloadLocation::fileReference() const { if (!v::is(data)) { return QByteArray(); } - return std::get(data).fileReference(); + return v::get(data).fileReference(); } bool DownloadLocation::refreshFileReference(const QByteArray &data) { if (!v::is(this->data)) { return false; } - auto &file = std::get(this->data); + auto &file = v::get(this->data); return file.refreshFileReference(data); } @@ -882,7 +882,7 @@ bool DownloadLocation::refreshFileReference( if (!v::is(data)) { return false; } - auto &file = std::get(data); + auto &file = v::get(data); return file.refreshFileReference(updates); } diff --git a/Telegram/lib_base b/Telegram/lib_base index 172948039..8609bff8b 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 1729480399aa34241b1a5bdacfdf284e041072dd +Subproject commit 8609bff8bd418be81f4ed52060576e5d06e4b9a4 diff --git a/Telegram/lib_storage b/Telegram/lib_storage index 52b8d0456..cbd295476 160000 --- a/Telegram/lib_storage +++ b/Telegram/lib_storage @@ -1 +1 @@ -Subproject commit 52b8d0456fec25f80ca96e6d354dd7583f7fa350 +Subproject commit cbd295476b7910cc7fad7039e5da4a04edf33200