diff options
| author | David Bremner <david@tethera.net> | 2022-06-04 18:53:57 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-06-25 19:49:55 -0300 |
| commit | 78632345868b5e4753ad402c806c29569946ce89 (patch) | |
| tree | 2b5fe60ca1a41b430beecc2be14fa191f016c467 /lib | |
| parent | 254912821fd06aae17305fdfa640c7888c4b87cb (diff) | |
lib/sexp: special case "" as an argument in lastmod ranges.
Support this syntax for constincy with (data from to) ranges.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/parse-sexp.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/parse-sexp.cc b/lib/parse-sexp.cc index 08fd7037..6282a456 100644 --- a/lib/parse-sexp.cc +++ b/lib/parse-sexp.cc @@ -504,14 +504,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; |
