Skip to content

Commit e052988

Browse files
authored
fix MSVC2015 type convert (#70)
fix MSVC2015 C2664 error.
1 parent 19e7fe9 commit e052988

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

trantor/net/InetAddress.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,19 @@ std::string InetAddress::toIp() const
189189
char buf[64];
190190
if (addr_.sin_family == AF_INET)
191191
{
192+
#if defined _MSC_VER && _MSC_VER == 1900
193+
::inet_ntop(AF_INET, (PVOID)&addr_.sin_addr, buf, sizeof(buf));
194+
#else
192195
::inet_ntop(AF_INET, &addr_.sin_addr, buf, sizeof(buf));
196+
#endif
193197
}
194198
else if (addr_.sin_family == AF_INET6)
195199
{
200+
#if defined _MSC_VER && _MSC_VER == 1900
201+
::inet_ntop(AF_INET6, (PVOID)&addr6_.sin6_addr, buf, sizeof(buf));
202+
#else
196203
::inet_ntop(AF_INET6, &addr6_.sin6_addr, buf, sizeof(buf));
204+
#endif
197205
}
198206

199207
return buf;

0 commit comments

Comments
 (0)