summaryrefslogtreecommitdiff
path: root/src/input/input_smb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/input_smb.c')
-rw-r--r--src/input/input_smb.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/input/input_smb.c b/src/input/input_smb.c
index e49eaa889..5d97d7518 100644
--- a/src/input/input_smb.c
+++ b/src/input/input_smb.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2008 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -41,7 +41,7 @@
typedef struct {
input_class_t input_class;
xine_t *xine;
-
+
int mrls_allocated_entries;
xine_mrl_t **mrls;
} smb_input_class_t;
@@ -138,7 +138,7 @@ smb_plugin_get_length (input_plugin_t *this_gen)
int e;
struct stat st;
-
+
if (this->fd>=0) e = smbc_fstat(this->fd,&st);
else e = smbc_stat(this->mrl,&st);
@@ -218,20 +218,20 @@ static int _strverscmp(const char *s1, const char *s2) {
c2 = *p2++;
state |= (c1 == '0') + (ISDIGIT(c1) != 0);
}
-
+
state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT(c2) != 0))];
-
+
switch(state) {
case CMP:
return diff;
-
+
case LEN:
while(ISDIGIT(*p1++))
if(!ISDIGIT(*p2++))
return 1;
-
+
return ISDIGIT(*p2) ? -1 : diff;
-
+
default:
return state;
}
@@ -245,9 +245,9 @@ static int _sortfiles_default(const xine_mrl_t *s1, const xine_mrl_t *s2) {
}
-static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
+static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
const char *filename, int *nFiles) {
-
+
smb_input_class_t *this = (smb_input_class_t *) this_gen;
int (*func) () = _sortfiles_default;
int dir;
@@ -263,11 +263,11 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
snprintf(current_path, XINE_PATH_MAX, "smb:/");
snprintf(current_path_smb, XINE_PATH_MAX, "smb://");
}
-
+
if ((dir = smbc_opendir(current_path_smb)) >= 0){
xine_mrl_t *dir_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t));
xine_mrl_t *norm_files = (xine_mrl_t *) calloc(MAXFILES, sizeof(xine_mrl_t));
- int num_dir_files=0;
+ int num_dir_files=0;
int num_norm_files=0;
while ((pdirent = smbc_readdir(dir)) != NULL){
if (pdirent->smbc_type == SMBC_WORKGROUP){
@@ -277,7 +277,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
asprintf(&(dir_files[num_dir_files].mrl), "%s/%s", current_path, pdirent->name);
dir_files[num_dir_files].size = pdirent->dirlen;
num_dir_files ++;
- }else if (pdirent->smbc_type == SMBC_SERVER){
+ }else if (pdirent->smbc_type == SMBC_SERVER){
if (num_dir_files == 0) {
dir_files[num_dir_files].link = NULL;
dir_files[num_dir_files].type = mrl_file | mrl_file_directory;
@@ -309,7 +309,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
asprintf(&(dir_files[num_dir_files].mrl), "%s/%s", current_path, pdirent->name);
dir_files[num_dir_files].size = pdirent->dirlen;
num_dir_files ++;
- }
+ }
} else if (pdirent->smbc_type == SMBC_DIR){
dir_files[num_dir_files].link = NULL;
dir_files[num_dir_files].type = mrl_file | mrl_file_directory;
@@ -342,49 +342,49 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
*/
if(num_dir_files)
qsort(dir_files, num_dir_files, sizeof(xine_mrl_t), func);
-
+
if(num_norm_files)
qsort(norm_files, num_norm_files, sizeof(xine_mrl_t), func);
-
+
/*
* Add directories entries
*/
for(i = 0; i < num_dir_files; i++) {
if (num_files >= this->mrls_allocated_entries) {
++this->mrls_allocated_entries;
- this->mrls = realloc(this->mrls,
+ this->mrls = realloc(this->mrls,
(this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*));
this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t));
}else
memset(this->mrls[num_files], 0, sizeof(xine_mrl_t));
-
- MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]);
+
+ MRL_DUPLICATE(&dir_files[i], this->mrls[num_files]);
num_files++;
}
-
- /*
+
+ /*
* Add other files entries
*/
for(i = 0; i < num_norm_files; i++) {
if(num_files >= this->mrls_allocated_entries) {
++this->mrls_allocated_entries;
- this->mrls = realloc(this->mrls,
+ this->mrls = realloc(this->mrls,
(this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*));
this->mrls[num_files] = calloc(1, sizeof(xine_mrl_t));
}else
memset(this->mrls[num_files], 0, sizeof(xine_mrl_t));
- MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]);
+ MRL_DUPLICATE(&norm_files[i], this->mrls[num_files]);
num_files++;
}
-
+
/* Some cleanups before leaving */
for(i = num_dir_files; i == 0; i--)
MRL_ZERO(&dir_files[i]);
free(dir_files);
-
+
for(i = num_norm_files; i == 0; i--)
MRL_ZERO(&norm_files[i]);
free(norm_files);
@@ -394,13 +394,13 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
current_path, errno, strerror(errno));
*nFiles = 0;
return NULL;
- }
-
+ }
+
/*
* Inform caller about files found number.
*/
*nFiles = num_files;
-
+
/*
* Freeing exceeded mrls if exists.
*/
@@ -408,7 +408,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
MRL_ZERO(this->mrls[this->mrls_allocated_entries - 1]);
free(this->mrls[this->mrls_allocated_entries--]);
}
-
+
/*
* This is useful to let UI know where it should stops ;-).
*/
@@ -418,7 +418,7 @@ static xine_mrl_t **smb_class_get_dir (input_class_t *this_gen,
}
static int
-smb_plugin_get_optional_data (input_plugin_t *this_gen,
+smb_plugin_get_optional_data (input_plugin_t *this_gen,
void *data, int data_type)
{
return INPUT_OPTIONAL_UNSUPPORTED;
@@ -443,8 +443,8 @@ smb_plugin_open (input_plugin_t *this_gen )
smb_input_class_t *class = (smb_input_class_t *) this_gen->input_class;
this->fd = smbc_open(this->mrl,O_RDONLY,0);
- xprintf(class->xine, XINE_VERBOSITY_DEBUG,
- "input_smb: open failed for %s: %s\n",
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG,
+ "input_smb: open failed for %s: %s\n",
this->mrl, strerror(errno));
if (this->fd<0) return 0;
@@ -464,7 +464,7 @@ smb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream,
const char *mrl)
{
smb_input_t *this;
-
+
if (mrl == NULL)
return NULL;
if (strncmp (mrl, "smb://",6))
@@ -508,7 +508,7 @@ static void
if (smbc_init(smb_auth,(xine->verbosity >= XINE_VERBOSITY_DEBUG)))
goto _exit_error;
-
+
this = calloc(1, sizeof(smb_input_class_t));
this->xine = xine;
@@ -526,7 +526,7 @@ static void
setlocale(LC_MESSAGES, lcl);
free(lcl);
#endif
-
+
return (input_class_t *) this;
}