Commit abcc9212 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* revert the rewrite of MP4_GETSTRINGZ in the previous commit, as strnlen is a...

* revert the rewrite of MP4_GETSTRINGZ in the previous commit, as strnlen is a GNU-extension and therefore unavailable on Mac OS X and other platforms. I think this way is easier than writing an own implementation for OSX, but feel free to tell me otherwise. (closes #1213)
parent 0e80477b
...@@ -62,21 +62,19 @@ ...@@ -62,21 +62,19 @@
MP4_GET3BYTES( p_void->i_flags ) MP4_GET3BYTES( p_void->i_flags )
#define MP4_GETSTRINGZ( p_str ) \ #define MP4_GETSTRINGZ( p_str ) \
if( (i_read > 0) && (p_peek[0]) ) \ if( ( i_read > 0 )&&(p_peek[0] ) ) \
{ \ { \
const int __i_copy__ = strnlen( (char*)p_peek, i_read-1 ); \ p_str = calloc( sizeof( char ), __MIN( strlen( (char*)p_peek ), i_read )+1);\
p_str = calloc( sizeof(char), __i_copy__+1 ); \ memcpy( p_str, p_peek, __MIN( strlen( (char*)p_peek ), i_read ) ); \
if( __i_copy__ > 0 ) memcpy( p_str, p_peek, __i_copy__ ); \ p_str[__MIN( strlen( (char*)p_peek ), i_read )] = 0; \
p_str[__i_copy__] = 0; \ p_peek += strlen( (char *)p_str ) + 1; \
p_peek += __i_copy__ + 1; \ i_read -= strlen( (char *)p_str ) + 1; \
i_read -= __i_copy__ + 1; \
} \ } \
else \ else \
{ \ { \
p_str = NULL; \ p_str = NULL; \
} }
#define MP4_READBOX_ENTER( MP4_Box_data_TYPE_t ) \ #define MP4_READBOX_ENTER( MP4_Box_data_TYPE_t ) \
int64_t i_read = p_box->i_size; \ int64_t i_read = p_box->i_size; \
uint8_t *p_peek, *p_buff; \ uint8_t *p_peek, *p_buff; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment