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 #ifndef HAVE_REWIND
00047 # include <stdio.h> /* FILE */
00048 #endif
00049 
00050 #if !defined (HAVE_STRLCPY) || \
00051     !defined (HAVE_STRNDUP) || \
00052     !defined (HAVE_STRNLEN) || \
00053     !defined (HAVE_GETCWD)
00054 # include <stddef.h> /* size_t */
00055 #endif
00056 
00057 #ifndef HAVE_VASPRINTF
00058 # include <stdarg.h> /* va_list */
00059 #endif
00060 
00061 #ifndef HAVE_GETPID
00062 # include <sys/types.h> /* pid_t */
00063 #endif
00064 
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068 
00069 #ifndef HAVE_STRDUP
00070 char *strdup (const char *);
00071 #endif
00072 
00073 #ifndef HAVE_VASPRINTF
00074 int vasprintf (char **, const char *, va_list);
00075 #endif
00076 
00077 #ifndef HAVE_ASPRINTF
00078 int asprintf (char **, const char *, ...);
00079 #endif
00080 
00081 #ifndef HAVE_STRNLEN
00082 size_t strnlen (const char *, size_t);
00083 #endif
00084 
00085 #ifndef HAVE_STRNDUP
00086 char *strndup (const char *, size_t);
00087 #endif
00088 
00089 #ifndef HAVE_STRLCPY
00090 size_t strlcpy (char *, const char *, size_t);
00091 #endif
00092 
00093 #ifndef HAVE_STRTOF
00094 float strtof (const char *, char **);
00095 #endif
00096 
00097 #ifndef HAVE_ATOF
00098 double atof (const char *);
00099 #endif
00100 
00101 #ifndef HAVE_STRTOLL
00102 long long int strtoll (const char *, char **, int);
00103 #endif
00104 
00105 #ifndef HAVE_STRSEP
00106 char *strsep (char **, const char *);
00107 #endif
00108 
00109 #ifndef HAVE_ATOLL
00110 long long atoll (const char *);
00111 #endif
00112 
00113 #ifndef HAVE_LLDIV
00114 lldiv_t lldiv (long long, long long);
00115 #endif
00116 
00117 #ifndef HAVE_STRCASECMP
00118 int strcasecmp (const char *, const char *);
00119 #endif
00120 
00121 #ifndef HAVE_STRNCASECMP
00122 int strncasecmp (const char *, const char *, size_t);
00123 #endif
00124 
00125 #ifndef HAVE_STRCASESTR
00126 char *strcasestr (const char *, const char *);
00127 #endif
00128 
00129 #ifndef HAVE_GMTIME_R
00130 struct tm *gmtime_r (const time_t *, struct tm *);
00131 #endif
00132 
00133 #ifndef HAVE_LOCALTIME_R
00134 struct tm *localtime_r (const time_t *, struct tm *);
00135 #endif
00136 
00137 #ifndef HAVE_REWIND
00138 void rewind (FILE *);
00139 #endif
00140 
00141 #ifndef HAVE_GETCWD
00142 char *getcwd (char *buf, size_t size);
00143 #endif
00144 
00145 #ifndef HAVE_GETPID
00146 pid_t getpid (void);
00147 #endif
00148 
00149 #ifdef __cplusplus
00150 } /* extern "C" */
00151 #endif
00152 
00153 #ifndef HAVE_GETENV
00154 static inline char *getenv (const char *name)
00155 {
00156     (void)name;
00157     return NULL;
00158 }
00159 #endif
00160 
00161 /* Alignment of critical static data structures */
00162 #ifdef ATTRIBUTE_ALIGNED_MAX
00163 #   define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
00164 #else
00165 #   define ATTR_ALIGN(align)
00166 #endif
00167 
00168 #ifndef HAVE_USELOCALE
00169 #define LC_NUMERIC_MASK 0
00170 typedef void *locale_t;
00171 static inline locale_t uselocale(locale_t loc)
00172 {
00173     (void)loc;
00174     return NULL;
00175 }
00176 static inline void freelocale(locale_t loc)
00177 {
00178     (void)loc;
00179 }
00180 static inline locale_t newlocale(int mask, const char * locale, locale_t base)
00181 {
00182     (void)mask; (void)locale; (void)base;
00183     return NULL;
00184 }
00185 #endif
00186 
00187 #ifdef WIN32
00188 # include <dirent.h>
00189 # define opendir Use_utf8_opendir_or_vlc_wopendir_instead!
00190 # define readdir Use_utf8_readdir_or_vlc_wreaddir_instead!
00191 # define closedir vlc_wclosedir
00192 #endif
00193 
00194 /* libintl support */
00195 #define _(str)            vlc_gettext (str)
00196 #define N_(str)           gettext_noop (str)
00197 #define gettext_noop(str) (str)
00198 
00199 #ifndef HAVE_SWAB
00200 void swab (const void *, void *, ssize_t);
00201 #endif
00202 
00203 #endif /* !LIBVLC_FIXUPS_H */

Generated on Sat Nov 21 08:05:14 2009 for VLC by  doxygen 1.5.6