00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef LIBVLC_FIXUPS_H
00027 # define LIBVLC_FIXUPS_H 1
00028
00029 #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R)
00030 # include <time.h>
00031 #endif
00032
00033 #ifndef HAVE_LLDIV
00034 typedef struct
00035 {
00036 long long quot;
00037 long long rem;
00038 } lldiv_t;
00039 #endif
00040
00041 #if !defined(HAVE_GETENV) || \
00042 !defined(HAVE_USELOCALE)
00043 # include <stddef.h>
00044 #endif
00045
00046 #if !defined (HAVE_REWIND) || \
00047 !defined (HAVE_GETDELIM)
00048 # include <stdio.h>
00049 #endif
00050
00051 #if !defined (HAVE_POSIX_MEMALIGN) || \
00052 !defined (HAVE_STRLCPY) || \
00053 !defined (HAVE_STRNDUP) || \
00054 !defined (HAVE_STRNLEN)
00055 # include <stddef.h>
00056 #endif
00057
00058 #ifndef HAVE_VASPRINTF
00059 # include <stdarg.h>
00060 #endif
00061
00062 #if !defined (HAVE_GETDELIM) || \
00063 !defined (HAVE_GETPID) || \
00064 !defined (HAVE_SWAB)
00065 # include <sys/types.h>
00066 #endif
00067
00068 #if !defined (HAVE_DIRFD) || \
00069 !defined (HAVE_FDOPENDIR)
00070 # include <dirent.h>
00071 #endif
00072
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00076
00077
00078 #ifndef HAVE_ASPRINTF
00079 int asprintf (char **, const char *, ...);
00080 #endif
00081
00082 #ifndef HAVE_FLOCKFILE
00083 void flockfile (FILE *);
00084 int ftrylockfile (FILE *);
00085 void funlockfile (FILE *);
00086 int getc_unlocked (FILE *);
00087 int getchar_unlocked (void);
00088 int putc_unlocked (int, FILE *);
00089 int putchar_unlocked (int);
00090 #endif
00091
00092 #ifndef HAVE_GETDELIM
00093 ssize_t getdelim (char **, size_t *, int, FILE *);
00094 ssize_t getline (char **, size_t *, FILE *);
00095 #endif
00096
00097 #ifndef HAVE_REWIND
00098 void rewind (FILE *);
00099 #endif
00100
00101 #ifndef HAVE_VASPRINTF
00102 int vasprintf (char **, const char *, va_list);
00103 #endif
00104
00105
00106 #ifndef HAVE_STRCASECMP
00107 int strcasecmp (const char *, const char *);
00108 #endif
00109
00110 #ifndef HAVE_STRCASESTR
00111 char *strcasestr (const char *, const char *);
00112 #endif
00113
00114 #ifndef HAVE_STRDUP
00115 char *strdup (const char *);
00116 #endif
00117
00118 #ifndef HAVE_STRNCASECMP
00119 int strncasecmp (const char *, const char *, size_t);
00120 #endif
00121
00122 #ifndef HAVE_STRVERSCMP
00123 int strverscmp (const char *, const char *);
00124 #endif
00125
00126 #ifndef HAVE_STRNLEN
00127 size_t strnlen (const char *, size_t);
00128 #endif
00129
00130 #ifndef HAVE_STRNDUP
00131 char *strndup (const char *, size_t);
00132 #endif
00133
00134 #ifndef HAVE_STRLCPY
00135 size_t strlcpy (char *, const char *, size_t);
00136 #endif
00137
00138 #ifndef HAVE_STRSEP
00139 char *strsep (char **, const char *);
00140 #endif
00141
00142 #ifndef HAVE_STRTOK_R
00143 char *strtok_r(char *, const char *, char **);
00144 #endif
00145
00146
00147 #ifndef HAVE_ATOF
00148 #ifndef __ANDROID__
00149 double atof (const char *);
00150 #endif
00151 #endif
00152
00153 #ifndef HAVE_ATOLL
00154 long long atoll (const char *);
00155 #endif
00156
00157 #ifndef HAVE_LLDIV
00158 lldiv_t lldiv (long long, long long);
00159 #endif
00160
00161 #ifndef HAVE_STRTOF
00162 #ifndef __ANDROID__
00163 float strtof (const char *, char **);
00164 #endif
00165 #endif
00166
00167 #ifndef HAVE_STRTOLL
00168 long long int strtoll (const char *, char **, int);
00169 #endif
00170
00171
00172 #ifndef HAVE_GMTIME_R
00173 struct tm *gmtime_r (const time_t *, struct tm *);
00174 #endif
00175
00176 #ifndef HAVE_LOCALTIME_R
00177 struct tm *localtime_r (const time_t *, struct tm *);
00178 #endif
00179
00180
00181 #ifndef HAVE_GETPID
00182 pid_t getpid (void);
00183 #endif
00184
00185 #ifndef HAVE_FSYNC
00186 int fsync (int fd);
00187 #endif
00188
00189
00190 #ifndef HAVE_DIRFD
00191 int (dirfd) (DIR *);
00192 #endif
00193
00194 #ifndef HAVE_FDOPENDIR
00195 DIR *fdopendir (int);
00196 #endif
00197
00198 #ifdef __cplusplus
00199 }
00200 #endif
00201
00202
00203 #ifndef HAVE_GETENV
00204 static inline char *getenv (const char *name)
00205 {
00206 (void)name;
00207 return NULL;
00208 }
00209 #endif
00210
00211 #ifndef HAVE_SETENV
00212 int setenv (const char *, const char *, int);
00213 int unsetenv (const char *);
00214 #endif
00215
00216 #ifndef HAVE_POSIX_MEMALIGN
00217 int posix_memalign (void **, size_t, size_t);
00218 #endif
00219
00220
00221 #ifndef HAVE_USELOCALE
00222 #define LC_NUMERIC_MASK 0
00223 #define LC_MESSAGES_MASK 0
00224 typedef void *locale_t;
00225 static inline locale_t uselocale(locale_t loc)
00226 {
00227 (void)loc;
00228 return NULL;
00229 }
00230 static inline void freelocale(locale_t loc)
00231 {
00232 (void)loc;
00233 }
00234 static inline locale_t newlocale(int mask, const char * locale, locale_t base)
00235 {
00236 (void)mask; (void)locale; (void)base;
00237 return NULL;
00238 }
00239 #endif
00240
00241 #if !defined (HAVE_STATIC_ASSERT)
00242 # define _Static_assert(x, s) ((void) sizeof (struct { unsigned:-!(x); }))
00243 # define static_assert _Static_assert
00244 #endif
00245
00246
00247 #ifdef ATTRIBUTE_ALIGNED_MAX
00248 # define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
00249 #else
00250 # define ATTR_ALIGN(align)
00251 #endif
00252
00253
00254 #define _(str) vlc_gettext (str)
00255 #define N_(str) gettext_noop (str)
00256 #define gettext_noop(str) (str)
00257
00258 #ifndef HAVE_SWAB
00259 void swab (const void *, void *, ssize_t);
00260 #endif
00261
00262
00263 #ifndef HAVE_INET_PTON
00264 int inet_pton(int, const char *, void *);
00265 const char *inet_ntop(int, const void *, char *, int);
00266 #endif
00267
00268 #ifndef HAVE_STRUCT_POLLFD
00269 enum
00270 {
00271 POLLIN=1,
00272 POLLOUT=2,
00273 POLLPRI=4,
00274 POLLERR=8,
00275 POLLHUP=16,
00276 POLLNVAL=32
00277 };
00278
00279 struct pollfd
00280 {
00281 int fd;
00282 unsigned events;
00283 unsigned revents;
00284 };
00285 #endif
00286 #ifndef HAVE_POLL
00287 struct pollfd;
00288 int poll (struct pollfd *, unsigned, int);
00289 #endif
00290
00291 #ifndef HAVE_IF_NAMEINDEX
00292 #include <errno.h>
00293 struct if_nameindex
00294 {
00295 unsigned if_index;
00296 char *if_name;
00297 };
00298 # ifndef HAVE_IF_NAMETOINDEX
00299 # define if_nametoindex(name) atoi(name)
00300 # endif
00301 # define if_nameindex() (errno = ENOBUFS, NULL)
00302 # define if_freenameindex(list) (void)0
00303 #endif
00304
00305
00306 #ifndef HAVE_SEARCH_H
00307 typedef struct entry {
00308 char *key;
00309 void *data;
00310 } ENTRY;
00311
00312 typedef enum {
00313 FIND, ENTER
00314 } ACTION;
00315
00316 typedef enum {
00317 preorder,
00318 postorder,
00319 endorder,
00320 leaf
00321 } VISIT;
00322
00323 void *tsearch( const void *key, void **rootp, int(*cmp)(const void *, const void *) );
00324 void *tfind( const void *key, const void **rootp, int(*cmp)(const void *, const void *) );
00325 void *tdelete( const void *key, void **rootp, int(*cmp)(const void *, const void *) );
00326 void twalk( const void *root, void(*action)(const void *nodep, VISIT which, int depth) );
00327 void tdestroy( void *root, void (*free_node)(void *nodep) );
00328 #else // HAVE_SEARCH_H
00329 # ifndef HAVE_TDESTROY
00330 # define tdestroy vlc_tdestroy
00331 # endif
00332 #endif
00333
00334
00335 #ifndef HAVE_NRAND48
00336 double erand48 (unsigned short subi[3]);
00337 long jrand48 (unsigned short subi[3]);
00338 long nrand48 (unsigned short subi[3]);
00339 #endif
00340
00341 #ifdef __OS2__
00342 # undef HAVE_FORK
00343 #endif
00344
00345 #endif