X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2F__scanf.c;h=7c82cca4016a5297ba3a5b0d23dbeb88772710b7;hb=e68a4633e01e1a9ef41fa6dbc39d1d93dca130d3;hp=062327d75c5851e7b014bb5e03742e19e6ab1409;hpb=5efc6af4ebb9d50eb978d0338835544fdfea0396;p=musl diff --git a/src/stdio/__scanf.c b/src/stdio/__scanf.c index 062327d7..7c82cca4 100644 --- a/src/stdio/__scanf.c +++ b/src/stdio/__scanf.c @@ -319,34 +319,29 @@ int __scanf(rctx_t *r, const wchar_t *fmt, va_list ap) unread(r); break; } + m = 1; if (((c=read(r))|0x20) != 'x') { - if (t == 'i') { - t = 'o'; - /* lone 0 is valid octal */ - if ((unsigned)(c-'0') >= 8) { - m = 1; - goto int_finish; - } - } + if (t == 'i') t = 'o'; unread(r); break; } t = 'x'; + m = 0; } } switch (t) { case 'd': case 'u': - for (m=0; isdigit(c=read(r)); m=1) + for (; isdigit(c=read(r)); m=1) i = 10*i + c-'0'; goto int_finish; case 'o': - for (m=0; (unsigned)(c=read(r))-'0' < 8; m=1) + for (; (unsigned)(c=read(r))-'0' < 8; m=1) i = (i<<3) + c-'0'; goto int_finish; case 'x': - for (m=0; ; m=1) { + for (; ; m=1) { if (isdigit(c=read(r))) { i = (i<<4) + c-'0'; } else if ((unsigned)(c|0x20)-'a' < 6) {