Fix some compiler warnings (#15596)

This commit is contained in:
Lars Müller 2024-12-26 11:29:00 +01:00 committed by GitHub
parent d2a7875b5b
commit 412cc96bc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 12 additions and 19 deletions

@ -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<int>(maxLogLen), &message[start]);
start += maxLogLen;
}
__android_log_print(LogLevel, "Irrlicht", "%s\n", &message[start]);

@ -13,7 +13,6 @@
#include "nodedef.h"
#include "client/tile.h"
#include "mesh.h"
#include <IMeshManipulator.h>
#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"))
{

@ -5,7 +5,6 @@
#pragma once
#include "nodedef.h"
#include <IMeshManipulator.h>
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;

@ -633,8 +633,7 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
*/
{
MapblockMeshGenerator(data, &collector,
client->getSceneManager()->getMeshManipulator()).generate();
MapblockMeshGenerator(data, &collector).generate();
}
/*

@ -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

@ -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<int>(line.size()), line.data());
}
#endif

@ -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);