Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 576168 Details for
Bug 685718
games-strategy/freeorion-0.4.8: fix boost support
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
https://github.com/freeorion/freeorion/pull/2443
freeorion-0.4.8-boost-compat.patch (text/plain), 27.15 KB, created by
Oleg
on 2019-05-12 11:53:20 UTC
(
hide
)
Description:
https://github.com/freeorion/freeorion/pull/2443
Filename:
MIME Type:
Creator:
Oleg
Created:
2019-05-12 11:53:20 UTC
Size:
27.15 KB
patch
obsolete
>From a9799229735b0ea4d4d300b08f6d32176f1b6f40 Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sun, 17 Mar 2019 13:11:11 +0100 >Subject: [PATCH 01/10] Replace deprecated boost::asio stuff. > >--- > network/ClientNetworking.cpp | 38 ++++++++++++++++++------------------ > network/ServerNetworking.cpp | 24 +++++++++++------------ > network/ServerNetworking.h | 8 ++++---- > server/ServerApp.cpp | 6 +++--- > server/ServerApp.h | 2 +- > server/ServerFSM.cpp | 2 +- > 6 files changed, 40 insertions(+), 40 deletions(-) > >diff --git a/network/ClientNetworking.cpp b/network/ClientNetworking.cpp >index cedb3b4cb4..8ecfd9c678 100644 >--- a/network/ClientNetworking.cpp >+++ b/network/ClientNetworking.cpp >@@ -42,10 +42,10 @@ namespace { > public: > using ServerList = std::vector<std::pair<boost::asio::ip::address, std::string>>; > >- ServerDiscoverer(boost::asio::io_service& io_service) : >- m_io_service(&io_service), >- m_timer(io_service), >- m_socket(io_service), >+ ServerDiscoverer(boost::asio::io_context& io_context) : >+ m_io_context(&io_context), >+ m_timer(io_context), >+ m_socket(io_context), > m_recv_buf(), > m_receive_successful(false), > m_server_name() >@@ -56,7 +56,7 @@ namespace { > > void DiscoverServers() { > using namespace boost::asio::ip; >- udp::resolver resolver(*m_io_service); >+ udp::resolver resolver(*m_io_context); > udp::resolver::query query(udp::v4(), "255.255.255.255", > std::to_string(Networking::DiscoveryPort()), > resolver_query_base::address_configured | >@@ -81,8 +81,8 @@ namespace { > boost::asio::placeholders::bytes_transferred)); > m_timer.expires_from_now(std::chrono::seconds(2)); > m_timer.async_wait(boost::bind(&ServerDiscoverer::CloseSocket, this)); >- m_io_service->run(); >- m_io_service->reset(); >+ m_io_context->run(); >+ m_io_context->reset(); > if (m_receive_successful) { > boost::asio::ip::address address = m_server_name == "localhost" ? > boost::asio::ip::address::from_string("127.0.0.1") : >@@ -121,7 +121,7 @@ namespace { > void CloseSocket() > { m_socket.close(); } > >- boost::asio::io_service* m_io_service; >+ boost::asio::io_context* m_io_context; > boost::asio::high_resolution_timer m_timer; > boost::asio::ip::udp::socket m_socket; > >@@ -233,7 +233,7 @@ class ClientNetworking::Impl { > int m_host_player_id; > Networking::AuthRoles m_roles; > >- boost::asio::io_service m_io_service; >+ boost::asio::io_context m_io_context; > boost::asio::ip::tcp::socket m_socket; > > // m_mutex guards m_incoming_message, m_rx_connected and m_tx_connected which are written by >@@ -262,8 +262,8 @@ class ClientNetworking::Impl { > ClientNetworking::Impl::Impl() : > m_player_id(Networking::INVALID_PLAYER_ID), > m_host_player_id(Networking::INVALID_PLAYER_ID), >- m_io_service(), >- m_socket(m_io_service), >+ m_io_context(), >+ m_socket(m_io_context), > m_rx_connected(false), > m_tx_connected(false), > m_incoming_messages(m_mutex) >@@ -302,7 +302,7 @@ bool ClientNetworking::Impl::HasAuthRole(Networking::RoleType role) const > ClientNetworking::ServerNames ClientNetworking::Impl::DiscoverLANServerNames() { > if (!IsConnected()) > return ServerNames(); >- ServerDiscoverer discoverer(m_io_service); >+ ServerDiscoverer discoverer(m_io_context); > discoverer.DiscoverServers(); > ServerNames names; > for (const auto& server : discoverer.Servers()) { >@@ -325,7 +325,7 @@ bool ClientNetworking::Impl::ConnectToServer( > auto deadline = start_time + timeout; > > using namespace boost::asio::ip; >- tcp::resolver resolver(m_io_service); >+ tcp::resolver resolver(m_io_context); > tcp::resolver::query query(ip_address, > std::to_string(Networking::MessagePort()), > boost::asio::ip::resolver_query_base::numeric_service); >@@ -347,8 +347,8 @@ bool ClientNetworking::Impl::ConnectToServer( > m_socket.async_connect(*it, boost::bind(&ClientNetworking::Impl::HandleConnection, this, > &it, > boost::asio::placeholders::error)); >- m_io_service.run(); >- m_io_service.reset(); >+ m_io_context.run(); >+ m_io_context.reset(); > > auto connection_time = Clock::now() - start_time; > >@@ -435,7 +435,7 @@ void ClientNetworking::Impl::DisconnectFromServer() { > } > > if (is_open) >- m_io_service.post(boost::bind(&ClientNetworking::Impl::DisconnectFromServerImpl, this)); >+ m_io_context.post(boost::bind(&ClientNetworking::Impl::DisconnectFromServerImpl, this)); > } > > void ClientNetworking::Impl::SetPlayerID(int player_id) { >@@ -455,7 +455,7 @@ void ClientNetworking::Impl::SendMessage(const Message& message) { > return; > } > TraceLogger(network) << "ClientNetworking::SendMessage() : sending message " << message; >- m_io_service.post(boost::bind(&ClientNetworking::Impl::SendMessageImpl, this, message)); >+ m_io_context.post(boost::bind(&ClientNetworking::Impl::SendMessageImpl, this, message)); > } > > boost::optional<Message> ClientNetworking::Impl::GetMessage() { >@@ -504,12 +504,12 @@ void ClientNetworking::Impl::NetworkingThread(const std::shared_ptr<const Client > if (!m_outgoing_messages.empty()) > AsyncWriteMessage(); > AsyncReadMessage(protect_from_destruction_in_other_thread); >- m_io_service.run(); >+ m_io_context.run(); > } catch (const boost::system::system_error& error) { > HandleException(error); > } > m_outgoing_messages.clear(); >- m_io_service.reset(); >+ m_io_context.reset(); > { // Mutex scope > boost::mutex::scoped_lock lock(m_mutex); > m_rx_connected = false; >diff --git a/network/ServerNetworking.cpp b/network/ServerNetworking.cpp >index 53daee6ac6..de6b0818c1 100644 >--- a/network/ServerNetworking.cpp >+++ b/network/ServerNetworking.cpp >@@ -23,7 +23,7 @@ namespace { > on the local network and sends out responses to them. */ > class DiscoveryServer { > public: >- DiscoveryServer(boost::asio::io_service& io_service); >+ DiscoveryServer(boost::asio::io_context& io_context); > > private: > void Listen(); >@@ -52,12 +52,12 @@ namespace { > //////////////////////////////////////////////////////////////////////////////// > // PlayerConnection > //////////////////////////////////////////////////////////////////////////////// >-PlayerConnection::PlayerConnection(boost::asio::io_service& io_service, >+PlayerConnection::PlayerConnection(boost::asio::io_context& io_context, > MessageAndConnectionFn nonplayer_message_callback, > MessageAndConnectionFn player_message_callback, > ConnectionFn disconnected_callback) : >- m_service(io_service), >- m_socket(io_service), >+ m_service(io_context), >+ m_socket(io_context), > m_ID(INVALID_PLAYER_ID), > m_new_connection(true), > m_client_type(Networking::INVALID_CLIENT_TYPE), >@@ -215,13 +215,13 @@ const std::string& PlayerConnection::ClientVersionString() const > bool PlayerConnection::ClientVersionStringMatchesThisServer() const > { return !m_client_version_string.empty() && m_client_version_string == FreeOrionVersionString(); } > >-PlayerConnectionPtr PlayerConnection::NewConnection(boost::asio::io_service& io_service, >+PlayerConnectionPtr PlayerConnection::NewConnection(boost::asio::io_context& io_context, > MessageAndConnectionFn nonplayer_message_callback, > MessageAndConnectionFn player_message_callback, > ConnectionFn disconnected_callback) > { > return PlayerConnectionPtr( >- new PlayerConnection(io_service, nonplayer_message_callback, player_message_callback, >+ new PlayerConnection(io_context, nonplayer_message_callback, player_message_callback, > disconnected_callback)); > } > >@@ -393,8 +393,8 @@ void PlayerConnection::AsyncErrorHandler(boost::system::error_code handled_error > //////////////////////////////////////////////////////////////////////////////// > // DiscoveryServer > //////////////////////////////////////////////////////////////////////////////// >-DiscoveryServer::DiscoveryServer(boost::asio::io_service& io_service) : >- m_socket(io_service, udp::endpoint(udp::v4(), Networking::DiscoveryPort())) >+DiscoveryServer::DiscoveryServer(boost::asio::io_context& io_context) : >+ m_socket(io_context, udp::endpoint(udp::v4(), Networking::DiscoveryPort())) > { Listen(); } > > void DiscoveryServer::Listen() { >@@ -421,20 +421,20 @@ bool ServerNetworking::EstablishedPlayer::operator()( > const PlayerConnectionPtr& player_connection) const > { return player_connection->EstablishedPlayer(); } > >-ServerNetworking::ServerNetworking(boost::asio::io_service& io_service, >+ServerNetworking::ServerNetworking(boost::asio::io_context& io_context, > MessageAndConnectionFn nonplayer_message_callback, > MessageAndConnectionFn player_message_callback, > ConnectionFn disconnected_callback) : > m_host_player_id(Networking::INVALID_PLAYER_ID), > m_discovery_server(nullptr), >- m_player_connection_acceptor(io_service), >+ m_player_connection_acceptor(io_context), > m_nonplayer_message_callback(nonplayer_message_callback), > m_player_message_callback(player_message_callback), > m_disconnected_callback(disconnected_callback) > { > if (!GetOptionsDB().Get<bool>("singleplayer")) { > // only start discovery service for multiplayer servers. >- m_discovery_server = new DiscoveryServer(io_service); >+ m_discovery_server = new DiscoveryServer(io_context); > } > > Init(); >@@ -673,7 +673,7 @@ void ServerNetworking::Init() { > void ServerNetworking::AcceptNextConnection() { > PlayerConnectionPtr next_connection = > PlayerConnection::NewConnection( >- m_player_connection_acceptor.get_io_service(), >+ m_player_connection_acceptor.get_executor().context(), > m_nonplayer_message_callback, > m_player_message_callback, > boost::bind(&ServerNetworking::DisconnectImpl, this, _1)); >diff --git a/network/ServerNetworking.h b/network/ServerNetworking.h >index 3643df257f..aed34d28ae 100644 >--- a/network/ServerNetworking.h >+++ b/network/ServerNetworking.h >@@ -58,7 +58,7 @@ class ServerNetworking { > typedef boost::filter_iterator<EstablishedPlayer, PlayerConnections::const_iterator> const_established_iterator; > > /** \name Structors */ //@{ >- ServerNetworking(boost::asio::io_service& io_service, >+ ServerNetworking(boost::asio::io_context& io_context, > MessageAndConnectionFn nonplayer_message_callback, > MessageAndConnectionFn player_message_callback, > ConnectionFn disconnected_callback); >@@ -286,12 +286,12 @@ class PlayerConnection : > > /** Creates a new PlayerConnection and returns it as a shared_ptr. */ > static PlayerConnectionPtr >- NewConnection(boost::asio::io_service& io_service, MessageAndConnectionFn nonplayer_message_callback, >+ NewConnection(boost::asio::io_context& io_context, MessageAndConnectionFn nonplayer_message_callback, > MessageAndConnectionFn player_message_callback, ConnectionFn disconnected_callback); > > private: > >- PlayerConnection(boost::asio::io_service& io_service, MessageAndConnectionFn nonplayer_message_callback, >+ PlayerConnection(boost::asio::io_context& io_context, MessageAndConnectionFn nonplayer_message_callback, > MessageAndConnectionFn player_message_callback, ConnectionFn disconnected_callback); > void HandleMessageBodyRead(boost::system::error_code error, std::size_t bytes_transferred); > void HandleMessageHeaderRead(boost::system::error_code error, std::size_t bytes_transferred); >@@ -299,7 +299,7 @@ class PlayerConnection : > bool SyncWriteMessage(const Message& message); > void AsyncErrorHandler(boost::system::error_code handled_error, boost::system::error_code error); > >- boost::asio::io_service& m_service; >+ boost::asio::io_context& m_service; > boost::asio::ip::tcp::socket m_socket; > Message::HeaderBuffer m_incoming_header_buffer; > Message m_incoming_message; >diff --git a/server/ServerApp.cpp b/server/ServerApp.cpp >index 19554a3ad0..162deff56b 100644 >--- a/server/ServerApp.cpp >+++ b/server/ServerApp.cpp >@@ -124,8 +124,8 @@ ServerSaveGameData::ServerSaveGameData(int current_turn) : > //////////////////////////////////////////////// > ServerApp::ServerApp() : > IApp(), >- m_signals(m_io_service, SIGINT, SIGTERM), >- m_networking(m_io_service, >+ m_signals(m_io_context, SIGINT, SIGTERM), >+ m_networking(m_io_context, > boost::bind(&ServerApp::HandleNonPlayerMessage, this, _1, _2), > boost::bind(&ServerApp::HandleMessage, this, _1, _2), > boost::bind(&ServerApp::PlayerDisconnected, this, _1)), >@@ -336,7 +336,7 @@ void ServerApp::Run() { > DebugLogger() << "FreeOrion server waiting for network events"; > try { > while (1) { >- if (m_io_service.run_one()) >+ if (m_io_context.run_one()) > m_networking.HandleNextEvent(); > else > break; >diff --git a/server/ServerApp.h b/server/ServerApp.h >index 57051f6342..fd9074e5a6 100644 >--- a/server/ServerApp.h >+++ b/server/ServerApp.h >@@ -333,7 +333,7 @@ class ServerApp : public IApp { > * between two empires. Updates those empires of the change. */ > void HandleDiplomaticMessageChange(int empire1_id, int empire2_id); > >- boost::asio::io_service m_io_service; >+ boost::asio::io_context m_io_context; > boost::asio::signal_set m_signals; > > Universe m_universe; >diff --git a/server/ServerFSM.cpp b/server/ServerFSM.cpp >index 1c0473047e..044dac581e 100644 >--- a/server/ServerFSM.cpp >+++ b/server/ServerFSM.cpp >@@ -2703,7 +2703,7 @@ const auto SHUTDOWN_POLLING_TIME = std::chrono::milliseconds(5000); > ShuttingDownServer::ShuttingDownServer(my_context c) : > my_base(c), > m_player_id_ack_expected(), >- m_timeout(Server().m_io_service, Clock::now() + SHUTDOWN_POLLING_TIME) >+ m_timeout(Server().m_io_context, Clock::now() + SHUTDOWN_POLLING_TIME) > { > TraceLogger(FSM) << "(ServerFSM) ShuttingDownServer"; > > >From a2bc8363d26497c78d89296a9a4c7bbebcb04854 Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sun, 17 Mar 2019 18:18:39 +0100 >Subject: [PATCH 02/10] grooming > >--- > network/ServerNetworking.cpp | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/network/ServerNetworking.cpp b/network/ServerNetworking.cpp >index de6b0818c1..99176ce205 100644 >--- a/network/ServerNetworking.cpp >+++ b/network/ServerNetworking.cpp >@@ -671,12 +671,11 @@ void ServerNetworking::Init() { > } > > void ServerNetworking::AcceptNextConnection() { >- PlayerConnectionPtr next_connection = >- PlayerConnection::NewConnection( >- m_player_connection_acceptor.get_executor().context(), >- m_nonplayer_message_callback, >- m_player_message_callback, >- boost::bind(&ServerNetworking::DisconnectImpl, this, _1)); >+ auto next_connection = PlayerConnection::NewConnection( >+ m_player_connection_acceptor.get_executor().context(), >+ m_nonplayer_message_callback, >+ m_player_message_callback, >+ boost::bind(&ServerNetworking::DisconnectImpl, this, _1)); > next_connection->EventSignal.connect( > boost::bind(&ServerNetworking::EnqueueEvent, this, _1)); > m_player_connection_acceptor.async_accept( > >From a7a2994c98292d39a996a207c37bc740185a4143 Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sun, 17 Mar 2019 18:19:41 +0100 >Subject: [PATCH 03/10] Re-implement pre-1.70 boost::asio::ip::tcp::acceptor. > >--- > network/ServerNetworking.h | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/network/ServerNetworking.h b/network/ServerNetworking.h >index aed34d28ae..42371255c3 100644 >--- a/network/ServerNetworking.h >+++ b/network/ServerNetworking.h >@@ -181,7 +181,12 @@ class ServerNetworking { > int m_host_player_id; > > DiscoveryServer* m_discovery_server; >+#if BOOST_VERSION >= 107000 >+ boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::io_context::executor_type> >+ m_player_connection_acceptor; >+#else > boost::asio::ip::tcp::acceptor m_player_connection_acceptor; >+#endif > PlayerConnections m_player_connections; > std::queue<NullaryFn> m_event_queue; > std::unordered_map<boost::uuids::uuid, CookieData, boost::hash<boost::uuids::uuid>> m_cookies; > >From 336f8a1f2e19352e542bca5ccc85446506d79c8d Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sat, 23 Mar 2019 13:29:08 +0100 >Subject: [PATCH 04/10] Added typedeof of io_service to io_context to restore > compatibility with Boost versions before 1.66. > >--- > network/ServerNetworking.h | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) > >diff --git a/network/ServerNetworking.h b/network/ServerNetworking.h >index 42371255c3..be434d1386 100644 >--- a/network/ServerNetworking.h >+++ b/network/ServerNetworking.h >@@ -22,13 +22,12 @@ typedef boost::function<void (Message, PlayerConnectionPtr)> MessageAndConnectio > typedef boost::function<void (PlayerConnectionPtr)> ConnectionFn; > typedef boost::function<void ()> NullaryFn; > >-/** Data associated with cookie >- */ >+/** Data associated with cookie */ > struct CookieData { >- std::string player_name; >- boost::posix_time::ptime expired; >- Networking::AuthRoles roles; >- bool authenticated; >+ std::string player_name; >+ boost::posix_time::ptime expired; >+ Networking::AuthRoles roles; >+ bool authenticated; > > CookieData(const std::string& player_name_, > const boost::posix_time::ptime& expired_, >@@ -38,9 +37,21 @@ struct CookieData { > expired(expired_), > roles(roles_), > authenticated(authenticated_) >- { } >+ {} > }; > >+ >+/** In Boost 1.66, io_service was replaced with a typedef of io_context. >+ * That typedef was removed in Boost 1.70 along with other interface changes. >+ * This code uses io_context for future compatibility and adds the typedef >+ * here for old versions of Boost. */ >+#if BOOST_VERSION < 106600 >+namespace boost { namespace asio { >+ typedef io_service io_context; >+}} >+#endif >+ >+ > /** Encapsulates the networking facilities of the server. This class listens > for incoming UDP LAN server-discovery requests and TCP player connections. > The server also sends and receives messages over the TCP player > >From 5dc48a14161a7aee405fcef83d8e4e338a847e8a Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sat, 23 Mar 2019 14:07:03 +0100 >Subject: [PATCH 05/10] Replace use of move_in with std::move similar to > https://github.com/boostorg/gil/commit/2308a1a85a7b#diff-9b9e3d16308e811b90e08ebb658fca86R28 > >--- > GG/src/Texture.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/GG/src/Texture.cpp b/GG/src/Texture.cpp >index 058be0e2ec..e2a0194077 100644 >--- a/GG/src/Texture.cpp >+++ b/GG/src/Texture.cpp >@@ -262,14 +262,14 @@ void Texture::Load(const boost::filesystem::path& path, bool mipmap/* = false*/) > if (extension == ".png") { > gil::rgba8_image_t rgba_image; > gil::read_and_convert_image(filename, rgba_image, gil::image_read_settings<gil::png_tag>()); >- image.move_in(rgba_image); >+ image = std::move(rgba_image); > } > #endif > #if GG_HAVE_LIBTIFF > if (extension == ".tif" || extension == ".tiff") { > gil::rgba8_image_t rgba_image; > gil::read_and_convert_image(filename, rgba_image, gil::image_read_settings<gil::tiff_tag>()); >- image.move_in(rgba_image); >+ image = std::move(rgba_image); > } > #endif > } > >From e76f674cebcbea05c83bf4d611e45b5809700260 Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sat, 23 Mar 2019 14:20:53 +0100 >Subject: [PATCH 06/10] Use get_io_service for pre-Boost 1.66 > >--- > network/ServerNetworking.cpp | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/network/ServerNetworking.cpp b/network/ServerNetworking.cpp >index 99176ce205..9992168d84 100644 >--- a/network/ServerNetworking.cpp >+++ b/network/ServerNetworking.cpp >@@ -672,7 +672,11 @@ void ServerNetworking::Init() { > > void ServerNetworking::AcceptNextConnection() { > auto next_connection = PlayerConnection::NewConnection( >+#if BOOST_VERSION >= 106600 > m_player_connection_acceptor.get_executor().context(), >+#else >+ m_player_connection_acceptor.get_io_service(), >+#endif > m_nonplayer_message_callback, > m_player_message_callback, > boost::bind(&ServerNetworking::DisconnectImpl, this, _1)); > >From 5f397d61534d71a739f22855130f244a998ef11b Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sat, 23 Mar 2019 14:54:51 +0100 >Subject: [PATCH 07/10] Attempt to replace removed (in Boost 1.70) GIL variant > functions with Boost::Variant equivalents. > >--- > GG/src/Texture.cpp | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > >diff --git a/GG/src/Texture.cpp b/GG/src/Texture.cpp >index e2a0194077..dfd7dde840 100644 >--- a/GG/src/Texture.cpp >+++ b/GG/src/Texture.cpp >@@ -48,6 +48,10 @@ > #include <iomanip> > #include <boost/scoped_array.hpp> > >+#if BOOST_VERSION >= 107000 >+#include <boost/variant/get.hpp> >+#endif >+ > > using namespace GG; > >@@ -279,12 +283,21 @@ void Texture::Load(const boost::filesystem::path& path, bool mipmap/* = false*/) > m_default_height = Y(image.height()); > m_type = GL_UNSIGNED_BYTE; > >+#if BOOST_VERSION >= 107000 >+#define IF_IMAGE_TYPE_IS(image_prefix) \ >+ if (boost::get<image_prefix ## _image_t>(image)) { \ >+ m_bytes_pp = sizeof(image_prefix ## _pixel_t); \ >+ image_data = interleaved_view_get_raw_data( \ >+ const_view(boost::get<image_prefix ## _image_t>(image))); \ >+ } >+#else > #define IF_IMAGE_TYPE_IS(image_prefix) \ > if (image.current_type_is<image_prefix ## _image_t>()) { \ > m_bytes_pp = sizeof(image_prefix ## _pixel_t); \ > image_data = interleaved_view_get_raw_data( \ > const_view(image._dynamic_cast<image_prefix ## _image_t>())); \ > } >+#endif > > const unsigned char* image_data = nullptr; > > >From 40c0cc65f95038d44213790e7fc1bb20ee4885f9 Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sun, 24 Mar 2019 14:41:45 +0100 >Subject: [PATCH 08/10] Support pre-Boost 1.66 > >--- > network/ClientNetworking.cpp | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > >diff --git a/network/ClientNetworking.cpp b/network/ClientNetworking.cpp >index 8ecfd9c678..8dad63f844 100644 >--- a/network/ClientNetworking.cpp >+++ b/network/ClientNetworking.cpp >@@ -33,6 +33,16 @@ > using boost::asio::ip::tcp; > using namespace Networking; > >+/** In Boost 1.66, io_service was replaced with a typedef of io_context. >+ * That typedef was removed in Boost 1.70 along with other interface changes. >+ * This code uses io_context for future compatibility and adds the typedef >+ * here for old versions of Boost. */ >+#if BOOST_VERSION < 106600 >+namespace boost { namespace asio { >+ typedef io_service io_context; >+}} >+#endif >+ > namespace { > DeclareThreadSafeLogger(network); > >@@ -121,16 +131,16 @@ namespace { > void CloseSocket() > { m_socket.close(); } > >- boost::asio::io_context* m_io_context; >- boost::asio::high_resolution_timer m_timer; >- boost::asio::ip::udp::socket m_socket; >+ boost::asio::io_context* m_io_context; >+ boost::asio::high_resolution_timer m_timer; >+ boost::asio::ip::udp::socket m_socket; > >- std::array<char, 1024> m_recv_buf; >+ std::array<char, 1024> m_recv_buf; > >- boost::asio::ip::udp::endpoint m_sender_endpoint; >- bool m_receive_successful; >- std::string m_server_name; >- ServerList m_servers; >+ boost::asio::ip::udp::endpoint m_sender_endpoint; >+ bool m_receive_successful; >+ std::string m_server_name; >+ ServerList m_servers; > }; > } > > >From e92284fa9da276d642674a40f7823e90e88d161e Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Sun, 24 Mar 2019 14:49:10 +0100 >Subject: [PATCH 09/10] Use expires_after or expires_from_now dependent on > BOOST_VERSION. > >--- > network/ClientNetworking.cpp | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/network/ClientNetworking.cpp b/network/ClientNetworking.cpp >index 8dad63f844..f14d4ca95b 100644 >--- a/network/ClientNetworking.cpp >+++ b/network/ClientNetworking.cpp >@@ -89,7 +89,11 @@ namespace { > this, > boost::asio::placeholders::error, > boost::asio::placeholders::bytes_transferred)); >+#if BOOST_VERSION >= 106600 >+ m_timer.expires_after(std::chrono::seconds(2)); >+#else > m_timer.expires_from_now(std::chrono::seconds(2)); >+#endif > m_timer.async_wait(boost::bind(&ServerDiscoverer::CloseSocket, this)); > m_io_context->run(); > m_io_context->reset(); > >From cad38dd2dbe33541156b7696926a089363cc7386 Mon Sep 17 00:00:00 2001 >From: geoffthemedio <geoffthemedio@gmail.com> >Date: Tue, 26 Mar 2019 19:19:55 +0100 >Subject: [PATCH 10/10] Use boost::get on address of boost::variant to check > its type. > >--- > GG/src/Texture.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/GG/src/Texture.cpp b/GG/src/Texture.cpp >index dfd7dde840..31673eae61 100644 >--- a/GG/src/Texture.cpp >+++ b/GG/src/Texture.cpp >@@ -285,7 +285,7 @@ void Texture::Load(const boost::filesystem::path& path, bool mipmap/* = false*/) > > #if BOOST_VERSION >= 107000 > #define IF_IMAGE_TYPE_IS(image_prefix) \ >- if (boost::get<image_prefix ## _image_t>(image)) { \ >+ if (boost::get<image_prefix ## _image_t>(&image)) { \ > m_bytes_pp = sizeof(image_prefix ## _pixel_t); \ > image_data = interleaved_view_get_raw_data( \ > const_view(boost::get<image_prefix ## _image_t>(image))); \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 685718
: 576168 |
579328