# HG changeset patch # User Olaf Wintermann # Date 1513504388 -3600 # Node ID b79fb94f9e0a25f506b8773176b8cad5a614cccf # Parent b6ff6be7aa9186aa55ba21946f432be0dfbe7e97 davqlexec handles xml properties now (not really, but it doesn't destroy everything) diff -r b6ff6be7aa91 -r b79fb94f9e0a libidav/davqlexec.c --- a/libidav/davqlexec.c Sat Dec 16 10:37:50 2017 +0100 +++ b/libidav/davqlexec.c Sun Dec 17 10:53:08 2017 +0100 @@ -266,21 +266,36 @@ sstr_t str; str.ptr = NULL; str.length = 0; + DavXmlNode *node = NULL; if(field_result.type == 0) { str = ucx_asprintf( sn->mp->allocator, "%d", field_result.data.integer); - } else { + } else if(field_result.type == 1) { if(field_result.data.string) { str = sstrdup_a(sn->mp->allocator, sstrn( field_result.data.string, field_result.length)); } + } else if(field_result.type == 2) { + // TODO: + } else { + // unknown type + // TODO: error + resource_free_properties(sn, new_properties); + return -1; } if(str.ptr) { + node = dav_session_malloc(sn, sizeof(DavXmlNode)); + memset(node, 0, sizeof(DavXmlNode)); + node->type = DAV_XML_TEXT; + node->content = str.ptr; + node->contentlength = str.length; + } + if(node) { UcxKey key = dav_property_key(field->ns, field->name); - ucx_map_put(new_properties, key, str.ptr); + ucx_map_put(new_properties, key, node); free(key.data); } } else { diff -r b6ff6be7aa91 -r b79fb94f9e0a libidav/davqlexec.h --- a/libidav/davqlexec.h Sat Dec 16 10:37:50 2017 +0100 +++ b/libidav/davqlexec.h Sun Dec 17 10:53:08 2017 +0100 @@ -106,11 +106,12 @@ }; struct DavQLStackObj { - int32_t type; // 0: int, 1: string + int32_t type; // 0: int, 1: string, 2: xml uint32_t length; union DavQLStackData { - int64_t integer; - char *string; + int64_t integer; + char *string; + DavXmlNode *node; } data; }; diff -r b6ff6be7aa91 -r b79fb94f9e0a libidav/resource.c --- a/libidav/resource.c Sat Dec 16 10:37:50 2017 +0100 +++ b/libidav/resource.c Sun Dec 17 10:53:08 2017 +0100 @@ -121,9 +121,10 @@ void resource_free_properties(DavSession *sn, UcxMap *properties) { UcxMapIterator i = ucx_map_iterator(properties); - char *property; - UCX_MAP_FOREACH(key, property, i) { - dav_session_free(sn, property); + DavXmlNode *node; + UCX_MAP_FOREACH(key, node, i) { + // TODO: free everything + dav_session_free(sn, node); } ucx_map_free(properties); }