From 255ca13fab1abd72dcee3f25c186bbac4f2bce99 Mon Sep 17 00:00:00 2001 From: wolfy1339 <4595477+wolfy1339@users.noreply.github.com> Date: Wed, 15 Nov 2017 18:35:27 -0500 Subject: [PATCH] Remove unused code in src/Config.h (Fixes #516) - Remove commented out code as it was not used anywhere in the code --- src/Config.h | 12 ------------ src/client/GameSave.cpp | 13 +++++++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/Config.h b/src/Config.h index d2583e7fe8..b5399d8e66 100644 --- a/src/Config.h +++ b/src/Config.h @@ -163,18 +163,6 @@ #define GLASS_IOR 1.9 #define GLASS_DISP 0.07 -#if defined(_MSC_VER) -#if _MSC_VER < 1800 -#define fmin min -#define fminf min -#define fmax max -#define fmaxf max -#else -#include -#endif -#endif - #define SDEUT -//#define REALHEAT #endif /* CONFIG_H */ diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 2bcc8ecf72..0fe17cd0e7 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -592,12 +593,12 @@ void GameSave::readOPS(char * data, int dataLength) bsonDataLen |= ((unsigned)inputData[9]) << 8; bsonDataLen |= ((unsigned)inputData[10]) << 16; bsonDataLen |= ((unsigned)inputData[11]) << 24; - + //Check for overflows, don't load saves larger than 200MB unsigned int toAlloc = bsonDataLen+1; if (toAlloc > 209715200 || !toAlloc) throw ParseException(ParseException::InvalidDimensions, "Save data too large, refusing"); - + bsonData = (unsigned char*)malloc(toAlloc); if (!bsonData) throw ParseException(ParseException::InternalError, "Unable to allocate memory"); @@ -1329,10 +1330,10 @@ void GameSave::readPSv(char * data, int dataLength) i |= ((unsigned)c[9])<<8; i |= ((unsigned)c[10])<<16; i |= ((unsigned)c[11])<<24; - + if(i > 209715200 || !i) throw ParseException(ParseException::InvalidDimensions, "Save data too large"); - + d = (unsigned char *)malloc(i); if (!d) throw ParseException(ParseException::Corrupt, "Cannot allocate memory"); @@ -1411,7 +1412,7 @@ void GameSave::readPSv(char * data, int dataLength) if (ver>=44) { /* The numbers used to save walls were changed, starting in v44. - * The new numbers are ignored for older versions due to some corruption of bmap in saves from older versions. + * The new numbers are ignored for older versions due to some corruption of bmap in saves from older versions. */ if (blockMap[y][x]==O_WL_WALLELEC) blockMap[y][x]=WL_WALLELEC; @@ -2321,7 +2322,7 @@ char * GameSave::serialiseOPS(unsigned int & dataLength) bson_append_int(&b, "major", minimumMajorVersion); bson_append_int(&b, "minor", minimumMinorVersion); bson_append_finish_object(&b); - + bson_append_bool(&b, "waterEEnabled", waterEEnabled); bson_append_bool(&b, "legacyEnable", legacyEnable);