dav/davql.c

changeset 28
4e46c65711ef
parent 27
e584c351b402
child 30
9a5a7a513a96
--- a/dav/davql.c	Wed Aug 21 13:08:22 2013 +0200
+++ b/dav/davql.c	Thu Aug 22 11:25:16 2013 +0200
@@ -268,6 +268,8 @@
                         operation->type = DAVQOP_RESPROP;
                     } else if(!sstrcmp(token, S("path"))) {
                         operation->type = DAVQOP_RESPROP;
+                    } else if(!sstrcmp(token, S("iscollection"))) {
+                        operation->type = DAVQOP_RESPROP;
                     } else {
                         operation->type = DAVQOP_PROPERTY;
                     }
@@ -448,7 +450,7 @@
                     if(stackpos < 1) {
                         // error
                         printf("no data on stack\n");
-                        return NULL;
+                        return 0;
                     }
                     int pos = stackpos-1;
                     if(stack[pos].type == DAVQOP_INTEGER) {
@@ -457,7 +459,7 @@
                     } else {
                         // error
                         printf("wrong value for 'not' operator\n");
-                        return NULL;
+                        return 0;
                     }
                 } else {
                     DavQOp val1 = stack[stackpos-2];
@@ -535,6 +537,10 @@
                     value.type = DAVQOP_STRING;
                     value.val = res->path;
                     value.intval = strlen(res->path);
+                } else if(!sstrcmp(name, S("iscollection"))) {
+                    value.type = DAVQOP_INTEGER;
+                    value.val = NULL;
+                    value.intval = res->iscollection;
                 }
                 stack[stackpos++] = value;
                 break;
@@ -680,7 +686,7 @@
         case 13: {
             // xor
             printf("str compare: %.*s xor %.*s\n", s1.length, s1.ptr, s2.length, s2.ptr);
-            res.intval = (int)s1.ptr ^ (int)s2.ptr;
+            res.intval = (intptr_t)s1.ptr ^ (intptr_t)s2.ptr;
             break;
         }
     }

mercurial