]> git.cworth.org Git - notmuch/blobdiff - lib/parse-sexp.cc
test/sexp: add known broken tests for macro param inside rx/wildcard
[notmuch] / lib / parse-sexp.cc
index 08fd703708e86e6c75d960f19e2a404f46bcd20c..6814c9fc28009558d2f5603f91c6a747fc699c8f 100644 (file)
@@ -473,6 +473,9 @@ _sexp_parse_range (notmuch_database_t *notmuch,  const _sexp_prefix_t *prefix,
     }
 
     from = sx->val;
+    if (strcmp (from, "*") == 0)
+       from = "";
+
     to = from;
 
     if (sx->next) {
@@ -488,6 +491,8 @@ _sexp_parse_range (notmuch_database_t *notmuch,  const _sexp_prefix_t *prefix,
        }
 
        to = sx->next->val;
+       if (strcmp (to, "*") == 0)
+           to = "";
     }
 
     if (strcmp (prefix->name, "date") == 0) {
@@ -504,14 +509,20 @@ _sexp_parse_range (notmuch_database_t *notmuch,  const _sexp_prefix_t *prefix,
        long from_idx, to_idx;
 
        try {
-           from_idx = std::stol (from);
+           if (EMPTY_STRING (from))
+               from_idx = 0L;
+           else
+               from_idx = std::stol (from);
        } catch (std::logic_error &e) {
            _notmuch_database_log (notmuch, "bad 'from' revision: '%s'\n", from);
            return NOTMUCH_STATUS_BAD_QUERY_SYNTAX;
        }
 
        try {
-           to_idx = std::stol (to);
+           if (EMPTY_STRING (to))
+               to_idx = LONG_MAX;
+           else
+               to_idx = std::stol (to);
        } catch (std::logic_error &e) {
            _notmuch_database_log (notmuch, "bad 'to' revision: '%s'\n", to);
            return NOTMUCH_STATUS_BAD_QUERY_SYNTAX;