]>
Commit | Line | Data |
---|---|---|
d8f41ccd A |
1 | #ifndef MISBASE_H |
2 | #define MISBASE_H | |
3 | ||
4 | /* Define the decoration we use to indicate public functions */ | |
5 | #if defined(__GNUC__) | |
6 | #define MIS_EXPORT extern __attribute__((visibility ("default"))) | |
7 | #else | |
8 | #define MIS_EXPORT | |
9 | #endif | |
10 | ||
11 | /* Define ssize_t if needed */ | |
12 | #if defined(__WIN32__) | |
13 | typedef long ssize_t; | |
14 | #endif | |
15 | ||
16 | /* Maximum path length */ | |
17 | #if !defined(MAXPATHLEN) | |
18 | #if defined(__WIN32__) | |
19 | /* | |
20 | * On windows, we handle paths up to length MAX_PATH. However, | |
21 | * we convert paths into UTF8 in a number of places and since | |
22 | * each character in the path can map to up to 4 bytes in UTF8, | |
23 | * we need to account for that. | |
24 | */ | |
25 | #define MAXPATHLEN (MAX_PATH * 4) | |
26 | #else | |
27 | #define MAXPATHLEN 1024 | |
28 | #endif | |
29 | #endif | |
30 | ||
31 | /* | |
32 | * The crazy CF situation on Windows requires this macro so we can build | |
33 | * against either version | |
34 | * The version of CF used by iTunes uses the system encoding as the file | |
35 | * encoding. However we need paths to be UTF8 when we pass them into | |
36 | * various file system APIs so we use CFStringGetCString instead. I'm | |
37 | * told that the other CF does return UTF8 so if iTunes ever moves to | |
38 | * that we can switch back to CFStringGetFileSystemRepresentation (5513199) | |
39 | */ | |
40 | #if defined(__WIN32__) | |
41 | #define CFStringGetFileSystemRepresentation(str, buf, len) CFStringGetCString(str, buf, len, kCFStringEncodingUTF8) | |
42 | #endif | |
43 | ||
44 | #endif |