Go to the documentation of this file.
26 #ifndef LIBVLC_FIXUPS_H
27 # define LIBVLC_FIXUPS_H 1
30 #ifdef HAVE_FEATURES_H
36 #if defined (__cplusplus) && (defined(__MINGW32__) || defined(__UCLIBC__) || defined(__native_client__))
37 # ifndef __STDC_FORMAT_MACROS
38 # define __STDC_FORMAT_MACROS 1
40 # ifndef __STDC_CONSTANT_MACROS
41 # define __STDC_CONSTANT_MACROS 1
43 # ifndef __STDC_LIMIT_MACROS
44 # define __STDC_LIMIT_MACROS 1
49 # ifdef HAVE_THREADS_H
51 # elif !defined(thread_local)
52 # ifdef HAVE_THREAD_LOCAL
53 # define thread_local _Thread_local
54 # elif defined(_MSC_VER)
55 # define thread_local __declspec(thread)
60 #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R) \
61 || !defined (HAVE_TIMEGM)
65 #ifndef HAVE_GETTIMEOFDAY
81 #if !defined(HAVE_GETENV) || \
82 !defined(HAVE_USELOCALE)
86 #if !defined (HAVE_REWIND) || \
87 !defined (HAVE_GETDELIM)
91 #if !defined (HAVE_ALIGNED_ALLOC) || \
92 !defined (HAVE_MEMRCHR) || \
93 !defined (HAVE_STRLCPY) || \
94 !defined (HAVE_STRNDUP) || \
95 !defined (HAVE_STRNLEN) || \
96 !defined (HAVE_STRNSTR)
100 #ifndef HAVE_VASPRINTF
104 #if !defined (HAVE_GETDELIM) || \
105 !defined (HAVE_GETPID) || \
107 # include <sys/types.h>
110 #if !defined (HAVE_DIRFD) || \
111 !defined (HAVE_FDOPENDIR)
116 # define VLC_NOTHROW throw ()
123 #if !defined(HAVE_SIGWAIT) && defined(__native_client__)
128 int sigwait(
const sigset_t *set,
int *sig);
132 #if !defined (__cplusplus) && !defined (HAVE_MAX_ALIGN_T)
140 #ifndef HAVE_ASPRINTF
141 int asprintf (
char **,
const char *, ...);
144 #ifndef HAVE_FLOCKFILE
153 #ifndef HAVE_GETDELIM
154 ssize_t
getdelim (
char **,
size_t *,
int, FILE *);
155 ssize_t
getline (
char **,
size_t *, FILE *);
162 #ifndef HAVE_VASPRINTF
163 int vasprintf (
char **,
const char *, va_list);
168 int ffsll(
long long);
172 void *
memrchr(
const void *,
int,
size_t);
175 #ifndef HAVE_STRCASECMP
179 #ifndef HAVE_STRCASESTR
180 char *
strcasestr (
const char *,
const char *);
184 char *
strdup (
const char *);
187 #ifndef HAVE_STRVERSCMP
192 size_t strnlen (
const char *,
size_t);
196 char *
strnstr (
const char *,
const char *,
size_t);
200 char *
strndup (
const char *,
size_t);
204 size_t strlcpy (
char *,
const char *,
size_t);
208 char *
strsep (
char **,
const char *);
211 #ifndef HAVE_STRTOK_R
212 char *
strtok_r(
char *,
const char *,
char **);
218 double atof (
const char *);
223 long long atoll (
const char *);
232 float strtof (
const char *,
char **);
237 long long int strtoll (
const char *,
char **,
int);
241 #ifndef HAVE_GMTIME_R
242 struct tm *
gmtime_r (
const time_t *,
struct tm *);
245 #ifndef HAVE_LOCALTIME_R
246 struct tm *
localtime_r (
const time_t *,
struct tm *);
250 time_t
timegm(
struct tm *);
253 #ifndef HAVE_TIMESPEC_GET
260 #ifndef HAVE_GETTIMEOFDAY
274 #ifndef HAVE_PATHCONF
283 #ifndef HAVE_FDOPENDIR
305 int setenv (
const char *,
const char *,
int);
309 #ifndef HAVE_ALIGNED_ALLOC
317 #if defined (_WIN32) && defined(__MINGW32__)
318 #define aligned_free(ptr) __mingw_aligned_free(ptr)
319 #elif defined (_WIN32) && defined(_MSC_VER)
320 #define aligned_free(ptr) _aligned_free(ptr)
322 #define aligned_free(ptr) free(ptr)
325 #if defined(__native_client__) && defined(__cplusplus)
326 # define HAVE_USELOCALE
329 #if !defined(HAVE_NEWLOCALE) && defined(HAVE_CXX_LOCALE_T) && defined(__cplusplus)
331 # define HAVE_NEWLOCALE
335 #ifndef HAVE_USELOCALE
336 # ifndef HAVE_NEWLOCALE
337 # define LC_ALL_MASK 0
338 # define LC_NUMERIC_MASK 0
339 # define LC_MESSAGES_MASK 0
340 # define LC_GLOBAL_LOCALE ((locale_t)(uintptr_t)1)
349 (void)mask; (void)locale; (void)base;
363 #if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert)
364 # define STATIC_ASSERT_CONCAT_(a, b) a##b
365 # define STATIC_ASSERT_CONCAT(a, b) STATIC_ASSERT_CONCAT_(a, b)
366 # define _Static_assert(x, s) extern char STATIC_ASSERT_CONCAT(static_assert_, __LINE__)[sizeof(struct { unsigned:-!(x); })]
367 # define static_assert _Static_assert
371 #define _(str) vlc_gettext (str)
372 #define N_(str) gettext_noop (str)
373 #define gettext_noop(str) (str)
380 void swab (
const void *,
void *, ssize_t);
384 #ifndef HAVE_INET_PTON
386 # include <sys/socket.h>
388 typedef int socklen_t;
390 int inet_pton(
int,
const char *,
void *);
391 const char *
inet_ntop(
int,
const void *,
char *, socklen_t);
395 #if defined(__native_client__) && !defined( HAVE_NETINET_TCP_H )
396 # define TCP_NODELAY 1
399 #ifndef HAVE_STRUCT_POLLFD
411 #define POLLIN (POLLRDNORM|POLLRDBAND)
412 #define POLLOUT (POLLWRNORM|POLLWRBAND)
426 #ifndef HAVE_IF_NAMEINDEX
428 # ifndef HAVE_STRUCT_IF_NAMEINDEX
435 # ifndef HAVE_IF_NAMETOINDEX
436 # define if_nametoindex(name) atoi(name)
438 # define if_nameindex() (errno = ENOBUFS, NULL)
439 # define if_freenameindex(list) (void)0
442 #ifndef HAVE_STRUCT_TIMESPEC
460 struct iovec *msg_iov;
463 size_t msg_controllen;
468 #ifdef _NEWLIB_VERSION
474 ssize_t
recvmsg(
int,
struct msghdr *,
int);
479 ssize_t
sendmsg(
int,
const struct msghdr *,
int);
483 #ifndef HAVE_SEARCH_H
484 typedef struct entry {
500 void *
tsearch(
const void *key,
void **rootp,
int(*cmp)(
const void *,
const void *) );
501 void *
tfind(
const void *key,
const void **rootp,
int(*cmp)(
const void *,
const void *) );
502 void *
tdelete(
const void *key,
void **rootp,
int(*cmp)(
const void *,
const void *) );
503 void twalk(
const void *root,
void(*action)(
const void *nodep,
VISIT which,
int depth) );
506 void *
lfind(
const void *key,
const void *base,
size_t *nmemb,
507 size_t size,
int(*cmp)(
const void *,
const void *) );
510 #ifndef HAVE_TDESTROY
511 void tdestroy(
void *root,
void (*free_node)(
void *nodep) );
529 # ifndef EAI_BADFLAGS
530 # define EAI_BADFLAGS -1
533 # define EAI_NONAME -2
536 # define EAI_AGAIN -3
542 # define EAI_NODATA -5
545 # define EAI_FAMILY -6
547 # ifndef EAI_SOCKTYPE
548 # define EAI_SOCKTYPE -7
551 # define EAI_SERVICE -8
553 # ifndef EAI_ADDRFAMILY
554 # define EAI_ADDRFAMILY -9
557 # define EAI_MEMORY -10
559 # ifndef EAI_OVERFLOW
560 # define EAI_OVERFLOW -11
563 # define EAI_SYSTEM -12
566 # ifndef NI_NUMERICHOST
567 # define NI_NUMERICHOST 0x01
568 # define NI_NUMERICSERV 0x02
569 # define NI_NOFQDN 0x04
570 # define NI_NAMEREQD 0x08
571 # define NI_DGRAM 0x10
575 # define NI_MAXHOST 1025
576 # define NI_MAXSERV 32
579 # define AI_PASSIVE 1
580 # define AI_CANONNAME 2
581 # define AI_NUMERICHOST 4
590 struct sockaddr *ai_addr;
592 struct addrinfo *ai_next;
598 # include <sys/socket.h>
601 const char *gai_strerror (
int);
603 int getaddrinfo (
const char *node,
const char *service,
604 const struct addrinfo *hints,
struct addrinfo **res);
605 void freeaddrinfo (
struct addrinfo *res);
606 int getnameinfo (
const struct sockaddr *sa, socklen_t salen,
607 char *host,
int hostlen,
char *serv,
int servlen,
623 uint32_t sin6_flowinfo;
624 struct in6_addr sin6_addr;
625 uint32_t sin6_scope_id;
628 # define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
630 static const struct in6_addr in6addr_any =
631 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
633 # define INET6_ADDRSTRLEN 46
637 # define EPROTO (ELAST + 1)
640 # ifndef HAVE_IF_NAMETOINDEX
641 # define if_nametoindex(name) atoi(name)
648 #define nanf(tagp) NAN
652 void sincos(
double,
double *,
double *);
653 void sincosf(
float,
float *,
float *);
656 #ifndef HAVE_REALPATH
657 char *
realpath(
const char * restrict pathname,
char * restrict resolved_path);
665 #if defined(_WIN32) && defined(__MINGW64_VERSION_MAJOR)
666 # define IN6_IS_ADDR_MULTICAST IN6_IS_ADDR_MULTICAST
670 # define fdatasync fsync
int getchar_unlocked(void)
Definition: vlc_fixups.h:490
double atof(const char *)
char * realpath(const char *restrict pathname, char *restrict resolved_path)
Definition: vlc_fixups.h:497
int putc_unlocked(int, FILE *)
ssize_t getdelim(char **, size_t *, int, FILE *)
int strcasecmp(const char *, const char *)
Definition: vlc_fixups.h:405
void sincosf(float, float *, float *)
long long rem
Definition: vlc_fixups.h:77
void * tdelete(const void *key, void **rootp, int(*cmp)(const void *, const void *))
size_t strnlen(const char *, size_t)
int fd
Definition: vlc_fixups.h:416
static locale_t uselocale(locale_t loc)
Definition: vlc_fixups.h:356
struct tm * gmtime_r(const time_t *, struct tm *)
int inet_pton(int, const char *, void *)
void * aligned_alloc(size_t, size_t)
long nrand48(unsigned short subi[3])
void * locale_t
Definition: vlc_fixups.h:341
float strtof(const char *, char **)
Definition: vlc_fixups.h:414
long double ld
Definition: vlc_fixups.h:135
unsigned if_index
Definition: vlc_fixups.h:431
Definition: vlc_fixups.h:406
unsigned short subi[3]
Definition: rand.c:50
long pathconf(const char *path, int name)
int poll(struct pollfd *, unsigned, int)
Definition: vlc_fixups.h:495
int unsetenv(const char *)
void sincos(double, double *, double *)
Definition: vlc_fixups.h:74
int strverscmp(const char *, const char *)
static char * getenv(const char *name)
Definition: vlc_fixups.h:293
static void freelocale(locale_t loc)
Definition: vlc_fixups.h:343
char * key
Definition: vlc_fixups.h:485
int asprintf(char **, const char *,...)
void * data
Definition: vlc_fixups.h:486
short revents
Definition: vlc_fixups.h:418
char * strndup(const char *, size_t)
long jrand48(unsigned short subi[3])
long tv_nsec
Definition: vlc_fixups.h:445
lldiv_t lldiv(long long, long long)
Definition: vlc_fixups.h:494
char * strnstr(const char *, const char *, size_t)
void swab(const void *, void *, ssize_t)
int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
Definition: getaddrinfo.c:184
long long quot
Definition: vlc_fixups.h:76
time_t tv_sec
Definition: vlc_fixups.h:444
char * strcasestr(const char *, const char *)
Definition: vlc_fixups.h:409
Definition: vlc_fixups.h:408
int timespec_get(struct timespec *, int)
static locale_t newlocale(int mask, const char *locale, locale_t base)
Definition: vlc_fixups.h:347
void * memrchr(const void *, int, size_t)
Definition: vlc_fixups.h:429
short events
Definition: vlc_fixups.h:417
ssize_t recvmsg(int, struct msghdr *, int)
FILE * vlc_win32_tmpfile(void)
Definition: filesystem.c:359
char * strtok_r(char *, const char *, char **)
#define VLC_NOTHROW
Definition: vlc_fixups.h:119
Definition: vlc_fixups.h:407
Definition: vlc_fixups.h:133
size_t strlcpy(char *, const char *, size_t)
VISIT
Definition: vlc_fixups.h:493
void * lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*cmp)(const void *, const void *))
Definition: vlc_fixups.h:496
ssize_t sendmsg(int, const struct msghdr *, int)
ACTION
Definition: vlc_fixups.h:489
void tdestroy(void *root, void(*free_node)(void *nodep))
void * tfind(const void *key, const void **rootp, int(*cmp)(const void *, const void *))
char * strdup(const char *)
Definition: vlc_fixups.h:404
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, int hostlen, char *serv, int servlen, int flags)
Definition: getaddrinfo.c:46
Definition: vlc_fixups.h:490
const char name[16]
Definition: httpd.c:1251
Definition: fourcc_gen.c:50
Definition: vlc_fixups.h:403
int gettimeofday(struct timeval *, struct timezone *)
long long int strtoll(const char *, char **, int)
int getc_unlocked(FILE *)
struct tm * localtime_r(const time_t *, struct tm *)
time_t timegm(struct tm *)
Definition: vlc_fixups.h:402
void * tsearch(const void *key, void **rootp, int(*cmp)(const void *, const void *))
Definition: vlc_fixups.h:443
char * strsep(char **, const char *)
void twalk(const void *root, void(*action)(const void *nodep, VISIT which, int depth))
long long atoll(const char *)
const char * inet_ntop(int, const void *, char *, socklen_t)
int vasprintf(char **, const char *, va_list)
double erand48(unsigned short subi[3])
int setenv(const char *, const char *, int)
int putchar_unlocked(int)
long long ll
Definition: vlc_fixups.h:134
char * if_name
Definition: vlc_fixups.h:432
ssize_t getline(char **, size_t *, FILE *)