From 7f6306ca964ac5b9245c433e3b688c5d4ee08c35 Mon Sep 17 00:00:00 2001 From: JosiahWI <41302989+JosiahWI@users.noreply.github.com> Date: Tue, 28 Dec 2021 07:05:49 -0600 Subject: Restore GCC 5 compatibility (#11778) --- src/client/client.h | 2 +- src/network/clientpackethandler.cpp | 3 ++- src/util/png.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/client/client.h b/src/client/client.h index b92b456f4..bae40f389 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -548,7 +548,7 @@ private: // Set of media filenames pushed by server at runtime std::unordered_set m_media_pushed_files; // Pending downloads of dynamic media (key: token) - std::vector>> m_pending_media_downloads; + std::vector>> m_pending_media_downloads; // time_of_day speed approximation for old protocol bool m_time_of_day_set = false; diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index d20a80fb7..6aececa7f 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -43,6 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "tileanimation.h" #include "gettext.h" #include "skyparams.h" +#include void Client::handleCommand_Deprecated(NetworkPacket* pkt) { @@ -1559,7 +1560,7 @@ void Client::handleCommand_MediaPush(NetworkPacket *pkt) m_media_pushed_files.insert(filename); // create a downloader for this file - auto downloader = new SingleMediaDownloader(cached); + auto downloader(std::make_shared(cached)); m_pending_media_downloads.emplace_back(token, downloader); downloader->addFile(filename, raw_hash); for (const auto &baseurl : m_remote_media_servers) diff --git a/src/util/png.cpp b/src/util/png.cpp index 7ac2e94a1..698cbc9a5 100755 --- a/src/util/png.cpp +++ b/src/util/png.cpp @@ -37,11 +37,11 @@ static void writeChunk(std::ostringstream &target, const std::string &chunk_str) std::string encodePNG(const u8 *data, u32 width, u32 height, s32 compression) { - auto file = std::ostringstream(std::ios::binary); + std::ostringstream file(std::ios::binary); file << "\x89PNG\r\n\x1a\n"; { - auto IHDR = std::ostringstream(std::ios::binary); + std::ostringstream IHDR(std::ios::binary); IHDR << "IHDR"; writeU32(IHDR, width); writeU32(IHDR, height); @@ -51,9 +51,9 @@ std::string encodePNG(const u8 *data, u32 width, u32 height, s32 compression) } { - auto IDAT = std::ostringstream(std::ios::binary); + std::ostringstream IDAT(std::ios::binary); IDAT << "IDAT"; - auto scanlines = std::ostringstream(std::ios::binary); + std::ostringstream scanlines(std::ios::binary); for(u32 i = 0; i < height; i++) { scanlines.write("\x00", 1); // Null predictor scanlines.write((const char*) data + width * 4 * i, width * 4); -- cgit v1.2.3