mirror of
https://github.com/minetest/minetest.git
synced 2024-08-19 21:14:15 +02:00
Fix some clang compiler warnings (#14654)
* Fix some clang compiler warnings * Get rid of sdl_supports_primary_selection * Fix draw2DImage hiding overloaded virtual function
This commit is contained in:
parent
93f4844c9c
commit
5c187363b2
@ -29,18 +29,6 @@
|
|||||||
|
|
||||||
#include "fast_atof.h"
|
#include "fast_atof.h"
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
|
||||||
static const bool sdl_supports_primary_selection = [] {
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
|
||||||
SDL_version linked_version;
|
|
||||||
SDL_GetVersion(&linked_version);
|
|
||||||
return (linked_version.major == 2 && linked_version.minor >= 25) || linked_version.major > 2;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -131,8 +119,7 @@ void COSOperator::copyToPrimarySelection(const c8 *text) const
|
|||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
||||||
if (sdl_supports_primary_selection)
|
SDL_SetPrimarySelectionText(text);
|
||||||
SDL_SetPrimarySelectionText(text);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||||
@ -195,11 +182,9 @@ const c8 *COSOperator::getTextFromPrimarySelection() const
|
|||||||
{
|
{
|
||||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||||
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
||||||
if (sdl_supports_primary_selection) {
|
SDL_free(PrimarySelectionText);
|
||||||
SDL_free(PrimarySelectionText);
|
PrimarySelectionText = SDL_GetPrimarySelectionText();
|
||||||
PrimarySelectionText = SDL_GetPrimarySelectionText();
|
return PrimarySelectionText;
|
||||||
return PrimarySelectionText;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -704,12 +704,6 @@ IRenderTarget *COpenGL3DriverBase::addRenderTarget()
|
|||||||
return renderTarget;
|
return renderTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// small helper function to create vertex buffer object adress offsets
|
|
||||||
static inline u8 *buffer_offset(const long offset)
|
|
||||||
{
|
|
||||||
return ((u8 *)0 + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! draws a vertex primitive list
|
//! draws a vertex primitive list
|
||||||
void COpenGL3DriverBase::drawVertexPrimitiveList(const void *vertices, u32 vertexCount,
|
void COpenGL3DriverBase::drawVertexPrimitiveList(const void *vertices, u32 vertexCount,
|
||||||
const void *indexList, u32 primitiveCount,
|
const void *indexList, u32 primitiveCount,
|
||||||
|
@ -102,6 +102,8 @@ public:
|
|||||||
// internally used
|
// internally used
|
||||||
virtual void draw2DImage(const video::ITexture *texture, u32 layer, bool flip);
|
virtual void draw2DImage(const video::ITexture *texture, u32 layer, bool flip);
|
||||||
|
|
||||||
|
using CNullDriver::draw2DImage;
|
||||||
|
|
||||||
void draw2DImageBatch(const video::ITexture *texture,
|
void draw2DImageBatch(const video::ITexture *texture,
|
||||||
const core::array<core::position2d<s32>> &positions,
|
const core::array<core::position2d<s32>> &positions,
|
||||||
const core::array<core::rect<s32>> &sourceRects,
|
const core::array<core::rect<s32>> &sourceRects,
|
||||||
|
@ -37,15 +37,15 @@ public:
|
|||||||
GLuint getProgram() const;
|
GLuint getProgram() const;
|
||||||
|
|
||||||
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
|
virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial,
|
||||||
bool resetAllRenderstates, IMaterialRendererServices *services);
|
bool resetAllRenderstates, IMaterialRendererServices *services) override;
|
||||||
|
|
||||||
virtual bool OnRender(IMaterialRendererServices *service, E_VERTEX_TYPE vtxtype);
|
virtual bool OnRender(IMaterialRendererServices *service, E_VERTEX_TYPE vtxtype) override;
|
||||||
|
|
||||||
virtual void OnUnsetMaterial();
|
virtual void OnUnsetMaterial() override;
|
||||||
|
|
||||||
virtual bool isTransparent() const;
|
virtual bool isTransparent() const override;
|
||||||
|
|
||||||
virtual s32 getRenderCapability() const;
|
virtual s32 getRenderCapability() const override;
|
||||||
|
|
||||||
void setBasicRenderStates(const SMaterial &material, const SMaterial &lastMaterial, bool resetAllRenderstates) override;
|
void setBasicRenderStates(const SMaterial &material, const SMaterial &lastMaterial, bool resetAllRenderstates) override;
|
||||||
|
|
||||||
|
@ -329,32 +329,6 @@ void final_color_blend(video::SColor *result,
|
|||||||
Mesh generation helpers
|
Mesh generation helpers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// This table is moved outside getNodeVertexDirs to avoid the compiler using
|
|
||||||
// a mutex to initialize this table at runtime right in the hot path.
|
|
||||||
// For details search the internet for "cxa_guard_acquire".
|
|
||||||
static const v3s16 vertex_dirs_table[] = {
|
|
||||||
// ( 1, 0, 0)
|
|
||||||
v3s16( 1,-1, 1), v3s16( 1,-1,-1),
|
|
||||||
v3s16( 1, 1,-1), v3s16( 1, 1, 1),
|
|
||||||
// ( 0, 1, 0)
|
|
||||||
v3s16( 1, 1,-1), v3s16(-1, 1,-1),
|
|
||||||
v3s16(-1, 1, 1), v3s16( 1, 1, 1),
|
|
||||||
// ( 0, 0, 1)
|
|
||||||
v3s16(-1,-1, 1), v3s16( 1,-1, 1),
|
|
||||||
v3s16( 1, 1, 1), v3s16(-1, 1, 1),
|
|
||||||
// invalid
|
|
||||||
v3s16(), v3s16(), v3s16(), v3s16(),
|
|
||||||
// ( 0, 0,-1)
|
|
||||||
v3s16( 1,-1,-1), v3s16(-1,-1,-1),
|
|
||||||
v3s16(-1, 1,-1), v3s16( 1, 1,-1),
|
|
||||||
// ( 0,-1, 0)
|
|
||||||
v3s16( 1,-1, 1), v3s16(-1,-1, 1),
|
|
||||||
v3s16(-1,-1,-1), v3s16( 1,-1,-1),
|
|
||||||
// (-1, 0, 0)
|
|
||||||
v3s16(-1,-1,-1), v3s16(-1,-1, 1),
|
|
||||||
v3s16(-1, 1, 1), v3s16(-1, 1,-1)
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Gets nth node tile (0 <= n <= 5).
|
Gets nth node tile (0 <= n <= 5).
|
||||||
*/
|
*/
|
||||||
@ -1006,7 +980,6 @@ video::SColor encode_light(u16 light, u8 emissive_light)
|
|||||||
u8 get_solid_sides(MeshMakeData *data)
|
u8 get_solid_sides(MeshMakeData *data)
|
||||||
{
|
{
|
||||||
std::unordered_map<v3s16, u8> results;
|
std::unordered_map<v3s16, u8> results;
|
||||||
v3s16 ofs;
|
|
||||||
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
|
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
|
||||||
const NodeDefManager *ndef = data->nodedef;
|
const NodeDefManager *ndef = data->nodedef;
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ static v3f quantizeDirection(v3f direction, float step)
|
|||||||
void DirectionalLight::createSplitMatrices(const Camera *cam)
|
void DirectionalLight::createSplitMatrices(const Camera *cam)
|
||||||
{
|
{
|
||||||
static const float COS_15_DEG = 0.965926f;
|
static const float COS_15_DEG = 0.965926f;
|
||||||
v3f newCenter;
|
|
||||||
v3f look = cam->getDirection().normalize();
|
v3f look = cam->getDirection().normalize();
|
||||||
|
|
||||||
// if current look direction is < 15 degrees away from the captured
|
// if current look direction is < 15 degrees away from the captured
|
||||||
|
@ -218,14 +218,6 @@ bool wouldCollideWithCeiling(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void getNeighborConnectingFace(const v3s16 &p,
|
|
||||||
const NodeDefManager *nodedef, Map *map, MapNode n, int v, int *neighbors)
|
|
||||||
{
|
|
||||||
MapNode n2 = map->getNode(p);
|
|
||||||
if (nodedef->nodeboxConnects(n, n2, v))
|
|
||||||
*neighbors |= v;
|
|
||||||
}
|
|
||||||
|
|
||||||
collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
||||||
f32 pos_max_d, const aabb3f &box_0,
|
f32 pos_max_d, const aabb3f &box_0,
|
||||||
f32 stepheight, f32 dtime,
|
f32 stepheight, f32 dtime,
|
||||||
|
@ -183,7 +183,6 @@ void GUITable::setTable(const TableOptions &options,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle table options
|
// Handle table options
|
||||||
video::SColor default_color(255, 255, 255, 255);
|
|
||||||
s32 opendepth = 0;
|
s32 opendepth = 0;
|
||||||
for (const Option &option : options) {
|
for (const Option &option : options) {
|
||||||
const std::string &name = option.name;
|
const std::string &name = option.name;
|
||||||
|
@ -94,7 +94,6 @@ void StaticText::draw()
|
|||||||
getTextWidth();
|
getTextWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
irr::video::SColor previous_color(255, 255, 255, 255);
|
|
||||||
for (const EnrichedString &str : BrokenText) {
|
for (const EnrichedString &str : BrokenText) {
|
||||||
if (HAlign == EGUIA_LOWERRIGHT)
|
if (HAlign == EGUIA_LOWERRIGHT)
|
||||||
{
|
{
|
||||||
|
@ -455,7 +455,7 @@ public:
|
|||||||
void PutReliableSendCommand(ConnectionCommandPtr &c,
|
void PutReliableSendCommand(ConnectionCommandPtr &c,
|
||||||
unsigned int max_packet_size) override;
|
unsigned int max_packet_size) override;
|
||||||
|
|
||||||
virtual const Address &getAddress() const {
|
virtual const Address &getAddress() const override {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user