-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtypes.h
executable file
·298 lines (230 loc) · 4.95 KB
/
types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
/*
* Type and type-support defintions
*
* Copyright (c) 2006-2013, Joachim Metz <[email protected]>
*
* Refer to AUTHORS for acknowledgements.
*
* This software is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined( _TYPES_H )
#define _TYPES_H
#include "common.h"
#if defined( HAVE_LIMITS_H ) || defined( WINAPI )
#include <limits.h>
#endif
/* Make sure to include inttypes.h or stdint.h before
* PRI definitions are defined
*/
#include <libewf/types.h>
/* Fix for systems without PRI definitions
*/
#if !defined( PRId8 )
#define PRId8 "d"
#endif
#if !defined( PRId16 )
#define PRId16 "d"
#endif
#if !defined( PRId32 )
#if defined( WINAPI )
#define PRId32 "I32d"
#else
#define PRId32 "d"
#endif
#endif
#if !defined( PRId64 )
#if defined( WINAPI )
#define PRId64 "I64d"
#elif __WORDSIZE == 64
#define PRId64 "ld"
#else
#define PRId64 "lld"
#endif
#endif
#if !defined( PRIi8 )
#define PRIi8 "i"
#endif
#if !defined( PRIi16 )
#define PRIi16 "i"
#endif
#if !defined( PRIi32 )
#if defined( WINAPI )
#define PRIi32 "I32i"
#else
#define PRIi32 "i"
#endif
#endif
#if !defined( PRIi64 )
#if defined( WINAPI )
#define PRIi64 "I64i"
#elif __WORDSIZE == 64
#define PRIi64 "li"
#else
#define PRIi64 "lli"
#endif
#endif
#if !defined( PRIu8 )
#define PRIu8 "u"
#endif
#if !defined( PRIu16 )
#define PRIu16 "u"
#endif
#if !defined( PRIu32 )
#if defined( WINAPI )
#define PRIu32 "I32u"
#else
#define PRIu32 "u"
#endif
#endif
#if !defined( PRIu64 )
#if defined( WINAPI )
#define PRIu64 "I64u"
#elif __WORDSIZE == 64
#define PRIu64 "lu"
#else
#define PRIu64 "llu"
#endif
#endif
#if !defined( PRIx8 )
#define PRIx8 "x"
#endif
#if !defined( PRIx16 )
#define PRIx16 "x"
#endif
#if !defined( PRIx32 )
#if defined( WINAPI )
#define PRIx32 "I32x"
#else
#define PRIx32 "x"
#endif
#endif
#if !defined( PRIx64 )
#if defined( WINAPI )
#define PRIx64 "I64x"
#elif __WORDSIZE == 64
#define PRIx64 "lx"
#else
#define PRIx64 "llx"
#endif
#endif
/* Fix for systems without printf %jd definition
*/
#if defined( HAVE_PRINTF_JD )
#define PRIjd "jd"
#define PRIji "ji"
#define PRIju "ju"
#define PRIjx "jx"
#elif SIZEOF_OFF_T == 8
#define PRIjd PRId64
#define PRIji PRIi64
#define PRIju PRIu64
#define PRIjx PRIx64
#else
#define PRIjd PRId32
#define PRIji PRIi32
#define PRIju PRIu32
#define PRIjx PRIx32
#endif
/* Fix for systems without printf %zd definition
*/
#if defined( HAVE_PRINTF_ZD )
#define PRIzd "zd"
#define PRIzi "zi"
#define PRIzu "zu"
#define PRIzx "zx"
#elif defined( WINAPI )
#define PRIzd "Id"
#define PRIzi "Ii"
#define PRIzu "Iu"
#define PRIzx "Ix"
#elif SIZEOF_SIZE_T == 8
#define PRIzd PRId64
#define PRIzi PRIi64
#define PRIzu PRIu64
#define PRIzx PRIx64
#else
#define PRIzd PRId32
#define PRIzi PRIi32
#define PRIzu PRIu32
#define PRIzx PRIx32
#endif
/* Fix for systems without (U)INTx_MAX definitions
*/
/* The maximum signed 8-bit integer is 127 (0x7f)
*/
#if !defined( INT8_MAX )
#define INT8_MAX (0x7f)
#endif
/* The maximum unsigned 8-bit integer is 256 (0xff)
*/
#if !defined( UINT8_MAX )
#define UINT8_MAX (0xff)
#endif
/* The maximum signed 16-bit integer is 32767 (0xr7ffff)
*/
#if !defined( INT16_MAX )
#define INT16_MAX (0x7fff)
#endif
/* The maximum unsigned 16-bit integer is 65535 (0xffff)
*/
#if !defined( UINT16_MAX )
#define UINT16_MAX (0xffff)
#endif
/* The maximum signed 32-bit integer is 2147483647 (0x7fffffff)
*/
#if !defined( INT32_MAX )
#define INT32_MAX (0x7fffffffL)
#endif
/* The maximum unsigned 32-bit integer is 4294967295 (0xffffffff)
*/
#if !defined( UINT32_MAX )
#define UINT32_MAX (0xffffffffUL)
#endif
/* The maximum signed 64-bit integer is 9223372036854775807 (0x7fffffffffffffff)
*/
#if !defined( INT64_MAX )
#if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define INT64_MAX (0x7fffffffffffffffUL)
#else
#define INT64_MAX (0x7fffffffffffffffULL)
#endif
#endif
/* The maximum signed integer
*/
#if !defined( INT_MAX )
#define INT_MAX INT32_MAX
#endif
/* The maximum unsigned integer
*/
#if !defined( UINT_MAX )
#define UINT_MAX UINT32_MAX
#endif
/* The maximum signed size type is platform dependent
*/
#if !defined( SSIZE_MAX )
#if defined( WINAPI )
#if defined( _WIN64 )
#define SSIZE_MAX INT64_MAX
#else
#define SSIZE_MAX INT32_MAX
#endif /* _WIN64 */
#else
#if __WORDSIZE == 64
#define SSIZE_MAX INT64_MAX
#else
#define SSIZE_MAX INT32_MAX
#endif /* __WORDSIZE == 64 */
#endif /* WINAPI */
#endif /* SSIZE_MAX */
#endif