[vlc-devel] [RFC PATCH 4/8] dsm: only one function to browse share and directory
Thomas Guillem
thomas at gllm.fr
Thu Nov 27 12:00:14 CET 2014
---
modules/access/dsm/access.c | 19 +++----------------
modules/access/dsm/common.c | 19 +++++++++++++++----
modules/access/dsm/common.h | 4 +---
3 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 5ec3b2a..50dc0f7 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -194,20 +194,12 @@ static int AddToNode( void *p_ctx, input_item_t *p_item )
: VLC_EGENERIC;
}
-static int BrowseShare( access_t *p_access, input_item_node_t *p_node )
+static int Browse( access_t *p_access, input_item_node_t *p_node )
{
bdsm_item_cb_t cb;
cb.pf_add_item = AddToNode;
cb.p_ctx = p_node;
- return bdsm_BrowseShare( p_access->p_sys, &cb, p_node->p_item->psz_uri );
-}
-
-static int BrowseDirectory( access_t *p_access, input_item_node_t *p_node )
-{
- bdsm_item_cb_t cb;
- cb.pf_add_item = AddToNode;
- cb.p_ctx = p_node;
- return bdsm_BrowseDirectory( p_access->p_sys, &cb, p_node->p_item->psz_uri );
+ return bdsm_Browse( p_access->p_sys, &cb, p_node->p_item->psz_uri );
}
static int BrowserControl( access_t *p_access, int i_query, va_list args )
@@ -238,12 +230,7 @@ static int BrowserControl( access_t *p_access, int i_query, va_list args )
static int BrowserInit( access_t *p_access )
{
- access_sys_t *p_sys = p_access->p_sys;
-
- if( p_sys->psz_share == NULL )
- p_access->pf_readdir = BrowseShare;
- else
- p_access->pf_readdir = BrowseDirectory;
+ p_access->pf_readdir = Browse;
p_access->pf_control = BrowserControl;
return VLC_SUCCESS;
diff --git a/modules/access/dsm/common.c b/modules/access/dsm/common.c
index 2b566d4..5fb36ad 100644
--- a/modules/access/dsm/common.c
+++ b/modules/access/dsm/common.c
@@ -40,6 +40,8 @@ static void get_credentials( bdsm_sys_t *p_sys );
static int login( bdsm_sys_t *p_sys, bdsm_login_cb_t *p_login_cb );
static int add_item( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
const char *psz_parent_uri, const char *psz_name );
+static int browse_share( bdsm_sys_t *, bdsm_item_cb_t *, const char * );
+static int browse_directory( bdsm_sys_t *, bdsm_item_cb_t *, const char * );
/* get ip address/path/creds, then connects and try to authenticate */
int bdsm_Init( bdsm_sys_t *p_sys, vlc_object_t *p_obj )
@@ -148,8 +150,17 @@ void bdsm_SplitDomainLogin( char **psz_login, char **psz_domain )
}
}
-int bdsm_BrowseShare( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
- const char *psz_uri )
+int bdsm_Browse( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
+ const char *psz_uri )
+{
+ if( p_sys->psz_share == NULL )
+ return browse_share( p_sys, p_cb, psz_uri );
+ else
+ return browse_directory( p_sys, p_cb, psz_uri );
+}
+
+static int browse_share( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
+ const char *psz_uri )
{
smb_share_list shares;
const char *psz_name;
@@ -179,8 +190,8 @@ int bdsm_BrowseShare( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
return i_ret;
}
-int bdsm_BrowseDirectory( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
- const char *psz_uri )
+static int browse_directory( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
+ const char *psz_uri )
{
smb_stat_list files;
smb_stat st;
diff --git a/modules/access/dsm/common.h b/modules/access/dsm/common.h
index 9e14b6d..8805b66 100644
--- a/modules/access/dsm/common.h
+++ b/modules/access/dsm/common.h
@@ -73,6 +73,4 @@ int bdsm_Init( bdsm_sys_t *, vlc_object_t * );
int bdsm_Connect( bdsm_sys_t *, bdsm_login_cb_t *, const char * );
void bdsm_Destroy( bdsm_sys_t * );
void bdsm_SplitDomainLogin( char **psz_login, char **psz_domain );
-
-int bdsm_BrowseShare( bdsm_sys_t *, bdsm_item_cb_t *, const char * );
-int bdsm_BrowseDirectory( bdsm_sys_t *, bdsm_item_cb_t *, const char * );
+int bdsm_Browse( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb, const char *psz_uri );
--
2.1.3
More information about the vlc-devel
mailing list