[Pkg-owncloud-commits] [ocsync] 12/29: Use csync_normalize_etag everywhere.

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Dec 13 14:26:34 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 1b4e2becb3a18851844fb0791db40cd18ec0f3bd
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Dec 11 11:35:55 2013 +0100

    Use csync_normalize_etag everywhere.
    
    Technically, we don't need to strip '-gzip' from the etag comming from
    the propfind, but it is better to be consistant.
---
 src/csync_misc.c                        | 1 -
 src/csync_owncloud.c                    | 8 +-------
 src/csync_owncloud_recursive_propfind.c | 8 +-------
 src/csync_statedb.c                     | 3 +--
 4 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/csync_misc.c b/src/csync_misc.c
index 2654060..96ab122 100644
--- a/src/csync_misc.c
+++ b/src/csync_misc.c
@@ -264,7 +264,6 @@ CSYNC_STATUS csync_errno_to_status(int error, CSYNC_STATUS default_status)
 /* Remove possible quotes, and also the -gzip at the end
  * Remove "-gzip" at the end (cf. https://github.com/owncloud/mirall/issues/1195)
  * The caller must take ownership of the resulting string.
- * (work in place)
  */
 char *csync_normalize_etag(const char *etag)
 {
diff --git a/src/csync_owncloud.c b/src/csync_owncloud.c
index d30cc7f..6243323 100644
--- a/src/csync_owncloud.c
+++ b/src/csync_owncloud.c
@@ -621,13 +621,7 @@ static void results(void *userdata,
     }
 
     if( md5sum ) {
-        int len = strlen(md5sum)-2;
-        if( len > 0 ) {
-            /* Skip the " around the string coming back from the ne_propset_value call */
-            newres->md5 = c_malloc(len+1);
-            strncpy( newres->md5, md5sum+1, len );
-            newres->md5[len] = '\0';
-        }
+        newres->md5 = csync_normalize_etag(md5sum);
     }
 
     csync_vio_set_file_id(newres->file_id, file_id);
diff --git a/src/csync_owncloud_recursive_propfind.c b/src/csync_owncloud_recursive_propfind.c
index cb4741d..4522fc3 100644
--- a/src/csync_owncloud_recursive_propfind.c
+++ b/src/csync_owncloud_recursive_propfind.c
@@ -185,13 +185,7 @@ static void propfind_results_recursive(void *userdata,
     }
 
     if( md5sum ) {
-        int len = strlen(md5sum)-2;
-        if( len > 0 ) {
-            /* Skip the " around the string coming back from the ne_propset_value call */
-            newres->md5 = c_malloc(len+1);
-            strncpy( newres->md5, md5sum+1, len );
-            newres->md5[len] = '\0';
-        }
+        newres->md5 = csync_normalize_etag(md5sum);
     }
 
     csync_vio_set_file_id(newres->file_id, file_id);
diff --git a/src/csync_statedb.c b/src/csync_statedb.c
index 63fe615..5df2bd5 100644
--- a/src/csync_statedb.c
+++ b/src/csync_statedb.c
@@ -550,8 +550,7 @@ char *csync_statedb_get_uniqId( CSYNC *ctx, uint64_t jHash, csync_vio_file_stat_
     }
 
     if (result->count == 2) {
-        /* phash, pathlen, path, inode, uid, gid, mode, modtime */
-        ret = c_strdup( result->vector[0] );
+        ret = csync_normalize_etag( result->vector[0] );
         csync_vio_file_stat_set_file_id(buf, result->vector[1]);
     }
 

-- 
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