[vlc-devel] [PATCH] dsm: mark directories in readdir

Petri Hintukainen phintuka at users.sourceforge.net
Thu Mar 19 17:30:07 CET 2015


On to, 2015-03-19 at 16:05 +0100, Thomas Guillem wrote:
> 
> On Wed, Mar 18, 2015, at 09:21, Petri Hintukainen wrote:
> > From: Petri Hintukainen <phintuka at gmail.com>
> > 
> > ---
> >  modules/access/dsm/access.c | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
> > index 6e30adc..ab03493 100644
> > --- a/modules/access/dsm/access.c
> > +++ b/modules/access/dsm/access.c
> > @@ -108,7 +108,7 @@ static int login( access_t *p_access );
> >  static void backslash_path( vlc_url_t *p_url );
> >  static bool get_path( access_t *p_access );
> >  static int add_item( access_t *p_access,  input_item_node_t *p_node,
> > -                     const char *psz_name );
> > +                     const char *psz_name, int i_type );
> >  
> >  struct access_sys_t
> >  {
> > @@ -560,7 +560,7 @@ static int Control( access_t *p_access, int i_query,
> > va_list args )
> >  }
> >  
> >  static int add_item( access_t *p_access, input_item_node_t *p_node,
> > -                     const char *psz_name )
> > +                     const char *psz_name, int i_type )
> >  {
> >      access_sys_t *p_sys = p_access->p_sys;
> >      input_item_t *p_item;
> > @@ -571,7 +571,7 @@ static int add_item( access_t *p_access,
> > input_item_node_t *p_node,
> >      if( i_ret == -1 )
> >          return VLC_ENOMEM;
> >  
> > -    p_item = input_item_New( psz_uri, psz_name );
> > +    p_item = input_item_NewWithType( psz_uri, psz_name, 0, NULL, 0, -1,
> > i_type );
> >      free( psz_uri );
> >      if( p_item == NULL )
> >          return VLC_ENOMEM;
> > @@ -623,7 +623,7 @@ static int BrowseShare( access_t *p_access,
> > input_item_node_t *p_node )
> >          if( psz_name[strlen( psz_name ) - 1] == '$')
> >              continue;
> >  
> > -        i_ret = add_item( p_access, p_node, psz_name );
> > +        i_ret = add_item( p_access, p_node, psz_name, ITEM_TYPE_UNKNOWN
> > );
> 
> It should be ITEM_TYPE_DIRECTORY here since the item is a samba share.

Probably.
There were printers etc. in the list of shares so I left it as it was
(default is ITEM_TYPE_UNKNOWN).

> >          if( i_ret != VLC_SUCCESS )
> >              goto error;
> >      }
> > @@ -644,6 +644,7 @@ static int BrowseDirectory( access_t *p_access,
> > input_item_node_t *p_node )
> >      const char     *psz_name;
> >      size_t          files_count;
> >      int             i_ret;
> > +    int             i_type;
> >  
> >      if( p_sys->psz_path != NULL )
> >      {
> > @@ -675,7 +676,9 @@ static int BrowseDirectory( access_t *p_access,
> > input_item_node_t *p_node )
> >          if( !strcmp( psz_name, ".") || !strcmp( psz_name, "..") )
> >              continue;
> >  
> > -        i_ret = add_item( p_access, p_node, psz_name );
> > +        i_type = smb_stat_get( st, SMB_STAT_ISDIR ) ?
> > ITEM_TYPE_DIRECTORY : ITEM_TYPE_UNKNOWN;
> > +
> > +        i_ret = add_item( p_access, p_node, psz_name, i_type );
> >          if( i_ret != VLC_SUCCESS )
> >              goto error;
> >      }
> > -- 
> > 2.1.0
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel





More information about the vlc-devel mailing list