fixed SyncDatabase initialization

Wed, 13 Jul 2016 12:03:04 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 13 Jul 2016 12:03:04 +0200
changeset 243
f5921d151c29
parent 242
a39be87d34d4
child 244
47791bdf1725
child 245
ef931185ae05

fixed SyncDatabase initialization

dav/db.c file | annotate | diff | comparison | revisions
dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/db.c	Wed Jul 13 10:00:48 2016 +0200
+++ b/dav/db.c	Wed Jul 13 12:03:04 2016 +0200
@@ -59,7 +59,7 @@
         xmlDocSetRootElement(doc, root);
         if(xmlSaveFormatFileEnc(db_file, doc, "UTF-8", 1) != -1) {
             db->resources = ucx_map_new(2048);
-            //db->remove = ucx_map_new(8);
+            db->conflict = ucx_map_new(16);
         } else {
             free(db);
             db = NULL;
@@ -71,7 +71,6 @@
     free(db_file);
     
     db->resources = ucx_map_new(2048);
-    //db->remove = ucx_map_new(16);
     db->conflict = ucx_map_new(16);
     int error = 0;
     while(xmlTextReaderRead(reader)) {
@@ -166,7 +165,7 @@
         }
     }
     
-    if(!res->path || res->last_modified == 0) {
+    if(!res->path) {
         // TODO: free res
         return NULL;
     } else {
--- a/dav/sync.c	Wed Jul 13 10:00:48 2016 +0200
+++ b/dav/sync.c	Wed Jul 13 12:03:04 2016 +0200
@@ -225,7 +225,6 @@
     SyncDatabase *db = load_db(dir->database);
     if(!db) {
         fprintf(stderr, "Cannot load database file: %s\n", dir->database);
-        destroy_db(db);
         return -1;
     }
     remove_deleted_conflicts(dir, db);

mercurial