Changeset 11884b884c536d7f6305ff3459f630bb458ebda2

Show
Ignore:
Timestamp:
28/05/07 22:59:43 (1 year ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1180385983 +0000
git-parent:

[11db57b55bf2da16a178b65df57e628ae7470257]

git-author:
Laurent Aimar <fenrir@videolan.org> 1180385983 +0000
Message:

Added strnlen replacement (Untested)
Revert back mp4 r20330 !

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • configure.ac

    rce39456 r11884b8  
    464464 
    465465dnl Check for usual libc functions 
    466 AC_CHECK_FUNCS(strdup strndup atof) 
     466AC_CHECK_FUNCS(strdup strndup strnlen atof) 
    467467AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)]) 
    468468AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)]) 
  • include/vlc_common.h

    r2e0409a r11884b8  
    872872#endif 
    873873 
     874#ifndef HAVE_STRNLEN 
     875#   define strnlen vlc_strnlen 
     876    VLC_EXPORT( size_t, vlc_strnlen, ( const char *, size_t ) ); 
     877#elif !defined(__PLUGIN__) 
     878#   define vlc_strnlen NULL 
     879#endif 
     880 
    874881#ifndef HAVE_STRLCPY 
    875882#   define strlcpy vlc_strlcpy 
  • modules/demux/mp4/libmp4.c

    rabcc921 r11884b8  
    6262    MP4_GET3BYTES( p_void->i_flags ) 
    6363 
    64 #define MP4_GETSTRINGZ( p_str ) \ 
    65     if( ( i_read > 0 )&&(p_peek[0] ) ) \ 
    66     { \ 
    67         p_str = calloc( sizeof( char ), __MIN( strlen( (char*)p_peek ), i_read )+1);\ 
    68         memcpy( p_str, p_peek, __MIN( strlen( (char*)p_peek ), i_read ) ); \ 
    69         p_str[__MIN( strlen( (char*)p_peek ), i_read )] = 0; \ 
    70         p_peek += strlen( (char *)p_str ) + 1; \ 
    71         i_read -= strlen( (char *)p_str ) + 1; \ 
    72     } \ 
    73     else \ 
    74     { \ 
     64#define MP4_GETSTRINGZ( p_str )         \ 
     65    if( (i_read > 0) && (p_peek[0]) )   \ 
     66    {       \ 
     67        const int __i_copy__ = strnlen( (char*)p_peek, i_read-1 );  \ 
     68        p_str = calloc( sizeof(char), __i_copy__+1 );               \ 
     69        if( __i_copy__ > 0 ) memcpy( p_str, p_peek, __i_copy__ );   \ 
     70        p_str[__i_copy__] = 0;      \ 
     71        p_peek += __i_copy__ + 1;   \ 
     72        i_read -= __i_copy__ + 1;   \ 
     73    }       \ 
     74    else    \ 
     75    {       \ 
    7576        p_str = NULL; \ 
    7677    } 
  • src/extras/libc.c

    r0e39834 r11884b8  
    114114 
    115115/***************************************************************************** 
     116 * strnlen:  
     117 *****************************************************************************/ 
     118#if !defined( HAVE_STRNLEN ) 
     119size_t vlc_strnlen( const char *psz, size_t n ) 
     120{ 
     121    const char *psz_end = memchr( psz, 0, n ); 
     122    return psz_end ? ( psz_end - psz ) : n; 
     123} 
     124#endif 
     125 
     126/***************************************************************************** 
    116127 * strcasecmp: compare two strings ignoring case 
    117128 *****************************************************************************/