Skip to content

Commit 9dad8eb

Browse files
author
Josh Vermette
committed
cleanup_winsockapi
1 parent a003101 commit 9dad8eb

4 files changed

+20
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
ucat
55
ucat-static
66
tags
7+
*~

utp_packedsockaddr.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ cstr PackedSockAddr::fmt(str s, size_t len) const
126126
const byte family = get_family();
127127
str i;
128128
if (family == AF_INET) {
129-
inet_ntop(family, (uint32*)&_sin4, s, len);
129+
libutp::inet_ntop(family, (uint32*)&_sin4, s, len);
130130
i = s;
131131
while (*++i) {}
132132
} else {
133133
i = s;
134134
*i++ = '[';
135-
inet_ntop(family, (in6_addr*)&_in._in6addr, i, len-1);
135+
libutp::inet_ntop(family, (in6_addr*)&_in._in6addr, i, len-1);
136136
while (*++i) {}
137137
*i++ = ']';
138138
}

win32_inet_ntop.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
#include <ws2tcpip.h>
2727
#include "win32_inet_ntop.h"
2828

29-
#if ((!defined NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_LONGHORN))
30-
const char *inet_ntop(int af, const void *src, char *dest, size_t length)
29+
30+
//######################################################################
31+
const char *libutp::inet_ntop(int af, const void *src, char *dest, size_t length)
3132
{
3233
if (af != AF_INET && af != AF_INET6)
3334
{
@@ -68,7 +69,8 @@ const char *inet_ntop(int af, const void *src, char *dest, size_t length)
6869
return result == SOCKET_ERROR ? NULL : dest;
6970
}
7071

71-
int inet_pton(int af, const char* src, void* dest)
72+
//######################################################################
73+
int libutp::inet_pton(int af, const char* src, void* dest)
7274
{
7375
if (af != AF_INET && af != AF_INET6)
7476
{
@@ -104,4 +106,3 @@ int inet_pton(int af, const char* src, void* dest)
104106

105107
return result == SOCKET_ERROR ? -1 : 1;
106108
}
107-
#endif

win32_inet_ntop.h

+12-5
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@
2020
* THE SOFTWARE.
2121
*/
2222

23-
#ifndef __WIN32_INET_NTOP_H__
24-
#define __WIN32_INET_NTOP_H__
23+
#pragma once
2524

26-
#if ((!defined NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_LONGHORN))
25+
//######################################################################
26+
//######################################################################
27+
namespace libutp {
28+
29+
30+
//######################################################################
2731
const char *inet_ntop(int af, const void *src, char *dest, size_t length);
32+
33+
//######################################################################
2834
int inet_pton(int af, const char* src, void* dest);
29-
#endif
3035

31-
#endif //__WIN32_INET_NTOP_H__
36+
37+
} //namespace libutp
38+

0 commit comments

Comments
 (0)