vlc_fixups.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * fixups.h: portability fixups included from config.h
00003  *****************************************************************************
00004  * Copyright © 1998-2008 the VideoLAN project
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00019  *****************************************************************************/
00020 
00021 /**
00022  * \file
00023  * This file is a collection of portability fixes
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> /* time_t */
00031 #endif
00032 
00033 #ifndef HAVE_LLDIV
00034 typedef struct
00035 {
00036     long long quot; /* Quotient. */
00037     long long rem;  /* Remainder. */
00038 } lldiv_t;
00039 #endif
00040 
00041 #if !defined(HAVE_GETENV) || \
00042     !defined(HAVE_USELOCALE)
00043 # include <stddef.h> /* NULL */
00044 #endif
00045 
00046 #if !defined (HAVE_REWIND) || \
00047     !defined (HAVE_GETDELIM)
00048 # include <stdio.h> /* FILE */
00049 #endif
00050 
00051 #if !defined (HAVE_STRLCPY) || \
00052     !defined (HAVE_STRNDUP) || \
00053     !defined (HAVE_STRNLEN) || \
00054     !defined (HAVE_GETCWD)
00055 # include <stddef.h> /* size_t */
00056 #endif
00057 
00058 #ifndef HAVE_VASPRINTF
00059 # include <stdarg.h> /* va_list */
00060 #endif
00061 
00062 #if !defined (HAVE_GETDELIM) || \
00063     !defined (HAVE_GETPID)   || \
00064     !defined (HAVE_SWAB)
00065 # include <sys/types.h> /* ssize_t, pid_t */
00066 #endif
00067 
00068 #ifdef __cplusplus
00069 extern "C" {
00070 #endif
00071 
00072 #ifndef HAVE_STRDUP
00073 char *strdup (const char *);
00074 #endif
00075 
00076 #ifndef HAVE_VASPRINTF
00077 int vasprintf (char **, const char *, va_list);
00078 #endif
00079 
00080 #ifndef HAVE_ASPRINTF
00081 int asprintf (char **, const char *, ...);
00082 #endif
00083 
00084 #ifndef HAVE_STRNLEN
00085 size_t strnlen (const char *, size_t);
00086 #endif
00087 
00088 #ifndef HAVE_STRNDUP
00089 char *strndup (const char *, size_t);
00090 #endif
00091 
00092 #ifndef HAVE_STRLCPY
00093 size_t strlcpy (char *, const char *, size_t);
00094 #endif
00095 
00096 #ifndef HAVE_STRTOF
00097 float strtof (const char *, char **);
00098 #endif
00099 
00100 #ifndef HAVE_ATOF
00101 double atof (const char *);
00102 #endif
00103 
00104 #ifndef HAVE_STRTOLL
00105 long long int strtoll (const char *, char **, int);
00106 #endif
00107 
00108 #ifndef HAVE_STRSEP
00109 char *strsep (char **, const char *);
00110 #endif
00111 
00112 #ifndef HAVE_ATOLL
00113 long long atoll (const char *);
00114 #endif
00115 
00116 #ifndef HAVE_LLDIV
00117 lldiv_t lldiv (long long, long long);
00118 #endif
00119 
00120 #ifndef HAVE_STRCASECMP
00121 int strcasecmp (const char *, const char *);
00122 #endif
00123 
00124 #ifndef HAVE_STRNCASECMP
00125 int strncasecmp (const char *, const char *, size_t);
00126 #endif
00127 
00128 #ifndef HAVE_STRCASESTR
00129 char *strcasestr (const char *, const char *);
00130 #endif
00131 
00132 #ifndef HAVE_GMTIME_R
00133 struct tm *gmtime_r (const time_t *, struct tm *);
00134 #endif
00135 
00136 #ifndef HAVE_LOCALTIME_R
00137 struct tm *localtime_r (const time_t *, struct tm *);
00138 #endif
00139 
00140 #ifndef HAVE_REWIND
00141 void rewind (FILE *);
00142 #endif
00143 
00144 #ifndef HAVE_GETCWD
00145 char *getcwd (char *buf, size_t size);
00146 #endif
00147 
00148 #ifndef HAVE_GETDELIM
00149 ssize_t getdelim (char **, size_t *, int, FILE *);
00150 ssize_t getline (char **, size_t *, FILE *);
00151 #endif
00152 
00153 #ifndef HAVE_GETPID
00154 pid_t getpid (void);
00155 #endif
00156 
00157 #ifndef HAVE_STRTOK_R
00158 char *strtok_r(char *, const char *, char **);
00159 #endif
00160 
00161 #ifdef __cplusplus
00162 } /* extern "C" */
00163 #endif
00164 
00165 #ifndef HAVE_GETENV
00166 static inline char *getenv (const char *name)
00167 {
00168     (void)name;
00169     return NULL;
00170 }
00171 #endif
00172 
00173 /* Alignment of critical static data structures */
00174 #ifdef ATTRIBUTE_ALIGNED_MAX
00175 #   define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
00176 #else
00177 #   define ATTR_ALIGN(align)
00178 #endif
00179 
00180 #ifndef HAVE_USELOCALE
00181 #define LC_NUMERIC_MASK  0
00182 #define LC_MESSAGES_MASK 0
00183 typedef void *locale_t;
00184 static inline locale_t uselocale(locale_t loc)
00185 {
00186     (void)loc;
00187     return NULL;
00188 }
00189 static inline void freelocale(locale_t loc)
00190 {
00191     (void)loc;
00192 }
00193 static inline locale_t newlocale(int mask, const char * locale, locale_t base)
00194 {
00195     (void)mask; (void)locale; (void)base;
00196     return NULL;
00197 }
00198 #endif
00199 
00200 /* libintl support */
00201 #define _(str)            vlc_gettext (str)
00202 #define N_(str)           gettext_noop (str)
00203 #define gettext_noop(str) (str)
00204 
00205 #ifndef HAVE_SWAB
00206 void swab (const void *, void *, ssize_t);
00207 #endif
00208 
00209 /* Socket stuff */
00210 #ifndef HAVE_INET_PTON
00211 # define inet_pton vlc_inet_pton
00212 #endif
00213 
00214 #ifndef HAVE_INET_NTOP
00215 # define inet_ntop vlc_inet_ntop
00216 #endif
00217 
00218 #ifndef HAVE_POLL
00219 enum
00220 {
00221     POLLIN=1,
00222     POLLOUT=2,
00223     POLLPRI=4,
00224     POLLERR=8,  // unsupported stub
00225     POLLHUP=16, // unsupported stub
00226     POLLNVAL=32 // unsupported stub
00227 };
00228 
00229 struct pollfd
00230 {
00231     int fd;
00232     unsigned events;
00233     unsigned revents;
00234 };
00235 
00236 # define poll(a, b, c) vlc_poll(a, b, c)
00237 #elif defined (HAVE_MAEMO)
00238 # include <poll.h>
00239 # define poll(a, b, c) vlc_poll(a, b, c)
00240 int vlc_poll (struct pollfd *, unsigned, int);
00241 #endif
00242 
00243 #ifndef HAVE_TDESTROY
00244 # define tdestroy vlc_tdestroy
00245 #endif
00246 
00247 /* Random numbers */
00248 #ifndef HAVE_NRAND48
00249 double erand48 (unsigned short subi[3]);
00250 long jrand48 (unsigned short subi[3]);
00251 long nrand48 (unsigned short subi[3]);
00252 #endif
00253 
00254 #endif /* !LIBVLC_FIXUPS_H */

Generated on Mon Nov 22 07:55:19 2010 for VLC by  doxygen 1.5.6