mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
owncloud: Removed unused _stat function.
This commit is contained in:
parent
71e110364e
commit
45ec3c0248
1 changed files with 0 additions and 88 deletions
|
@ -1132,94 +1132,6 @@ static int owncloud_rmdir(const char *uri) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _stat(const char *uri, csync_vio_file_stat_t *buf) {
|
||||
/* get props:
|
||||
* modtime
|
||||
* creattime
|
||||
* size
|
||||
*/
|
||||
int rc = 0;
|
||||
csync_vio_file_stat_t *lfs = NULL;
|
||||
struct listdir_context *fetchCtx = NULL;
|
||||
|
||||
DEBUG_WEBDAV(("__stat__ %s called\n", uri ));
|
||||
|
||||
buf->name = c_basename(uri);
|
||||
|
||||
if (buf->name == NULL) {
|
||||
csync_vio_file_stat_destroy(buf);
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check if the data in the static 'cache' fs is for the same file.
|
||||
* The cache is filled by readdir which is often called directly before
|
||||
* stat. If the cache matches, a http call is saved.
|
||||
*/
|
||||
if( _fs.name && strcmp( buf->name, _fs.name ) == 0 ) {
|
||||
buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERMISSIONS;
|
||||
|
||||
buf->fields = _fs.fields;
|
||||
buf->type = _fs.type;
|
||||
buf->mtime = _fs.mtime;
|
||||
buf->size = _fs.size;
|
||||
buf->mode = _stat_perms( _fs.type );
|
||||
} else {
|
||||
// fetch data via a propfind call.
|
||||
DEBUG_WEBDAV(("I have no stat cache, call propfind.\n"));
|
||||
|
||||
fetchCtx = c_malloc( sizeof( struct listdir_context ));
|
||||
if( ! fetchCtx ) {
|
||||
errno = ne_error_to_errno( NE_ERROR );
|
||||
csync_vio_file_stat_destroy(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fetchCtx->list = NULL;
|
||||
fetchCtx->target = _cleanPath( uri );
|
||||
fetchCtx->include_target = 1;
|
||||
fetchCtx->currResource = NULL;
|
||||
|
||||
DEBUG_WEBDAV(("fetchCtx good.\n" ));
|
||||
|
||||
rc = fetch_resource_list( uri, NE_DEPTH_ONE, fetchCtx );
|
||||
if( rc != NE_OK ) {
|
||||
errno = ne_error_to_errno( rc );
|
||||
SAFE_FREE(fetchCtx);
|
||||
csync_vio_file_stat_destroy(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( fetchCtx ) {
|
||||
fetchCtx->currResource = fetchCtx->list;
|
||||
lfs = resourceToFileStat( fetchCtx->currResource );
|
||||
if( lfs ) {
|
||||
buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERMISSIONS;
|
||||
|
||||
buf->fields = lfs->fields;
|
||||
buf->type = lfs->type;
|
||||
buf->mtime = lfs->mtime;
|
||||
buf->size = lfs->size;
|
||||
buf->mode = _stat_perms( lfs->type );
|
||||
|
||||
csync_vio_file_stat_destroy( lfs );
|
||||
}
|
||||
SAFE_FREE( fetchCtx );
|
||||
}
|
||||
}
|
||||
DEBUG_WEBDAV(("STAT result: %s, type=%d\n", buf->name, buf->type ));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int owncloud_rename(const char *olduri, const char *newuri) {
|
||||
char *src = NULL;
|
||||
char *target = NULL;
|
||||
|
|
Loading…
Reference in a new issue