mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Remove almost all uses of NetAddress.
This probably has a bunch of bugs because of Network Order/Host Order issues. If we intend to actually support BE architectures, these problems are going to get much much worse :(
This commit is contained in:
@ -94,30 +94,6 @@ static NetAddressNode NodeFromString (const wchar_t * string[]) {
|
||||
*
|
||||
***/
|
||||
|
||||
//===========================================================================
|
||||
void NetAddressToString (
|
||||
const NetAddress & addr,
|
||||
wchar_t * str,
|
||||
unsigned chars,
|
||||
ENetAddressFormat format
|
||||
) {
|
||||
ASSERT(str);
|
||||
|
||||
static const wchar_t * s_fmts[] = {
|
||||
L"%S", // kNetAddressFormatNodeNumber
|
||||
L"%S:%u", // kNetAddressFormatAll
|
||||
};
|
||||
ASSERT(format < arrsize(s_fmts));
|
||||
const sockaddr_in & inetaddr = * (const sockaddr_in *) &addr;
|
||||
StrPrintf(
|
||||
str,
|
||||
chars,
|
||||
s_fmts[format],
|
||||
inet_ntoa(inetaddr.sin_addr),
|
||||
ntohs(inetaddr.sin_port)
|
||||
);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool NetAddressFromString (NetAddress * addr, const wchar_t str[], unsigned defaultPort) {
|
||||
ASSERT(addr);
|
||||
@ -146,14 +122,3 @@ bool NetAddressFromString (NetAddress * addr, const wchar_t str[], unsigned defa
|
||||
// address already zeroed
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void NetAddressNodeToString (
|
||||
NetAddressNode node,
|
||||
wchar_t * str,
|
||||
unsigned chars
|
||||
) {
|
||||
in_addr addr;
|
||||
addr.S_un.S_addr = htonl(node);
|
||||
StrPrintf(str, chars, L"%S", inet_ntoa(addr));
|
||||
}
|
||||
|
@ -74,19 +74,6 @@ typedef uint32_t NetAddressNode;
|
||||
*
|
||||
***/
|
||||
|
||||
enum ENetAddressFormat {
|
||||
kNetAddressFormatNodeNumber,
|
||||
kNetAddressFormatAll,
|
||||
kNumNetAddressFormats
|
||||
};
|
||||
|
||||
void NetAddressToString (
|
||||
const NetAddress & addr,
|
||||
wchar_t * str,
|
||||
unsigned chars,
|
||||
ENetAddressFormat format
|
||||
);
|
||||
|
||||
// 'str' must be in the form of a dotted IP address (IPv4 or IPv6)
|
||||
// - names which require DNS lookup will cause the function to return false
|
||||
bool NetAddressFromString (
|
||||
@ -95,10 +82,4 @@ bool NetAddressFromString (
|
||||
unsigned defaultPort
|
||||
);
|
||||
|
||||
void NetAddressNodeToString (
|
||||
NetAddressNode node,
|
||||
wchar_t * str,
|
||||
unsigned chars
|
||||
);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user