]> git.sesse.net Git - vlc/blob - include/vlc_fixups.h
vlc_fixups: Dummy definition for LC_NUMERIC_MASK.
[vlc] / include / vlc_fixups.h
1 /*****************************************************************************
2  * fixups.h: portability fixups included from config.h
3  *****************************************************************************
4  * Copyright © 1998-2008 the VideoLAN project
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20
21 /**
22  * \file
23  * This file is a collection of portability fixes
24  */
25
26 #ifndef LIBVLC_FIXUPS_H
27 # define LIBVLC_FIXUPS_H 1
28
29 #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R)
30 # include <time.h> /* time_t */
31 #endif
32
33 #ifndef HAVE_LLDIV
34 typedef struct
35 {
36     long long quot; /* Quotient. */
37     long long rem;  /* Remainder. */
38 } lldiv_t;
39 #endif
40
41 #ifndef HAVE_REWIND
42 # include <stdio.h> /* FILE */
43 #endif
44
45 #if !defined (HAVE_STRLCPY) || \
46     !defined (HAVE_STRNDUP) || \
47     !defined (HAVE_STRNLEN) || \
48     !defined (HAVE_GETCWD)
49 # include <stddef.h> /* size_t */
50 #endif
51
52 #ifndef HAVE_VASPRINTF
53 # include <stdarg.h> /* va_list */
54 #endif
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 #ifndef HAVE_STRDUP
61 char *strdup (const char *);
62 #endif
63
64 #ifndef HAVE_VASPRINTF
65 int vasprintf (char **, const char *, va_list);
66 #endif
67
68 #ifndef HAVE_ASPRINTF
69 int asprintf (char **, const char *, ...);
70 #endif
71
72 #ifndef HAVE_STRNLEN
73 size_t strnlen (const char *, size_t);
74 #endif
75
76 #ifndef HAVE_STRNDUP
77 char *strndup (const char *, size_t);
78 #endif
79
80 #ifndef HAVE_STRLCPY
81 size_t strlcpy (char *, const char *, size_t);
82 #endif
83
84 #ifndef HAVE_STRTOF
85 float strtof (const char *, char **);
86 #endif
87
88 #ifndef HAVE_ATOF
89 double atof (const char *);
90 #endif
91
92 #ifndef HAVE_STRTOLL
93 long long int strtoll (const char *, char **, int);
94 #endif
95
96 #ifndef HAVE_STRSEP
97 char *strsep (char **, const char *);
98 #endif
99
100 #ifndef HAVE_ATOLL
101 long long atoll (const char *);
102 #endif
103
104 #ifndef HAVE_LLDIV
105 lldiv_t lldiv (long long, long long);
106 #endif
107
108 #ifndef HAVE_STRCASECMP
109 int strcasecmp (const char *, const char *);
110 #endif
111
112 #ifndef HAVE_STRNCASECMP
113 int strncasecmp (const char *, const char *, size_t);
114 #endif
115
116 #ifndef HAVE_STRCASESTR
117 char *strcasestr (const char *, const char *);
118 #endif
119
120 #ifndef HAVE_GMTIME_R
121 struct tm *gmtime_r (const time_t *, struct tm *);
122 #endif
123
124 #ifndef HAVE_LOCALTIME_R
125 struct tm *localtime_r (const time_t *, struct tm *);
126 #endif
127
128 #ifndef HAVE_REWIND
129 void rewind (FILE *);
130 #endif
131
132 #ifndef HAVE_GETCWD
133 char *getcwd (char *buf, size_t size);
134 #endif
135
136 #ifdef __cplusplus
137 } /* extern "C" */
138 #endif
139
140 #ifndef HAVE_GETENV
141 static inline char *getenv (const char *name)
142 {
143     (void)name;
144     return NULL;
145 }
146 #endif
147
148 /* Alignment of critical static data structures */
149 #ifdef ATTRIBUTE_ALIGNED_MAX
150 #   define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
151 #else
152 #   define ATTR_ALIGN(align)
153 #endif
154
155 #ifndef HAVE_USELOCALE
156 #define LC_NUMERIC_MASK 0
157 typedef void *locale_t;
158 static inline locale_t uselocale(locale_t loc)
159 {
160     (void)loc;
161     return NULL;
162 }
163 static inline void freelocale(locale_t loc)
164 {
165     (void)loc;
166 }
167 static inline locale_t newlocale(int mask, const char * locale, locale_t base)
168 {
169     (void)mask; (void)locale; (void)base;
170     return NULL;
171 }
172 #endif
173
174 #ifdef WIN32
175 # include <dirent.h>
176 # define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
177 # define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
178 # define closedir vlc_wclosedir
179 #endif
180
181 /* libintl support */
182 #define _(str)            vlc_gettext (str)
183 #define N_(str)           gettext_noop (str)
184 #define gettext_noop(str) (str)
185
186 #ifndef HAVE_SWAB
187 void swab (const void *, void *, ssize_t);
188 #endif
189
190 #endif /* !LIBVLC_FIXUPS_H */