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
29 #ifdef __MINGW32_VERSION
30 # if __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 14
31 # error This mingw-runtime is too old, it has a broken vsnprintf
33 /* mingw-runtime provides the whole printf family in a c99 compliant way. */
34 /* the way to enable this is to define __USE_MINGW_ANSI_STDIO, or something
35 * such as _ISOC99_SOURCE; the former is done by configure.ac */
36 /* This isn't done here, since some modules don't include config.h and
37 * therefore this as the first include file */
38 #elif defined UNDER_CE
39 # error Window CE support for *printf needs fixing.
42 #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R)
43 # include <time.h> /* time_t */
49 long long quot; /* Quotient. */
50 long long rem; /* Remainder. */
55 # include <stdio.h> /* FILE */
58 #if !defined (HAVE_STRLCPY) || \
59 !defined (HAVE_STRNDUP) || \
60 !defined (HAVE_STRNLEN)
61 # include <stddef.h> /* size_t */
64 #ifndef HAVE_VASPRINTF
65 # include <stdarg.h> /* va_list */
73 char *strdup (const char *);
76 #ifndef HAVE_VASPRINTF
77 int vasprintf (char **, const char *, va_list);
81 int asprintf (char **, const char *, ...);
85 size_t strnlen (const char *, size_t);
89 char *strndup (const char *, size_t);
93 size_t strlcpy (char *, const char *, size_t);
97 float strtof (const char *, char **);
101 double atof (const char *);
105 long long int strtoll (const char *, char **, int);
109 char *strsep (char **, const char *);
113 long long atoll (const char *);
117 lldiv_t lldiv (long long, long long);
120 #ifndef HAVE_STRCASECMP
121 int strcasecmp (const char *, const char *);
124 #ifndef HAVE_STRNCASECMP
125 int strncasecmp (const char *, const char *, size_t);
128 #ifndef HAVE_STRCASESTR
129 char *strcasestr (const char *, const char *);
132 #ifndef HAVE_GMTIME_R
133 struct tm *gmtime_r (const time_t *, struct tm *);
136 #ifndef HAVE_LOCALTIME_R
137 struct tm *localtime_r (const time_t *, struct tm *);
141 void rewind (FILE *);
149 static inline char *getenv (const char *name)
156 /* Alignment of critical static data structures */
157 #ifdef ATTRIBUTE_ALIGNED_MAX
158 # define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
160 # define ATTR_ALIGN(align)
163 #ifndef HAVE_USELOCALE
164 typedef void *locale_t;
165 # define newlocale( a, b, c ) ((locale_t)0)
166 # define uselocale( a ) ((locale_t)0)
167 # define freelocale( a ) (void)0
172 # define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
173 # define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
174 # define closedir vlc_wclosedir
177 /* libintl support */
178 #define _(str) gettext(str)
179 #define gettext(str) vlc_gettext (str)
180 #define pgettext(ctx,id) vlc_pgettext(ctx,id)
182 #if defined (ENABLE_NLS)
183 # include <libintl.h>
186 #define N_(str) gettext_noop (str)
187 #define gettext_noop(str) (str)
190 void swab (const void *, void *, ssize_t);
193 #endif /* !LIBVLC_FIXUPS_H */