Commit c39a7125 authored by Sergey Lyubka's avatar Sergey Lyubka

Win32 build fix

parent e9f6111b
...@@ -948,7 +948,9 @@ void ns_server_free(struct ns_server *s) { ...@@ -948,7 +948,9 @@ void ns_server_free(struct ns_server *s) {
#include <ctype.h> #include <ctype.h>
#ifdef _WIN32 #ifdef _WIN32 //////////////// Windows specific defines and includes
#include <io.h> // For _lseeki64
#include <direct.h> // For _mkdir
#ifndef S_ISDIR #ifndef S_ISDIR
#define S_ISDIR(x) ((x) & _S_IFDIR) #define S_ISDIR(x) ((x) & _S_IFDIR)
#endif #endif
...@@ -964,15 +966,22 @@ void ns_server_free(struct ns_server *s) { ...@@ -964,15 +966,22 @@ void ns_server_free(struct ns_server *s) {
#define STR(x) STRX(x) #define STR(x) STRX(x)
#define __func__ __FILE__ ":" STR(__LINE__) #define __func__ __FILE__ ":" STR(__LINE__)
#endif #endif
#define INT64_FMT "I64d"
#define stat(x, y) mg_stat((x), (y))
#define fopen(x, y) mg_fopen((x), (y))
#define open(x, y) mg_open((x), (y))
#define flockfile(x) ((void) (x))
#define funlockfile(x) ((void) (x))
typedef struct _stati64 file_stat_t; typedef struct _stati64 file_stat_t;
#else typedef HANDLE pid_t;
#else ////////////// UNIX specific defines and includes
#include <dirent.h> #include <dirent.h>
#include <inttypes.h> #include <inttypes.h>
#include <pwd.h> #include <pwd.h>
#define O_BINARY 0 #define O_BINARY 0
#define INT64_FMT PRId64 #define INT64_FMT PRId64
typedef struct stat file_stat_t; typedef struct stat file_stat_t;
#endif #endif //////// End of platform-specific defines and includes
#include "mongoose.h" #include "mongoose.h"
...@@ -1622,7 +1631,7 @@ static pid_t start_process(char *interp, const char *cmd, const char *env, ...@@ -1622,7 +1631,7 @@ static pid_t start_process(char *interp, const char *cmd, const char *env,
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
CloseHandle(pi.hProcess); CloseHandle(pi.hProcess);
return pi.hProcess; return (pid_t) pi.hProcess;
} }
#else #else
static pid_t start_process(const char *interp, const char *cmd, const char *env, static pid_t start_process(const char *interp, const char *cmd, const char *env,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment