[vlc-devel] [PATCH 10/14] dsm: only one function to browse share and directory
Thomas Guillem
thomas at gllm.fr
Fri Dec 5 14:43:01 CET 2014
---
modules/access/dsm/access.c | 19 +++----------------
modules/access/dsm/common.c | 32 ++++++++++++++++++++------------
modules/access/dsm/common.h | 4 +---
3 files changed, 24 insertions(+), 31 deletions(-)
diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index bfc0a5b..ceb25ae 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -142,20 +142,12 @@ static int AddToNode( void *p_opaque, 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_opaque = 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_opaque = 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 )
@@ -186,12 +178,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 7ead179..34aa8d8 100644
--- a/modules/access/dsm/common.c
+++ b/modules/access/dsm/common.c
@@ -55,6 +55,8 @@ static void get_credentials( bdsm_sys_t *p_sys );
static int login( bdsm_sys_t *p_sys );
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 * );
/*****************************************************************************
* bdsm_Init: init bdsm_sys_t struct
@@ -172,10 +174,23 @@ void bdsm_SplitDomainLogin( char **psz_login, char **psz_domain )
}
/*****************************************************************************
- * bdsm_BrowseShare: browse to psz_uri
+ * bdsm_Browse: browse to psz_uri
*****************************************************************************/
-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 );
+}
+
+/*****************************************************************************
+ * Local functions
+ *****************************************************************************/
+
+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;
@@ -205,11 +220,8 @@ int bdsm_BrowseShare( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
return i_ret;
}
-/*****************************************************************************
- * bdsm_BrowseDirectory: browse to psz_uri
- *****************************************************************************/
-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;
@@ -261,10 +273,6 @@ int bdsm_BrowseDirectory( bdsm_sys_t *p_sys, bdsm_item_cb_t *p_cb,
return i_ret;
}
-/*****************************************************************************
- * Local functions
- *****************************************************************************/
-
static void cleanup( bdsm_sys_t *p_sys )
{
p_sys->b_is_browsing = false;
diff --git a/modules/access/dsm/common.h b/modules/access/dsm/common.h
index 5c44185..f29c8b8 100644
--- a/modules/access/dsm/common.h
+++ b/modules/access/dsm/common.h
@@ -64,6 +64,4 @@ int bdsm_Init( bdsm_sys_t *, vlc_object_t * );
int bdsm_Connect( bdsm_sys_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