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)
148#if !defined(HAVE_GETENV) || \
149 !defined(HAVE_USELOCALE)
153#if !defined (HAVE_REWIND) || \
154 !defined (HAVE_GETDELIM)
158#if !defined (HAVE_ALIGNED_ALLOC) || \
159 !defined (HAVE_MEMRCHR) || \
160 !defined (HAVE_POSIX_MEMALIGN) || \
161 !defined (HAVE_QSORT_R) || \
162 !defined (HAVE_STRLCPY) || \
163 !defined (HAVE_STRNDUP) || \
164 !defined (HAVE_STRNLEN) || \
165 !defined (HAVE_STRNSTR)
169#ifndef HAVE_VASPRINTF
173#if !defined (HAVE_GETDELIM) || \
174 !defined (HAVE_GETPID) || \
175 !defined (HAVE_SWAB) || \
176 !defined (HAVE_WRITEV) || \
177 !defined (HAVE_READV)
178# include <sys/types.h>
180# if defined(_CRT_INTERNAL_NONSTDC_NAMES) && !_CRT_INTERNAL_NONSTDC_NAMES
186#if !defined (HAVE_DIRFD) || \
187 !defined (HAVE_FDOPENDIR)
192# define VLC_NOTHROW throw ()
199#if !defined (__cplusplus) && !defined (HAVE_MAX_ALIGN_T)
208int asprintf (
char **,
const char *, ...);
211#ifndef HAVE_FLOCKFILE
221ssize_t
getdelim (
char **,
size_t *,
int, FILE *);
229#ifndef HAVE_VASPRINTF
230int vasprintf (
char **,
const char *, va_list);
235void *
memrchr(
const void *,
int,
size_t);
238#ifndef HAVE_STRCASECMP
242#ifndef HAVE_STRCASESTR
247char *
strdup (
const char *);
250#ifndef HAVE_STRVERSCMP
255size_t strnlen (
const char *,
size_t);
259char *
strnstr (
const char *,
const char *,
size_t);
263char *
strndup (
const char *,
size_t);
267size_t strlcpy (
char *,
const char *,
size_t);
271char *
strsep (
char **,
const char *);
275char *
strtok_r(
char *,
const char *,
char **);
281double atof (
const char *);
286long long atoll (
const char *);
295float strtof (
const char *,
char **);
300long long int strtoll (
const char *,
char **,
int);
306ssize_t
readv(
int,
const struct iovec *,
int);
311ssize_t
writev(
int,
const struct iovec *,
int);
316struct tm *
gmtime_r (
const time_t *,
struct tm *);
319#ifndef HAVE_LOCALTIME_R
320struct tm *
localtime_r (
const time_t *,
struct tm *);
324time_t
timegm(
struct tm *);
327#ifndef HAVE_TIMESPEC_GET
336#if defined(WIN32) && !defined(WINSTORECOMPAT) && defined(HAVE_GETPID)
337#include <winapifamily.h>
338#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
340#include <processthreadsapi.h>
341#define getpid() GetCurrentProcessId()
359#ifndef HAVE_FDOPENDIR
381int setenv (
const char *,
const char *,
int);
385#ifndef HAVE_POSIX_MEMALIGN
389#ifndef HAVE_ALIGNED_ALLOC
398#define aligned_free(ptr) _aligned_free(ptr)
400#define aligned_free(ptr) free(ptr)
403#if !defined(HAVE_NEWLOCALE) && defined(HAVE_CXX_LOCALE_T) && defined(__cplusplus)
405# define HAVE_NEWLOCALE
409#ifndef HAVE_USELOCALE
410# ifndef HAVE_NEWLOCALE
411# define LC_ALL_MASK 0
412# define LC_NUMERIC_MASK 0
413# define LC_MESSAGES_MASK 0
414# define LC_GLOBAL_LOCALE ((locale_t)(uintptr_t)1)
423 (void)mask; (void)locale; (void)base;
438#define _(str) vlc_gettext (str)
439#define N_(str) gettext_noop (str)
440#define gettext_noop(str) (str)
449void swab (
const void *,
void *, ssize_t);
454#ifndef HAVE_INET_PTON
459# include <sys/socket.h>
461typedef int socklen_t;
468const char *
inet_ntop(
int,
const void *,
char *, socklen_t);
471#ifndef HAVE_STRUCT_POLLFD
483#define POLLIN (POLLRDNORM|POLLRDBAND)
484#define POLLOUT (POLLWRNORM|POLLWRBAND)
498#ifndef HAVE_IF_NAMEINDEX
506# ifndef HAVE_STRUCT_IF_NAMEINDEX
513# define if_nameindex() (errno = ENOBUFS, NULL)
514# define if_freenameindex(list) (void)0
517#ifndef HAVE_STRUCT_TIMESPEC
535 struct iovec *msg_iov;
538 size_t msg_controllen;
542# ifndef HAVE_IF_NAMETOINDEX
550static inline int if_nametoindex(
const char *
name)
557#ifdef _NEWLIB_VERSION
563ssize_t
recvmsg(
int,
struct msghdr *,
int);
568ssize_t
sendmsg(
int,
const struct msghdr *,
int);
580void *
tsearch(
const void *key,
void **rootp,
int(*cmp)(
const void *,
const void *) );
581void *
tfind(
const void *key,
void *
const *rootp,
int(*cmp)(
const void *,
const void *) );
582void *
tdelete(
const void *key,
void **rootp,
int(*cmp)(
const void *,
const void *) );
583void twalk(
const void *root,
void(*action)(
const void *nodep,
VISIT which,
int depth) );
586void *
lfind(
const void *key,
const void *base,
size_t *nmemb,
587 size_t size,
int(*cmp)(
const void *,
const void *) );
592void tdestroy(
void *root,
void (*free_node)(
void *nodep) );
596#ifndef HAVE_GETAUXVAL
616# define EAI_BADFLAGS -1
619# define EAI_NONAME -2
628# define EAI_NODATA -5
631# define EAI_FAMILY -6
634# define EAI_SOCKTYPE -7
637# define EAI_SERVICE -8
639# ifndef EAI_ADDRFAMILY
640# define EAI_ADDRFAMILY -9
643# define EAI_MEMORY -10
646# define EAI_OVERFLOW -11
649# define EAI_SYSTEM -12
652# ifndef NI_NUMERICHOST
653# define NI_NUMERICHOST 0x01
654# define NI_NUMERICSERV 0x02
655# define NI_NOFQDN 0x04
656# define NI_NAMEREQD 0x08
657# define NI_DGRAM 0x10
661# define NI_MAXHOST 1025
662# define NI_MAXSERV 32
666# define AI_CANONNAME 2
667# define AI_NUMERICHOST 4
676 struct sockaddr *ai_addr;
678 struct addrinfo *ai_next;
684# include <sys/socket.h>
687const char *gai_strerror (
int);
689int getaddrinfo (
const char *node,
const char *service,
690 const struct addrinfo *hints,
struct addrinfo **res);
691void freeaddrinfo (
struct addrinfo *res);
692int getnameinfo (
const struct sockaddr *sa, socklen_t salen,
693 char *host,
int hostlen,
char *serv,
int servlen,
709 uint32_t sin6_flowinfo;
710 struct in6_addr sin6_addr;
711 uint32_t sin6_scope_id;
714# define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
716# define INET6_ADDRSTRLEN 46
718static const struct in6_addr in6addr_any =
719 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
721static const struct in6_addr in6addr_loopback =
722 { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } };
724#define IN6ADDR_ANY_INIT \
725 { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } }
727#define IN6ADDR_LOOPBACK_INIT \
728 { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } } }
732# define EPROTO (ELAST + 1)
735# ifndef HAVE_IF_NAMETOINDEX
736# define if_nametoindex(name) atoi(name)
740# if defined(__STDC_VERSION__) && \
741 __STDC_VERSION__ >= 201112L && __STDC_VERSION__ < 202311L
743# ifndef static_assert
744# define static_assert _Static_assert
752#define nanf(tagp) NAN
756void (
sincos)(double,
double *,
double *);
761char *
realpath(
const char * restrict pathname,
char * restrict resolved_path);
765# define fdatasync fsync
774# ifndef TIMER_ABSTIME
775# define TIMER_ABSTIME 0x01
777# ifndef CLOCK_REALTIME
778# define CLOCK_REALTIME 0
780# ifndef CLOCK_MONOTONIC
781# define CLOCK_MONOTONIC 6
783# ifndef HAVE_CLOCK_GETTIME
784int clock_gettime(clockid_t clock_id,
struct timespec *tp);
786# ifndef HAVE_CLOCK_GETRES
787int clock_getres(clockid_t clock_id,
struct timespec *tp);
792# ifndef HAVE_CLOCK_NANOSLEEP
806# if defined(_CRT_INTERNAL_NONSTDC_NAMES) && !_CRT_INTERNAL_NONSTDC_NAMES
809static inline char *
strdup(
const char *str)
814# define O_WRONLY _O_WRONLY
815# define O_CREAT _O_CREAT
816# define O_APPEND _O_APPEND
817# define O_TRUNC _O_TRUNC
818# define O_BINARY _O_BINARY
819# define O_EXCL _O_EXCL
820# define O_RDWR _O_RDWR
821# define O_TEXT _O_TEXT
822# define O_NOINHERIT _O_NOINHERIT
823# define O_RDONLY _O_RDONLY
833#if defined(__cplusplus)
834#ifndef HAVE_CXX_TYPEOF
835# include <type_traits>
836# 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:186
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, int hostlen, char *serv, int servlen, int flags)
Definition getaddrinfo.c:49
unsigned if_index
Definition vlc_fixups.h:510
char * if_name
Definition vlc_fixups.h:511
Definition vlc_fixups.h:143
long long rem
Definition vlc_fixups.h:145
long long quot
Definition vlc_fixups.h:144
Definition vlc_fixups.h:201
long long ll
Definition vlc_fixups.h:202
long double ld
Definition vlc_fixups.h:203
Definition vlc_fixups.h:488
int fd
Definition vlc_fixups.h:489
short revents
Definition vlc_fixups.h:491
short events
Definition vlc_fixups.h:490
Definition vlc_fixups.h:519
long tv_nsec
Definition vlc_fixups.h:521
time_t tv_sec
Definition vlc_fixups.h:520
This file is a collection of common definitions and types.
ssize_t recvmsg(int, struct msghdr *, int)
float strtof(const char *, char **)
@ POLLRDBAND
Definition vlc_fixups.h:481
@ POLLWRBAND
Definition vlc_fixups.h:479
@ POLLPRI
Definition vlc_fixups.h:482
@ POLLRDNORM
Definition vlc_fixups.h:480
@ POLLHUP
Definition vlc_fixups.h:476
@ POLLNVAL
Definition vlc_fixups.h:477
@ POLLWRNORM
Definition vlc_fixups.h:478
@ POLLERR
Definition vlc_fixups.h:475
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)
ssize_t getdelim(char **, size_t *, int, FILE *)
#define VLC_NOTHROW
Definition vlc_fixups.h:196
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:418
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:431
struct tm * localtime_r(const time_t *, struct tm *)
#define if_nameindex()
Definition vlc_fixups.h:514
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:370
ssize_t getline(char **, size_t *, FILE *)
static locale_t newlocale(int mask, const char *locale, locale_t base)
Definition vlc_fixups.h:422
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:416
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:574
@ postorder
Definition vlc_fixups.h:576
@ leaf
Definition vlc_fixups.h:578
@ endorder
Definition vlc_fixups.h:577
@ preorder
Definition vlc_fixups.h:575
int asprintf(char **, const char *,...)
int getchar_unlocked(void)
char * strsep(char **, const char *)