/*****************************************************************************
- * asprintf.c: asprintf() replacement
+ * asprintf.c: GNU asprintf() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * atof.c: atof replacement
+ * atof.c: C atof() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * atoll.c: atoll replacement
+ * atoll.c: C atoll() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
--- /dev/null
+/*****************************************************************************
+ * gmtime_r.c: POSIX gmtime_r() replacement
+ *****************************************************************************
+ * Copyright © 1998-2008 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <time.h>
+
+struct tm *gmtime_r (const time_t *timep, struct tm *result)
+{
+ struct tm *s = gmtime (timep);
+ if (s == NULL)
+ return NULL;
+
+ *result = *s;
+ return result;
+}
/*****************************************************************************
- * lldiv.c: lldiv replacement
+ * lldiv.c: C lldiv() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
--- /dev/null
+/*****************************************************************************
+ * localtime_r.c: POSIX localtime_r() replacement
+ *****************************************************************************
+ * Copyright © 1998-2008 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <time.h>
+
+/* If localtime_r() is not provided, we assume localtime() uses
+ * thread-specific storage. */
+struct tm *localtime_r (const time_t *timep, struct tm *result)
+{
+ struct tm *s = localtime (timep);
+ if (s == NULL)
+ return NULL;
+
+ *result = *s;
+ return result;
+}
--- /dev/null
+/*****************************************************************************
+ * rewind.c: C rewind replacement
+ *****************************************************************************
+ * Copyright © 1998-2008 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+void rewind (FILE *stream)
+{
+ fseek (stream, 0L, SEEK_SET);
+ clearerr (stream);
+}
--- /dev/null
+/*****************************************************************************
+ * strcasecmp.c: POSIX strcasecmp() replacement
+ *****************************************************************************
+ * Copyright © 1998-2008 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+
+int strcasecmp (const char *s1, const char *s2)
+{
+#ifdef HAVE_STRICMP
+ return stricmp (s1, s2);
+#else
+ for (size_t i = 0;; i++)
+ {
+ int d = tolower (s1[i]) - tolower (s2[i]);
+ if (d || !s1[i])
+ return d;
+ assert (s2[i]);
+ }
+#endif
+}
--- /dev/null
+/*****************************************************************************
+ * strcasestr.c: GNU strcasestr() replacement
+ *****************************************************************************
+ * Copyright © 2002-2006 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+
+int strcasecmp (const char *psz_big, const char *psz_little)
+{
+ char *p_pos = (char *)psz_big;
+
+ if( !*psz_little ) return p_pos;
+
+ while( *p_pos )
+ {
+ if( toupper( *p_pos ) == toupper( *psz_little ) )
+ {
+ char * psz_cur1 = p_pos + 1;
+ char * psz_cur2 = (char *)psz_little + 1;
+ while( *psz_cur1 && *psz_cur2 &&
+ toupper( *psz_cur1 ) == toupper( *psz_cur2 ) )
+ {
+ psz_cur1++;
+ psz_cur2++;
+ }
+ if( !*psz_cur2 ) return p_pos;
+ }
+ p_pos++;
+ }
+ return NULL;
+}
/*****************************************************************************
- * strdup.c: strdup replacement
+ * strdup.c: POSIX strdup() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * strlcpy.c: BSD strlcpy replacement
+ * strlcpy.c: BSD strlcpy() replacement
*****************************************************************************
* Copyright © 2006 Rémi Denis-Courmont
*
--- /dev/null
+/*****************************************************************************
+ * strncasecmp.c: POSIX strncasecmp() replacement
+ *****************************************************************************
+ * Copyright © 1998-2008 the VideoLAN project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+
+int strncasecmp (const char *s1, const char *s2)
+{
+#ifdef HAVE_STRNICMP
+ return strnicmp (s1, s2);
+#else
+ for (size_t i = 0; i < n; i++)
+ {
+ int d = tolower (s1[i]) - tolower (s2[i]);
+ if (d || !s1[i])
+ return d;
+ assert (s2[i]);
+ }
+ return 0;
+#endif
+}
/*****************************************************************************
- * strndup.c: strndup replacement
+ * strndup.c: POSIX strndup() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * strnlen.c: strnlen replacement
+ * strnlen.c: POSIX strnlen() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * strsep.c: BSD strsep replacement
+ * strsep.c: BSD strsep() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * strtof.c: strtof replacement
+ * strtof.c: C strtof() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * strtoll.c: strtoll replacement
+ * strtoll.c: C strtoll() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
/*****************************************************************************
- * vasprintf.c: vasprintf replacement
+ * vasprintf.c: GNU vasprintf() replacement
*****************************************************************************
* Copyright © 1998-2008 the VideoLAN project
*
need_libc=false
dnl Check for usual libc functions
-AC_CHECK_FUNCS([gettimeofday isatty swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex getenv putenv setenv gmtime_r ctime_r localtime_r lrintf daemon fork lstat posix_fadvise posix_madvise uselocale])
-AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
-AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
-AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
+AC_CHECK_FUNCS([gettimeofday isatty swab sigrelse getpwuid_r memalign posix_memalign if_nametoindex getenv putenv setenv ctime_r lrintf daemon fork lstat posix_fadvise posix_madvise uselocale])
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(fcntl)
-AC_REPLACE_FUNCS([asprintf atof atoll lldiv strdup strlcpy strndup strnlen strsep strtof strtoll vasprintf])
+AC_REPLACE_FUNCS([asprintf atof atoll gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtoll vasprintf])
+AC_CHECK_FUNCS([stricmp strnicmp])
dnl Check for Linux system calls
AC_CHECK_FUNCS([vmsplice])
#define VLC_UNUSED(x) (void)(x)
/* Stuff defined in src/extras/libc.c */
-VLC_EXPORT( char *, vlc_strcasestr, ( const char *s1, const char *s2 ) LIBVLC_USED );
#if defined(WIN32) || defined(UNDER_CE)
/* win32, cl and icl support */
#endif
#ifndef HAVE_STRCASECMP
-# ifndef HAVE_STRICMP
-# include <ctype.h>
-static inline int strcasecmp (const char *s1, const char *s2)
-{
- for (size_t i = 0;; i++)
- {
- int d = tolower (s1[i]) - tolower (s2[i]);
- if (d || !s1[i]) return d;
- }
- return 0;
-}
-# else
-# define strcasecmp stricmp
-# endif
+int strcasecmp (const char *, const char *);
#endif
#ifndef HAVE_STRNCASECMP
-# ifndef HAVE_STRNICMP
-# include <ctype.h>
-static inline int strncasecmp (const char *s1, const char *s2, size_t n)
-{
- for (size_t i = 0; i < n; i++)
- {
- int d = tolower (s1[i]) - tolower (s2[i]);
- if (d || !s1[i]) return d;
- }
- return 0;
-}
-# else
-# define strncasecmp strnicmp
-# endif
+int strncasecmp (const char *, const char *, size_t);
#endif
#ifndef HAVE_STRCASESTR
-# ifndef HAVE_STRISTR
-# define strcasestr vlc_strcasestr
-# else
-# define strcasestr stristr
-# endif
+char *strcasestr (const char *, const char *
#endif
-#ifndef HAVE_LOCALTIME_R
-/* If localtime_r() is not provided, we assume localtime() uses
- * thread-specific storage. */
+#ifndef HAVE_GMTIME_R
# include <time.h>
-static inline struct tm *localtime_r (const time_t *timep, struct tm *result)
-{
- struct tm *s = localtime (timep);
- if (s == NULL)
- return NULL;
+struct tm *gmtime_r (const time_t *, struct tm *);
+#endif
- *result = *s;
- return result;
-}
-static inline struct tm *gmtime_r (const time_t *timep, struct tm *result)
-{
- struct tm *s = gmtime (timep);
- if (s == NULL)
- return NULL;
+#ifndef HAVE_LOCALTIME_R
+# include <time.h>
+struct tm *localtime_r (const time_t *, struct tm *);
+#endif
- *result = *s;
- return result;
-}
+#ifndef HAVE_REWIND
+# include <stdio.h>
+void rewind (FILE *);
#endif
/* Alignment of critical static data structures */
#define N_(str) gettext_noop (str)
#define gettext_noop(str) (str)
-#ifdef UNDER_CE
-static inline void rewind ( FILE *stream )
-{
- fseek(stream, 0L, SEEK_SET);
- clearerr(stream);
-}
-#endif
-
#endif /* !LIBVLC_FIXUPS_H */
msg_Dbg( &sys.demuxer, "| | + family=%d", *(uint32*)uid->GetBuffer() );
}
-#if defined( HAVE_GMTIME_R )
else if( MKV_IS_ID( l, KaxDateUTC ) )
{
KaxDateUTC &date = *(KaxDateUTC*)l;
msg_Dbg( &sys.demuxer, "| | + Date=%s", psz_date_utc );
}
}
-#endif
else if( MKV_IS_ID( l, KaxChapterTranslate ) )
{
KaxChapterTranslate *p_trans = static_cast<KaxChapterTranslate*>( l );
# include <windows.h>
#endif
-/******************************************************************************
- * strcasestr: find a substring (little) in another substring (big)
- * Case sensitive. Return NULL if not found, return big if little == null
- *****************************************************************************/
-char * vlc_strcasestr( const char *psz_big, const char *psz_little )
-{
-#if defined (HAVE_STRCASESTR) || defined (HAVE_STRISTR)
- return strcasestr (psz_big, psz_little);
-#else
- char *p_pos = (char *)psz_big;
-
- if( !psz_big || !psz_little || !*psz_little ) return p_pos;
-
- while( *p_pos )
- {
- if( toupper( *p_pos ) == toupper( *psz_little ) )
- {
- char * psz_cur1 = p_pos + 1;
- char * psz_cur2 = (char *)psz_little + 1;
- while( *psz_cur1 && *psz_cur2 &&
- toupper( *psz_cur1 ) == toupper( *psz_cur2 ) )
- {
- psz_cur1++;
- psz_cur2++;
- }
- if( !*psz_cur2 ) return p_pos;
- }
- p_pos++;
- }
- return NULL;
-#endif
-}
-
/*****************************************************************************
* vlc_*dir_wrapper: wrapper under Windows to return the list of drive letters
* when called with an empty argument or just '\'
vlc_sd_Start
vlc_sd_Stop
vlc_sendmsg
-vlc_strcasestr
vlc_testcancel
vlc_thread_create
__vlc_thread_join