Fix build on macOS.

This commit is contained in:
John Preston 2020-09-01 23:56:25 +04:00
parent 95a579f25f
commit ce91caa820
13 changed files with 52 additions and 37 deletions

View file

@ -121,29 +121,44 @@ private:
int section = 0; int section = 0;
int index = 0; int index = 0;
bool overDelete = false; 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 { struct OverSet {
int section = 0; int section = 0;
inline bool operator==(OverSet other) const {
return (section == other.section);
}
inline bool operator!=(OverSet other) const {
return !(*this == other);
}
}; };
struct OverButton { struct OverButton {
int section = 0; int section = 0;
inline bool operator==(OverButton other) const {
return (section == other.section);
}
inline bool operator!=(OverButton other) const {
return !(*this == other);
}
}; };
struct OverGroupAdd { 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< using OverState = std::variant<
v::null_t, v::null_t,
OverSticker, OverSticker,

View file

@ -202,7 +202,7 @@ CloudPasswordAlgo ValidateNewCloudPasswordAlgo(CloudPasswordAlgo &&parsed) {
if (!v::is<CloudPasswordAlgoModPow>(parsed)) { if (!v::is<CloudPasswordAlgoModPow>(parsed)) {
return v::null; return v::null;
} }
auto &value = std::get<CloudPasswordAlgoModPow>(parsed); auto &value = v::get<CloudPasswordAlgoModPow>(parsed);
const auto already = value.salt1.size(); const auto already = value.salt1.size();
value.salt1.resize(already + kAdditionalSalt); value.salt1.resize(already + kAdditionalSalt);
bytes::set_random(bytes::make_span(value.salt1).subspan(already)); bytes::set_random(bytes::make_span(value.salt1).subspan(already));
@ -273,7 +273,7 @@ SecureSecretAlgo ValidateNewSecureSecretAlgo(SecureSecretAlgo &&parsed) {
if (!v::is<SecureSecretAlgoPBKDF2>(parsed)) { if (!v::is<SecureSecretAlgoPBKDF2>(parsed)) {
return v::null; return v::null;
} }
auto &value = std::get<SecureSecretAlgoPBKDF2>(parsed); auto &value = v::get<SecureSecretAlgoPBKDF2>(parsed);
const auto already = value.salt.size(); const auto already = value.salt.size();
value.salt.resize(already + kAdditionalSalt); value.salt.resize(already + kAdditionalSalt);
bytes::set_random(bytes::make_span(value.salt).subspan(already)); bytes::set_random(bytes::make_span(value.salt).subspan(already));
@ -317,4 +317,4 @@ CloudPasswordState ParseCloudPasswordState(
return result; return result;
} }
} // namespace Core } // namespace Core

View file

@ -177,7 +177,7 @@ void UpdateCloudFile(
auto cacheBytes = !data.bytes.isEmpty() auto cacheBytes = !data.bytes.isEmpty()
? data.bytes ? data.bytes
: v::is<InMemoryLocation>(file.location.file().data) : v::is<InMemoryLocation>(file.location.file().data)
? std::get<InMemoryLocation>(file.location.file().data).bytes ? v::get<InMemoryLocation>(file.location.file().data).bytes
: QByteArray(); : QByteArray();
if (!cacheBytes.isEmpty()) { if (!cacheBytes.isEmpty()) {
if (const auto cacheKey = data.location.file().cacheKey()) { if (const auto cacheKey = data.location.file().cacheKey()) {

View file

@ -448,7 +448,7 @@ auto PhotoData::createStreamingLoader(
return v::is<StorageFileLocation>(videoLocation().file().data) return v::is<StorageFileLocation>(videoLocation().file().data)
? std::make_unique<Media::Streaming::LoaderMtproto>( ? std::make_unique<Media::Streaming::LoaderMtproto>(
&session().downloader(), &session().downloader(),
std::get<StorageFileLocation>(videoLocation().file().data), v::get<StorageFileLocation>(videoLocation().file().data),
videoByteSize(), videoByteSize(),
origin) origin)
: nullptr; : nullptr;

View file

@ -102,8 +102,8 @@ bool RepliesList::buildFromData(not_null<Viewer*> viewer) {
const auto i = around const auto i = around
? ranges::lower_bound(_list, around, std::greater<>()) ? ranges::lower_bound(_list, around, std::greater<>())
: end(_list); : end(_list);
const auto availableBefore = (end(_list) - i); const auto availableBefore = int(end(_list) - i);
const auto availableAfter = (i - begin(_list)); const auto availableAfter = int(i - begin(_list));
const auto useBefore = std::min(availableBefore, viewer->limitBefore + 1); const auto useBefore = std::min(availableBefore, viewer->limitBefore + 1);
const auto useAfter = std::min(availableAfter, viewer->limitAfter); const auto useAfter = std::min(availableAfter, viewer->limitAfter);
const auto slice = &viewer->slice; const auto slice = &viewer->slice;

View file

@ -120,7 +120,7 @@ public:
key.peerId, key.peerId,
key.migratedPeerId, key.migratedPeerId,
v::is<MessageId>(key.universalId) v::is<MessageId>(key.universalId)
? std::get<MessageId>(key.universalId) ? v::get<MessageId>(key.universalId)
: ServerMaxMsgId - 1 : ServerMaxMsgId - 1
}; };
} }
@ -165,7 +165,7 @@ private:
? ComputeId(key.peerId, *messageId) ? ComputeId(key.peerId, *messageId)
: ComputeId(key.migratedPeerId, ServerMaxMsgId + *messageId); : ComputeId(key.migratedPeerId, ServerMaxMsgId + *messageId);
} }
return std::get<not_null<PhotoData*>>(key.universalId); return v::get<not_null<PhotoData*>>(key.universalId);
} }
bool isolatedInSlice() const { bool isolatedInSlice() const {

View file

@ -1095,7 +1095,7 @@ auto HtmlWriter::Wrap::pushMessage(
if (!serviceText.isEmpty()) { if (!serviceText.isEmpty()) {
const auto &content = message.action.content; const auto &content = message.action.content;
const auto photo = v::is<ActionChatEditPhoto>(content) const auto photo = v::is<ActionChatEditPhoto>(content)
? &std::get<ActionChatEditPhoto>(content).photo ? &v::get<ActionChatEditPhoto>(content).photo
: nullptr; : nullptr;
return { info, pushServiceMessage( return { info, pushServiceMessage(
message.id, message.id,

View file

@ -326,7 +326,7 @@ void File::Context::readNextPacket() {
} else { } else {
// Still trying to read by drain. // Still trying to read by drain.
Assert(v::is<FFmpeg::AvErrorWrap>(result)); Assert(v::is<FFmpeg::AvErrorWrap>(result));
Assert(std::get<FFmpeg::AvErrorWrap>(result).code() == AVERROR_EOF); Assert(v::get<FFmpeg::AvErrorWrap>(result).code() == AVERROR_EOF);
processQueuedPackets(SleepPolicy::Allowed); processQueuedPackets(SleepPolicy::Allowed);
if (!finished()) { if (!finished()) {
handleEndOfFile(); handleEndOfFile();

View file

@ -31,7 +31,7 @@ LoaderMtproto::LoaderMtproto(
} }
Storage::Cache::Key LoaderMtproto::baseCacheKey() const { Storage::Cache::Key LoaderMtproto::baseCacheKey() const {
return std::get<StorageFileLocation>( return v::get<StorageFileLocation>(
location().data location().data
).bigFileBaseCacheKey(); ).bigFileBaseCacheKey();
} }

View file

@ -1624,7 +1624,7 @@ Data::FileOrigin OverlayWidget::fileOrigin(const Entity &entity) const {
} else if (!v::is<not_null<PhotoData*>>(entity.data)) { } else if (!v::is<not_null<PhotoData*>>(entity.data)) {
return Data::FileOrigin(); return Data::FileOrigin();
} }
const auto photo = std::get<not_null<PhotoData*>>(entity.data); const auto photo = v::get<not_null<PhotoData*>>(entity.data);
if (_user) { if (_user) {
return Data::FileOriginUserPhoto(_user->bareId(), photo->id); return Data::FileOriginUserPhoto(_user->bareId(), photo->id);
} else if (_peer && _peer->userpicPhotoId() == photo->id) { } else if (_peer && _peer->userpicPhotoId() == photo->id) {

View file

@ -682,7 +682,7 @@ std::optional<StorageImageLocation> StorageImageLocation::FromSerialized(
QByteArray DownloadLocation::serialize() const { QByteArray DownloadLocation::serialize() const {
if (!valid() || v::is<StorageFileLocation>(data)) { if (!valid() || v::is<StorageFileLocation>(data)) {
return std::get<StorageFileLocation>(data).serialize(); return v::get<StorageFileLocation>(data).serialize();
} }
auto result = QByteArray(); auto result = QByteArray();
auto buffer = QBuffer(&result); auto buffer = QBuffer(&result);
@ -719,7 +719,7 @@ QByteArray DownloadLocation::serialize() const {
int DownloadLocation::serializeSize() const { int DownloadLocation::serializeSize() const {
if (!valid() || v::is<StorageFileLocation>(data)) { if (!valid() || v::is<StorageFileLocation>(data)) {
return std::get<StorageFileLocation>(data).serializeSize(); return v::get<StorageFileLocation>(data).serializeSize();
} }
auto result = sizeof(quint16) + sizeof(quint8) + sizeof(quint8); auto result = sizeof(quint16) + sizeof(quint8) + sizeof(quint8);
v::match(data, [&](const StorageFileLocation &data) { v::match(data, [&](const StorageFileLocation &data) {
@ -812,7 +812,7 @@ DownloadLocation DownloadLocation::convertToModern(
if (!v::is<StorageFileLocation>(data)) { if (!v::is<StorageFileLocation>(data)) {
return *this; return *this;
} }
auto &file = std::get<StorageFileLocation>(data); auto &file = v::get<StorageFileLocation>(data);
return DownloadLocation{ file.convertToModern(type, id, accessHash) }; return DownloadLocation{ file.convertToModern(type, id, accessHash) };
} }
@ -838,7 +838,7 @@ Storage::Cache::Key DownloadLocation::cacheKey() const {
Storage::Cache::Key DownloadLocation::bigFileBaseCacheKey() const { Storage::Cache::Key DownloadLocation::bigFileBaseCacheKey() const {
return v::is<StorageFileLocation>(data) return v::is<StorageFileLocation>(data)
? std::get<StorageFileLocation>(data).bigFileBaseCacheKey() ? v::get<StorageFileLocation>(data).bigFileBaseCacheKey()
: Storage::Cache::Key(); : Storage::Cache::Key();
} }
@ -858,7 +858,7 @@ bool DownloadLocation::valid() const {
bool DownloadLocation::isLegacy() const { bool DownloadLocation::isLegacy() const {
return v::is<StorageFileLocation>(data) return v::is<StorageFileLocation>(data)
? std::get<StorageFileLocation>(data).isLegacy() ? v::get<StorageFileLocation>(data).isLegacy()
: false; : false;
} }
@ -866,14 +866,14 @@ QByteArray DownloadLocation::fileReference() const {
if (!v::is<StorageFileLocation>(data)) { if (!v::is<StorageFileLocation>(data)) {
return QByteArray(); return QByteArray();
} }
return std::get<StorageFileLocation>(data).fileReference(); return v::get<StorageFileLocation>(data).fileReference();
} }
bool DownloadLocation::refreshFileReference(const QByteArray &data) { bool DownloadLocation::refreshFileReference(const QByteArray &data) {
if (!v::is<StorageFileLocation>(this->data)) { if (!v::is<StorageFileLocation>(this->data)) {
return false; return false;
} }
auto &file = std::get<StorageFileLocation>(this->data); auto &file = v::get<StorageFileLocation>(this->data);
return file.refreshFileReference(data); return file.refreshFileReference(data);
} }
@ -882,7 +882,7 @@ bool DownloadLocation::refreshFileReference(
if (!v::is<StorageFileLocation>(data)) { if (!v::is<StorageFileLocation>(data)) {
return false; return false;
} }
auto &file = std::get<StorageFileLocation>(data); auto &file = v::get<StorageFileLocation>(data);
return file.refreshFileReference(updates); return file.refreshFileReference(updates);
} }

@ -1 +1 @@
Subproject commit 1729480399aa34241b1a5bdacfdf284e041072dd Subproject commit 8609bff8bd418be81f4ed52060576e5d06e4b9a4

@ -1 +1 @@
Subproject commit 52b8d0456fec25f80ca96e6d354dd7583f7fa350 Subproject commit cbd295476b7910cc7fad7039e5da4a04edf33200