Fix compilation on gcc 5 and below

This is only necessary for compiling and running the save renderer on a server with a very old glibc 2.17 version.
This commit is contained in:
jacob1 2019-09-08 22:18:02 -04:00
parent 86b48eb022
commit 898a0f8128
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
9 changed files with 113 additions and 112 deletions

View File

@ -358,86 +358,86 @@ namespace http
{ {
switch (ret) switch (ret)
{ {
case 0: return "Status code 0 (bug?)"; case 0: return String("Status code 0 (bug?)");
case 100: return "Continue"; case 100: return String("Continue");
case 101: return "Switching Protocols"; case 101: return String("Switching Protocols");
case 102: return "Processing"; case 102: return String("Processing");
case 200: return "OK"; case 200: return String("OK");
case 201: return "Created"; case 201: return String("Created");
case 202: return "Accepted"; case 202: return String("Accepted");
case 203: return "Non-Authoritative Information"; case 203: return String("Non-Authoritative Information");
case 204: return "No Content"; case 204: return String("No Content");
case 205: return "Reset Content"; case 205: return String("Reset Content");
case 206: return "Partial Content"; case 206: return String("Partial Content");
case 207: return "Multi-Status"; case 207: return String("Multi-Status");
case 300: return "Multiple Choices"; case 300: return String("Multiple Choices");
case 301: return "Moved Permanently"; case 301: return String("Moved Permanently");
case 302: return "Found"; case 302: return String("Found");
case 303: return "See Other"; case 303: return String("See Other");
case 304: return "Not Modified"; case 304: return String("Not Modified");
case 305: return "Use Proxy"; case 305: return String("Use Proxy");
case 306: return "Switch Proxy"; case 306: return String("Switch Proxy");
case 307: return "Temporary Redirect"; case 307: return String("Temporary Redirect");
case 400: return "Bad Request"; case 400: return String("Bad Request");
case 401: return "Unauthorized"; case 401: return String("Unauthorized");
case 402: return "Payment Required"; case 402: return String("Payment Required");
case 403: return "Forbidden"; case 403: return String("Forbidden");
case 404: return "Not Found"; case 404: return String("Not Found");
case 405: return "Method Not Allowed"; case 405: return String("Method Not Allowed");
case 406: return "Not Acceptable"; case 406: return String("Not Acceptable");
case 407: return "Proxy Authentication Required"; case 407: return String("Proxy Authentication Required");
case 408: return "Request Timeout"; case 408: return String("Request Timeout");
case 409: return "Conflict"; case 409: return String("Conflict");
case 410: return "Gone"; case 410: return String("Gone");
case 411: return "Length Required"; case 411: return String("Length Required");
case 412: return "Precondition Failed"; case 412: return String("Precondition Failed");
case 413: return "Request Entity Too Large"; case 413: return String("Request Entity Too Large");
case 414: return "Request URI Too Long"; case 414: return String("Request URI Too Long");
case 415: return "Unsupported Media Type"; case 415: return String("Unsupported Media Type");
case 416: return "Requested Range Not Satisfiable"; case 416: return String("Requested Range Not Satisfiable");
case 417: return "Expectation Failed"; case 417: return String("Expectation Failed");
case 418: return "I'm a teapot"; case 418: return String("I'm a teapot");
case 422: return "Unprocessable Entity"; case 422: return String("Unprocessable Entity");
case 423: return "Locked"; case 423: return String("Locked");
case 424: return "Failed Dependency"; case 424: return String("Failed Dependency");
case 425: return "Unordered Collection"; case 425: return String("Unordered Collection");
case 426: return "Upgrade Required"; case 426: return String("Upgrade Required");
case 444: return "No Response"; case 444: return String("No Response");
case 450: return "Blocked by Windows Parental Controls"; case 450: return String("Blocked by Windows Parental Controls");
case 499: return "Client Closed Request"; case 499: return String("Client Closed Request");
case 500: return "Internal Server Error"; case 500: return String("Internal Server Error");
case 501: return "Not Implemented"; case 501: return String("Not Implemented");
case 502: return "Bad Gateway"; case 502: return String("Bad Gateway");
case 503: return "Service Unavailable"; case 503: return String("Service Unavailable");
case 504: return "Gateway Timeout"; case 504: return String("Gateway Timeout");
case 505: return "HTTP Version Not Supported"; case 505: return String("HTTP Version Not Supported");
case 506: return "Variant Also Negotiates"; case 506: return String("Variant Also Negotiates");
case 507: return "Insufficient Storage"; case 507: return String("Insufficient Storage");
case 509: return "Bandwidth Limit Exceeded"; case 509: return String("Bandwidth Limit Exceeded");
case 510: return "Not Extended"; case 510: return String("Not Extended");
case 600: return "Internal Client Error"; case 600: return String("Internal Client Error");
case 601: return "Unsupported Protocol"; case 601: return String("Unsupported Protocol");
case 602: return "Server Not Found"; case 602: return String("Server Not Found");
case 603: return "Malformed Response"; case 603: return String("Malformed Response");
case 604: return "Network Not Available"; case 604: return String("Network Not Available");
case 605: return "Request Timed Out"; case 605: return String("Request Timed Out");
case 606: return "Malformed URL"; case 606: return String("Malformed URL");
case 607: return "Connection Refused"; case 607: return String("Connection Refused");
case 608: return "Proxy Server Not Found"; case 608: return String("Proxy Server Not Found");
case 609: return "SSL: Invalid Certificate Status"; case 609: return String("SSL: Invalid Certificate Status");
case 610: return "Cancelled by Shutdown"; case 610: return String("Cancelled by Shutdown");
case 611: return "Too Many Redirects"; case 611: return String("Too Many Redirects");
case 612: return "SSL: Connect Error"; case 612: return String("SSL: Connect Error");
case 613: return "SSL: Crypto Engine Not Found"; case 613: return String("SSL: Crypto Engine Not Found");
case 614: return "SSL: Failed to Set Default Crypto Engine"; case 614: return String("SSL: Failed to Set Default Crypto Engine");
case 615: return "SSL: Local Certificate Issue"; case 615: return String("SSL: Local Certificate Issue");
case 616: return "SSL: Unable to Use Specified Cipher"; case 616: return String("SSL: Unable to Use Specified Cipher");
case 617: return "SSL: Failed to Initialise Crypto Engine"; case 617: return String("SSL: Failed to Initialise Crypto Engine");
case 618: return "SSL: Failed to Load CACERT File"; case 618: return String("SSL: Failed to Load CACERT File");
case 619: return "SSL: Failed to Load CRL File"; case 619: return String("SSL: Failed to Load CRL File");
case 620: return "SSL: Issuer Check Failed"; case 620: return String("SSL: Issuer Check Failed");
case 621: return "SSL: Pinned Public Key Mismatch"; case 621: return String("SSL: Pinned Public Key Mismatch");
default: return "Unknown Status Code"; default: return String("Unknown Status Code");
} }
} }
} }

View File

@ -11,7 +11,7 @@ namespace http
{ {
R *request; R *request;
protected: public:
RequestMonitor() : RequestMonitor() :
request(nullptr) request(nullptr)
{ {

View File

@ -383,7 +383,7 @@ String DoMigration(ByteString fromDir, ByteString toDir)
if (stamps.empty() && saves.empty() && scripts.empty() && downloadedScripts.empty() && screenshots.empty() && !hasAutorun && !hasPref) if (stamps.empty() && saves.empty() && scripts.empty() && downloadedScripts.empty() && screenshots.empty() && !hasAutorun && !hasPref)
{ {
logFile << "Nothing to migrate."; logFile << "Nothing to migrate.";
return "Nothing to migrate. This button is used to migrate data from pre-96.0 TPT installations to the shared directory"; return String("Nothing to migrate. This button is used to migrate data from pre-96.0 TPT installations to the shared directory");
} }
StringBuilder result; StringBuilder result;

View File

@ -1531,7 +1531,7 @@ String GameController::ElementResolve(int type, int ctype)
{ {
return gameModel->GetSimulation()->ElementResolve(type, ctype); return gameModel->GetSimulation()->ElementResolve(type, ctype);
} }
return ""; return String("");
} }
String GameController::BasicParticleInfo(Particle const &sample_part) String GameController::BasicParticleInfo(Particle const &sample_part)
@ -1540,7 +1540,7 @@ String GameController::BasicParticleInfo(Particle const &sample_part)
{ {
return gameModel->GetSimulation()->BasicParticleInfo(sample_part); return gameModel->GetSimulation()->BasicParticleInfo(sample_part);
} }
return ""; return String("");
} }
void GameController::ReloadSim() void GameController::ReloadSim()

View File

@ -175,12 +175,12 @@ void PreviewModel::OnSaveReady()
{ {
GameSave *gameSave = new GameSave(*saveData); GameSave *gameSave = new GameSave(*saveData);
if (gameSave->fromNewerVersion) if (gameSave->fromNewerVersion)
new ErrorMessage("This save is from a newer version", "Please update TPT in game or at https://powdertoy.co.uk"); new ErrorMessage("This save is from a newer version", "Please update TPT in game or at https://powdertoy.co.uk", {});
saveInfo->SetGameSave(gameSave); saveInfo->SetGameSave(gameSave);
} }
catch(ParseException &e) catch(ParseException &e)
{ {
new ErrorMessage("Error", ByteString(e.what()).FromUtf8()); new ErrorMessage("Error", ByteString(e.what()).FromUtf8(), {});
canOpen = false; canOpen = false;
} }
notifySaveChanged(); notifySaveChanged();

View File

@ -4,6 +4,7 @@
#include "client/SaveFile.h" #include "client/SaveFile.h"
#include <functional> #include <functional>
#include <memory>
namespace ui namespace ui
{ {

View File

@ -5367,7 +5367,7 @@ String Simulation::ElementResolve(int type, int ctype)
} }
else if (type >= 0 && type < PT_NUM) else if (type >= 0 && type < PT_NUM)
return elements[type].Name; return elements[type].Name;
return "Empty"; return String("Empty");
} }
String Simulation::BasicParticleInfo(Particle const &sample_part) String Simulation::BasicParticleInfo(Particle const &sample_part)

View File

@ -21,30 +21,30 @@ const BuiltinGOL builtinGol[NGOL] = {
// * the ruleset constants below look 20-bit, but rulesets actually consist of 21 // * the ruleset constants below look 20-bit, but rulesets actually consist of 21
// bits of data; bit 20 just happens to not be set for any of the built-in types, // bits of data; bit 20 just happens to not be set for any of the built-in types,
// as none of them have 10 or more states // as none of them have 10 or more states
{ "GOL", GT_GOL , 0x0080C, PIXPACK(0x0CAC00), PIXPACK(0x0CAC00), NGT_GOL, String("Game Of Life: Begin 3/Stay 23") }, { String("GOL"), GT_GOL , 0x0080C, PIXPACK(0x0CAC00), PIXPACK(0x0CAC00), NGT_GOL, String("Game Of Life: Begin 3/Stay 23") },
{ "HLIF", GT_HLIF, 0x0480C, PIXPACK(0xFF0000), PIXPACK(0xFF0000), NGT_HLIF, String("High Life: B36/S23") }, { String("HLIF"), GT_HLIF, 0x0480C, PIXPACK(0xFF0000), PIXPACK(0xFF0000), NGT_HLIF, String("High Life: B36/S23") },
{ "ASIM", GT_ASIM, 0x038F0, PIXPACK(0x0000FF), PIXPACK(0x0000FF), NGT_ASIM, String("Assimilation: B345/S4567") }, { String("ASIM"), GT_ASIM, 0x038F0, PIXPACK(0x0000FF), PIXPACK(0x0000FF), NGT_ASIM, String("Assimilation: B345/S4567") },
{ "2X2", GT_2x2 , 0x04826, PIXPACK(0xFFFF00), PIXPACK(0xFFFF00), NGT_2x2, String("2X2: B36/S125") }, { String("2X2"), GT_2x2 , 0x04826, PIXPACK(0xFFFF00), PIXPACK(0xFFFF00), NGT_2x2, String("2X2: B36/S125") },
{ "DANI", GT_DANI, 0x1C9D8, PIXPACK(0x00FFFF), PIXPACK(0x00FFFF), NGT_DANI, String("Day and Night: B3678/S34678") }, { String("DANI"), GT_DANI, 0x1C9D8, PIXPACK(0x00FFFF), PIXPACK(0x00FFFF), NGT_DANI, String("Day and Night: B3678/S34678") },
{ "AMOE", GT_AMOE, 0x0A92A, PIXPACK(0xFF00FF), PIXPACK(0xFF00FF), NGT_AMOE, String("Amoeba: B357/S1358") }, { String("AMOE"), GT_AMOE, 0x0A92A, PIXPACK(0xFF00FF), PIXPACK(0xFF00FF), NGT_AMOE, String("Amoeba: B357/S1358") },
{ "MOVE", GT_MOVE, 0x14834, PIXPACK(0xFFFFFF), PIXPACK(0xFFFFFF), NGT_MOVE, String("'Move' particles. Does not move things.. it is a life type: B368/S245") }, { String("MOVE"), GT_MOVE, 0x14834, PIXPACK(0xFFFFFF), PIXPACK(0xFFFFFF), NGT_MOVE, String("'Move' particles. Does not move things.. it is a life type: B368/S245") },
{ "PGOL", GT_PGOL, 0x0A90C, PIXPACK(0xE05010), PIXPACK(0xE05010), NGT_PGOL, String("Pseudo Life: B357/S238") }, { String("PGOL"), GT_PGOL, 0x0A90C, PIXPACK(0xE05010), PIXPACK(0xE05010), NGT_PGOL, String("Pseudo Life: B357/S238") },
{ "DMOE", GT_DMOE, 0x1E9E0, PIXPACK(0x500000), PIXPACK(0x500000), NGT_DMOE, String("Diamoeba: B35678/S5678") }, { String("DMOE"), GT_DMOE, 0x1E9E0, PIXPACK(0x500000), PIXPACK(0x500000), NGT_DMOE, String("Diamoeba: B35678/S5678") },
{ "3-4", GT_34 , 0x01818, PIXPACK(0x500050), PIXPACK(0x500050), NGT_34, String("3-4: B34/S34") }, { String("3-4"), GT_34 , 0x01818, PIXPACK(0x500050), PIXPACK(0x500050), NGT_34, String("3-4: B34/S34") },
{ "LLIF", GT_LLIF, 0x03820, PIXPACK(0x505050), PIXPACK(0x505050), NGT_LLIF, String("Long Life: B345/S5") }, { String("LLIF"), GT_LLIF, 0x03820, PIXPACK(0x505050), PIXPACK(0x505050), NGT_LLIF, String("Long Life: B345/S5") },
{ "STAN", GT_STAN, 0x1C9EC, PIXPACK(0x5000FF), PIXPACK(0x5000FF), NGT_STAN, String("Stains: B3678/S235678") }, { String("STAN"), GT_STAN, 0x1C9EC, PIXPACK(0x5000FF), PIXPACK(0x5000FF), NGT_STAN, String("Stains: B3678/S235678") },
{ "SEED", GT_SEED, 0x00400, PIXPACK(0xFBEC7D), PIXPACK(0xFBEC7D), NGT_SEED, String("Seeds: B2/S") }, { String("SEED"), GT_SEED, 0x00400, PIXPACK(0xFBEC7D), PIXPACK(0xFBEC7D), NGT_SEED, String("Seeds: B2/S") },
{ "MAZE", GT_MAZE, 0x0083E, PIXPACK(0xA8E4A0), PIXPACK(0xA8E4A0), NGT_MAZE, String("Maze: B3/S12345") }, { String("MAZE"), GT_MAZE, 0x0083E, PIXPACK(0xA8E4A0), PIXPACK(0xA8E4A0), NGT_MAZE, String("Maze: B3/S12345") },
{ "COAG", GT_COAG, 0x189EC, PIXPACK(0x9ACD32), PIXPACK(0x9ACD32), NGT_COAG, String("Coagulations: B378/S235678") }, { String("COAG"), GT_COAG, 0x189EC, PIXPACK(0x9ACD32), PIXPACK(0x9ACD32), NGT_COAG, String("Coagulations: B378/S235678") },
{ "WALL", GT_WALL, 0x1F03C, PIXPACK(0x0047AB), PIXPACK(0x0047AB), NGT_WALL, String("Walled cities: B45678/S2345") }, { String("WALL"), GT_WALL, 0x1F03C, PIXPACK(0x0047AB), PIXPACK(0x0047AB), NGT_WALL, String("Walled cities: B45678/S2345") },
{ "GNAR", GT_GNAR, 0x00202, PIXPACK(0xE5B73B), PIXPACK(0xE5B73B), NGT_GNAR, String("Gnarl: B1/S1") }, { String("GNAR"), GT_GNAR, 0x00202, PIXPACK(0xE5B73B), PIXPACK(0xE5B73B), NGT_GNAR, String("Gnarl: B1/S1") },
{ "REPL", GT_REPL, 0x0AAAA, PIXPACK(0x259588), PIXPACK(0x259588), NGT_REPL, String("Replicator: B1357/S1357") }, { String("REPL"), GT_REPL, 0x0AAAA, PIXPACK(0x259588), PIXPACK(0x259588), NGT_REPL, String("Replicator: B1357/S1357") },
{ "MYST", GT_MYST, 0x139E1, PIXPACK(0x0C3C00), PIXPACK(0x0C3C00), NGT_MYST, String("Mystery: B3458/S05678") }, { String("MYST"), GT_MYST, 0x139E1, PIXPACK(0x0C3C00), PIXPACK(0x0C3C00), NGT_MYST, String("Mystery: B3458/S05678") },
{ "LOTE", GT_LOTE, 0x48938, PIXPACK(0xFF0000), PIXPACK(0xFFFF00), NGT_LOTE, String("Living on the Edge: B37/S3458/4") }, { String("LOTE"), GT_LOTE, 0x48938, PIXPACK(0xFF0000), PIXPACK(0xFFFF00), NGT_LOTE, String("Living on the Edge: B37/S3458/4") },
{ "FRG2", GT_FRG2, 0x20816, PIXPACK(0x006432), PIXPACK(0x00FF5A), NGT_FRG2, String("Like Frogs rule: B3/S124/3") }, { String("FRG2"), GT_FRG2, 0x20816, PIXPACK(0x006432), PIXPACK(0x00FF5A), NGT_FRG2, String("Like Frogs rule: B3/S124/3") },
{ "STAR", GT_STAR, 0x98478, PIXPACK(0x000040), PIXPACK(0x0000E6), NGT_STAR, String("Like Star Wars rule: B278/S3456/6") }, { String("STAR"), GT_STAR, 0x98478, PIXPACK(0x000040), PIXPACK(0x0000E6), NGT_STAR, String("Like Star Wars rule: B278/S3456/6") },
{ "FROG", GT_FROG, 0x21806, PIXPACK(0x006400), PIXPACK(0x00FF00), NGT_FROG, String("Frogs: B34/S12/3") }, { String("FROG"), GT_FROG, 0x21806, PIXPACK(0x006400), PIXPACK(0x00FF00), NGT_FROG, String("Frogs: B34/S12/3") },
{ "BRAN", GT_BRAN, 0x25440, PIXPACK(0xFFFF00), PIXPACK(0x969600), NGT_BRAN, String("Brian 6: B246/S6/3" )} { String("BRAN"), GT_BRAN, 0x25440, PIXPACK(0xFFFF00), PIXPACK(0x969600), NGT_BRAN, String("Brian 6: B246/S6/3" )}
}; };
std::vector<wall_type> LoadWalls() std::vector<wall_type> LoadWalls()

View File

@ -45,7 +45,7 @@ void TaskWindow::NotifyStatus(Task * task)
void TaskWindow::NotifyError(Task * task) void TaskWindow::NotifyError(Task * task)
{ {
new ErrorMessage("Error", task->GetError()); new ErrorMessage("Error", task->GetError(), {});
done = true; done = true;
} }