forked from Mirrorlandia_minetest/minetest
Fix compiler warnings
This commit is contained in:
parent
3a87fab6c8
commit
5683bb76cc
@ -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}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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++)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user