libplatform/platform_win32.h Source File
platform_win32.h
1 #ifndef MP4V2_PLATFORM_WIN32_H
2 #define MP4V2_PLATFORM_WIN32_H
3 
5 
6 // mingw needs this to enable some newer 64-bit functions
7 #ifdef __MINGW32__
8 # undef __MSVCRT_VERSION__
9 # define __MSVCRT_VERSION__ 0x800
10 // JAN: see http://code.google.com/p/mp4v2/issues/detail?id=132
11 # define _USE_32BIT_TIME_T
12 #endif
13 
14 // set minimum win32 API requirement to Windows 2000 or higher
15 #ifndef _WIN32_WINNT
16 # define _WIN32_WINNT 0x0500
17 #endif
18 #ifndef WINVER
19 # define WINVER 0x0500
20 #endif
21 
23 
24 #include "libplatform/platform_base.h"
25 #include <mp4v2/mp4v2.h>
26 
28 
29 namespace mp4v2 { namespace platform {
30  using namespace std;
31 
32  using ::int8_t;
33  using ::int16_t;
34  using ::int32_t;
35  using ::int64_t;
36 
37  using ::uint8_t;
38  using ::uint16_t;
39  using ::uint32_t;
40  using ::uint64_t;
41 }} // namespace mp4v2::platform
42 
44 
45 // fprintf macros for unsigned types - mingw32 is a good source if more needed
46 #define PRId8 "d"
47 #define PRId16 "d"
48 #define PRId32 "d"
49 #define PRId64 "I64d"
50 
51 #define PRIu8 "u"
52 #define PRIu16 "u"
53 #define PRIu32 "u"
54 #define PRIu64 "I64u"
55 
56 #define PRIx8 "x"
57 #define PRIx16 "x"
58 #define PRIx32 "x"
59 #define PRIx64 "I64x"
60 
62 
63 // If using Visual Studio 2010 or newer these aren't needed since stdint.h is available.
64 #if !(defined(_MSC_VER) && _MSC_VER >= 1600)
65 // some macros for constant expressions
66 #define INT8_C(x) x
67 #define INT16_C(x) x
68 #define INT32_C(x) x ## L
69 #define INT64_C(x) x ## LL
70 
71 #define UINT8_C(x) x
72 #define UINT16_C(x) x
73 #define UINT32_C(x) x ## UL
74 #define UINT64_C(x) x ## ULL
75 #endif
76 
78 
79 #ifdef min
80 # undef min
81 #endif
82 
83 #ifdef max
84 # undef max
85 #endif
86 
88 
89 #define snprintf(s,n,...) _snprintf(s,n,__VA_ARGS__)
90 #define strcasecmp(s1,s2) _stricmp(s1,s2)
91 #define strdup(s) _strdup(s)
92 
94 
95 // macro clashes with symbol
96 #undef LC_NONE
97 
98 #endif // MP4V2_PLATFORM_WIN32_H