mirror of https://github.com/mpv-player/mpv
9a210ca2d5
Something like "char *s = ...; isdigit(s[0]);" triggers undefined behavior, because char can be signed, and thus s[0] can be a negative value. The is*() functions require unsigned char _or_ EOF. EOF is a special value outside of unsigned char range, thus the argument to the is*() functions can't be a char. This undefined behavior can actually trigger crashes if the implementation of these functions e.g. uses lookup tables, which are then indexed with out-of-range values. Replace all <ctype.h> uses with our own custom mp_is*() functions added with misc/ctype.h. As a bonus, these functions are locale-independent. (Although currently, we _require_ C locale for other reasons.) |
||
---|---|---|
.. | ||
ao.c | ||
ao.h | ||
ao_alsa.c | ||
ao_coreaudio.c | ||
ao_coreaudio_properties.c | ||
ao_coreaudio_properties.h | ||
ao_coreaudio_utils.c | ||
ao_coreaudio_utils.h | ||
ao_dsound.c | ||
ao_jack.c | ||
ao_lavc.c | ||
ao_null.c | ||
ao_openal.c | ||
ao_oss.c | ||
ao_pcm.c | ||
ao_portaudio.c | ||
ao_pulse.c | ||
ao_rsound.c | ||
ao_sdl.c | ||
ao_sndio.c | ||
ao_wasapi.c | ||
ao_wasapi.h | ||
ao_wasapi_utils.c | ||
ao_wasapi_utils.h | ||
internal.h | ||
pull.c | ||
push.c |