else
not_in = 0;
- if (width < 0)
- /* There is no width given so there is also no limit on the
- number of characters we read. Therefore we set width to
- a very high value to make the algorithm easier. */
- width = INT_MAX;
#ifdef COMPILE_WSCANF
/* Find the beginning and the end of the scanlist. We are not
}
}
}
- while (--width > 0 && inchar () != WEOF);
+ while ((width < 0 || --width > 0) && inchar () != WEOF);
out:
#else
char buf[MB_LEN_MAX];
}
}
- if (--width <= 0)
+ if (width >= 0 && --width <= 0)
break;
}
while (inchar () != EOF);
assert (n <= MB_LEN_MAX);
str += n;
}
- while (--width > 0 && inchar () != WEOF);
+ while ((width < 0 || --width > 0) && inchar () != WEOF);
out2:
#else
do
}
}
}
- while (--width > 0 && inchar () != EOF);
+ while ((width < 0 || --width > 0) && inchar () != EOF);
#endif
if (__glibc_unlikely (now == read_in))