diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2015-02-22 11:13:57 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2015-02-22 11:34:11 +0100 |
commit | a6c73232a8ffeed7c58dd45b766e241f8ec59d25 (patch) | |
tree | 6e73c61b977fa35c7d14022f7354e5612ef99a7a | |
parent | c84c911f5b94894495d177bae474afd14b7a40ff (diff) | |
download | calcurse-a6c73232a8ffeed7c58dd45b766e241f8ec59d25.tar.gz calcurse-a6c73232a8ffeed7c58dd45b766e241f8ec59d25.zip |
Use LONG_MAX for invalid dates in parse_datearg()
We cannot use -1 here since negative values are valid dates.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | src/args.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -326,7 +326,7 @@ static long parse_datearg(const char *str) (int *)&day.mm, (int *)&day.dd, NULL)) return date2sec(day, 0, 0); - return -1; + return LONG_MAX; } static long parse_datetimearg(const char *str) @@ -345,7 +345,7 @@ static long parse_datetimearg(const char *str) if (!parse_time(time, &hour, &min)) return -1; ret = parse_datearg(date); - if (!ret) + if (ret == LONG_MAX) return -1; ret += hour * HOURINSEC + min * MININSEC; @@ -353,7 +353,7 @@ static long parse_datetimearg(const char *str) } ret = parse_datearg(date); - if (ret < 0) { + if (ret == LONG_MAX) { /* No date specified, use time only. */ if (!parse_time(date, &hour, &min)) return -1; |