libidav/davqlexec.c

changeset 136
59058927b885
parent 135
664aeaec8d25
child 137
01cb9aabff05
--- a/libidav/davqlexec.c	Wed Jul 08 17:31:26 2015 +0200
+++ b/libidav/davqlexec.c	Thu Jul 09 15:00:16 2015 +0200
@@ -200,7 +200,7 @@
 }
 
 static int reset_properties(DavSession *sn, DavResult *result, DavResource *res, UcxList *fields) {
-    return 0;
+    //return 0;
     UcxMap *new_properties = ucx_map_new_a(sn->mp->allocator, 32);
     DavResourceData *data = (DavResourceData*)res->data;
     
@@ -255,15 +255,19 @@
         DavQLStackObj field_result;
         if(!dav_exec_expr(field->code, res, &field_result)) {
             sstr_t str;
+            str.ptr = NULL;
+            str.length = 0;
             if(field_result.type == 0) {
                 str = ucx_asprintf(
                         sn->mp->allocator,
                         "%d",
                         field_result.data.integer);
             } else {
-                str = sstrdup_a(sn->mp->allocator, sstrn(
-                        field_result.data.string,
-                        field_result.length));
+                if(field_result.data.string) {
+                    str = sstrdup_a(sn->mp->allocator, sstrn(
+                            field_result.data.string,
+                            field_result.length));
+                }
             }
             if(str.ptr) {
                 UcxKey key = dav_property_key(field->ns, field->name);
@@ -284,8 +288,17 @@
     ucx_map_remove(data->properties, cn_key);
     ucx_map_remove(data->properties, ck_key);
     
-    resource_free_properties(sn, data->properties);
+    //resource_free_properties(sn, data->properties);
     data->properties = new_properties;
+    //printf("(%s) new properties: ", res->name, data->properties);
+    
+    free(cl_key.data);
+    free(cd_key.data);
+    free(lm_key.data);
+    free(ct_key.data);
+    free(rt_key.data);
+    free(cn_key.data);
+    free(ck_key.data);
     
     return 0;
 }
@@ -828,7 +841,7 @@
                 //printf("timestamp %d\n", cmd.data.timestamp);
                 obj.type = 0;
                 obj.length = 0;
-                obj.data.integer = (int)cmd.data.timestamp;
+                obj.data.integer = (int64_t)cmd.data.timestamp;
                 DAVQL_PUSH(obj);
                 break;
             }

mercurial