1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00: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:
Lars Müller 2024-05-15 19:56:25 +02:00 committed by GitHub
parent 93f4844c9c
commit 5c187363b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 12 additions and 69 deletions

View file

@ -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,8 +119,7 @@ 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);
SDL_SetPrimarySelectionText(text);
#endif
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
@ -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;
}
SDL_free(PrimarySelectionText);
PrimarySelectionText = SDL_GetPrimarySelectionText();
return PrimarySelectionText;
#endif
return 0;

View file

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

View file

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

View file

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