From a8711158896d993e23d823f41ab086c3915c7d4e Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 30 Jul 2022 12:51:23 +0100 Subject: [PATCH] Fix some warnings (#12615) --- src/client/game.cpp | 1 - src/client/mapblock_mesh.cpp | 2 +- src/client/particles.h | 2 -- src/emerge.cpp | 2 +- src/network/serverpackethandler.cpp | 2 ++ src/particles.h | 4 +--- src/script/common/c_packer.cpp | 2 +- src/script/lua_api/l_particleparams.h | 9 ++++++--- src/server/mods.cpp | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/client/game.cpp b/src/client/game.cpp index 61b957e78..c34e3a415 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -846,7 +846,6 @@ private: EventManager *eventmgr = nullptr; QuicktuneShortcutter *quicktune = nullptr; - bool registration_confirmation_shown = false; std::unique_ptr m_game_ui; GUIChatConsole *gui_chat_console = nullptr; // Free using ->Drop() diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index d8a8c25eb..c730b9bf9 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -1174,7 +1174,7 @@ void PartialMeshBuffer::beforeDraw() const void PartialMeshBuffer::afterDraw() const { // Take the data back - m_vertex_indexes = std::move(m_buffer->Indices.steal()); + m_vertex_indexes = m_buffer->Indices.steal(); } /* diff --git a/src/client/particles.h b/src/client/particles.h index 36be903f1..0818b796b 100644 --- a/src/client/particles.h +++ b/src/client/particles.h @@ -39,7 +39,6 @@ struct ClientTexture video::ITexture *ref = nullptr; ClientTexture() = default; - ClientTexture(const ClientTexture&) = default; ClientTexture(const ServerParticleTexture& p, ITextureSource *t): tex(p), ref(t->getTextureForMesh(p.string)) {}; @@ -52,7 +51,6 @@ struct ClientTexRef ParticleTexture* tex = nullptr; video::ITexture* ref = nullptr; ClientTexRef() = default; - ClientTexRef(const ClientTexRef&) = default; /* constructor used by particles spawned from a spawner */ ClientTexRef(ClientTexture& t): diff --git a/src/emerge.cpp b/src/emerge.cpp index e36d36448..3e42742f6 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -504,7 +504,7 @@ EmergeThread *EmergeManager::getOptimalThread() void EmergeManager::reportCompletedEmerge(EmergeAction action) { - assert((int)action < ARRLEN(m_completed_emerge_counter)); + assert((size_t)action < ARRLEN(m_completed_emerge_counter)); m_completed_emerge_counter[(int)action]->increment(); } diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 4b9de488c..a5ee81a9c 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -108,8 +108,10 @@ void Server::handleCommand_Init(NetworkPacket* pkt) // Use the highest version supported by both u8 depl_serial_v = std::min(client_max, our_max); // If it's lower than the lowest supported, give up. +#if SER_FMT_VER_LOWEST_READ > 0 if (depl_serial_v < SER_FMT_VER_LOWEST_READ) depl_serial_v = SER_FMT_VER_INVALID; +#endif if (depl_serial_v == SER_FMT_VER_INVALID) { actionstream << "Server: A mismatched client tried to connect from " << diff --git a/src/particles.h b/src/particles.h index 622fee099..74bfa7fce 100644 --- a/src/particles.h +++ b/src/particles.h @@ -95,7 +95,7 @@ namespace ParticleParamTypes using This = Parameter; Parameter() = default; - Parameter(const This& a) = default; + template Parameter(Args... args) : val(args...) {} @@ -165,7 +165,6 @@ namespace ParticleParamTypes f32 bias = 0; RangedParameter() = default; - RangedParameter(const This& a) = default; RangedParameter(T _min, T _max) : min(_min), max(_max) {} template RangedParameter(M b) : min(b), max(b) {} @@ -245,7 +244,6 @@ namespace ParticleParamTypes T start, end; TweenedParameter() = default; - TweenedParameter(const This& a) = default; TweenedParameter(T _start, T _end) : start(_start), end(_end) {} template TweenedParameter(M b) : start(b), end(b) {} diff --git a/src/script/common/c_packer.cpp b/src/script/common/c_packer.cpp index ede00c758..597f5e447 100644 --- a/src/script/common/c_packer.cpp +++ b/src/script/common/c_packer.cpp @@ -568,7 +568,7 @@ void script_dump_packed(const PackedValue *val) printf("table(%d, %d)", i.uidata1, i.uidata2); break; case LUA_TFUNCTION: - printf("function(%d byte)", i.sdata.size()); + printf("function(%lu byte)", i.sdata.size()); break; case LUA_TUSERDATA: printf("userdata %s %p", i.sdata.c_str(), i.ptrdata); diff --git a/src/script/lua_api/l_particleparams.h b/src/script/lua_api/l_particleparams.h index 4fefc5e3a..03f11c07f 100644 --- a/src/script/lua_api/l_particleparams.h +++ b/src/script/lua_api/l_particleparams.h @@ -226,15 +226,18 @@ namespace LuaParticleParams // get the effect settings lua_getfield(L, -1, "style"); - lua_isnil(L,-1) || (readLuaValue(L, field.style), true); + if (!lua_isnil(L,-1)) + readLuaValue(L, field.style); lua_pop(L, 1); lua_getfield(L, -1, "reps"); - lua_isnil(L,-1) || (readLuaValue(L, field.reps), true); + if (!lua_isnil(L,-1)) + readLuaValue(L, field.reps); lua_pop(L, 1); lua_getfield(L, -1, "start"); - lua_isnil(L,-1) || (readLuaValue(L, field.beginning), true); + if (!lua_isnil(L,-1)) + readLuaValue(L, field.beginning); lua_pop(L, 1); goto done; diff --git a/src/server/mods.cpp b/src/server/mods.cpp index 0e9bf4911..f302d4240 100644 --- a/src/server/mods.cpp +++ b/src/server/mods.cpp @@ -96,7 +96,7 @@ void ServerModManager::getModsMediaPaths(std::vector &paths) const { // Iterate mods in reverse load order: Media loading expects higher priority media files first // and mods loading later should be able to override media of already loaded mods - const auto mods = configuration.getMods(); + const auto &mods = configuration.getMods(); for (auto it = mods.crbegin(); it != mods.crend(); it++) { const ModSpec &spec = *it; fs::GetRecursiveDirs(paths, spec.path + DIR_DELIM + "textures");