mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Add -Wsign-compare for Clang builds and fix some signed/unsigned compiler warnings
This commit is contained in:
parent
fb36c471d7
commit
11a96e4901
@ -590,6 +590,7 @@ else()
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# clang does not understand __extern_always_inline but libc headers use it
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} -Wsign-compare")
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
|
@ -142,12 +142,12 @@ class TestCAO : public ClientActiveObject
|
||||
public:
|
||||
TestCAO(IGameDef *gamedef, ClientEnvironment *env);
|
||||
virtual ~TestCAO();
|
||||
|
||||
|
||||
ActiveObjectType getType() const
|
||||
{
|
||||
return ACTIVEOBJECT_TYPE_TEST;
|
||||
}
|
||||
|
||||
|
||||
static ClientActiveObject* create(IGameDef *gamedef, ClientEnvironment *env);
|
||||
|
||||
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
@ -192,9 +192,9 @@ void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
{
|
||||
if(m_node != NULL)
|
||||
return;
|
||||
|
||||
|
||||
//video::IVideoDriver* driver = smgr->getVideoDriver();
|
||||
|
||||
|
||||
scene::SMesh *mesh = new scene::SMesh();
|
||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||
video::SColor c(255,255,255,255);
|
||||
@ -286,12 +286,12 @@ class ItemCAO : public ClientActiveObject
|
||||
public:
|
||||
ItemCAO(IGameDef *gamedef, ClientEnvironment *env);
|
||||
virtual ~ItemCAO();
|
||||
|
||||
|
||||
ActiveObjectType getType() const
|
||||
{
|
||||
return ACTIVEOBJECT_TYPE_ITEM;
|
||||
}
|
||||
|
||||
|
||||
static ClientActiveObject* create(IGameDef *gamedef, ClientEnvironment *env);
|
||||
|
||||
void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
@ -308,12 +308,12 @@ public:
|
||||
void processMessage(const std::string &data);
|
||||
|
||||
void initialize(const std::string &data);
|
||||
|
||||
|
||||
core::aabbox3d<f32>* getSelectionBox()
|
||||
{return &m_selection_box;}
|
||||
v3f getPosition()
|
||||
{return m_position;}
|
||||
|
||||
|
||||
std::string infoText()
|
||||
{return m_infotext;}
|
||||
|
||||
@ -357,9 +357,9 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
{
|
||||
if(m_node != NULL)
|
||||
return;
|
||||
|
||||
|
||||
//video::IVideoDriver* driver = smgr->getVideoDriver();
|
||||
|
||||
|
||||
scene::SMesh *mesh = new scene::SMesh();
|
||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||
video::SColor c(255,255,255,255);
|
||||
@ -469,7 +469,7 @@ void ItemCAO::updateTexture()
|
||||
<<": error deSerializing itemstring \""
|
||||
<<m_itemstring<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
// Set meshbuffer texture
|
||||
m_node->getMaterial(0).setTexture(0, texture);
|
||||
}
|
||||
@ -514,7 +514,7 @@ void ItemCAO::processMessage(const std::string &data)
|
||||
void ItemCAO::initialize(const std::string &data)
|
||||
{
|
||||
infostream<<"ItemCAO: Got init data"<<std::endl;
|
||||
|
||||
|
||||
{
|
||||
std::istringstream is(data, std::ios::binary);
|
||||
// version
|
||||
@ -527,7 +527,7 @@ void ItemCAO::initialize(const std::string &data)
|
||||
// itemstring
|
||||
m_itemstring = deSerializeString(is);
|
||||
}
|
||||
|
||||
|
||||
updateNodePos();
|
||||
updateInfoText();
|
||||
}
|
||||
@ -748,7 +748,7 @@ ClientActiveObject* GenericCAO::getParent()
|
||||
void GenericCAO::removeFromScene(bool permanent)
|
||||
{
|
||||
// Should be true when removing the object permanently and false when refreshing (eg: updating visuals)
|
||||
if((m_env != NULL) && (permanent))
|
||||
if((m_env != NULL) && (permanent))
|
||||
{
|
||||
for(std::vector<u16>::iterator ci = m_children.begin();
|
||||
ci != m_children.end(); ci++)
|
||||
@ -759,7 +759,7 @@ void GenericCAO::removeFromScene(bool permanent)
|
||||
}
|
||||
|
||||
m_env->m_attachements[getId()] = 0;
|
||||
|
||||
|
||||
LocalPlayer* player = m_env->getLocalPlayer();
|
||||
if (this == player->parent) {
|
||||
player->parent = NULL;
|
||||
@ -898,7 +898,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
|
||||
m_meshnode->grab();
|
||||
mesh->drop();
|
||||
|
||||
|
||||
m_meshnode->setScale(v3f(m_prop.visual_size.X,
|
||||
m_prop.visual_size.Y,
|
||||
m_prop.visual_size.X));
|
||||
@ -1014,7 +1014,7 @@ void GenericCAO::updateNodePos()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenericCAO::step(float dtime, ClientEnvironment *env)
|
||||
{
|
||||
// Handel model of local player instantly to prevent lags
|
||||
@ -1485,7 +1485,7 @@ void GenericCAO::updateBonePosition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenericCAO::updateAttachments()
|
||||
{
|
||||
|
||||
@ -1716,14 +1716,14 @@ void GenericCAO::processMessage(const std::string &data)
|
||||
m_armor_groups[name] = rating;
|
||||
}
|
||||
} else if (cmd == GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES) {
|
||||
u8 version = readU8(is); // forward compatibility
|
||||
//u8 version = readU8(is); // forward compatibility
|
||||
m_nametag_color = readARGB8(is);
|
||||
if (m_textnode != NULL) {
|
||||
m_textnode->setTextColor(m_nametag_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* \pre punchitem != NULL
|
||||
*/
|
||||
bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem,
|
||||
|
@ -590,8 +590,8 @@ void Noise::gradientMap2D(
|
||||
int seed)
|
||||
{
|
||||
float v00, v01, v10, v11, u, v, orig_u;
|
||||
int index, i, j, x0, y0, noisex, noisey;
|
||||
int nlx, nly;
|
||||
u32 index, i, j, x0, y0, noisex, noisey;
|
||||
u32 nlx, nly;
|
||||
|
||||
bool eased = np.flags & (NOISE_FLAG_DEFAULTS | NOISE_FLAG_EASED);
|
||||
Interp2dFxn interpolate = eased ?
|
||||
@ -604,8 +604,8 @@ void Noise::gradientMap2D(
|
||||
orig_u = u;
|
||||
|
||||
//calculate noise point lattice
|
||||
nlx = (int)(u + sx * step_x) + 2;
|
||||
nly = (int)(v + sy * step_y) + 2;
|
||||
nlx = (u32)(u + sx * step_x) + 2;
|
||||
nly = (u32)(v + sy * step_y) + 2;
|
||||
index = 0;
|
||||
for (j = 0; j != nly; j++)
|
||||
for (i = 0; i != nlx; i++)
|
||||
@ -655,8 +655,8 @@ void Noise::gradientMap3D(
|
||||
float v000, v010, v100, v110;
|
||||
float v001, v011, v101, v111;
|
||||
float u, v, w, orig_u, orig_v;
|
||||
int index, i, j, k, x0, y0, z0, noisex, noisey, noisez;
|
||||
int nlx, nly, nlz;
|
||||
u32 index, i, j, k, x0, y0, z0, noisex, noisey, noisez;
|
||||
u32 nlx, nly, nlz;
|
||||
|
||||
Interp3dFxn interpolate = (np.flags & NOISE_FLAG_EASED) ?
|
||||
triLinearInterpolation : triLinearInterpolationNoEase;
|
||||
@ -671,9 +671,9 @@ void Noise::gradientMap3D(
|
||||
orig_v = v;
|
||||
|
||||
//calculate noise point lattice
|
||||
nlx = (int)(u + sx * step_x) + 2;
|
||||
nly = (int)(v + sy * step_y) + 2;
|
||||
nlz = (int)(w + sz * step_z) + 2;
|
||||
nlx = (u32)(u + sx * step_x) + 2;
|
||||
nly = (u32)(v + sy * step_y) + 2;
|
||||
nlz = (u32)(w + sz * step_z) + 2;
|
||||
index = 0;
|
||||
for (k = 0; k != nlz; k++)
|
||||
for (j = 0; j != nly; j++)
|
||||
|
@ -99,7 +99,7 @@ void TestSchematic::testMtsSerializeDeserialize(INodeDefManager *ndef)
|
||||
UASSERT(schem2.size == size);
|
||||
for (size_t i = 0; i != volume; i++)
|
||||
UASSERT(schem2.schemdata[i] == schem.schemdata[i]);
|
||||
for (size_t y = 0; y != size.Y; y++)
|
||||
for (s16 y = 0; y != size.Y; y++)
|
||||
UASSERTEQ(u8, schem2.slice_probs[y], schem.slice_probs[y]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user