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