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 #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R)
30 # include <time.h> /* time_t */
36 long long quot; /* Quotient. */
37 long long rem; /* Remainder. */
42 # include <stdio.h> /* FILE */
45 #if !defined (HAVE_STRLCPY) || \
46 !defined (HAVE_STRNDUP) || \
47 !defined (HAVE_STRNLEN) || \
48 !defined (HAVE_GETCWD)
49 # include <stddef.h> /* size_t */
52 #ifndef HAVE_VASPRINTF
53 # include <stdarg.h> /* va_list */
57 # include <sys/types.h> /* pid_t */
65 char *strdup (const char *);
68 #ifndef HAVE_VASPRINTF
69 int vasprintf (char **, const char *, va_list);
73 int asprintf (char **, const char *, ...);
77 size_t strnlen (const char *, size_t);
81 char *strndup (const char *, size_t);
85 size_t strlcpy (char *, const char *, size_t);
89 float strtof (const char *, char **);
93 double atof (const char *);
97 long long int strtoll (const char *, char **, int);
101 char *strsep (char **, const char *);
105 long long atoll (const char *);
109 lldiv_t lldiv (long long, long long);
112 #ifndef HAVE_STRCASECMP
113 int strcasecmp (const char *, const char *);
116 #ifndef HAVE_STRNCASECMP
117 int strncasecmp (const char *, const char *, size_t);
120 #ifndef HAVE_STRCASESTR
121 char *strcasestr (const char *, const char *);
124 #ifndef HAVE_GMTIME_R
125 struct tm *gmtime_r (const time_t *, struct tm *);
128 #ifndef HAVE_LOCALTIME_R
129 struct tm *localtime_r (const time_t *, struct tm *);
133 void rewind (FILE *);
137 char *getcwd (char *buf, size_t size);
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 #define LC_NUMERIC_MASK 0
165 typedef void *locale_t;
166 static inline locale_t uselocale(locale_t loc)
171 static inline void freelocale(locale_t loc)
175 static inline locale_t newlocale(int mask, const char * locale, locale_t base)
177 (void)mask; (void)locale; (void)base;
184 # define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
185 # define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
186 # define closedir vlc_wclosedir
189 /* libintl support */
190 #define _(str) vlc_gettext (str)
191 #define N_(str) gettext_noop (str)
192 #define gettext_noop(str) (str)
195 void swab (const void *, void *, ssize_t);
198 #endif /* !LIBVLC_FIXUPS_H */