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 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,

View file

@ -202,7 +202,7 @@ CloudPasswordAlgo ValidateNewCloudPasswordAlgo(CloudPasswordAlgo &&parsed) {
if (!v::is<CloudPasswordAlgoModPow>(parsed)) {
return v::null;
}
auto &value = std::get<CloudPasswordAlgoModPow>(parsed);
auto &value = v::get<CloudPasswordAlgoModPow>(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<SecureSecretAlgoPBKDF2>(parsed)) {
return v::null;
}
auto &value = std::get<SecureSecretAlgoPBKDF2>(parsed);
auto &value = v::get<SecureSecretAlgoPBKDF2>(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
} // namespace Core

View file

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

View file

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

View file

@ -102,8 +102,8 @@ bool RepliesList::buildFromData(not_null<Viewer*> 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;

View file

@ -120,7 +120,7 @@ public:
key.peerId,
key.migratedPeerId,
v::is<MessageId>(key.universalId)
? std::get<MessageId>(key.universalId)
? v::get<MessageId>(key.universalId)
: ServerMaxMsgId - 1
};
}
@ -165,7 +165,7 @@ private:
? ComputeId(key.peerId, *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 {

View file

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

View file

@ -326,7 +326,7 @@ void File::Context::readNextPacket() {
} else {
// Still trying to read by drain.
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);
if (!finished()) {
handleEndOfFile();

View file

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

View file

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

View file

@ -682,7 +682,7 @@ std::optional<StorageImageLocation> StorageImageLocation::FromSerialized(
QByteArray DownloadLocation::serialize() const {
if (!valid() || v::is<StorageFileLocation>(data)) {
return std::get<StorageFileLocation>(data).serialize();
return v::get<StorageFileLocation>(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<StorageFileLocation>(data)) {
return std::get<StorageFileLocation>(data).serializeSize();
return v::get<StorageFileLocation>(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<StorageFileLocation>(data)) {
return *this;
}
auto &file = std::get<StorageFileLocation>(data);
auto &file = v::get<StorageFileLocation>(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<StorageFileLocation>(data)
? std::get<StorageFileLocation>(data).bigFileBaseCacheKey()
? v::get<StorageFileLocation>(data).bigFileBaseCacheKey()
: Storage::Cache::Key();
}
@ -858,7 +858,7 @@ bool DownloadLocation::valid() const {
bool DownloadLocation::isLegacy() const {
return v::is<StorageFileLocation>(data)
? std::get<StorageFileLocation>(data).isLegacy()
? v::get<StorageFileLocation>(data).isLegacy()
: false;
}
@ -866,14 +866,14 @@ QByteArray DownloadLocation::fileReference() const {
if (!v::is<StorageFileLocation>(data)) {
return QByteArray();
}
return std::get<StorageFileLocation>(data).fileReference();
return v::get<StorageFileLocation>(data).fileReference();
}
bool DownloadLocation::refreshFileReference(const QByteArray &data) {
if (!v::is<StorageFileLocation>(this->data)) {
return false;
}
auto &file = std::get<StorageFileLocation>(this->data);
auto &file = v::get<StorageFileLocation>(this->data);
return file.refreshFileReference(data);
}
@ -882,7 +882,7 @@ bool DownloadLocation::refreshFileReference(
if (!v::is<StorageFileLocation>(data)) {
return false;
}
auto &file = std::get<StorageFileLocation>(data);
auto &file = v::get<StorageFileLocation>(data);
return file.refreshFileReference(updates);
}

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

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