2020-12-05 19:26:32 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#if MG_ARCH == MG_ARCH_WIN32
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER < 1700
|
|
|
|
#define __func__ ""
|
|
|
|
typedef __int64 int64_t;
|
|
|
|
typedef unsigned __int64 uint64_t;
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
typedef int bool;
|
|
|
|
enum { false = 0, true = 1 };
|
|
|
|
#else
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2020-12-22 17:44:59 +08:00
|
|
|
#include <ws2tcpip.h>
|
2020-12-05 19:26:32 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <winsock2.h>
|
2020-12-24 05:05:46 +08:00
|
|
|
|
|
|
|
// Protect from calls like std::snprintf in app code
|
|
|
|
// See https://github.com/cesanta/mongoose/issues/1047
|
|
|
|
#ifndef __cplusplus
|
2020-12-05 19:26:32 +08:00
|
|
|
#define snprintf _snprintf
|
|
|
|
#define vsnprintf _vsnprintf
|
|
|
|
#define strdup(x) _strdup(x)
|
2020-12-24 05:05:46 +08:00
|
|
|
#endif
|
|
|
|
|
2020-12-05 19:26:32 +08:00
|
|
|
typedef int socklen_t;
|
|
|
|
#define PATH_MAX MAX_PATH
|
|
|
|
#define MG_DIRSEP '\\'
|
|
|
|
#ifndef EINPROGRESS
|
|
|
|
#define EINPROGRESS WSAEINPROGRESS
|
|
|
|
#endif
|
|
|
|
#ifndef EWOULDBLOCK
|
|
|
|
#define EWOULDBLOCK WSAEWOULDBLOCK
|
|
|
|
#endif
|
|
|
|
#define realpath(a, b) _fullpath((b), (a), 512)
|
|
|
|
#ifndef va_copy
|
|
|
|
#ifdef __va_copy
|
|
|
|
#define va_copy __va_copy
|
|
|
|
#else
|
|
|
|
#define va_copy(x, y) (x) = (y)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef S_ISDIR
|
|
|
|
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|