CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
os-types.h
1#pragma once
2
3#if !defined(__WINDOWS__)
4#define __WINDOWS__
5#endif
6
7/* Enable LEAN_AND_MEAN support */
8#define WIN32_LEAN_AND_MEAN
9
10/* Don't define min() and max() to prevent a clash with std::min() and std::max */
11#ifndef NOMINMAX
12#define NOMINMAX
13#endif
14
15#ifndef __STDC_FORMAT_MACROS
16#define __STDC_FORMAT_MACROS
17#endif
18
19/* Disable warning C4005: '_WINSOCKAPI_' : macro redefinition */
20#pragma warning(disable:4005)
21#include <WinSock2.h>
22#pragma warning(default:4005)
23#include <Windows.h>
24#include <wchar.h>
25#include <time.h>
26#include <sys/timeb.h>
27#include <io.h>
28#include <stdlib.h>
29#include <errno.h>
30#include <stddef.h>
31#include <stdint.h>
32
33/* Prevent inclusion of wingdi.h */
34#define NOGDI
35
36#ifndef _SSIZE_T_DEFINED
37#if (defined(_WIN64) || defined(_M_ARM64))
38typedef __int64 ssize_t;
39#else
40typedef _W64 int ssize_t;
41#endif
42#define _SSIZE_T_DEFINED
43#endif
44
45#ifndef PATH_MAX
46#ifdef _MAX_PATH
47#define PATH_MAX _MAX_PATH
48#else
49#define PATH_MAX 256
50#endif
51#endif
52
53#ifndef PATH_SEPARATOR_CHAR
54#define PATH_SEPARATOR_CHAR '\\'
55#define PATH_SEPARATOR_STRING "\\"
56#endif
57
58#define INVALID_SOCKET_VALUE INVALID_SOCKET
59typedef SOCKET net_socket_t;
60
61__inline int usleep(unsigned int usec)
62{
63 Sleep((DWORD)(usec / 1000));
64 return 0;
65}
66
67__inline unsigned int sleep(unsigned int sec)
68{
69 Sleep((DWORD)(sec * 1000));
70 return 0;
71}
72
74{
75 int tz_minuteswest;
76 int tz_dsttime;
77};
78
79#if defined(_MSC_VER)
80
81#if (_MSC_VER < 1800)
82#include "msc_inttypes.h"
83#define atoll(S) _atoi64(S)
84#else
85#include <inttypes.h>
86#endif
87
88#if (_MSC_VER < 1900)
89#define snprintf _snprintf
90#endif
91
92#define strnicmp _strnicmp
93#define strncasecmp _strnicmp
94#define stricmp _stricmp
95#define strcasecmp _stricmp
96
97#else
98#include <inttypes.h>
99#endif /* _MSC_VER */