memcpy( p_guid->v4, p_data + 8, 8 );
}
-int ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 )
+bool ASF_CmpGUID( const guid_t *p_guid1, const guid_t *p_guid2 )
{
if( (p_guid1->v1 != p_guid2->v1 )||
(p_guid1->v2 != p_guid2->v2 )||
(p_guid1->v3 != p_guid2->v3 )||
( memcmp( p_guid1->v4, p_guid2->v4,8 )) )
{
- return( 0 );
+ return false;
}
- return( 1 ); /* match */
+ return true;
}
/****************************************************************************
const uint8_t *p_peek;
if( stream_Peek( s, &p_peek, 24 ) < 24 )
- {
- return( VLC_EGENERIC );
- }
+ return VLC_EGENERIC;
+
ASF_GetGUID( &p_common->i_object_id, p_peek );
p_common->i_object_size = GetQWLE( p_peek + 16 );
p_common->i_object_pos = stream_Tell( s );
p_common->i_object_size );
#endif
- return( VLC_SUCCESS );
+ return VLC_SUCCESS;
}
static int ASF_NextObject( stream_t *s, asf_object_t *p_obj )
if( p_obj == NULL )
{
if( ASF_ReadObjectCommon( s, &obj ) )
- {
- return( VLC_EGENERIC );
- }
+ return VLC_EGENERIC;
+
p_obj = &obj;
}
if( p_obj->common.i_object_size <= 0 )
- {
return VLC_EGENERIC;
- }
+
if( p_obj->common.p_father &&
p_obj->common.p_father->common.i_object_size != 0 )
{
static void ASF_FreeObject_Null( asf_object_t *pp_obj )
{
VLC_UNUSED(pp_obj);
- return;
}
static int ASF_ReadObject_Header( stream_t *s, asf_object_t *p_obj )
const uint8_t *p_peek;
if( ( i_peek = stream_Peek( s, &p_peek, 30 ) ) < 30 )
- {
- return( VLC_EGENERIC );
- }
+ return VLC_EGENERIC;
p_hdr->i_sub_object_count = GetDWLE( p_peek + 24 );
p_hdr->i_reserved1 = p_peek[28];
break;
}
if( ASF_NextObject( s, p_subobj ) ) /* Go to the next object */
- {
break;
- }
}
return VLC_SUCCESS;
}
const uint8_t *p_peek;
if( ( i_peek = stream_Peek( s, &p_peek, 50 ) ) < 50 )
- {
return VLC_EGENERIC;
- }
+
ASF_GetGUID( &p_data->i_file_id, p_peek + 24 );
p_data->i_total_data_packets = GetQWLE( p_peek + 40 );
p_data->i_reserved = GetWLE( p_peek + 48 );
const uint8_t *p_peek;
int i;
+ /* We just ignore error on the index */
if( stream_Peek( s, &p_peek, p_index->i_object_size ) <
__MAX( (int)p_index->i_object_size, 56 ) )
- {
- /* Just ignore */
return VLC_SUCCESS;
- }
ASF_GetGUID( &p_index->i_file_id, p_peek + 24 );
p_index->i_index_entry_time_interval = GetQWLE( p_peek + 40 );
const uint8_t *p_peek;
if( ( i_peek = stream_Peek( s, &p_peek, 104 ) ) < 104 )
- {
return VLC_EGENERIC;
- }
+
ASF_GetGUID( &p_fp->i_file_id, p_peek + 24 );
p_fp->i_file_size = GetQWLE( p_peek + 40 );
p_fp->i_creation_date = GetQWLE( p_peek + 48 );
unsigned int j;
#endif
- p_meta->i_record_entries_count = 0;
- p_meta->record = 0;
-
if( stream_Peek( s, &p_peek, p_meta->i_object_size ) <
__MAX( (int)p_meta->i_object_size, 26 ) )
- {
return VLC_EGENERIC;
- }
+
+ p_meta->i_record_entries_count = 0;
+ p_meta->record = NULL;
i_peek = 24;
i_entries = GetWLE( p_peek + i_peek ); i_peek += 2;
const uint8_t *p_peek;
if( ( i_peek = stream_Peek( s, &p_peek, p_sp->i_object_size ) ) < 78 )
- {
return VLC_EGENERIC;
- }
ASF_GetGUID( &p_sp->i_stream_type, p_peek + 24 );
ASF_GetGUID( &p_sp->i_error_correction_type, p_peek + 40 );
unsigned int i_codec;
if( ( i_peek = stream_Peek( s, &p_peek, p_cl->i_object_size ) ) < 44 )
- {
return VLC_EGENERIC;
- }
ASF_GetGUID( &p_cl->i_reserved, p_peek + 24 );
p_cl->i_codec_entries_count = GetWLE( p_peek + 40 );
size_t i_ibl, i_obl, i_len;
if( ( i_peek = stream_Peek( s, &p_peek, p_cd->i_object_size ) ) < 34 )
- {
return VLC_EGENERIC;
- }
cd = vlc_iconv_open("UTF-8", "UTF-16LE");
- if ( cd == (vlc_iconv_t)-1 ) {
+ if( cd == (vlc_iconv_t)-1 )
+ {
msg_Err( s, "vlc_iconv_open failed" );
return VLC_EGENERIC;
}
}
static void ASF_FreeObject_stream_bitrate_properties( asf_object_t *p_obj)
{
+ VLC_UNUSED(p_obj);
}
static int ASF_ReadObject_extended_stream_properties( stream_t *s,
int i_index;
if( !p_obj )
- return( 0 );
+ return 0;
memset( p_obj, 0, sizeof( *p_obj ) );
p_father->common.p_last = p_obj;
}
- return( i_result );
+ return i_result;
}
static void ASF_FreeObject( stream_t *s, asf_object_t *p_obj )
int i_index;
asf_object_t *p_child;
- if( !p_obj ) return;
+ if( !p_obj )
+ return;
/* Free all child object */
p_child = p_obj->common.p_first;
(ASF_Object_Function[i_index].ASF_FreeObject_function)( p_obj );
}
free( p_obj );
- return;
}
/*****************************************************************************
}
if( ASF_NextObject( s, p_obj ) ) /* Go to the next object */
- {
break;
- }
}
if( p_root->p_hdr != NULL && p_root->p_data != NULL )
int i_count;
asf_object_t *p_child;
- if( !p_obj ) return( 0 );
+ if( !p_obj )
+ return 0;
i_count = 0;
p_child = p_obj->common.p_first;
while( p_child )
{
if( ASF_CmpGUID( &p_child->common.i_object_id, p_guid ) )
- {
i_count++;
- }
+
p_child = p_child->common.p_next;
}
- return( i_count );
+ return i_count;
}
void *__ASF_FindObject( asf_object_t *p_obj, const guid_t *p_guid,
if( ASF_CmpGUID( &p_child->common.i_object_id, p_guid ) )
{
if( i_number == 0 )
- {
- /* We found it */
- return( p_child );
- }
+ return p_child;
i_number--;
}
p_child = p_child->common.p_next;
}
- return( NULL );
+ return NULL;
}