1 /*****************************************************************************
2 * fixups.h: portability fixups included from config.h
3 *****************************************************************************
4 * Copyright © 1998-2007 the VideoLAN project
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
24 * This file is a collection of portability fixes
27 #ifndef LIBVLC_FIXUPS_H
28 # define LIBVLC_FIXUPS_H 1
31 # define strdup vlc_strdup
34 #ifndef HAVE_VASPRINTF
35 # define vasprintf vlc_vasprintf
39 # define asprintf vlc_asprintf
43 # define strndup vlc_strndup
47 # define strnlen vlc_strnlen
51 # define strlcpy vlc_strlcpy
55 # define atof vlc_atof
60 # define strtof( a, b ) ((float)strtod (a, b))
65 # define atoll vlc_atoll
69 # define strtoll vlc_strtoll
73 # define lldiv vlc_lldiv
77 # define scandir vlc_scandir
78 # define alphasort vlc_alphasort
82 # define getenv vlc_getenv
85 #ifndef HAVE_STRCASECMP
87 # define strcasecmp vlc_strcasecmp
89 # define strcasecmp stricmp
93 #ifndef HAVE_STRNCASECMP
94 # ifndef HAVE_STRNICMP
95 # define strncasecmp vlc_strncasecmp
97 # define strncasecmp strnicmp
101 #ifndef HAVE_STRCASESTR
102 # ifndef HAVE_STRISTR
103 # define strcasestr vlc_strcasestr
105 # define strcasestr stristr
109 #ifndef HAVE_LOCALTIME_R
110 /* If localtime_r() is not provided, we assume localtime() uses
111 * thread-specific storage. */
113 static inline struct tm *localtime_r (const time_t *timep, struct tm *result)
115 struct tm *s = localtime (timep);
122 static inline struct tm *gmtime_r (const time_t *timep, struct tm *result)
124 struct tm *s = gmtime (timep);
133 #ifndef HAVE_DIRENT_H
135 # ifndef FILENAME_MAX
136 # define FILENAME_MAX (260)
140 long d_ino; /* Always zero. */
141 unsigned short d_reclen; /* Always zero. */
142 unsigned short d_namlen; /* Length of name in d_name. */
143 char d_name[FILENAME_MAX]; /* File name. */
145 # define opendir vlc_opendir
146 # define readdir vlc_readdir
147 # define closedir vlc_closedir
148 # define rewinddir vlc_rewindir
149 # define seekdir vlc_seekdir
150 # define telldir vlc_telldir
151 VLC_EXPORT( void *, vlc_opendir, ( const char * ) );
152 VLC_EXPORT( void *, vlc_readdir, ( void * ) );
153 VLC_EXPORT( int, vlc_closedir, ( void * ) );
154 VLC_INTERNAL( void, vlc_rewinddir, ( void * ) );
155 VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) );
156 VLC_INTERNAL( long, vlc_telldir, ( void * ) );
159 #endif /* !LIBVLC_FIXUPS_H */