mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 01:33:53 +00:00
Fixed build problems on Msys2
This commit is contained in:
parent
929c546f17
commit
0968d71c96
15
httplib.h
15
httplib.h
@ -16,18 +16,16 @@
|
|||||||
#define _CRT_NONSTDC_NO_DEPRECATE
|
#define _CRT_NONSTDC_NO_DEPRECATE
|
||||||
#endif //_CRT_NONSTDC_NO_DEPRECATE
|
#endif //_CRT_NONSTDC_NO_DEPRECATE
|
||||||
|
|
||||||
#ifndef SO_SYNCHRONOUS_NONALERT
|
#if (_MSC_VER && _MSC_VER < 1900)
|
||||||
#define SO_SYNCHRONOUS_NONALERT 0x20
|
|
||||||
#endif
|
|
||||||
#ifndef SO_OPENTYPE
|
|
||||||
#define SO_OPENTYPE 0x7008
|
|
||||||
#endif
|
|
||||||
#if (_MSC_VER < 1900)
|
|
||||||
#define snprintf _snprintf_s
|
#define snprintf _snprintf_s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef S_ISREG
|
||||||
#define S_ISREG(m) (((m)&S_IFREG)==S_IFREG)
|
#define S_ISREG(m) (((m)&S_IFREG)==S_IFREG)
|
||||||
|
#endif
|
||||||
|
#ifndef S_ISDIR
|
||||||
#define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)
|
#define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
@ -394,6 +392,9 @@ template <typename Fn>
|
|||||||
socket_t create_socket(const char* host, int port, Fn fn, int socket_flags = 0)
|
socket_t create_socket(const char* host, int port, Fn fn, int socket_flags = 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#define SO_SYNCHRONOUS_NONALERT 0x20
|
||||||
|
#define SO_OPENTYPE 0x7008
|
||||||
|
|
||||||
int opt = SO_SYNCHRONOUS_NONALERT;
|
int opt = SO_SYNCHRONOUS_NONALERT;
|
||||||
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char*)&opt, sizeof(opt));
|
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char*)&opt, sizeof(opt));
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user