Skip to content

Commit

Permalink
Restore GCC 5 compatibility (#11778)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahWI committed Dec 28, 2021
1 parent 0c4929f commit 7f6306c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/client/client.h
Expand Up @@ -548,7 +548,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
// Set of media filenames pushed by server at runtime
std::unordered_set<std::string> m_media_pushed_files;
// Pending downloads of dynamic media (key: token)
std::vector<std::pair<u32, std::unique_ptr<SingleMediaDownloader>>> m_pending_media_downloads;
std::vector<std::pair<u32, std::shared_ptr<SingleMediaDownloader>>> m_pending_media_downloads;

// time_of_day speed approximation for old protocol
bool m_time_of_day_set = false;
Expand Down
3 changes: 2 additions & 1 deletion src/network/clientpackethandler.cpp
Expand Up @@ -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 <memory>

void Client::handleCommand_Deprecated(NetworkPacket* pkt)
{
Expand Down Expand Up @@ -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<SingleMediaDownloader>(cached));
m_pending_media_downloads.emplace_back(token, downloader);
downloader->addFile(filename, raw_hash);
for (const auto &baseurl : m_remote_media_servers)
Expand Down
8 changes: 4 additions & 4 deletions src/util/png.cpp
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 7f6306c

Please sign in to comment.