Merge pull request #4324 from FernetMenta/wasapi
[vuplus_xbmc] / lib / UnrarXLib / os.hpp
1 #ifndef _RAR_OS_
2 #define _RAR_OS_
3
4 #ifdef TARGET_WINDOWS
5 #include <windows.h>
6 #endif
7
8 #define FALSE 0
9 #define TRUE  1
10
11 #ifdef __EMX__
12   #define INCL_BASE
13 #endif
14
15 #if defined(_WIN_32) || defined(_EMX)
16 #define ENABLE_BAD_ALLOC
17 #endif
18
19
20 #if defined(_WIN_32) || defined(_EMX)
21
22 #define LITTLE_ENDIAN
23 #define NM  1024
24
25 #ifdef _WIN_32
26
27 //#define STRICT
28 //#define WINVER 0x0400
29 #if _WIN32_WINNT < 0x0300
30 #undef _WIN32_WINNT
31 #define _WIN32_WINNT 0x0300
32 #endif
33
34 #ifndef XBMC
35 #define WIN32_LEAN_AND_MEAN
36 #endif
37
38
39 #include "system.h"
40 #include <prsht.h>
41 #if defined(TARGET_POSIX)
42 #include "PlatformDefs.h"
43 #endif
44
45 #endif
46
47 #ifndef _WIN_CE
48 #include <sys/types.h>
49 #include <sys/stat.h>
50 #include <dos.h>
51 #endif
52
53 #if !defined(_EMX) && !defined(_MSC_VER) && !defined(_WIN_CE)
54   #define ENABLE_MKTEMP
55   #include <dir.h>
56 #endif
57 #ifdef _MSC_VER
58 //  #define for if (0) ; else for
59 #ifndef _WIN_CE
60   #include <direct.h>
61 #endif
62 #else
63   #include <dirent.h>
64 #endif
65
66 #ifndef _WIN_CE
67 #include <share.h>
68 #endif
69
70 #if defined(ENABLE_BAD_ALLOC) && !defined(_WIN_CE)
71   #include <new.h>
72 #endif
73
74 #ifdef _EMX
75   #include <unistd.h>
76   #include <pwd.h>
77   #include <grp.h>
78   #include <errno.h>
79   #ifdef _DJGPP
80     #include <utime.h>
81   #else
82     #include <os2.h>
83     #include <sys/utime.h>
84     #include <emx/syscalls.h>
85   #endif
86 #else
87   #if defined(_MSC_VER) || defined(__MINGW32__)
88       #include <exception>
89   #else
90     #include <except.h>
91   #endif
92 #endif
93
94 #include <stdio.h>
95 #include <stdlib.h>
96 #include <stdarg.h>
97 #include <string.h>
98 #include <ctype.h>
99 #ifndef _WIN_CE
100   #include <fcntl.h>
101   #include <dos.h>
102   #include <io.h>
103   #include <time.h>
104   #include <signal.h>
105 #endif
106
107 /*
108 #ifdef _WIN_32
109 #pragma hdrstop
110 #endif
111 */
112
113 #define ENABLE_ACCESS
114
115 #define DefConfigName  "rar.ini"
116 #define DefLogName     "rar.log"
117
118
119 #define PATHDIVIDER  "\\"
120 #define PATHDIVIDERW L"\\"
121 #define CPATHDIVIDER '\\'
122 #define MASKALL      "*"
123 #define MASKALLW     L"*"
124
125 #define READBINARY   "rb"
126 #define READTEXT     "rt"
127 #define UPDATEBINARY "r+b"
128 #define CREATEBINARY "w+b"
129 #define APPENDTEXT   "at"
130
131 #if defined(_WIN_32)
132   #ifdef _MSC_VER
133     #define _stdfunction __cdecl
134   #else
135     #define _stdfunction _USERENTRY
136   #endif
137 #else
138   #define _stdfunction
139 #endif
140
141 #endif
142
143 #ifdef _UNIX
144
145 #define  NM  1024
146
147 #ifdef _BEOS
148 #include <be/kernel/fs_info.h>
149 #include <be/kernel/fs_attr.h>
150 #endif
151
152 #include <unistd.h>
153 #include <sys/types.h>
154 #include <sys/stat.h>
155 #include <sys/file.h>
156 #if defined(__QNXNTO__)
157   #include <sys/param.h>
158 #endif
159 #if defined(__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined(__APPLE__)
160   #include <sys/param.h>
161   #include <sys/mount.h>
162 #else
163 #endif
164 #include <pwd.h>
165 #include <grp.h>
166 #include <stdio.h>
167 #include <stdlib.h>
168 #include <stdarg.h>
169 #include <string.h>
170 #include <ctype.h>
171 #include <fcntl.h>
172 #include <errno.h>
173 #include <dirent.h>
174 #include <time.h>
175 #include <signal.h>
176 #include <utime.h>
177 #include <locale.h>
178
179 #ifdef  S_IFLNK
180 #define SAVE_LINKS
181 #endif
182
183 #define ENABLE_ACCESS
184
185 #define DefConfigName  ".rarrc"
186 #define DefLogName     ".rarlog"
187
188
189 #define PATHDIVIDER  "/"
190 #define PATHDIVIDERW L"/"
191 #define CPATHDIVIDER '/'
192 #define MASKALL      "*"
193 #define MASKALLW     L"*"
194
195 #define READBINARY   "r"
196 #define READTEXT     "r"
197 #define UPDATEBINARY "r+"
198 #define CREATEBINARY "w+"
199 #define APPENDTEXT   "a"
200
201 #define _stdfunction 
202
203 #if defined(__sparc) || defined(sparc) || defined(__hpux)
204   #ifndef BIG_ENDIAN
205      #define BIG_ENDIAN
206   #endif
207 #endif
208
209 #endif
210
211 typedef const char* MSGID;
212
213 #define safebuf static
214
215 #if defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
216   #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
217     #undef LITTLE_ENDIAN
218   #elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
219     #undef BIG_ENDIAN
220   #else
221     #error "Both LITTLE_ENDIAN and BIG_ENDIAN are defined. Undef something one"
222   #endif
223 #endif
224
225 #if !defined(BIG_ENDIAN) && !defined(_WIN_CE) && defined(_WIN_32)
226 #define ALLOW_NOT_ALIGNED_INT
227 #endif
228
229 #endif // _RAR_OS_