mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 17:41:52 +03:00
Updated included headers to support compilation on Windows (using Visual C++)
- most of posix related functions and constants in unistd.h can be found in io.h in Visual C++ - introduced src/compat/msvc.h to adjust for compiler differences (and avoid updating code with #ifdef blocks for Windows support) - removed some included headers that are not needed (both on Unix and Windows builds)
This commit is contained in:
22
src/compat/msvc.h
Normal file
22
src/compat/msvc.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef __COMPAT_MSVC
|
||||
#define __COMPAT_MSVC
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define strtok_r strtok_s
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
|
||||
inline tm* localtime_r(const time_t* tin, tm* tout) {
|
||||
if (!localtime_s(tout, tin)) return tout;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user