mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Add an operator== to plNetAddress.
This commit is contained in:
@ -177,7 +177,7 @@ static bool ListenPortIncrement (
|
||||
) {
|
||||
NtListener * listener;
|
||||
for (listener = s_listenList.Head(); listener; listener = s_listenList.Next(listener)) {
|
||||
if (!NetAddressEqual(listener->addr, listenAddr))
|
||||
if (listener->addr != listenAddr)
|
||||
continue;
|
||||
if (listener->notifyProc != notifyProc)
|
||||
continue;
|
||||
|
@ -79,6 +79,13 @@ public:
|
||||
plNetAddress(const char* addr, uint16_t port);
|
||||
virtual ~plNetAddress(){}
|
||||
|
||||
bool operator==(const plNetAddress& other) const {
|
||||
return (GetHost() == other.GetHost()) && (GetPort() == other.GetPort());
|
||||
}
|
||||
bool operator!=(const plNetAddress& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
void Clear();
|
||||
|
||||
bool SetAnyAddr();
|
||||
|
@ -94,15 +94,6 @@ static NetAddressNode NodeFromString (const wchar_t * string[]) {
|
||||
*
|
||||
***/
|
||||
|
||||
//===========================================================================
|
||||
int NetAddressCompare (const NetAddress & a1, const NetAddress & a2) {
|
||||
const sockaddr_in & i1 = * (const sockaddr_in *) &a1;
|
||||
const sockaddr_in & i2 = * (const sockaddr_in *) &a2;
|
||||
|
||||
int d = i1.sin_addr.S_un.S_addr - i2.sin_addr.S_un.S_addr;
|
||||
return d ? d : i1.sin_port - i2.sin_port;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void NetAddressToString (
|
||||
const NetAddress & addr,
|
||||
|
@ -80,11 +80,6 @@ enum ENetAddressFormat {
|
||||
kNumNetAddressFormats
|
||||
};
|
||||
|
||||
int NetAddressCompare (const NetAddress & a1, const NetAddress & a2);
|
||||
inline bool NetAddressEqual (const NetAddress & a1, const NetAddress & a2) {
|
||||
return NetAddressCompare(a1, a2) == 0;
|
||||
}
|
||||
|
||||
void NetAddressToString (
|
||||
const NetAddress & addr,
|
||||
wchar_t * str,
|
||||
|
Reference in New Issue
Block a user