diff --git a/src/libiso8601/200_parser.c b/src/libiso8601/200_parser.c index f438a5d..7a51f1c 100644 --- a/src/libiso8601/200_parser.c +++ b/src/libiso8601/200_parser.c @@ -94,13 +94,13 @@ int iso8601_parse(const char* str, struct iso8601_date* earliest, struct iso8601 switch(dig) { case 4: /* YYYY */ y = num; - goto done; + break; case 6: /* YYYYMM */ qr = div(num, 100); y = qr.quot; m = qr.rem; - goto done; + break; case 7: /* YYYYJJJ */ qr = div(num, 1000); @@ -121,7 +121,7 @@ int iso8601_parse(const char* str, struct iso8601_date* earliest, struct iso8601 } switch(ch) { - case '0': + case 0: goto done; case 'T': @@ -148,6 +148,9 @@ int iso8601_parse(const char* str, struct iso8601_date* earliest, struct iso8601 dig = 0; state = state_week_basic; break; + + default: + ERROR_IF(1); } break; @@ -531,6 +534,7 @@ int iso8601_parse(const char* str, struct iso8601_date* earliest, struct iso8601 } done: + --str; while(*str) ERROR_IF(!isspace(*str++)); if(neg) y *= -1;