summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2015-02-22 11:13:57 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2015-02-22 11:34:11 +0100
commita6c73232a8ffeed7c58dd45b766e241f8ec59d25 (patch)
tree6e73c61b977fa35c7d14022f7354e5612ef99a7a
parentc84c911f5b94894495d177bae474afd14b7a40ff (diff)
downloadcalcurse-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/args.c b/src/args.c
index 6686fe0..e600cc2 100644
--- a/src/args.c
+++ b/src/args.c
@@ -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;