238 WebdavPropfindRequest *request, |
238 WebdavPropfindRequest *request, |
239 WebdavResource *resource, |
239 WebdavResource *resource, |
240 CxAllocator *a, |
240 CxAllocator *a, |
241 CxMap *pmap) |
241 CxMap *pmap) |
242 { |
242 { |
243 CxIterator i = cxMapIteratorValues(pmap); |
243 CxMapIterator i = cxMapIteratorValues(pmap); |
244 cx_foreach(WebdavProperty*, prop, i) { |
244 cx_foreach(WebdavProperty*, prop, i) { |
245 if(request->propname) { |
245 if(request->propname) { |
246 prop->vtype = WS_VALUE_NO_TYPE; |
246 prop->vtype = WS_VALUE_NO_TYPE; |
247 } |
247 } |
248 if(resource->addproperty(resource, prop, 200)) { |
248 if(resource->addproperty(resource, prop, 200)) { |
320 CxHashKey key = webdav_property_key_a( |
320 CxHashKey key = webdav_property_key_a( |
321 a, |
321 a, |
322 (const char*)prop->namespace->href, |
322 (const char*)prop->namespace->href, |
323 (const char*)prop->name); |
323 (const char*)prop->name); |
324 if(!key.data) { |
324 if(!key.data) { |
325 cxMapDestroy(pmap); |
325 cxMapFree(pmap); |
326 return 1; |
326 return 1; |
327 } |
327 } |
328 void *rmprop = cxMapRemoveAndGet(pmap, key); |
328 void *rmprop = NULL; |
|
329 cxMapRemoveAndGet(pmap, key, &rmprop); |
329 cxFree(a, (void*)key.data); |
330 cxFree(a, (void*)key.data); |
330 |
331 |
331 // TODO: free rmprop |
332 // TODO: free rmprop |
332 |
333 |
333 if(rmprop) { |
334 if(rmprop) { |
504 return 0; |
505 return 0; |
505 } |
506 } |
506 |
507 |
507 int webdav_xattr_put_prop(CxMap *pmap, WebdavProperty *prop) { |
508 int webdav_xattr_put_prop(CxMap *pmap, WebdavProperty *prop) { |
508 CxHashKey key = webdav_property_key_a( |
509 CxHashKey key = webdav_property_key_a( |
509 pmap->allocator, |
510 pmap->collection.allocator, |
510 (const char*)prop->namespace->href, |
511 (const char*)prop->namespace->href, |
511 (const char*)prop->name); |
512 (const char*)prop->name); |
512 if(!key.data) { |
513 if(!key.data) { |
513 return 1; |
514 return 1; |
514 } |
515 } |
515 int ret = cxMapPut(pmap, key, prop); |
516 int ret = cxMapPut(pmap, key, prop); |
516 cxFree(pmap->allocator, (void*)key.data); |
517 cxFree(pmap->collection.allocator, (void*)key.data); |
517 return ret; |
518 return ret; |
518 } |
519 } |
519 |
520 |
520 CxMap* webdav_xattr_parse_data(CxAllocator *a, const char *data, size_t len, const char *path) { |
521 CxMap* webdav_xattr_parse_data(CxAllocator *a, const char *data, size_t len, const char *path) { |
521 CxMap *pmap = cxHashMapCreate(a, CX_STORE_POINTERS, 32); |
522 CxMap *pmap = cxHashMapCreate(a, CX_STORE_POINTERS, 32); |
711 CxBuffer buf; |
712 CxBuffer buf; |
712 if(cxBufferInit(&buf, NULL, 8192, a, CX_BUFFER_AUTO_EXTEND)) { |
713 if(cxBufferInit(&buf, NULL, 8192, a, CX_BUFFER_AUTO_EXTEND)) { |
713 return (cxmutstr){NULL,0}; |
714 return (cxmutstr){NULL,0}; |
714 } |
715 } |
715 |
716 |
716 CxIterator i = cxMapIteratorValues(pmap); |
717 CxMapIterator i = cxMapIteratorValues(pmap); |
717 cx_foreach(WebdavProperty*, prop, i) { |
718 cx_foreach(WebdavProperty*, prop, i) { |
718 WSXmlData *property_value = NULL; |
719 WSXmlData *property_value = NULL; |
719 if(prop->vtype == WS_VALUE_XML_NODE) { |
720 if(prop->vtype == WS_VALUE_XML_NODE) { |
720 property_value = wsxml_node2data(pool, prop->value.node); |
721 property_value = wsxml_node2data(pool, prop->value.node); |
721 } else if(prop->vtype == WS_VALUE_XML_DATA) { |
722 } else if(prop->vtype == WS_VALUE_XML_DATA) { |