fix some bugs in scanf %[ handling detected while writing the wide version
This commit is contained in:
parent
73ec1d0495
commit
e0d9f780d1
1 changed files with 4 additions and 4 deletions
|
|
@ -227,14 +227,14 @@ int vfscanf(FILE *f, const char *fmt, va_list ap)
|
||||||
|
|
||||||
scanset[0] = 0;
|
scanset[0] = 0;
|
||||||
if (*p == '-') p++, scanset[1+'-'] = 1-invert;
|
if (*p == '-') p++, scanset[1+'-'] = 1-invert;
|
||||||
if (*p == ']') p++, scanset[1+']'] = 1-invert;
|
else if (*p == ']') p++, scanset[1+']'] = 1-invert;
|
||||||
for (; *p && *p != ']'; p++) {
|
for (; *p != ']'; p++) {
|
||||||
if (*p=='-' && p[1] != ']')
|
if (!*p) goto fmt_fail;
|
||||||
|
if (*p=='-' && p[1] && p[1] != ']')
|
||||||
for (c=p++[-1]; c<*p; c++)
|
for (c=p++[-1]; c<*p; c++)
|
||||||
scanset[1+c] = 1-invert;
|
scanset[1+c] = 1-invert;
|
||||||
scanset[1+*p] = 1-invert;
|
scanset[1+*p] = 1-invert;
|
||||||
}
|
}
|
||||||
if (!*p) goto fmt_fail;
|
|
||||||
|
|
||||||
if (size == SIZE_l) {
|
if (size == SIZE_l) {
|
||||||
st = (mbstate_t){0};
|
st = (mbstate_t){0};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue