]> git.sesse.net Git - vlc/blob - include/vlc_fixups.h
Fix win32 warning
[vlc] / include / vlc_fixups.h
1 /*****************************************************************************
2  * fixups.h: portability fixups included from config.h
3  *****************************************************************************
4  * Copyright © 1998-2007 the VideoLAN project
5  * $Id$
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20  *****************************************************************************/
21
22 /**
23  * \file
24  * This file is a collection of portability fixes
25  */
26
27 #ifndef LIBVLC_FIXUPS_H
28 # define LIBVLC_FIXUPS_H 1
29
30 #ifndef HAVE_STRDUP
31 # define strdup vlc_strdup
32 #endif
33
34 #ifndef HAVE_VASPRINTF
35 # define vasprintf vlc_vasprintf
36 #endif
37
38 #ifndef HAVE_ASPRINTF
39 # define asprintf vlc_asprintf
40 #endif
41
42 #ifndef HAVE_STRNDUP
43 # define strndup vlc_strndup
44 #endif
45
46 #ifndef HAVE_STRNLEN
47 # define strnlen vlc_strnlen
48 #endif
49
50 #ifndef HAVE_STRLCPY
51 # define strlcpy vlc_strlcpy
52 #endif
53
54 #ifndef HAVE_ATOF
55 # define atof vlc_atof
56 #endif
57
58 #ifndef HAVE_STRTOF
59 # ifdef HAVE_STRTOD
60 #  define strtof( a, b ) ((float)strtod (a, b))
61 # endif
62 #endif
63
64 #ifndef HAVE_ATOLL
65 # define atoll vlc_atoll
66 #endif
67
68 #ifndef HAVE_STRTOLL
69 # define strtoll vlc_strtoll
70 #endif
71
72 #ifndef HAVE_LLDIV
73 # define lldiv vlc_lldiv
74 #endif
75
76 #ifndef HAVE_SCANDIR
77 # define scandir vlc_scandir
78 # define alphasort vlc_alphasort
79 #endif
80
81 #ifndef HAVE_GETENV
82 # define getenv vlc_getenv
83 #endif
84
85 #ifndef HAVE_STRCASECMP
86 # ifndef HAVE_STRICMP
87 #  define strcasecmp vlc_strcasecmp
88 # else
89 #  define strcasecmp stricmp
90 # endif
91 #endif
92
93 #ifndef HAVE_STRNCASECMP
94 # ifndef HAVE_STRNICMP
95 #  define strncasecmp vlc_strncasecmp
96 # else
97 #  define strncasecmp strnicmp
98 # endif
99 #endif
100
101 #ifndef HAVE_STRCASESTR
102 # ifndef HAVE_STRISTR
103 #  define strcasestr vlc_strcasestr
104 # else
105 #  define strcasestr stristr
106 # endif
107 #endif
108
109 #ifndef HAVE_LOCALTIME_R
110 /* If localtime_r() is not provided, we assume localtime() uses
111  * thread-specific storage. */
112 # include <time.h>
113 static inline struct tm *localtime_r (const time_t *timep, struct tm *result)
114 {
115     struct tm *s = localtime (timep);
116     if (s == NULL)
117         return NULL;
118
119     *result = *s;
120     return result;
121 }
122 #endif
123
124 #endif /* !LIBVLC_FIXUPS_H */