26#ifndef LIBVLC_FIXUPS_H
27# define LIBVLC_FIXUPS_H 1
31#ifndef _CRT_NONSTDC_NO_DEPRECATE
33# if !(defined(_GAMING_XBOX_SCARLETT) || defined(_GAMING_XBOX_XBOXONE) || defined(_XBOX_ONE))
34# define _CRT_NONSTDC_NO_DEPRECATE
37#ifndef _CRT_SECURE_NO_WARNINGS
38#define _CRT_SECURE_NO_WARNINGS 1
40#if defined(_GAMING_XBOX_SCARLETT) || defined(_GAMING_XBOX_XBOXONE) || defined(_XBOX_ONE)
42# undef _CRT_DECLARE_NONSTDC_NAMES
43# define _CRT_DECLARE_NONSTDC_NAMES 0
48#define S_IWUSR _S_IWRITE
49#define S_IRUSR _S_IREAD
50#define S_IFIFO _S_IFIFO
52#define S_IFCHR _S_IFCHR
53#define S_IFREG _S_IFREG
54#define S_IFDIR _S_IFDIR
55#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
56#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
60typedef unsigned short mode_t;
63#define strncasecmp _strnicmp
64#define snwprintf _snwprintf
67#define _CRT_SUPPRESS_RESTRICT
68#define DECLSPEC_RESTRICT
71#if defined(_M_X64) && !defined(__x86_64__)
74#if defined(_M_IX86) && !defined(__i386__)
77#if defined(_M_ARM64) && !defined(__aarch64__)
80#if defined(_M_ARM) && !defined(__arm__)
83#if defined(_M_IX86_FP) && _M_IX86_FP == 1 && !defined(__SSE__)
86#if defined(_M_IX86_FP) && _M_IX86_FP == 2 && !defined(__SSE2__)
93# if !defined(NOMINMAX)
97# if !defined(_USE_MATH_DEFINES)
99# define _USE_MATH_DEFINES
105#ifdef HAVE_FEATURES_H
111#if defined (__cplusplus) && defined(__UCLIBC__)
112# ifndef __STDC_FORMAT_MACROS
113# define __STDC_FORMAT_MACROS 1
115# ifndef __STDC_CONSTANT_MACROS
116# define __STDC_CONSTANT_MACROS 1
118# ifndef __STDC_LIMIT_MACROS
119# define __STDC_LIMIT_MACROS 1
124# ifdef HAVE_THREADS_H
126# elif !defined(thread_local)
127# ifdef HAVE_THREAD_LOCAL
128# define thread_local _Thread_local
129# elif defined(_MSC_VER)
130# define thread_local __declspec(thread)
135#if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R) \
136 || !defined (HAVE_TIMEGM)
140#ifndef HAVE_GETTIMEOFDAY
156#if !defined(HAVE_GETENV) || \
157 !defined(HAVE_USELOCALE)
161#if !defined (HAVE_REWIND) || \
162 !defined (HAVE_GETDELIM)
166#if !defined (HAVE_ALIGNED_ALLOC) || \
167 !defined (HAVE_MEMRCHR) || \
168 !defined (HAVE_POSIX_MEMALIGN) || \
169 !defined (HAVE_QSORT_R) || \
170 !defined (HAVE_STRLCPY) || \
171 !defined (HAVE_STRNDUP) || \
172 !defined (HAVE_STRNLEN) || \
173 !defined (HAVE_STRNSTR)
177#ifndef HAVE_VASPRINTF
181#if !defined (HAVE_GETDELIM) || \
182 !defined (HAVE_GETPID) || \
183 !defined (HAVE_SWAB) || \
184 !defined (HAVE_WRITEV) || \
185 !defined (HAVE_READV)
186# include <sys/types.h>
188# if defined(_CRT_INTERNAL_NONSTDC_NAMES) && !_CRT_INTERNAL_NONSTDC_NAMES
194#if !defined (HAVE_DIRFD) || \
195 !defined (HAVE_FDOPENDIR)
200# define VLC_NOTHROW throw ()
207#if !defined (__cplusplus) && !defined (HAVE_MAX_ALIGN_T)
216int asprintf (
char **,
const char *, ...);
219#ifndef HAVE_FLOCKFILE
229ssize_t
getdelim (
char **,
size_t *,
int, FILE *);
237#ifndef HAVE_VASPRINTF
238int vasprintf (
char **,
const char *, va_list);
243void *
memrchr(
const void *,
int,
size_t);
246#ifndef HAVE_STRCASECMP
250#ifndef HAVE_STRCASESTR
255char *
strdup (
const char *);
258#ifndef HAVE_STRVERSCMP
263size_t strnlen (
const char *,
size_t);
267char *
strnstr (
const char *,
const char *,
size_t);
271char *
strndup (
const char *,
size_t);
275size_t strlcpy (
char *,
const char *,
size_t);
279char *
strsep (
char **,
const char *);
283char *
strtok_r(
char *,
const char *,
char **);
289double atof (
const char *);
294long long atoll (
const char *);
303float strtof (
const char *,
char **);
308long long int strtoll (
const char *,
char **,
int);
314ssize_t
readv(
int,
const struct iovec *,
int);
319ssize_t
writev(
int,
const struct iovec *,
int);
324struct tm *
gmtime_r (
const time_t *,
struct tm *);
327#ifndef HAVE_LOCALTIME_R
328struct tm *
localtime_r (
const time_t *,
struct tm *);
332time_t
timegm(
struct tm *);
335#ifndef HAVE_TIMESPEC_GET
344#ifndef HAVE_GETTIMEOFDAY
349#if defined(WIN32) && !defined(WINSTORECOMPAT) && defined(HAVE_GETPID)
350#include <winapifamily.h>
351#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
353#include <processthreadsapi.h>
354#define getpid() GetCurrentProcessId()
372#ifndef HAVE_FDOPENDIR
394int setenv (
const char *,
const char *,
int);
398#ifndef HAVE_POSIX_MEMALIGN
402#ifndef HAVE_ALIGNED_ALLOC
411#define aligned_free(ptr) _aligned_free(ptr)
413#define aligned_free(ptr) free(ptr)
416#if !defined(HAVE_NEWLOCALE) && defined(HAVE_CXX_LOCALE_T) && defined(__cplusplus)
418# define HAVE_NEWLOCALE
422#ifndef HAVE_USELOCALE
423# ifndef HAVE_NEWLOCALE
424# define LC_ALL_MASK 0
425# define LC_NUMERIC_MASK 0
426# define LC_MESSAGES_MASK 0
427# define LC_GLOBAL_LOCALE ((locale_t)(uintptr_t)1)
436 (void)mask; (void)locale; (void)base;
451#define _(str) vlc_gettext (str)
452#define N_(str) gettext_noop (str)
453#define gettext_noop(str) (str)
462void swab (
const void *,
void *, ssize_t);
467#ifndef HAVE_INET_PTON
472# include <sys/socket.h>
474typedef int socklen_t;
481const char *
inet_ntop(
int,
const void *,
char *, socklen_t);
484#ifndef HAVE_STRUCT_POLLFD
496#define POLLIN (POLLRDNORM|POLLRDBAND)
497#define POLLOUT (POLLWRNORM|POLLWRBAND)
511#ifndef HAVE_IF_NAMEINDEX
519# ifndef HAVE_STRUCT_IF_NAMEINDEX
526# define if_nameindex() (errno = ENOBUFS, NULL)
527# define if_freenameindex(list) (void)0
530#ifndef HAVE_STRUCT_TIMESPEC
548 struct iovec *msg_iov;
551 size_t msg_controllen;
555# ifndef HAVE_IF_NAMETOINDEX
563static inline int if_nametoindex(
const char *
name)
570#ifdef _NEWLIB_VERSION
576ssize_t
recvmsg(
int,
struct msghdr *,
int);
581ssize_t
sendmsg(
int,
const struct msghdr *,
int);
593void *
tsearch(
const void *key,
void **rootp,
int(*cmp)(
const void *,
const void *) );
594void *
tfind(
const void *key,
void *
const *rootp,
int(*cmp)(
const void *,
const void *) );
595void *
tdelete(
const void *key,
void **rootp,
int(*cmp)(
const void *,
const void *) );
596void twalk(
const void *root,
void(*action)(
const void *nodep,
VISIT which,
int depth) );
599void *
lfind(
const void *key,
const void *base,
size_t *nmemb,
600 size_t size,
int(*cmp)(
const void *,
const void *) );
605void tdestroy(
void *root,
void (*free_node)(
void *nodep) );
609#ifndef HAVE_GETAUXVAL
629# define EAI_BADFLAGS -1
632# define EAI_NONAME -2
641# define EAI_NODATA -5
644# define EAI_FAMILY -6
647# define EAI_SOCKTYPE -7
650# define EAI_SERVICE -8
652# ifndef EAI_ADDRFAMILY
653# define EAI_ADDRFAMILY -9
656# define EAI_MEMORY -10
659# define EAI_OVERFLOW -11
662# define EAI_SYSTEM -12
665# ifndef NI_NUMERICHOST
666# define NI_NUMERICHOST 0x01
667# define NI_NUMERICSERV 0x02
668# define NI_NOFQDN 0x04
669# define NI_NAMEREQD 0x08
670# define NI_DGRAM 0x10
674# define NI_MAXHOST 1025
675# define NI_MAXSERV 32
679# define AI_CANONNAME 2
680# define AI_NUMERICHOST 4
689 struct sockaddr *ai_addr;
691 struct addrinfo *ai_next;
697# include <sys/socket.h>
700const char *gai_strerror (
int);
702int getaddrinfo (
const char *node,
const char *service,
703 const struct addrinfo *hints,
struct addrinfo **res);
704void freeaddrinfo (
struct addrinfo *res);
705int getnameinfo (
const struct sockaddr *sa, socklen_t salen,
706 char *host,
int hostlen,
char *serv,
int servlen,
722 uint32_t sin6_flowinfo;
723 struct in6_addr sin6_addr;
724 uint32_t sin6_scope_id;
727# define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
729# define INET6_ADDRSTRLEN 46
731static const struct in6_addr in6addr_any =
732 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
734#define IN6ADDR_ANY_INIT \
735 { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } }
739# define EPROTO (ELAST + 1)
742# ifndef HAVE_IF_NAMETOINDEX
743# define if_nametoindex(name) atoi(name)
747# if defined(__STDC_VERSION__) && \
748 __STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L
750# ifndef static_assert
751# define static_assert _Static_assert
759#define nanf(tagp) NAN
763void sincos(
double,
double *,
double *);
768char *
realpath(
const char * restrict pathname,
char * restrict resolved_path);
772# define fdatasync fsync
781# ifndef TIMER_ABSTIME
782# define TIMER_ABSTIME 0x01
784# ifndef CLOCK_REALTIME
785# define CLOCK_REALTIME 0
787# ifndef CLOCK_MONOTONIC
788# define CLOCK_MONOTONIC 6
790# ifndef HAVE_CLOCK_GETTIME
791int clock_gettime(clockid_t clock_id,
struct timespec *tp);
793# ifndef HAVE_CLOCK_GETRES
794int clock_getres(clockid_t clock_id,
struct timespec *tp);
799# ifndef HAVE_CLOCK_NANOSLEEP
813# if defined(_CRT_INTERNAL_NONSTDC_NAMES) && !_CRT_INTERNAL_NONSTDC_NAMES
816static inline char *
strdup(
const char *str)
821# define O_WRONLY _O_WRONLY
822# define O_CREAT _O_CREAT
823# define O_APPEND _O_APPEND
824# define O_TRUNC _O_TRUNC
825# define O_BINARY _O_BINARY
826# define O_EXCL _O_EXCL
827# define O_RDWR _O_RDWR
828# define O_TEXT _O_TEXT
829# define O_NOINHERIT _O_NOINHERIT
830# define O_RDONLY _O_RDONLY
840#if defined(__cplusplus)
841#ifndef HAVE_CXX_TYPEOF
842# include <type_traits>
843# define typeof(t) std::remove_reference<decltype(t)>::type
const char name[16]
Definition httpd.c:1298
unsigned short subi[3]
Definition rand.c:32
int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
Definition getaddrinfo.c:187
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, int hostlen, char *serv, int servlen, int flags)
Definition getaddrinfo.c:49
Definition vlc_fixups.h:522
unsigned if_index
Definition vlc_fixups.h:523
char * if_name
Definition vlc_fixups.h:524
Definition vlc_fixups.h:151
long long rem
Definition vlc_fixups.h:153
long long quot
Definition vlc_fixups.h:152
Definition vlc_fixups.h:209
long long ll
Definition vlc_fixups.h:210
long double ld
Definition vlc_fixups.h:211
Definition vlc_fixups.h:501
int fd
Definition vlc_fixups.h:502
short revents
Definition vlc_fixups.h:504
short events
Definition vlc_fixups.h:503
Definition vlc_fixups.h:532
long tv_nsec
Definition vlc_fixups.h:534
time_t tv_sec
Definition vlc_fixups.h:533
This file is a collection of common definitions and types.
ssize_t recvmsg(int, struct msghdr *, int)
float strtof(const char *, char **)
void * tfind(const void *key, void *const *rootp, int(*cmp)(const void *, const void *))
int inet_pton(int, const char *, void *)
ssize_t readv(int, const struct iovec *, int)
int gettimeofday(struct timeval *, struct timezone *)
ssize_t getdelim(char **, size_t *, int, FILE *)
#define VLC_NOTHROW
Definition vlc_fixups.h:204
double erand48(unsigned short subi[3])
int getc_unlocked(FILE *)
void * aligned_alloc(size_t, size_t)
static void freelocale(locale_t loc)
Definition vlc_fixups.h:431
int posix_memalign(void **, size_t, size_t)
char * strdup(const char *)
lldiv_t lldiv(long long, long long)
void sincos(double, double *, double *)
int putc_unlocked(int, FILE *)
const char * inet_ntop(int, const void *, char *, socklen_t)
long nrand48(unsigned short subi[3])
int vasprintf(char **, const char *, va_list)
double atof(const char *)
int putchar_unlocked(int)
static locale_t uselocale(locale_t loc)
Definition vlc_fixups.h:444
struct tm * localtime_r(const time_t *, struct tm *)
char * strnstr(const char *, const char *, size_t)
long long atoll(const char *)
void twalk(const void *root, void(*action)(const void *nodep, VISIT which, int depth))
int setenv(const char *, const char *, int)
int unsetenv(const char *)
void sincosf(float, float *, float *)
time_t timegm(struct tm *)
unsigned long getauxval(unsigned long)
char * realpath(const char *restrict pathname, char *restrict resolved_path)
long jrand48(unsigned short subi[3])
int timespec_get(struct timespec *, int)
size_t strlcpy(char *, const char *, size_t)
static char * getenv(const char *name)
Definition vlc_fixups.h:383
ssize_t getline(char **, size_t *, FILE *)
@ POLLRDBAND
Definition vlc_fixups.h:494
@ POLLWRBAND
Definition vlc_fixups.h:492
@ POLLPRI
Definition vlc_fixups.h:495
@ POLLRDNORM
Definition vlc_fixups.h:493
@ POLLHUP
Definition vlc_fixups.h:489
@ POLLNVAL
Definition vlc_fixups.h:490
@ POLLWRNORM
Definition vlc_fixups.h:491
@ POLLERR
Definition vlc_fixups.h:488
static locale_t newlocale(int mask, const char *locale, locale_t base)
Definition vlc_fixups.h:435
ssize_t writev(int, const struct iovec *, int)
void * lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*cmp)(const void *, const void *))
long long int strtoll(const char *, char **, int)
void * tdelete(const void *key, void **rootp, int(*cmp)(const void *, const void *))
void swab(const void *, void *, ssize_t)
int strcasecmp(const char *, const char *)
int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp)
void * locale_t
Definition vlc_fixups.h:429
int poll(struct pollfd *, unsigned, int)
void * tsearch(const void *key, void **rootp, int(*cmp)(const void *, const void *))
void tdestroy(void *root, void(*free_node)(void *nodep))
char * strndup(const char *, size_t)
char * strtok_r(char *, const char *, char **)
void * memrchr(const void *, int, size_t)
char * strcasestr(const char *, const char *)
struct tm * gmtime_r(const time_t *, struct tm *)
int strverscmp(const char *, const char *)
ssize_t sendmsg(int, const struct msghdr *, int)
size_t strnlen(const char *, size_t)
VISIT
Definition vlc_fixups.h:587
@ postorder
Definition vlc_fixups.h:589
@ leaf
Definition vlc_fixups.h:591
@ endorder
Definition vlc_fixups.h:590
@ preorder
Definition vlc_fixups.h:588
int asprintf(char **, const char *,...)
int getchar_unlocked(void)
char * strsep(char **, const char *)