vlc_fixups.h 4.11 KB
Newer Older
1 2 3
/*****************************************************************************
 * fixups.h: portability fixups included from config.h
 *****************************************************************************
4
 * Copyright © 1998-2008 the VideoLAN project
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

/**
 * \file
 * This file is a collection of portability fixes
 */

26 27 28
#ifndef LIBVLC_FIXUPS_H
# define LIBVLC_FIXUPS_H 1

29 30 31 32 33 34 35 36 37 38 39 40 41
#ifdef __MINGW32_VERSION
# if __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 14
#  error This mingw-runtime is too old, it has a broken vsnprintf
# endif
/* mingw-runtime provides the whole printf family in a c99 compliant way. */
/* the way to enable this is to define __USE_MINGW_ANSI_STDIO, or something
 * such as _ISOC99_SOURCE; the former is done by configure.ac */
/* This isn't done here, since some modules don't include config.h and
 * therefore this as the first include file */
#elif defined UNDER_CE
# error Window CE support for *printf needs fixing.
#endif

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
42
#ifndef HAVE_STRDUP
43
char *strdup (const char *);
44 45 46
#endif

#ifndef HAVE_VASPRINTF
47
# include <stdarg.h>
48
int vasprintf (char **, const char *, va_list);
49 50 51
#endif

#ifndef HAVE_ASPRINTF
52
int asprintf (char **, const char *, ...);
53 54
#endif

55
#ifndef HAVE_STRNLEN
56 57
# include <stddef.h>
size_t strnlen (const char *, size_t);
58 59
#endif

60
#ifndef HAVE_STRNDUP
61 62
# include <stddef.h>
char *strndup (const char *, size_t);
63 64 65
#endif

#ifndef HAVE_STRLCPY
66 67
# include <stddef.h>
size_t strlcpy (char *, const char *, size_t);
68 69 70
#endif

#ifndef HAVE_STRTOF
71
float strtof (const char *, char **);
72 73
#endif

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
74
#ifndef HAVE_ATOF
75
double atof (const char *);
76 77 78
#endif

#ifndef HAVE_STRTOLL
79
long long int strtoll (const char *, char **, int);
80 81
#endif

82
#ifndef HAVE_STRSEP
83
char *strsep (char **, const char *);
84 85
#endif

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
86
#ifndef HAVE_ATOLL
87
long long atoll (const char *);
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
88 89
#endif

90
#ifndef HAVE_LLDIV
91 92 93 94 95
typedef struct {
    long long quot; /* Quotient. */
    long long rem;  /* Remainder. */
} lldiv_t;

96
lldiv_t lldiv (long long, long long);
97 98 99
#endif

#ifndef HAVE_GETENV
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
100
static inline char *getenv (const char *name)
101 102 103 104
{
    (void)name;
    return NULL;
}
105 106 107
#endif

#ifndef HAVE_STRCASECMP
108
int strcasecmp (const char *, const char *);
109 110 111
#endif

#ifndef HAVE_STRNCASECMP
112
int strncasecmp (const char *, const char *, size_t);
113 114 115
#endif

#ifndef HAVE_STRCASESTR
116
char *strcasestr (const char *, const char *
117 118
#endif

119
#ifndef HAVE_GMTIME_R
120
# include <time.h>
121 122
struct tm *gmtime_r (const time_t *, struct tm *);
#endif
123

124 125 126 127
#ifndef HAVE_LOCALTIME_R
# include <time.h>
struct tm *localtime_r (const time_t *, struct tm *);
#endif
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
128

129 130 131
#ifndef HAVE_REWIND
# include <stdio.h>
void rewind (FILE *);
132 133
#endif

134 135 136 137 138 139 140
/* Alignment of critical static data structures */
#ifdef ATTRIBUTE_ALIGNED_MAX
#   define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
#else
#   define ATTR_ALIGN(align)
#endif

141 142 143 144 145 146 147
#ifndef HAVE_USELOCALE
typedef void *locale_t;
# define newlocale( a, b, c ) ((locale_t)0)
# define uselocale( a ) ((locale_t)0)
# define freelocale( a ) (void)0
#endif

148
#ifdef WIN32
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
149
# include <dirent.h>
150 151 152 153 154
# define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
# define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
# define closedir vlc_wclosedir
#endif

155
/* libintl support */
156
#define _(str) vlc_gettext (str)
157 158 159 160 161 162 163 164

#if defined (ENABLE_NLS)
# include <libintl.h>
#endif

#define N_(str) gettext_noop (str)
#define gettext_noop(str) (str)

165
#endif /* !LIBVLC_FIXUPS_H */