From 2de591000db2ab9a051c03f1eb3418a1ec60b96c Mon Sep 17 00:00:00 2001 From: Florian Knigge Date: Tue, 15 Nov 2022 15:29:57 +0100 Subject: [PATCH] Fixing unintended month rollovers, ported from staticlibs/ccronexpr#35 --- ccronexpr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ccronexpr.c b/ccronexpr.c index be4bd80..a90a93d 100644 --- a/ccronexpr.c +++ b/ccronexpr.c @@ -369,10 +369,10 @@ static unsigned int find_next(uint8_t* bits, unsigned int max, unsigned int valu next_value = next_set_bit(bits, max, 0, ¬found); } if (notfound || next_value != value) { - err = set_field(calendar, field, next_value); - if (err) goto return_error; err = reset_all(calendar, reset_fields); if (err) goto return_error; + err = set_field(calendar, field, next_value); + if (err) goto return_error; } return next_value; @@ -1206,7 +1206,7 @@ uint8_t cron_getBit(uint8_t* rbyte, int idx) { * @param target cron_expr field looking to be filled * @param min Min possible value for current field * @param max Max possible value for current field, not included in interval - * @param error String output of error, if one occured + * @param error String output of error, if one occurred */ void set_number_hits(const char* value, uint8_t* target, unsigned int min, unsigned int max, const char** error) { size_t i;