mirror of
https://github.com/minetest/minetest.git
synced 2024-12-28 08:57:30 +01:00
Fix compiler warnings
This commit is contained in:
parent
6952bab519
commit
492aab20fe
@ -71,14 +71,14 @@ static void imageCleanTransparentWithInlining(video::IImage *src, u32 threshold)
|
||||
void *const src_data = src->getData();
|
||||
const core::dimension2d<u32> dim = src->getDimension();
|
||||
|
||||
auto get_pixel = [src, src_data, dim](u32 x, u32 y) -> video::SColor {
|
||||
auto get_pixel = [=](u32 x, u32 y) -> video::SColor {
|
||||
if constexpr (IS_A8R8G8B8) {
|
||||
return reinterpret_cast<u32 *>(src_data)[y*dim.Width + x];
|
||||
} else {
|
||||
return src->getPixel(x, y);
|
||||
}
|
||||
};
|
||||
auto set_pixel = [src, src_data, dim](u32 x, u32 y, video::SColor color) {
|
||||
auto set_pixel = [=](u32 x, u32 y, video::SColor color) {
|
||||
if constexpr (IS_A8R8G8B8) {
|
||||
u32 *dest = &reinterpret_cast<u32 *>(src_data)[y*dim.Width + x];
|
||||
*dest = color.color;
|
||||
|
@ -615,7 +615,7 @@ class Peer {
|
||||
u64 m_last_timeout_check;
|
||||
};
|
||||
|
||||
class UDPPeer : public Peer
|
||||
class UDPPeer final : public Peer
|
||||
{
|
||||
public:
|
||||
|
||||
@ -628,15 +628,15 @@ public:
|
||||
virtual ~UDPPeer() = default;
|
||||
|
||||
void PutReliableSendCommand(ConnectionCommandPtr &c,
|
||||
unsigned int max_packet_size);
|
||||
unsigned int max_packet_size) override;
|
||||
|
||||
bool getAddress(MTProtocols type, Address& toset);
|
||||
bool getAddress(MTProtocols type, Address& toset) override;
|
||||
|
||||
u16 getNextSplitSequenceNumber(u8 channel);
|
||||
void setNextSplitSequenceNumber(u8 channel, u16 seqnum);
|
||||
u16 getNextSplitSequenceNumber(u8 channel) override;
|
||||
void setNextSplitSequenceNumber(u8 channel, u16 seqnum) override;
|
||||
|
||||
SharedBuffer<u8> addSplitPacket(u8 channel, BufferedPacketPtr &toadd,
|
||||
bool reliable);
|
||||
bool reliable) override;
|
||||
|
||||
bool isTimedOut(float timeout, std::string &reason) override;
|
||||
|
||||
@ -645,7 +645,7 @@ protected:
|
||||
Calculates avg_rtt and resend_timeout.
|
||||
rtt=-1 only recalculates resend_timeout
|
||||
*/
|
||||
void reportRTT(float rtt);
|
||||
void reportRTT(float rtt) override;
|
||||
|
||||
void RunCommandQueues(
|
||||
unsigned int max_packet_size,
|
||||
@ -657,7 +657,7 @@ protected:
|
||||
void setResendTimeout(float timeout)
|
||||
{ MutexAutoLock lock(m_exclusive_access_mutex); resend_timeout = timeout; }
|
||||
|
||||
bool Ping(float dtime,SharedBuffer<u8>& data);
|
||||
bool Ping(float dtime, SharedBuffer<u8>& data) override;
|
||||
|
||||
Channel channels[CHANNEL_COUNT];
|
||||
bool m_pending_disconnect = false;
|
||||
|
@ -630,7 +630,7 @@ void script_dump_packed(const PackedValue *val)
|
||||
printf("table(%d, %d)", i.uidata1, i.uidata2);
|
||||
break;
|
||||
case LUA_TFUNCTION:
|
||||
printf("function(%lu byte)", i.sdata.size());
|
||||
printf("function(%d bytes)", (int)i.sdata.size());
|
||||
break;
|
||||
case LUA_TUSERDATA:
|
||||
printf("userdata %s %p", i.sdata.c_str(), i.ptrdata);
|
||||
|
@ -132,9 +132,6 @@ int LuaMinimap::l_show(lua_State *L)
|
||||
if (!g_settings->getBool("enable_minimap"))
|
||||
return 1;
|
||||
|
||||
Client *client = getClient(L);
|
||||
assert(client);
|
||||
|
||||
LuaMinimap *ref = checkObject<LuaMinimap>(L, 1);
|
||||
Minimap *m = getobject(ref);
|
||||
|
||||
@ -149,9 +146,6 @@ int LuaMinimap::l_show(lua_State *L)
|
||||
|
||||
int LuaMinimap::l_hide(lua_State *L)
|
||||
{
|
||||
Client *client = getClient(L);
|
||||
assert(client);
|
||||
|
||||
LuaMinimap *ref = checkObject<LuaMinimap>(L, 1);
|
||||
Minimap *m = getobject(ref);
|
||||
|
||||
|
@ -104,7 +104,7 @@ void TestDataStructures::testMap1()
|
||||
UASSERT(t0.deleted);
|
||||
UASSERT(!t1.copied);
|
||||
UASSERT(!t1.deleted);
|
||||
if (once |= 1)
|
||||
if ((once |= 1))
|
||||
break;
|
||||
}
|
||||
UASSERT(once);
|
||||
|
@ -43,13 +43,19 @@ class Translations;
|
||||
( (unsigned int)(x) <= 0x7e))
|
||||
|
||||
// Checks whether a value is in a Unicode private use area
|
||||
#define IS_PRIVATE_USE_CHAR(x) \
|
||||
(((wchar_t)(x) >= 0xE000 && \
|
||||
(wchar_t)(x) <= 0xF8FF) || \
|
||||
((wchar_t)(x) >= 0xF0000 && \
|
||||
#define IS_PRIVATE_USE_CHAR16(x) \
|
||||
((wchar_t)(x) >= 0xE000 && \
|
||||
(wchar_t)(x) <= 0xF8FF)
|
||||
#define IS_PRIVATE_USE_CHAR32(x) \
|
||||
(((wchar_t)(x) >= 0xF0000 && \
|
||||
(wchar_t)(x) <= 0xFFFFD) || \
|
||||
((wchar_t)(x) >= 0x100000 && \
|
||||
(wchar_t)(x) <= 0x10FFFD)) \
|
||||
(wchar_t)(x) <= 0x10FFFD))
|
||||
#if WCHAR_MAX > 0xFFFF
|
||||
#define IS_PRIVATE_USE_CHAR(x) (IS_PRIVATE_USE_CHAR16(x) || IS_PRIVATE_USE_CHAR32(x))
|
||||
#else
|
||||
#define IS_PRIVATE_USE_CHAR(x) IS_PRIVATE_USE_CHAR16(x)
|
||||
#endif
|
||||
|
||||
// Checks whether a byte is an inner byte for an utf-8 multibyte sequence
|
||||
#define IS_UTF8_MULTB_INNER(x) \
|
||||
|
Loading…
Reference in New Issue
Block a user