Fix -Wtype-limits warnings and remove disabling of -Wtype-limits
parent
5038b9aaec
commit
3993102e88
|
@ -643,11 +643,6 @@ else()
|
|||
if(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wno-type-limits" HAS_TYPE_LIMITS_WARNING)
|
||||
if(HAS_TYPE_LIMITS_WARNING)
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-type-limits")
|
||||
endif(HAS_TYPE_LIMITS_WARNING)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
|
|
|
@ -2334,6 +2334,11 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
|||
|
||||
u8 type = readU8(&(packetdata[0]));
|
||||
|
||||
if (MAX_UDP_PEERS <= 65535 && peer_id >= MAX_UDP_PEERS) {
|
||||
errorstream << "Something is wrong with peer_id" << std::endl;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if(type == TYPE_CONTROL)
|
||||
{
|
||||
if(packetdata.getSize() < 2)
|
||||
|
@ -2341,8 +2346,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
|||
|
||||
u8 controltype = readU8(&(packetdata[1]));
|
||||
|
||||
if( (controltype == CONTROLTYPE_ACK)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
if(controltype == CONTROLTYPE_ACK)
|
||||
{
|
||||
assert(channel != 0);
|
||||
if(packetdata.getSize() < 4)
|
||||
|
@ -2399,8 +2403,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
|||
}
|
||||
throw ProcessedSilentlyException("Got an ACK");
|
||||
}
|
||||
else if((controltype == CONTROLTYPE_SET_PEER_ID)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
else if(controltype == CONTROLTYPE_SET_PEER_ID)
|
||||
{
|
||||
// Got a packet to set our peer id
|
||||
if(packetdata.getSize() < 4)
|
||||
|
@ -2432,8 +2435,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
|||
|
||||
throw ProcessedSilentlyException("Got a SET_PEER_ID");
|
||||
}
|
||||
else if((controltype == CONTROLTYPE_PING)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
else if(controltype == CONTROLTYPE_PING)
|
||||
{
|
||||
// Just ignore it, the incoming data already reset
|
||||
// the timeout counter
|
||||
|
@ -2455,8 +2457,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
|||
|
||||
throw ProcessedSilentlyException("Got a DISCO");
|
||||
}
|
||||
else if((controltype == CONTROLTYPE_ENABLE_BIG_SEND_WINDOW)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
else if(controltype == CONTROLTYPE_ENABLE_BIG_SEND_WINDOW)
|
||||
{
|
||||
dynamic_cast<UDPPeer*>(&peer)->setNonLegacyPeer();
|
||||
throw ProcessedSilentlyException("Got non legacy control");
|
||||
|
@ -2514,7 +2515,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
|||
//TODO throw some error
|
||||
}
|
||||
}
|
||||
else if((peer_id <= MAX_UDP_PEERS) && (type == TYPE_RELIABLE))
|
||||
else if(type == TYPE_RELIABLE)
|
||||
{
|
||||
assert(channel != 0);
|
||||
// Recursive reliable packets not allowed
|
||||
|
|
|
@ -1766,7 +1766,11 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
|
|||
content_t new_node_content;
|
||||
s8 new_node_level = -1;
|
||||
s8 max_node_level = -1;
|
||||
u8 range = rangelim(nodemgr->get(liquid_kind).liquid_range, 0, LIQUID_LEVEL_MAX+1);
|
||||
|
||||
u8 range = nodemgr->get(liquid_kind).liquid_range;
|
||||
if (range > LIQUID_LEVEL_MAX+1)
|
||||
range = LIQUID_LEVEL_MAX+1;
|
||||
|
||||
if ((num_sources >= 2 && nodemgr->get(liquid_kind).liquid_renewable) || liquid_type == LIQUID_SOURCE) {
|
||||
// liquid_kind will be set to either the flowing alternative of the node (if it's a liquid)
|
||||
// or the flowing alternative of the first of the surrounding sources (if it's air), so
|
||||
|
|
|
@ -72,7 +72,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
// Lowest supported serialization version
|
||||
#define SER_FMT_VER_LOWEST 0
|
||||
|
||||
#define ser_ver_supported(v) (v >= SER_FMT_VER_LOWEST && v <= SER_FMT_VER_HIGHEST_READ)
|
||||
inline bool ser_ver_supported(s32 v) {
|
||||
return v >= SER_FMT_VER_LOWEST && v <= SER_FMT_VER_HIGHEST_READ;
|
||||
}
|
||||
|
||||
/*
|
||||
Misc. serialization functions
|
||||
|
|
|
@ -1361,7 +1361,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
u8 client_max = data[2];
|
||||
u8 our_max = SER_FMT_VER_HIGHEST_READ;
|
||||
// Use the highest version supported by both
|
||||
u8 deployed = std::min(client_max, our_max);
|
||||
int deployed = std::min(client_max, our_max);
|
||||
// If it's lower than the lowest supported, give up.
|
||||
if(deployed < SER_FMT_VER_LOWEST)
|
||||
deployed = SER_FMT_VER_INVALID;
|
||||
|
|
|
@ -1859,7 +1859,7 @@ void imageTransform(u32 transform, video::IImage *src, video::IImage *dst)
|
|||
core::dimension2d<u32> dstdim = dst->getDimension();
|
||||
|
||||
assert(dstdim == imageTransformDimension(transform, srcdim));
|
||||
assert(transform >= 0 && transform <= 7);
|
||||
assert(transform <= 7);
|
||||
|
||||
/*
|
||||
Compute the transformation from source coordinates (sx,sy)
|
||||
|
|
Loading…
Reference in New Issue