1 /*****************************************************************************
2 * fixups.h: portability fixups included from config.h
3 *****************************************************************************
4 * Copyright © 1998-2008 the VideoLAN project
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
23 * This file is a collection of portability fixes
26 #ifndef LIBVLC_FIXUPS_H
27 # define LIBVLC_FIXUPS_H 1
30 # define strdup vlc_strdup
33 #ifndef HAVE_VASPRINTF
34 # define vasprintf vlc_vasprintf
38 # define asprintf vlc_asprintf
42 # define strndup vlc_strndup
46 # define strnlen vlc_strnlen
50 # define strlcpy vlc_strlcpy
54 # define atof vlc_atof
59 # define strtof( a, b ) ((float)strtod (a, b))
64 # define atoll vlc_atoll
68 # define strtoll vlc_strtoll
72 # define lldiv vlc_lldiv
76 # define scandir vlc_scandir
77 # define alphasort vlc_alphasort
81 # define getenv vlc_getenv
84 #ifndef HAVE_STRCASECMP
86 # define strcasecmp vlc_strcasecmp
88 # define strcasecmp stricmp
92 #ifndef HAVE_STRNCASECMP
93 # ifndef HAVE_STRNICMP
94 # define strncasecmp vlc_strncasecmp
96 # define strncasecmp strnicmp
100 #ifndef HAVE_STRCASESTR
101 # ifndef HAVE_STRISTR
102 # define strcasestr vlc_strcasestr
104 # define strcasestr stristr
108 #ifndef HAVE_LOCALTIME_R
109 /* If localtime_r() is not provided, we assume localtime() uses
110 * thread-specific storage. */
112 static inline struct tm *localtime_r (const time_t *timep, struct tm *result)
114 struct tm *s = localtime (timep);
121 static inline struct tm *gmtime_r (const time_t *timep, struct tm *result)
123 struct tm *s = gmtime (timep);
132 #ifndef HAVE_USELOCALE
133 typedef void *locale_t;
134 # define newlocale( a, b, c ) ((locale_t)0)
135 # define uselocale( a ) ((locale_t)0)
136 # define freelocale( a ) (void)0
140 # define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
141 # define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
142 # define closedir vlc_wclosedir
145 /* libintl support */
146 #define _(str) vlc_gettext (str)
148 #if defined (ENABLE_NLS)
149 # include <libintl.h>
151 # define dgettext(dom, str) ((char *)(str))
154 #define N_(str) gettext_noop (str)
155 #define gettext_noop(str) (str)
157 #endif /* !LIBVLC_FIXUPS_H */