]> git.sesse.net Git - vlc/commitdiff
Fix gcc4 warnings (refs #258)
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 10 Jul 2005 08:00:25 +0000 (08:00 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 10 Jul 2005 08:00:25 +0000 (08:00 +0000)
NOTE to developers :
When you want to compare n bytes from two buffers, please use :
  memcmp( buf1, buf2, n )
rather than :
  strncmp( buf1, buf2, n )

strncmp should only be used if either of the buffers might be
nul-terminated within its first n bytes.

modules/demux/a52.c

index 9d7c8af1214e5cda3b2ae3e26b04bcbe831460f3..177cea14fb1519aa96a83ffff0b087313986ad7e 100644 (file)
@@ -85,14 +85,14 @@ static int Open( vlc_object_t * p_this )
 
     /* Check if we are dealing with a WAV file */
     if( stream_Peek( p_demux->s, &p_peek, 12 ) == 12 &&
-        !strncmp( p_peek, "RIFF", 4 ) && !strncmp( &p_peek[8], "WAVE", 4 ) )
+        !memcmp( p_peek, "RIFF", 4 ) && !memcmp( p_peek + 8, "WAVE", 4 ) )
     {
         int i_size;
 
         /* Skip the wave header */
         i_peek = 12 + 8;
         while( stream_Peek( p_demux->s, &p_peek, i_peek ) == i_peek &&
-               strncmp( p_peek + i_peek - 8, "data", 4 ) )
+               memcmp( p_peek + i_peek - 8, "data", 4 ) )
         {
             i_peek += GetDWLE( p_peek + i_peek - 4 ) + 8;
         }