]> git.sesse.net Git - vlc/blobdiff - modules/demux/asf/libasf.c
NIH syndrome cure (2)
[vlc] / modules / demux / asf / libasf.c
index 3cb42f3191b087768e05ad9b364d81fb02ce6327..144ce645e4f3dc7e44e403f3a582beae61601e5d 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
-#include <stdio.h>
-#include <stdlib.h>                                      /* malloc(), free() */
 
 #include <vlc_demux.h>
 
@@ -89,7 +91,7 @@ static int ASF_ReadObjectCommon( stream_t *s, asf_object_t *p_obj )
 
 #ifdef ASF_DEBUG
     msg_Dbg( s,
-             "found object guid: " GUID_FMT " size:"I64Fd,
+             "found object guid: " GUID_FMT " size:%"PRId64,
              GUID_PRINT( p_common->i_object_id ),
              p_common->i_object_size );
 #endif
@@ -132,6 +134,7 @@ static int ASF_NextObject( stream_t *s, asf_object_t *p_obj )
 
 static void ASF_FreeObject_Null( asf_object_t *pp_obj )
 {
+    VLC_UNUSED(pp_obj);
     return;
 }
 
@@ -199,7 +202,7 @@ static int ASF_ReadObject_Data( stream_t *s, asf_object_t *p_obj )
 #ifdef ASF_DEBUG
     msg_Dbg( s,
              "read \"data object\" file_id:" GUID_FMT " total data packet:"
-             I64Fd" reserved:%d",
+             "%"PRId64" reserved:%d",
              GUID_PRINT( p_data->i_file_id ),
              p_data->i_total_data_packets,
              p_data->i_reserved );
@@ -230,7 +233,7 @@ static int ASF_ReadObject_Index( stream_t *s, asf_object_t *p_obj )
 #ifdef ASF_DEBUG
     msg_Dbg( s,
             "read \"index object\" file_id:" GUID_FMT
-            " index_entry_time_interval:"I64Fd" max_packet_count:%d "
+            " index_entry_time_interval:%"PRId64" max_packet_count:%d "
             "index_entry_count:%ld",
             GUID_PRINT( p_index->i_file_id ),
             p_index->i_index_entry_time_interval,
@@ -268,7 +271,7 @@ static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj )
     int           i_peek;
     const uint8_t *p_peek;
 
-    if( ( i_peek = stream_Peek( s, &p_peek,  104) ) < 104 )
+    if( ( i_peek = stream_Peek( s, &p_peek,  104 ) ) < 104 )
     {
        return VLC_EGENERIC;
     }
@@ -287,10 +290,10 @@ static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj )
 #ifdef ASF_DEBUG
     msg_Dbg( s,
             "read \"file properties object\" file_id:" GUID_FMT
-            " file_size:"I64Fd" creation_date:"I64Fd" data_packets_count:"
-            I64Fd" play_duration:"I64Fd" send_duration:"I64Fd" preroll:"
-            I64Fd" flags:%d min_data_packet_size:%d max_data_packet_size:%d "
-            "max_bitrate:%d",
+            " file_size:%"PRId64" creation_date:%"PRId64" data_packets_count:"
+            "%"PRId64" play_duration:%"PRId64" send_duration:%"PRId64" preroll:%"PRId64
+            " flags:%d min_data_packet_size:%d "
+            " max_data_packet_size:%d max_bitrate:%d",
             GUID_PRINT( p_fp->i_file_id ), p_fp->i_file_size,
             p_fp->i_creation_date, p_fp->i_data_packets_count,
             p_fp->i_play_duration, p_fp->i_send_duration,
@@ -310,10 +313,10 @@ static void ASF_FreeObject_metadata( asf_object_t *p_obj )
 
     for( i = 0; i < p_meta->i_record_entries_count; i++ )
     {
-        if( p_meta->record[i].psz_name ) free( p_meta->record[i].psz_name );
-        if( p_meta->record[i].p_data ) free( p_meta->record[i].p_data );
+        free( p_meta->record[i].psz_name );
+        free( p_meta->record[i].p_data );
     }
-    if( p_meta->record ) free( p_meta->record );
+    free( p_meta->record );
 }
 
 static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
@@ -431,7 +434,7 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
             msg_Dbg( s, "  - %s (%i bytes)",
                      p_rec->psz_name, p_rec->i_data );
         else
-            msg_Dbg( s, "  - %s="I64Fd,
+            msg_Dbg( s, "  - %s=%"PRId64,
                      p_rec->psz_name, p_rec->i_val );
     }
 #endif
@@ -572,7 +575,7 @@ static int ASF_ReadObject_stream_properties( stream_t *s, asf_object_t *p_obj )
 #ifdef ASF_DEBUG
     msg_Dbg( s,
             "read \"stream Properties object\" stream_type:" GUID_FMT
-            " error_correction_type:" GUID_FMT " time_offset:"I64Fd
+            " error_correction_type:" GUID_FMT " time_offset:%"PRId64
             " type_specific_data_length:%d error_correction_data_length:%d"
             " flags:0x%x stream_number:%d",
             GUID_PRINT( p_sp->i_stream_type ),
@@ -817,10 +820,10 @@ static int ASF_ReadObject_language_list(stream_t *s, asf_object_t *p_obj)
     }
 
 #ifdef ASF_DEBUG
-    msg_Dbg( s, "read \"language list object\" %d entries", 
+    msg_Dbg( s, "read \"language list object\" %d entries",
              p_ll->i_language );
     for( i = 0; i < p_ll->i_language; i++ )
-        msg_Dbg( s, "  - '%s'", 
+        msg_Dbg( s, "  - '%s'",
                  p_ll->ppsz_language[i] );
 #endif
     return VLC_SUCCESS;
@@ -868,7 +871,7 @@ static int ASF_ReadObject_stream_bitrate_properties( stream_t *s,
     {
         msg_Dbg( s,"  - stream=%d bitrate=%d",
                  p_sb->bitrate[i].i_stream_number,
-                 p_sb->bitrate[i].i_avg_bitrate ); 
+                 p_sb->bitrate[i].i_avg_bitrate );
     }
 #endif
     return VLC_SUCCESS;
@@ -947,7 +950,7 @@ static int ASF_ReadObject_extended_stream_properties( stream_t *s,
         asf_object_t *p_sp;
         /* Cannot fail as peek succeed */
         stream_Read( s, NULL, p_data - p_peek );
-        
         p_sp = malloc( sizeof( asf_object_t ) );
 
         if( ASF_ReadObject( s, p_sp, NULL ) )
@@ -963,7 +966,7 @@ static int ASF_ReadObject_extended_stream_properties( stream_t *s,
 
 #ifdef ASF_DEBUG
     msg_Dbg( s, "read \"extended stream properties object\":" );
-    msg_Dbg( s, "  - start="I64Fd" end="I64Fd,
+    msg_Dbg( s, "  - start=%"PRId64" end=%"PRId64,
              p_esp->i_start_time, p_esp->i_end_time );
     msg_Dbg( s, "  - data bitrate=%d buffer=%d initial fullness=%d",
              p_esp->i_data_bitrate,
@@ -977,7 +980,7 @@ static int ASF_ReadObject_extended_stream_properties( stream_t *s,
     msg_Dbg( s, "  - flags=0x%x", p_esp->i_flags );
     msg_Dbg( s, "  - stream number=%d language=%d",
              p_esp->i_stream_number, p_esp->i_language_index );
-    msg_Dbg( s, "  - average time per frame="I64Fd,
+    msg_Dbg( s, "  - average time per frame=%"PRId64,
              p_esp->i_average_time_per_frame );
     msg_Dbg( s, "  - stream name count=%d", p_esp->i_stream_name_count );
     for( i = 0; i < p_esp->i_stream_name_count; i++ )
@@ -1027,7 +1030,7 @@ static int ASF_ReadObject_advanced_mutual_exclusion( stream_t *s,
         p_ae->pi_stream_number[i] = GetWLE( p_data );
         p_data += 2;
     }
-        
 #ifdef ASF_DEBUG
     msg_Dbg( s, "read \"advanced mutual exclusion object\"" );
     for( i = 0; i < p_ae->i_stream_number_count; i++ )
@@ -1156,7 +1159,7 @@ static int ASF_ReadObject_extended_content_description( stream_t *s,
         else if( i_type == 4 )
         {
             /* QWord */
-            asprintf( &p_ec->ppsz_value[i], I64Fd, GetQWLE(p_data));
+            asprintf( &p_ec->ppsz_value[i], "%"PRId64, GetQWLE(p_data));
         }
         else if( i_type == 5 )
         {
@@ -1167,7 +1170,7 @@ static int ASF_ReadObject_extended_content_description( stream_t *s,
             p_ec->ppsz_value[i] = NULL;
 
         p_data += i_size;
-        
 
 
 #undef GETSTRINGW
@@ -1454,7 +1457,7 @@ static void ASF_ObjectDumpDebug( vlc_object_t *p_obj,
         str[i * 5] = '|';
     }
     snprintf( str + 5*i_level, 1024,
-             "+ '%s' GUID "GUID_FMT" size:"I64Fu"pos:"I64Fu,
+             "+ '%s' GUID "GUID_FMT" size:%"PRIu64"pos:%"PRIu64,
              psz_name,
              GUID_PRINT( p_node->i_object_id ),
              p_node->i_object_size, p_node->i_object_pos );