Fix up whitespace skipping

This commit is contained in:
Laurence Withers 2007-07-23 14:22:40 +00:00
parent 1b6343e474
commit 674e705d05
1 changed files with 7 additions and 3 deletions

View File

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