aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/client/clientlauncher.cpp2
-rw-r--r--src/client/shader.cpp10
-rw-r--r--src/serialization.cpp14
-rw-r--r--src/server/player_sao.h48
-rw-r--r--src/terminal_chat_console.cpp3
-rw-r--r--src/unittest/test_irrptr.cpp4
-rw-r--r--src/unittest/test_voxelarea.cpp4
-rw-r--r--src/util/srp.cpp4
9 files changed, 44 insertions, 51 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ac4c1de73..2de68a8f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -470,6 +470,9 @@ endif()
include_directories(
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
+ ${PROJECT_SOURCE_DIR}/script
+)
+include_directories(SYSTEM
${ZLIB_INCLUDE_DIR}
${ZSTD_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR}
@@ -477,7 +480,6 @@ include_directories(
${GMP_INCLUDE_DIR}
${JSON_INCLUDE_DIR}
${LUA_BIT_INCLUDE_DIR}
- ${PROJECT_SOURCE_DIR}/script
)
if(USE_GETTEXT)
@@ -485,7 +487,7 @@ if(USE_GETTEXT)
endif()
if(BUILD_CLIENT)
- include_directories(
+ include_directories(SYSTEM
${FREETYPE_INCLUDE_DIRS}
${SOUND_INCLUDE_DIRS}
${X11_INCLUDE_DIR}
diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp
index 063154316..54c561d11 100644
--- a/src/client/clientlauncher.cpp
+++ b/src/client/clientlauncher.cpp
@@ -564,6 +564,8 @@ void ClientLauncher::speed_tests()
// volatile to avoid some potential compiler optimisations
volatile static s16 temp16;
volatile static f32 tempf;
+ // Silence compiler warning
+ (void)temp16;
static v3f tempv3f1;
static v3f tempv3f2;
static std::string tempstring;
diff --git a/src/client/shader.cpp b/src/client/shader.cpp
index 1be9ef128..bbb872761 100644
--- a/src/client/shader.cpp
+++ b/src/client/shader.cpp
@@ -242,11 +242,6 @@ public:
MainShaderConstantSetter() :
m_world_view_proj("mWorldViewProj")
, m_world("mWorld")
-#if ENABLE_GLES
- , m_world_view("mWorldView")
- , m_texture("mTexture")
- , m_normal("mNormal")
-#endif
, m_shadow_view_proj("m_ShadowViewProj")
, m_light_direction("v_LightDirection")
, m_texture_res("f_textureresolution")
@@ -261,6 +256,11 @@ public:
, m_perspective_bias1_pixel("xyPerspectiveBias1")
, m_perspective_zbias_vertex("zPerspectiveBias")
, m_perspective_zbias_pixel("zPerspectiveBias")
+#if ENABLE_GLES
+ , m_world_view("mWorldView")
+ , m_texture("mTexture")
+ , m_normal("mNormal")
+#endif
{}
~MainShaderConstantSetter() = default;
diff --git a/src/serialization.cpp b/src/serialization.cpp
index d3009bc83..11164a0ed 100644
--- a/src/serialization.cpp
+++ b/src/serialization.cpp
@@ -108,7 +108,6 @@ void decompressZlib(std::istream &is, std::ostream &os, size_t limit)
char output_buffer[bufsize];
int status = 0;
int ret;
- int bytes_read = 0;
int bytes_written = 0;
int input_buffer_len = 0;
@@ -122,8 +121,6 @@ void decompressZlib(std::istream &is, std::ostream &os, size_t limit)
z.avail_in = 0;
- //dstream<<"initial fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
-
for(;;)
{
int output_size = bufsize;
@@ -147,19 +144,13 @@ void decompressZlib(std::istream &is, std::ostream &os, size_t limit)
is.read(input_buffer, bufsize);
input_buffer_len = is.gcount();
z.avail_in = input_buffer_len;
- //dstream<<"read fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
}
if(z.avail_in == 0)
{
- //dstream<<"z.avail_in == 0"<<std::endl;
break;
}
- //dstream<<"1 z.avail_in="<<z.avail_in<<std::endl;
status = inflate(&z, Z_NO_FLUSH);
- //dstream<<"2 z.avail_in="<<z.avail_in<<std::endl;
- bytes_read += is.gcount() - z.avail_in;
- //dstream<<"bytes_read="<<bytes_read<<std::endl;
if(status == Z_NEED_DICT || status == Z_DATA_ERROR
|| status == Z_MEM_ERROR)
@@ -168,16 +159,11 @@ void decompressZlib(std::istream &is, std::ostream &os, size_t limit)
throw SerializationError("decompressZlib: inflate failed");
}
int count = output_size - z.avail_out;
- //dstream<<"count="<<count<<std::endl;
if(count)
os.write(output_buffer, count);
bytes_written += count;
if(status == Z_STREAM_END)
{
- //dstream<<"Z_STREAM_END"<<std::endl;
-
- //dstream<<"z.avail_in="<<z.avail_in<<std::endl;
- //dstream<<"fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
// Unget all the data that inflate didn't take
is.clear(); // Just in case EOF is set
for(u32 i=0; i < z.avail_in; i++)
diff --git a/src/server/player_sao.h b/src/server/player_sao.h
index 96d8f7189..1067801e7 100644
--- a/src/server/player_sao.h
+++ b/src/server/player_sao.h
@@ -72,24 +72,24 @@ public:
PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_,
bool is_singleplayer);
- ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_PLAYER; }
- ActiveObjectType getSendType() const { return ACTIVEOBJECT_TYPE_GENERIC; }
- std::string getDescription();
+ ActiveObjectType getType() const override { return ACTIVEOBJECT_TYPE_PLAYER; }
+ ActiveObjectType getSendType() const override { return ACTIVEOBJECT_TYPE_GENERIC; }
+ std::string getDescription() override;
/*
Active object <-> environment interface
*/
- void addedToEnvironment(u32 dtime_s);
- void removingFromEnvironment();
- bool isStaticAllowed() const { return false; }
- bool shouldUnload() const { return false; }
- std::string getClientInitializationData(u16 protocol_version);
- void getStaticData(std::string *result) const;
- void step(float dtime, bool send_recommended);
+ void addedToEnvironment(u32 dtime_s) override;
+ void removingFromEnvironment() override;
+ bool isStaticAllowed() const override { return false; }
+ bool shouldUnload() const override { return false; }
+ std::string getClientInitializationData(u16 protocol_version) override;
+ void getStaticData(std::string *result) const override;
+ void step(float dtime, bool send_recommended) override;
void setBasePosition(const v3f &position);
- void setPos(const v3f &pos);
- void moveTo(v3f pos, bool continuous);
+ void setPos(const v3f &pos) override;
+ void moveTo(v3f pos, bool continuous) override;
void setPlayerYaw(const float yaw);
// Data should not be sent at player initialization
void setPlayerYawAndSend(const float yaw);
@@ -110,8 +110,8 @@ public:
*/
u32 punch(v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher,
- float time_from_last_punch, u16 initial_wear = 0);
- void rightClick(ServerActiveObject *clicker);
+ float time_from_last_punch, u16 initial_wear = 0) override;
+ void rightClick(ServerActiveObject *clicker) override;
void setHP(s32 hp, const PlayerHPChangeReason &reason) override
{
return setHP(hp, reason, false);
@@ -124,13 +124,13 @@ public:
/*
Inventory interface
*/
- Inventory *getInventory() const;
- InventoryLocation getInventoryLocation() const;
- void setInventoryModified() {}
- std::string getWieldList() const { return "main"; }
- u16 getWieldIndex() const;
- ItemStack getWieldedItem(ItemStack *selected, ItemStack *hand = nullptr) const;
- bool setWieldedItem(const ItemStack &item);
+ Inventory *getInventory() const override;
+ InventoryLocation getInventoryLocation() const override;
+ void setInventoryModified() override {}
+ std::string getWieldList() const override { return "main"; }
+ u16 getWieldIndex() const override;
+ ItemStack getWieldedItem(ItemStack *selected, ItemStack *hand = nullptr) const override;
+ bool setWieldedItem(const ItemStack &item) override;
/*
PlayerSAO-specific
@@ -171,9 +171,9 @@ public:
m_is_singleplayer = is_singleplayer;
}
- bool getCollisionBox(aabb3f *toset) const;
- bool getSelectionBox(aabb3f *toset) const;
- bool collideWithObjects() const { return true; }
+ bool getCollisionBox(aabb3f *toset) const override;
+ bool getSelectionBox(aabb3f *toset) const override;
+ bool collideWithObjects() const override { return true; }
void finalize(RemotePlayer *player, const std::set<std::string> &privs);
diff --git a/src/terminal_chat_console.cpp b/src/terminal_chat_console.cpp
index 9e3d33736..b12261c3b 100644
--- a/src/terminal_chat_console.cpp
+++ b/src/terminal_chat_console.cpp
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <inttypes.h>
#include "config.h"
#if USE_CURSES
#include "version.h"
@@ -398,7 +399,7 @@ void TerminalChatConsole::step(int ch)
minutes = (float)minutes / 1000 * 60;
if (m_game_time)
- printw(" | Game %d Time of day %02d:%02d ",
+ printw(" | Game %" PRIu64 " Time of day %02d:%02d ",
m_game_time, hours, minutes);
// draw text
diff --git a/src/unittest/test_irrptr.cpp b/src/unittest/test_irrptr.cpp
index 3484f1514..2fb7cfcd6 100644
--- a/src/unittest/test_irrptr.cpp
+++ b/src/unittest/test_irrptr.cpp
@@ -93,7 +93,9 @@ void TestIrrPtr::testRefCounting()
#if defined(__clang__)
#pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
+ #if __clang_major__ >= 7
+ #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
+ #endif
#pragma GCC diagnostic ignored "-Wself-move"
#endif
diff --git a/src/unittest/test_voxelarea.cpp b/src/unittest/test_voxelarea.cpp
index 9826d2ee7..1d72650d7 100644
--- a/src/unittest/test_voxelarea.cpp
+++ b/src/unittest/test_voxelarea.cpp
@@ -120,7 +120,7 @@ void TestVoxelArea::test_extent()
VoxelArea v1(v3s16(-1337, -547, -789), v3s16(-147, 447, 669));
UASSERT(v1.getExtent() == v3s16(1191, 995, 1459));
- VoxelArea v2(v3s16(32493, -32507, 32753), v3s16(32508, -32492, 32768));
+ VoxelArea v2(v3s16(32493, -32507, 32753), v3s16(32508, -32492, -32768));
UASSERT(v2.getExtent() == v3s16(16, 16, 16));
}
@@ -129,7 +129,7 @@ void TestVoxelArea::test_volume()
VoxelArea v1(v3s16(-1337, -547, -789), v3s16(-147, 447, 669));
UASSERTEQ(s32, v1.getVolume(), 1728980655);
- VoxelArea v2(v3s16(32493, -32507, 32753), v3s16(32508, -32492, 32768));
+ VoxelArea v2(v3s16(32493, -32507, 32753), v3s16(32508, -32492, -32768));
UASSERTEQ(s32, v2.getVolume(), 4096);
}
diff --git a/src/util/srp.cpp b/src/util/srp.cpp
index ceb2fef9e..daa7f332b 100644
--- a/src/util/srp.cpp
+++ b/src/util/srp.cpp
@@ -354,7 +354,7 @@ static size_t hash_length(SRP_HashAlgorithm alg)
case SRP_SHA384: return SHA384_DIGEST_LENGTH;
case SRP_SHA512: return SHA512_DIGEST_LENGTH;
*/
- default: return -1;
+ default: return 0;
};
}
// clang-format on
@@ -422,7 +422,7 @@ static SRP_Result H_nn(
}
static SRP_Result H_ns(mpz_t result, SRP_HashAlgorithm alg, const unsigned char *n,
- size_t len_n, const unsigned char *bytes, uint32_t len_bytes)
+ size_t len_n, const unsigned char *bytes, size_t len_bytes)
{
unsigned char buff[SHA512_DIGEST_LENGTH];
size_t nbytes = len_n + len_bytes;