vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Tue Oct  4 
22:26:44 2011 +0300| [346ae7a9f685c9c64a4df1a7c926e82e75d041bf] | committer: 
Rémi Denis-Courmont

MP4: use strcpsn() and check one malloc()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=346ae7a9f685c9c64a4df1a7c926e82e75d041bf
---

 modules/demux/mp4/libmp4.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index cd6fe44..35ebfee 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3203,17 +3203,12 @@ static void get_token( char **ppsz_path, char 
**ppsz_token, int *pi_number )
         *pi_number = 0;
         return;
     }
-    i_len = 0;
-    while(  (*ppsz_path)[i_len] &&
-            (*ppsz_path)[i_len] != '/' && (*ppsz_path)[i_len] != '[' )
-    {
-        i_len++;
-    }
+    i_len = strcspn( *ppsz_path, "/[" );
     if( !i_len && **ppsz_path == '/' )
     {
         i_len = 1;
     }
-    *ppsz_token = malloc( i_len + 1 );
+    *ppsz_token = xmalloc( i_len + 1 );
 
     memcpy( *ppsz_token, *ppsz_path, i_len );
 

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to