check tagfilter scope after checking tagfilter existence

Mon, 11 Jun 2018 19:32:41 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 11 Jun 2018 19:32:41 +0200
changeset 415
6e1861e8262c
parent 414
ea50585ec9d9
child 416
d7a086201a6e

check tagfilter scope after checking tagfilter existence

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Mon Jun 11 19:31:03 2018 +0200
+++ b/dav/sync.c	Mon Jun 11 19:32:41 2018 +0200
@@ -259,15 +259,15 @@
 }
 
 static int res_matches_tags(DavResource *res, SyncTagFilter *tagfilter) {
+    if(!tagfilter || tagfilter->mode == DAV_SYNC_TAGFILTER_OFF) {
+        return 1;
+    }
     int scope = res->iscollection ?
             DAV_SYNC_TAGFILTER_SCOPE_COLLECTION
           : DAV_SYNC_TAGFILTER_SCOPE_RESOURCE;
     if(tagfilter->scope & scope != scope) {
         return 1;
     }
-    if(!tagfilter || tagfilter->mode == DAV_SYNC_TAGFILTER_OFF) {
-        return 1;
-    }
     
     DavXmlNode *tagsprop = dav_get_property_ns(res, DAV_NS, "tags");
     UcxList *res_tags = parse_dav_xml_taglist(tagsprop);
@@ -285,15 +285,15 @@
         LocalResource *res,
         SyncTagFilter *tagfilter)
 {
+    if(!tagfilter || tagfilter->mode == DAV_SYNC_TAGFILTER_OFF) {
+        return 1;
+    }
     int scope = res->isdirectory ?
             DAV_SYNC_TAGFILTER_SCOPE_COLLECTION
           : DAV_SYNC_TAGFILTER_SCOPE_RESOURCE;
     if(tagfilter->scope & scope != scope) {
         return 1;
     }
-    if(!tagfilter || tagfilter->mode == DAV_SYNC_TAGFILTER_OFF) {
-        return 1;
-    }
 
     DavBool changed = 0;
     UcxList *res_tags = sync_get_file_tags(dir, res, &changed);

mercurial