mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 14:37:41 +00:00
Get rid of pnUtW32Addr and make IP strings char*s.
IP addresses don't need to be unicode. pnUtAddr is still around until we replace all NetAddress uses with plNetAddress (they are typedef'ed to each other right now).
This commit is contained in:
@ -540,13 +540,13 @@ static SOCKET ListenSocket (NetAddress * listenAddr) {
|
||||
);
|
||||
*/
|
||||
|
||||
NetAddressNode node = listenAddr->GetHost();
|
||||
unsigned port = listenAddr->GetPort();
|
||||
uint32_t node = listenAddr->GetHost();
|
||||
uint16_t port = listenAddr->GetPort();
|
||||
|
||||
// bind socket to port
|
||||
sockaddr_in addr;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons((uint16_t)port);
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_addr.S_un.S_addr = node;
|
||||
memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
if (bind(s, (sockaddr *) &addr, sizeof(addr))) {
|
||||
|
@ -69,7 +69,7 @@ struct Lookup {
|
||||
FAsyncLookupProc lookupProc;
|
||||
unsigned port;
|
||||
void * param;
|
||||
wchar_t name[kMaxLookupName];
|
||||
char name[kMaxLookupName];
|
||||
char buffer[MAXGETHOSTSTRUCT];
|
||||
};
|
||||
|
||||
@ -122,7 +122,7 @@ static void LookupProcess (Lookup * lookup, unsigned error) {
|
||||
}
|
||||
|
||||
if (host.h_name && host.h_name[0])
|
||||
StrToUnicode(lookup->name, host.h_name, arrsize(lookup->name));
|
||||
strncpy(lookup->name, host.h_name, arrsize(lookup->name));
|
||||
|
||||
if (lookup->lookupProc)
|
||||
lookup->lookupProc(lookup->param, lookup->name, count, addrs);
|
||||
@ -271,7 +271,7 @@ void DnsDestroy (unsigned exitThreadWaitMs) {
|
||||
void AsyncAddressLookupName (
|
||||
AsyncCancelId * cancelId, // out
|
||||
FAsyncLookupProc lookupProc,
|
||||
const wchar_t name[],
|
||||
const char* name,
|
||||
unsigned port,
|
||||
void * param
|
||||
) {
|
||||
@ -282,9 +282,8 @@ void AsyncAddressLookupName (
|
||||
PerfAddCounter(kAsyncPerfNameLookupAttemptsTotal, 1);
|
||||
|
||||
// Get name/port
|
||||
char ansiName[kMaxLookupName];
|
||||
StrToAnsi(ansiName, name, arrsize(ansiName));
|
||||
if (char * portStr = StrChr(ansiName, ':')) {
|
||||
char* ansiName = strdup(name);
|
||||
if (char* portStr = StrChr(ansiName, ':')) {
|
||||
if (unsigned newPort = StrToUnsigned(portStr + 1, nil, 10))
|
||||
port = newPort;
|
||||
*portStr = 0;
|
||||
@ -295,7 +294,7 @@ void AsyncAddressLookupName (
|
||||
lookup->lookupProc = lookupProc;
|
||||
lookup->port = port;
|
||||
lookup->param = param;
|
||||
StrCopy(lookup->name, name, arrsize(lookup->name));
|
||||
strncpy(lookup->name, name, arrsize(lookup->name));
|
||||
|
||||
s_critsect.Enter();
|
||||
{
|
||||
@ -312,7 +311,7 @@ void AsyncAddressLookupName (
|
||||
lookup->cancelHandle = WSAAsyncGetHostByName(
|
||||
s_lookupWindow,
|
||||
WM_LOOKUP_FOUND_HOST,
|
||||
ansiName,
|
||||
name,
|
||||
&lookup->buffer[0],
|
||||
sizeof(lookup->buffer)
|
||||
);
|
||||
@ -342,7 +341,7 @@ void AsyncAddressLookupAddr (
|
||||
lookup->param = param;
|
||||
|
||||
plString str = address.GetHostString();
|
||||
wcsncpy(lookup->name, (const wchar_t*)str.ToUtf16().GetData(), 127);
|
||||
strncpy(lookup->name, str.c_str(), arrsize(lookup->name));
|
||||
|
||||
s_critsect.Enter();
|
||||
{
|
||||
|
Reference in New Issue
Block a user