From 412cc96bc95add2db52e59a55cdfd92087f5fa57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:29:00 +0100 Subject: [PATCH] Fix some compiler warnings (#15596) --- irr/src/os.cpp | 5 +++-- src/client/content_mapblock.cpp | 5 +---- src/client/content_mapblock.h | 5 +---- src/client/mapblock_mesh.cpp | 3 +-- src/client/wieldmesh.cpp | 3 +-- src/log.cpp | 2 +- src/unittest/test_content_mapblock.cpp | 8 ++++---- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/irr/src/os.cpp b/irr/src/os.cpp index 96be8dd63..8762c8c54 100644 --- a/irr/src/os.cpp +++ b/irr/src/os.cpp @@ -160,11 +160,12 @@ void Printer::print(const c8 *message, ELOG_LEVEL ll) // Android logcat restricts log-output and cuts the rest of the message away. But we want it all. // On my device max-len is 1023 (+ 0 byte). Some websites claim a limit of 4096 so maybe different numbers on different devices. - const size_t maxLogLen = 1023; + constexpr size_t maxLogLen = 1023; size_t msgLen = strlen(message); size_t start = 0; while (msgLen - start > maxLogLen) { - __android_log_print(LogLevel, "Irrlicht", "%.*s\n", maxLogLen, &message[start]); + __android_log_print(LogLevel, "Irrlicht", "%.*s\n", + static_cast(maxLogLen), &message[start]); start += maxLogLen; } __android_log_print(LogLevel, "Irrlicht", "%s\n", &message[start]); diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp index 49abbd4fa..4d1eeec47 100644 --- a/src/client/content_mapblock.cpp +++ b/src/client/content_mapblock.cpp @@ -13,7 +13,6 @@ #include "nodedef.h" #include "client/tile.h" #include "mesh.h" -#include #include "client/meshgen/collector.h" #include "client/renderingengine.h" #include "client.h" @@ -60,12 +59,10 @@ static const auto &quad_indices = quad_indices_02; const std::string MapblockMeshGenerator::raillike_groupname = "connect_to_raillike"; -MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output, - scene::IMeshManipulator *mm): +MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output): data(input), collector(output), nodedef(data->nodedef), - meshmanip(mm), blockpos_nodes(data->m_blockpos * MAP_BLOCKSIZE), smooth_liquids(g_settings->getBool("enable_water_reflections")) { diff --git a/src/client/content_mapblock.h b/src/client/content_mapblock.h index 0473a9b75..327a7ea05 100644 --- a/src/client/content_mapblock.h +++ b/src/client/content_mapblock.h @@ -5,7 +5,6 @@ #pragma once #include "nodedef.h" -#include struct MeshMakeData; struct MeshCollector; @@ -46,8 +45,7 @@ struct LightFrame { class MapblockMeshGenerator { public: - MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output, - scene::IMeshManipulator *mm); + MapblockMeshGenerator(MeshMakeData *input, MeshCollector *output); void generate(); void renderSingle(content_t node, u8 param2 = 0x00); @@ -56,7 +54,6 @@ private: MeshCollector *const collector; const NodeDefManager *const nodedef; - scene::IMeshManipulator *const meshmanip; const v3s16 blockpos_nodes; diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index c8cd79248..43c6e22e2 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -633,8 +633,7 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs */ { - MapblockMeshGenerator(data, &collector, - client->getSceneManager()->getMeshManipulator()).generate(); + MapblockMeshGenerator(data, &collector).generate(); } /* diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index 5e645e9be..bb3d91f7e 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -299,8 +299,7 @@ static scene::SMesh *createSpecialNodeMesh(Client *client, MapNode n, MeshMakeData mesh_make_data(client->ndef(), 1); MeshCollector collector(v3f(0.0f * BS), v3f()); mesh_make_data.setSmoothLighting(false); - MapblockMeshGenerator gen(&mesh_make_data, &collector, - client->getSceneManager()->getMeshManipulator()); + MapblockMeshGenerator gen(&mesh_make_data, &collector); if (n.getParam2()) { // keep it diff --git a/src/log.cpp b/src/log.cpp index 144504660..8bc8ed0f4 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -105,7 +105,7 @@ void AndroidLogOutput::logRaw(LogLevel lev, std::string_view line) static_assert(ARRLEN(g_level_to_android) == LL_MAX, "mismatch between android and internal loglevels"); __android_log_print(g_level_to_android[lev], PROJECT_NAME_C, "%.*s", - line.size(), line.data()); + static_cast(line.size()), line.data()); } #endif diff --git a/src/unittest/test_content_mapblock.cpp b/src/unittest/test_content_mapblock.cpp index 6e0026cba..c357c5ea7 100644 --- a/src/unittest/test_content_mapblock.cpp +++ b/src/unittest/test_content_mapblock.cpp @@ -175,7 +175,7 @@ void TestMapblockMeshGenerator::testSimpleNode() data.m_vmanip.setNode({0, 0, 0}, {stone, 0, 0}); MeshCollector col{{}}; - MapblockMeshGenerator mg{&data, &col, nullptr}; + MapblockMeshGenerator mg{&data, &col}; mg.generate(); UASSERTEQ(std::size_t, col.prebuffers[0].size(), 1); UASSERTEQ(std::size_t, col.prebuffers[1].size(), 0); @@ -197,7 +197,7 @@ void TestMapblockMeshGenerator::testSurroundedNode() data.m_vmanip.setNode({1, 0, 0}, {wood, 0, 0}); MeshCollector col{{}}; - MapblockMeshGenerator mg{&data, &col, nullptr}; + MapblockMeshGenerator mg{&data, &col}; mg.generate(); UASSERTEQ(std::size_t, col.prebuffers[0].size(), 1); UASSERTEQ(std::size_t, col.prebuffers[1].size(), 0); @@ -218,7 +218,7 @@ void TestMapblockMeshGenerator::testInterliquidSame() data.m_vmanip.setNode({1, 0, 0}, {water, 0, 0}); MeshCollector col{{}}; - MapblockMeshGenerator mg{&data, &col, nullptr}; + MapblockMeshGenerator mg{&data, &col}; mg.generate(); UASSERTEQ(std::size_t, col.prebuffers[0].size(), 1); UASSERTEQ(std::size_t, col.prebuffers[1].size(), 0); @@ -240,7 +240,7 @@ void TestMapblockMeshGenerator::testInterliquidDifferent() data.m_vmanip.setNode({0, 0, 1}, {lava, 0, 0}); MeshCollector col{{}}; - MapblockMeshGenerator mg{&data, &col, nullptr}; + MapblockMeshGenerator mg{&data, &col}; mg.generate(); UASSERTEQ(std::size_t, col.prebuffers[0].size(), 1); UASSERTEQ(std::size_t, col.prebuffers[1].size(), 0);