Resolve casts to target types

This commit is contained in:
Peter L Jones 2020-04-10 09:12:27 +01:00
parent bc04ff2fb2
commit 4c286d8f43
2 changed files with 7 additions and 7 deletions

View file

@ -1473,7 +1473,7 @@ bool CProtocol::EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr,
// port number (2 bytes)
RecServerInfo.iLocalPortNumber =
static_cast<uint16_t> ( GetValFromStream ( vecData, iPos, 2 ) );
static_cast<quint16> ( GetValFromStream ( vecData, iPos, 2 ) );
// country (2 bytes)
RecServerInfo.eCountry =
@ -1633,11 +1633,11 @@ bool CProtocol::EvaluateCLServerListMes ( const CHostAddress& InetAddr,
// IP address (4 bytes)
const quint32 iIpAddr =
static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
static_cast<quint32> ( GetValFromStream ( vecData, iPos, 4 ) );
// port number (2 bytes)
const quint16 iPort =
static_cast<uint16_t> ( GetValFromStream ( vecData, iPos, 2 ) );
static_cast<quint16> ( GetValFromStream ( vecData, iPos, 2 ) );
// country (2 bytes)
const QLocale::Country eCountry =

View file

@ -90,10 +90,10 @@ protected:
QHostAddress GenRandomIPv4Address() const
{
uint32_t a = static_cast<uint32_t> ( 192 );
uint32_t b = static_cast<uint32_t> ( 168 );
uint32_t c = static_cast<uint32_t> ( GenRandomIntInRange ( 1, 253 ) );
uint32_t d = static_cast<uint32_t> ( GenRandomIntInRange ( 1, 253 ) );
quint32 a = static_cast<quint32> ( 192 );
quint32 b = static_cast<quint32> ( 168 );
quint32 c = static_cast<quint32> ( GenRandomIntInRange ( 1, 253 ) );
quint32 d = static_cast<quint32> ( GenRandomIntInRange ( 1, 253 ) );
return QHostAddress( a << 24 | b << 16 | c << 8 | d );
}