[Pkg-owncloud-commits] [ocsync] 01/29: Remove error string from file_status struct and replace by CSYNC_STATUS

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Dec 13 14:26:33 UTC 2013


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository ocsync.

commit 553c8d6658f52fb80e5f03b1b641e12536938103
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Dec 4 12:18:09 2013 +0100

    Remove error string from file_status struct and replace by CSYNC_STATUS
    
    That way we can translate the error states through miralls i18n
    mechanisms.
---
 src/csync.c         | 3 +--
 src/csync.h         | 9 ++++++---
 src/csync_private.h | 2 +-
 src/csync_update.c  | 5 +++--
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/csync.c b/src/csync.c
index 2425d47..2105ffe 100644
--- a/src/csync.c
+++ b/src/csync.c
@@ -555,7 +555,7 @@ static int _csync_treewalk_visitor(void *obj, void *data) {
       trav.etag         = cur->etag;
       trav.file_id      = cur->file_id;
 
-      trav.error_string = cur->error_string;
+      trav.error_status = cur->error_status;
       trav.should_update_etag = cur->should_update_etag;
 
       rc = (*visitor)(&trav, twctx->userdata);
@@ -1034,7 +1034,6 @@ void csync_file_stat_free(csync_file_stat_t *st)
 {
   if (st) {
     SAFE_FREE(st->etag);
-    SAFE_FREE(st->error_string);
     SAFE_FREE(st->destpath);
     SAFE_FREE(st);
   }
diff --git a/src/csync.h b/src/csync.h
index db3b6a2..9afa035 100644
--- a/src/csync.h
+++ b/src/csync.h
@@ -99,7 +99,11 @@ enum csync_status_codes_e {
   CSYNC_STATUS_OPENDIR_ERROR,
   CSYNC_STATUS_READDIR_ERROR,
   CSYNC_STATUS_OPEN_ERROR,
-  CSYNC_STATUS_ABORTED
+  CSYNC_STATUS_ABORTED,
+    /* Codes for file individual status: */
+    CSYNC_STATUS_INDIVIDUAL_IS_SYMLINK,
+    CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST,
+    CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS
 };
 
 typedef enum csync_status_codes_e CSYNC_STATUS;
@@ -199,9 +203,8 @@ struct csync_tree_walk_file_s {
 
     const char *rename_path;
     const char *etag;
-    const char *error_string;
     const char *file_id;
-
+    CSYNC_STATUS error_status;
 };
 typedef struct csync_tree_walk_file_s TREE_WALK_FILE;
 
diff --git a/src/csync_private.h b/src/csync_private.h
index ab6c837..037ced4 100644
--- a/src/csync_private.h
+++ b/src/csync_private.h
@@ -196,7 +196,7 @@ struct csync_file_stat_s {
   char *destpath;   /* for renames */
   const char *etag;
   char file_id[FILE_ID_BUF_SIZE+1];  /* the ownCloud file id is fixed width of 21 byte. */
-  const char *error_string;
+  CSYNC_STATUS error_status;
 
   enum csync_instructions_e instruction; /* u32 */
   char path[1]; /* u8 */
diff --git a/src/csync_update.c b/src/csync_update.c
index 91a7e23..352e6a0 100644
--- a/src/csync_update.c
+++ b/src/csync_update.c
@@ -193,6 +193,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
     goto out;
   }
   if (excluded > CSYNC_NOT_EXCLUDED || type == CSYNC_FTW_TYPE_SLINK) {
+      st->error_status = CSYNC_STATUS_INDIVIDUAL_IS_SYMLINK; /* Symbolic links are ignored. */
     st->instruction = CSYNC_INSTRUCTION_IGNORE;
     goto out;
   }
@@ -309,9 +310,9 @@ out:
   /* Set the ignored error string. */
   if (st->instruction == CSYNC_INSTRUCTION_IGNORE) {
     if (excluded == CSYNC_FILE_EXCLUDE_LIST) {
-      st->error_string = c_strdup("File listed on ignore list.");
+      st->error_status = CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST; /* File listed on ignore list. */
     } else if (excluded == CSYNC_FILE_EXCLUDE_INVALID_CHAR) {
-      st->error_string = c_strdup("File contains invalid characters.");
+      st->error_status = CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS;  /* File contains invalid characters. */
     }
   }
   if (st->instruction != CSYNC_INSTRUCTION_NONE && st->instruction != CSYNC_INSTRUCTION_IGNORE

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/ocsync.git



More information about the Pkg-owncloud-commits mailing list