Fix QHostAddress::operator==(QHostAddress::SpecialAddress)
QHostAddress(QHostAddress::Any) was not equal to QHostAddress::Any because only one of the operator== overloads was handling this. Task-number: QTBUG-22898 Change-Id: Ifd36947a50e8c36362b4e850fd8d5105ee0925ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
6468dd4179
commit
49140efe2d
@ -899,6 +899,8 @@ bool QHostAddress::operator ==(SpecialAddress other) const
|
||||
return otherAddress.d->protocol == QAbstractSocket::IPv6Protocol
|
||||
&& memcmp(&d->a6, &otherAddress.d->a6, sizeof(Q_IPV6ADDR)) == 0;
|
||||
}
|
||||
if (d->protocol == QAbstractSocket::AnyIPProtocol)
|
||||
return other == QHostAddress::Any;
|
||||
return int(other) == int(Null);
|
||||
}
|
||||
|
||||
|
@ -285,6 +285,10 @@ void tst_QHostAddress::specialAddresses()
|
||||
QFETCH(bool, result);
|
||||
QVERIFY((QHostAddress(text) == (QHostAddress::SpecialAddress)address) == result);
|
||||
|
||||
//check special address equal to itself (QTBUG-22898), note two overloads of operator==
|
||||
QVERIFY(QHostAddress((QHostAddress::SpecialAddress)address) == QHostAddress((QHostAddress::SpecialAddress)address));
|
||||
QVERIFY(QHostAddress((QHostAddress::SpecialAddress)address) == (QHostAddress::SpecialAddress)address);
|
||||
|
||||
QHostAddress setter;
|
||||
setter.setAddress(text);
|
||||
if (result) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user