mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01: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"
|
||||
|
||||
#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
|
||||
{
|
||||
|
||||
@ -131,7 +119,6 @@ void COSOperator::copyToPrimarySelection(const c8 *text) const
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
||||
if (sdl_supports_primary_selection)
|
||||
SDL_SetPrimarySelectionText(text);
|
||||
#endif
|
||||
|
||||
@ -195,11 +182,9 @@ const c8 *COSOperator::getTextFromPrimarySelection() const
|
||||
{
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
||||
if (sdl_supports_primary_selection) {
|
||||
SDL_free(PrimarySelectionText);
|
||||
PrimarySelectionText = SDL_GetPrimarySelectionText();
|
||||
return PrimarySelectionText;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
|
@ -704,12 +704,6 @@ IRenderTarget *COpenGL3DriverBase::addRenderTarget()
|
||||
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
|
||||
void COpenGL3DriverBase::drawVertexPrimitiveList(const void *vertices, u32 vertexCount,
|
||||
const void *indexList, u32 primitiveCount,
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
// internally used
|
||||
virtual void draw2DImage(const video::ITexture *texture, u32 layer, bool flip);
|
||||
|
||||
using CNullDriver::draw2DImage;
|
||||
|
||||
void draw2DImageBatch(const video::ITexture *texture,
|
||||
const core::array<core::position2d<s32>> &positions,
|
||||
const core::array<core::rect<s32>> &sourceRects,
|
||||
|
@ -37,15 +37,15 @@ public:
|
||||
GLuint getProgram() const;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -329,32 +329,6 @@ void final_color_blend(video::SColor *result,
|
||||
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).
|
||||
*/
|
||||
@ -1006,7 +980,6 @@ video::SColor encode_light(u16 light, u8 emissive_light)
|
||||
u8 get_solid_sides(MeshMakeData *data)
|
||||
{
|
||||
std::unordered_map<v3s16, u8> results;
|
||||
v3s16 ofs;
|
||||
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
|
||||
const NodeDefManager *ndef = data->nodedef;
|
||||
|
||||
|
@ -42,7 +42,6 @@ static v3f quantizeDirection(v3f direction, float step)
|
||||
void DirectionalLight::createSplitMatrices(const Camera *cam)
|
||||
{
|
||||
static const float COS_15_DEG = 0.965926f;
|
||||
v3f newCenter;
|
||||
v3f look = cam->getDirection().normalize();
|
||||
|
||||
// if current look direction is < 15 degrees away from the captured
|
||||
|
@ -218,14 +218,6 @@ bool wouldCollideWithCeiling(
|
||||
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,
|
||||
f32 pos_max_d, const aabb3f &box_0,
|
||||
f32 stepheight, f32 dtime,
|
||||
|
@ -183,7 +183,6 @@ void GUITable::setTable(const TableOptions &options,
|
||||
}
|
||||
|
||||
// Handle table options
|
||||
video::SColor default_color(255, 255, 255, 255);
|
||||
s32 opendepth = 0;
|
||||
for (const Option &option : options) {
|
||||
const std::string &name = option.name;
|
||||
|
@ -94,7 +94,6 @@ void StaticText::draw()
|
||||
getTextWidth();
|
||||
}
|
||||
|
||||
irr::video::SColor previous_color(255, 255, 255, 255);
|
||||
for (const EnrichedString &str : BrokenText) {
|
||||
if (HAlign == EGUIA_LOWERRIGHT)
|
||||
{
|
||||
|
@ -455,7 +455,7 @@ public:
|
||||
void PutReliableSendCommand(ConnectionCommandPtr &c,
|
||||
unsigned int max_packet_size) override;
|
||||
|
||||
virtual const Address &getAddress() const {
|
||||
virtual const Address &getAddress() const override {
|
||||
return address;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user