Commit a913906b authored by Thomas Guillem's avatar Thomas Guillem

se/archive: use readdir_helper

parent 4ce1905d
......@@ -505,6 +505,8 @@ static int ReadDir( stream_directory_t* p_directory, input_item_node_t* p_node )
private_sys_t* p_sys = p_directory->p_sys;
libarchive_t* p_arc = p_sys->p_archive;
struct vlc_readdir_helper rdh;
vlc_readdir_helper_init( &rdh, p_directory, p_node);
struct archive_entry* entry;
int archive_status;
......@@ -517,28 +519,22 @@ static int ReadDir( stream_directory_t* p_directory, input_item_node_t* p_node )
char* mrl = vlc_stream_extractor_CreateMRL( p_directory, path );
if( unlikely( !mrl ) )
return VLC_ENOMEM;
input_item_t* p_item = input_item_New( mrl, path );
break;
if( vlc_readdir_helper_additem( &rdh, mrl, path, NULL, ITEM_TYPE_FILE,
ITEM_LOCAL ) )
{
free( mrl );
break;
}
free( mrl );
if( unlikely( !p_item ) )
return VLC_ENOMEM;
input_item_CopyOptions( p_node->p_item, p_item );
input_item_node_AppendItem( p_node, p_item );
input_item_Release( p_item );
if( archive_read_data_skip( p_arc ) )
break;
}
if( archive_status != ARCHIVE_EOF )
return VLC_EGENERIC;
return VLC_SUCCESS;
vlc_readdir_helper_finish( &rdh, archive_status == ARCHIVE_EOF );
return archive_status == ARCHIVE_EOF ? VLC_SUCCESS : VLC_EGENERIC;
}
static ssize_t Read( stream_extractor_t *p_extractor, void* p_data, size_t i_size )
......
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