mirror of
https://github.com/Kiritow/GSock.git
synced 2024-03-22 13:10:51 +08:00
Fix compile error in Codeblocks.
The compile error might be caused by different typedef of PVOID.
This commit is contained in:
parent
8b58c30b07
commit
2a740e924c
11
gsock.cpp
11
gsock.cpp
|
@ -7,6 +7,11 @@
|
|||
|
||||
#include "gsock.h"
|
||||
|
||||
// C++ version check
|
||||
#if __cplusplus<201103L
|
||||
#error "GSock requires at least C++11 to compile."
|
||||
#endif
|
||||
|
||||
#ifdef GSOCK_DEBUG
|
||||
#pragma message("GSock Debug mode compiled in")
|
||||
#include <cstdio>
|
||||
|
@ -1355,7 +1360,8 @@ static int convertback_ipv46(const sockaddr* paddr, std::string& _out_IPStr)
|
|||
char buff[128] = { 0 };
|
||||
if (paddr->sa_family == AF_INET)
|
||||
{
|
||||
if (inet_ntop(AF_INET, &(((const sockaddr_in*)paddr)->sin_addr), buff, 128)!=NULL)
|
||||
// Change to non-const pointer to avoid compile error in Codeblocks.
|
||||
if (inet_ntop(AF_INET, (void*)&(((const sockaddr_in*)paddr)->sin_addr), buff, 128)!=NULL)
|
||||
{
|
||||
_out_IPStr = std::move(std::string(buff));
|
||||
return 0;
|
||||
|
@ -1364,7 +1370,8 @@ static int convertback_ipv46(const sockaddr* paddr, std::string& _out_IPStr)
|
|||
}
|
||||
else if (paddr->sa_family == AF_INET6)
|
||||
{
|
||||
if (inet_ntop(AF_INET6, &(((const sockaddr_in6*)paddr)->sin6_addr), buff, 128) != NULL)
|
||||
// Change to non-const pointer to avoid compile error in Codeblocks.
|
||||
if (inet_ntop(AF_INET6, (void*)&(((const sockaddr_in6*)paddr)->sin6_addr), buff, 128) != NULL)
|
||||
{
|
||||
_out_IPStr = std::move(std::string(buff));
|
||||
return 1;
|
||||
|
|
|
@ -6,9 +6,15 @@
|
|||
#include "gsock_helper.h"
|
||||
#include <cstring>
|
||||
|
||||
// C++ version check
|
||||
#if __cplusplus<201103L
|
||||
#error "GSock requires at least C++11 to compile."
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
/// Using Win8.1
|
||||
#define _WIN32_WINNT 0x0603
|
||||
// See gsock.cpp for more information on _WIN32_WINNT.
|
||||
// Using Win10 by default.
|
||||
#define _WIN32_WINNT 0x0A00
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#ifdef _MSC_VER
|
||||
|
|
Loading…
Reference in New Issue
Block a user