Changeset 11884b884c536d7f6305ff3459f630bb458ebda2
- 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
| rce39456 |
r11884b8 |
|
| 464 | 464 | |
|---|
| 465 | 465 | dnl Check for usual libc functions |
|---|
| 466 | | AC_CHECK_FUNCS(strdup strndup atof) |
|---|
| | 466 | AC_CHECK_FUNCS(strdup strndup strnlen atof) |
|---|
| 467 | 467 | AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)]) |
|---|
| 468 | 468 | AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)]) |
|---|
| r2e0409a |
r11884b8 |
|
| 872 | 872 | #endif |
|---|
| 873 | 873 | |
|---|
| | 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 | |
|---|
| 874 | 881 | #ifndef HAVE_STRLCPY |
|---|
| 875 | 882 | # define strlcpy vlc_strlcpy |
|---|
| rabcc921 |
r11884b8 |
|
| 62 | 62 | MP4_GET3BYTES( p_void->i_flags ) |
|---|
| 63 | 63 | |
|---|
| 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 | { \ |
|---|
| 75 | 76 | p_str = NULL; \ |
|---|
| 76 | 77 | } |
|---|
| r0e39834 |
r11884b8 |
|
| 114 | 114 | |
|---|
| 115 | 115 | /***************************************************************************** |
|---|
| | 116 | * strnlen: |
|---|
| | 117 | *****************************************************************************/ |
|---|
| | 118 | #if !defined( HAVE_STRNLEN ) |
|---|
| | 119 | size_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 | /***************************************************************************** |
|---|
| 116 | 127 | * strcasecmp: compare two strings ignoring case |
|---|
| 117 | 128 | *****************************************************************************/ |
|---|