Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/csync
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2018-03-01 15:55:29 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-06-04 16:41:38 +0300
commitbe29fc2f6994842ca1d0cd0d5b2e194ef93989a1 (patch)
tree349923c925cee54898e2a6175fe1943248407284 /src/csync
parent0443f8dd4d957a9870dbeda9ec2da2dc6e90a4ca (diff)
csync: remove CSYNC_PARAM_ERROR
It does not make sense to report such error to the user. Its goal was to show invalid use of the csync API, but this is now done with asserts.
Diffstat (limited to 'src/csync')
-rw-r--r--src/csync/csync.h1
-rw-r--r--src/csync/csync_misc.cpp4
-rw-r--r--src/csync/csync_update.cpp13
3 files changed, 3 insertions, 15 deletions
diff --git a/src/csync/csync.h b/src/csync/csync.h
index 94a7ce088..29525f6ca 100644
--- a/src/csync/csync.h
+++ b/src/csync/csync.h
@@ -72,7 +72,6 @@ enum csync_status_codes_e {
CSYNC_STATUS_TIMESKEW, /* OBSOLETE */
CSYNC_STATUS_FILESYSTEM_UNKNOWN, /* UNUSED */
CSYNC_STATUS_TREE_ERROR, /* csync trees could not be created */
- CSYNC_STATUS_PARAM_ERROR, /* parameter is zero where not expected */
CSYNC_STATUS_UPDATE_ERROR, /* general update or discovery error */
CSYNC_STATUS_RECONCILE_ERROR, /* general reconcile error */
CSYNC_STATUS_PROPAGATE_ERROR, /* OBSOLETE */
diff --git a/src/csync/csync_misc.cpp b/src/csync/csync_misc.cpp
index 7945c428f..fc35983a5 100644
--- a/src/csync/csync_misc.cpp
+++ b/src/csync/csync_misc.cpp
@@ -125,14 +125,12 @@ CSYNC_STATUS csync_errno_to_status(int error, CSYNC_STATUS default_status)
case EEXIST: /* File exists */
status = CSYNC_STATUS_FILE_EXISTS;
break;
- case EINVAL:
- status = CSYNC_STATUS_PARAM_ERROR;
- break;
case ENOSPC:
status = CSYNC_STATUS_OUT_OF_SPACE;
break;
/* All the remaining basic errnos: */
+ case EINVAL: /* Invalid argument */
case EIO: /* I/O error */
case ESRCH: /* No such process */
case EINTR: /* Interrupted system call */
diff --git a/src/csync/csync_update.cpp b/src/csync/csync_update.cpp
index 9e3ab0c28..1ac7e3a13 100644
--- a/src/csync/csync_update.cpp
+++ b/src/csync/csync_update.cpp
@@ -108,15 +108,9 @@ static bool _csync_mtime_equal(time_t a, time_t b)
* See doc/dev/sync-algorithm.md for an overview.
*/
static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> fs) {
+ Q_ASSERT(fs);
OCC::SyncJournalFileRecord base;
CSYNC_EXCLUDE_TYPE excluded = CSYNC_NOT_EXCLUDED;
-
- if (fs == NULL) {
- errno = EINVAL;
- ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
- return -1;
- }
-
if (fs->type == ItemTypeSkip) {
excluded =CSYNC_FILE_EXCLUDE_STAT_FAILED;
} else {
@@ -711,10 +705,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
// Now process to have a relative path to the sync root for the local replica, or to the data root on the remote.
dirent->path = fullpath;
if (ctx->current == LOCAL_REPLICA) {
- if (dirent->path.size() <= (int)strlen(ctx->local.uri)) {
- ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
- goto error;
- }
+ ASSERT(dirent->path.startsWith(ctx->local.uri)); // path is relative to uri
// "len + 1" to include the slash in-between.
dirent->path = dirent->path.mid(strlen(ctx->local.uri) + 1);
}