From c3db57a4fc11c2747f2db4bb38054b601634e2c7 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Wed, 28 Jun 2017 10:24:06 +0300
Subject: [PATCH] Closed beta 1001007003: Fix Xcode build.

---
 Telegram/SourceFiles/core/utils.h                 | 15 +--------------
 .../history/history_admin_log_item.cpp            |  9 ++++-----
 Telegram/SourceFiles/history/history_item.h       |  2 +-
 .../mtproto/special_config_request.cpp            |  2 +-
 4 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h
index 92888fe49..91e69aab2 100644
--- a/Telegram/SourceFiles/core/utils.h
+++ b/Telegram/SourceFiles/core/utils.h
@@ -27,20 +27,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 #include <set>
 #include <gsl/gsl>
 
-#ifdef OS_MAC_OLD
-namespace gsl {
-
-inline span<char> make_span(QByteArray &container) {
-	return span<char>(container.begin(), container.end());
-}
-
-inline span<const char> make_span(const QByteArray &container) {
-	return span<const char>(container.begin(), container.end());
-}
-
-} // namespace gsl
-#endif // OS_MAC_OLD
-
 // Release build assertions.
 inline void t_noop() {
 }
@@ -468,6 +454,7 @@ public:
 	ReadLockerAttempt &operator=(ReadLockerAttempt &&other) {
 		_lock = other._lock;
 		_locked = base::take(other._locked);
+		return *this;
 	}
 	~ReadLockerAttempt() {
 		if (_locked) {
diff --git a/Telegram/SourceFiles/history/history_admin_log_item.cpp b/Telegram/SourceFiles/history/history_admin_log_item.cpp
index bf2c4d0be..7fb6d4421 100644
--- a/Telegram/SourceFiles/history/history_admin_log_item.cpp
+++ b/Telegram/SourceFiles/history/history_admin_log_item.cpp
@@ -117,8 +117,8 @@ auto GenerateAdminChangeText(gsl::not_null<ChannelData*> channel, const TextWith
 
 	Expects(!newRights || newRights->type() == mtpc_channelAdminRights);
 	Expects(!prevRights || prevRights->type() == mtpc_channelAdminRights);
-	auto newFlags = newRights ? newRights->c_channelAdminRights().vflags.v : 0;
-	auto prevFlags = prevRights ? prevRights->c_channelAdminRights().vflags.v : 0;
+	auto newFlags = newRights ? newRights->c_channelAdminRights().vflags.v : MTPDchannelAdminRights::Flags(0);
+	auto prevFlags = prevRights ? prevRights->c_channelAdminRights().vflags.v : MTPDchannelAdminRights::Flags(0);
 	auto result = lng_admin_log_promoted__generic(lt_user, user);
 
 	auto inviteKey = Flag::f_invite_users | Flag::f_invite_link;
@@ -150,8 +150,8 @@ auto GenerateBannedChangeText(const TextWithEntities &user, const MTPChannelBann
 
 	Expects(!newRights || newRights->type() == mtpc_channelBannedRights);
 	Expects(!prevRights || prevRights->type() == mtpc_channelBannedRights);
-	auto newFlags = newRights ? newRights->c_channelBannedRights().vflags.v : 0;
-	auto prevFlags = prevRights ? prevRights->c_channelBannedRights().vflags.v : 0;
+	auto newFlags = newRights ? newRights->c_channelBannedRights().vflags.v : MTPDchannelBannedRights::Flags(0);
+	auto prevFlags = prevRights ? prevRights->c_channelBannedRights().vflags.v : MTPDchannelBannedRights::Flags(0);
 	auto newUntil = newRights ? newRights->c_channelBannedRights().vuntil_date : MTP_int(0);
 	auto indefinitely = ChannelData::IsRestrictedForever(newUntil.v);
 	if (newFlags & Flag::f_view_messages) {
@@ -248,7 +248,6 @@ void GenerateItems(gsl::not_null<History*> history, LocalIdManager &idManager, c
 		return callback(HistoryItemOwned(item));
 	};
 
-	using ServiceFlag = MTPDmessageService::Flag;
 	using Flag = MTPDmessage::Flag;
 	auto fromName = App::peerName(from);
 	auto fromLink = peerOpenClickHandler(from);
diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h
index 5e5c52168..d0bc743d9 100644
--- a/Telegram/SourceFiles/history/history_item.h
+++ b/Telegram/SourceFiles/history/history_item.h
@@ -779,7 +779,7 @@ public:
 		return (!out() || isPost()) && !history()->peer->isUser();
 	}
 	PeerData *author() const {
-		return isPost() ? history()->peer : _from;
+		return isPost() ? history()->peer : from();
 	}
 
 	QDateTime dateOriginal() const {
diff --git a/Telegram/SourceFiles/mtproto/special_config_request.cpp b/Telegram/SourceFiles/mtproto/special_config_request.cpp
index 7223614ff..3bb2ea258 100644
--- a/Telegram/SourceFiles/mtproto/special_config_request.cpp
+++ b/Telegram/SourceFiles/mtproto/special_config_request.cpp
@@ -107,7 +107,7 @@ void SpecialConfigRequest::dnsFinished() {
 		} else if (!answerIt->isArray()) {
 			LOG(("Config Error: Not an array received in Answer in dns response JSON."));
 		} else {
-			for (auto &elem : answerIt->toArray()) {
+			for (auto elem : answerIt->toArray()) {
 				if (!elem.isObject()) {
 					LOG(("Config Error: Not an object found in Answer array in dns response JSON."));
 				} else {