more sstr to scstr conversion

Sun, 24 Feb 2019 17:35:18 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 24 Feb 2019 17:35:18 +0100
changeset 510
d6e801f97e7a
parent 509
0576dd6409f3
child 511
59a216f8d4e8

more sstr to scstr conversion

dav/main.c file | annotate | diff | comparison | revisions
dav/sync.c file | annotate | diff | comparison | revisions
dav/tags.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Sun Feb 24 15:06:25 2019 +0100
+++ b/dav/main.c	Sun Feb 24 17:35:18 2019 +0100
@@ -1999,7 +1999,7 @@
             timeout = -1;
         } else {
             uint64_t i;
-            if(util_strtoint(timeoutstr)) {
+            if(util_strtoint(timeoutstr, &i)) {
                 timeout = (time_t)i;
             } else {
                 fprintf(stderr, "Error: -T option has invalid value\n");
--- a/dav/sync.c	Sun Feb 24 15:06:25 2019 +0100
+++ b/dav/sync.c	Sun Feb 24 17:35:18 2019 +0100
@@ -2130,7 +2130,7 @@
         // get the path to the version history collection for this resource
         // if propfind fails we just assume that it doesn't exist
         // better error handling is done later (sync_put_resource)
-        // if there is no history collection for this resource, we create a one
+        // if there is no history collection for this resource, we create one
         
         DavPropName prop;
         prop.ns = DAV_NS;
--- a/dav/tags.c	Sun Feb 24 15:06:25 2019 +0100
+++ b/dav/tags.c	Sun Feb 24 17:35:18 2019 +0100
@@ -361,13 +361,12 @@
 
 /* ----------- ----------- tag filter  ---------------------- */
 
-// TODO: use scstr_t after update to UCX 2.0
-static size_t rtrimskip(sstr_t str, size_t skip) {
+static size_t rtrimskip(scstr_t str, size_t skip) {
     while (skip < str.length && isspace(str.ptr[skip])) skip++;
     return skip;
 }
 
-static size_t parse_tagfilter_taglist(sstr_t fs, SyncTagFilter* tagfilter) {
+static size_t parse_tagfilter_taglist(scstr_t fs, SyncTagFilter* tagfilter) {
     size_t csvlen;
     for (csvlen = 0 ; csvlen < fs.length ; ++csvlen) {
         if (fs.ptr[csvlen] == ')') break;
@@ -379,12 +378,12 @@
     return csvlen;
 }
 
-static size_t parse_tagfilter_subfilters(sstr_t fs, SyncTagFilter* tagfilter);
+static size_t parse_tagfilter_subfilters(scstr_t fs, SyncTagFilter* tagfilter);
 
-static size_t parse_tagfilter_filter(sstr_t fs, SyncTagFilter* tagfilter) {
+static size_t parse_tagfilter_filter(scstr_t fs, SyncTagFilter* tagfilter) {
     
     size_t consumed = rtrimskip(fs, 0);
-    fs = sstrsubs(fs, consumed);
+    fs = scstrsubs(fs, consumed);
     
     if (fs.length == 0) {
         return consumed;
@@ -412,7 +411,7 @@
         if (hasop) {
             size_t skip = rtrimskip(fs, 1);
             consumed += skip;
-            fs = sstrsubs(fs, skip);
+            fs = scstrsubs(fs, skip);
         }
 
         if (fs.length > 0 && fs.ptr[0] == '(') {
@@ -433,7 +432,7 @@
 /*
  * Parses:  ( "(" , filter , ")" )+
  */
-static size_t parse_tagfilter_subfilters(sstr_t fs, SyncTagFilter* f) {
+static size_t parse_tagfilter_subfilters(scstr_t fs, SyncTagFilter* f) {
     
     // strategy: allocate much and give back later (instead of reallocs in loop)
     size_t subfilter_cap = 8;
@@ -445,7 +444,7 @@
     do {
         // skip leading parenthesis (and white spaces)
         c = rtrimskip(fs, 1);
-        fs = sstrsubs(fs, c);
+        fs = scstrsubs(fs, c);
         total_consumed += c;
     
         // increase array capacity, if necessary
@@ -472,7 +471,7 @@
             
             // consume ')' and find the next parenthesis or the end-of-string
             c = rtrimskip(fs, 1+c);
-            fs = sstrsubs(fs, c);
+            fs = scstrsubs(fs, c);
             total_consumed += c;
 
             if (fs.length == 0 || fs.ptr[0] == ')') {
@@ -511,8 +510,7 @@
         return tagfilter;
     }
     
-    // TODO: use scstr_t after update to UCX 2.0
-    sstr_t fs = sstr((char*) filterstring);
+    scstr_t fs = scstr(filterstring);
     size_t consumed = parse_tagfilter_filter(fs, tagfilter);
     if (!consumed) {
         free_tagfilter(tagfilter);

mercurial