mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 14:36:01 +03:00
Fix warning about shadowed variables.
This commit is contained in:
parent
269f5f5403
commit
ec5d3afea0
2 changed files with 22 additions and 26 deletions
|
@ -176,8 +176,7 @@ static int _closedir(csync_vio_method_t *dhandle) {
|
|||
static csync_vio_file_stat_t *_readdir(csync_vio_method_handle_t *dhandle) {
|
||||
struct smbc_dirent *dirent = NULL;
|
||||
smb_dhandle_t *handle = NULL;
|
||||
csync_vio_file_stat_t *fstat = NULL;
|
||||
struct stat sb;
|
||||
csync_vio_file_stat_t *file_stat = NULL;
|
||||
|
||||
handle = (smb_dhandle_t *) dhandle;
|
||||
|
||||
|
@ -186,18 +185,18 @@ static csync_vio_file_stat_t *_readdir(csync_vio_method_handle_t *dhandle) {
|
|||
goto err;
|
||||
}
|
||||
|
||||
fstat = csync_vio_file_stat_new();
|
||||
if (fstat == NULL) {
|
||||
file_stat = csync_vio_file_stat_new();
|
||||
if (file_stat == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
fstat->name = c_strndup(dirent->name, dirent->namelen);
|
||||
fstat->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
file_stat->name = c_strndup(dirent->name, dirent->namelen);
|
||||
file_stat->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
|
||||
switch (dirent->smbc_type) {
|
||||
case SMBC_FILE_SHARE:
|
||||
fstat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
fstat->type = CSYNC_VIO_FILE_TYPE_DIRECTORY;
|
||||
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
file_stat->type = CSYNC_VIO_FILE_TYPE_DIRECTORY;
|
||||
break;
|
||||
case SMBC_WORKGROUP:
|
||||
case SMBC_SERVER:
|
||||
|
@ -206,15 +205,11 @@ static csync_vio_file_stat_t *_readdir(csync_vio_method_handle_t *dhandle) {
|
|||
break;
|
||||
case SMBC_DIR:
|
||||
case SMBC_FILE:
|
||||
if (smbc_stat(handle->path, &sb) < 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
fstat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
if (dirent->smbc_type == SMBC_DIR) {
|
||||
fstat->type = CSYNC_VIO_FILE_TYPE_DIRECTORY;
|
||||
file_stat->type = CSYNC_VIO_FILE_TYPE_DIRECTORY;
|
||||
} else {
|
||||
fstat->type = CSYNC_VIO_FILE_TYPE_REGULAR;
|
||||
file_stat->type = CSYNC_VIO_FILE_TYPE_REGULAR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -222,11 +217,11 @@ static csync_vio_file_stat_t *_readdir(csync_vio_method_handle_t *dhandle) {
|
|||
}
|
||||
|
||||
SAFE_FREE(dirent);
|
||||
return fstat;
|
||||
return file_stat;
|
||||
|
||||
err:
|
||||
SAFE_FREE(dirent);
|
||||
SAFE_FREE(fstat);
|
||||
SAFE_FREE(file_stat);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -24,22 +24,23 @@
|
|||
#include "vio/csync_vio_file_stat_private.h"
|
||||
|
||||
csync_vio_file_stat_t *csync_vio_file_stat_new(void) {
|
||||
csync_vio_file_stat_t *fstat = NULL;
|
||||
csync_vio_file_stat_t *file_stat = NULL;
|
||||
|
||||
fstat = (csync_vio_file_stat_t *) c_malloc(sizeof(csync_vio_file_stat_t));
|
||||
if (fstat == NULL) {
|
||||
file_stat = (csync_vio_file_stat_t *) c_malloc(sizeof(csync_vio_file_stat_t));
|
||||
if (file_stat == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return fstat;
|
||||
return file_stat;
|
||||
}
|
||||
|
||||
void csync_vio_file_stat_destroy(csync_vio_file_stat_t *fstat) {
|
||||
void csync_vio_file_stat_destroy(csync_vio_file_stat_t *file_stat) {
|
||||
/* FIXME: free rest */
|
||||
|
||||
if (fstat->fields == CSYNC_VIO_FILE_STAT_FIELDS_SYMLINK_NAME) {
|
||||
SAFE_FREE(fstat->symlink_name);
|
||||
if (file_stat->fields == CSYNC_VIO_FILE_STAT_FIELDS_SYMLINK_NAME) {
|
||||
SAFE_FREE(file_stat->symlink_name);
|
||||
}
|
||||
SAFE_FREE(fstat->name);
|
||||
SAFE_FREE(fstat);
|
||||
SAFE_FREE(file_stat->name);
|
||||
SAFE_FREE(file_stat);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue