diff options
author | Baptiste Jonglez <baptiste--git@jonglez.org> | 2012-05-02 16:19:30 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-05-02 17:11:13 +0200 |
commit | 0a352fe5190c7ba40dec2c29bafd181c1984bb95 (patch) | |
tree | 5b9fa3712208b638c3f609ada04b97d42717cc1c /src/utils.c | |
parent | 6fd0ae2ea74b1dbb713e822de425bb415217de14 (diff) | |
download | calcurse-0a352fe5190c7ba40dec2c29bafd181c1984bb95.zip |
src/utils.c: Get rid of "semantic range checks" when parsing duration
Don't restrict ranges when entering durations. We now accept duration
like "+1d42h600m". This might not seem very logical, but it's
perfectly valid, and being able to enter "+36h" is useful when you
don't want to do the maths yourself.
Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/utils.c b/src/utils.c index 56295f6..aa4a2d6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -729,9 +729,6 @@ parse_time (const char *string, unsigned *hour, unsigned *minute) * * "\d" is used as a placeholder for "(0|1|2|3|4|5|6|7|8|9)". * - * Note that this function performs an additional range check on each token to - * ensure we do not accept semantically invalid strings such as "42:23". - * * Returns 1 on success and 0 on failure. */ int @@ -779,15 +776,11 @@ parse_duration (const char *string, unsigned *duration) } else if (*p == 'h') { - if (in >= DAYINHOURS) - return 0; dur += in * HOURINMIN; state = STATE_DDHHMM_MM; } else if (*p == 'm') { - if (in >= HOURINMIN) - return 0; dur += in; state = STATE_DONE; } @@ -797,15 +790,11 @@ parse_duration (const char *string, unsigned *duration) case STATE_DDHHMM_HH: if (*p == 'h') { - if (in >= DAYINHOURS) - return 0; dur += in * HOURINMIN; state = STATE_DDHHMM_MM; } else if (*p == 'm') { - if (in >= HOURINMIN) - return 0; dur += in; state = STATE_DONE; } @@ -815,8 +804,6 @@ parse_duration (const char *string, unsigned *duration) case STATE_DDHHMM_MM: if (*p == 'm') { - if (in >= HOURINMIN) - return 0; dur += in; state = STATE_DONE; } |