1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 09:02:38 +00:00
Commit Graph

7 Commits

Author SHA1 Message Date
wm4
f8c2dd1b78 build: include <strings.h> for strcasecmp()
It happens to work without strings.h on glibc or with _GNU_SOURCE, but
the POSIX standard requires including <strings.h>.

Hopefully fixes OSX build.
2014-07-10 08:29:32 +02:00
wm4
9a210ca2d5 Audit and replace all ctype.h uses
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.)
2014-07-01 23:11:08 +02:00
wm4
ca8937d7d2 bstr: add function for splitting UTF-8 2014-01-15 16:13:07 +01:00
wm4
7ed4ce91e8 bstr: check for overflow in buffer allocation
We're being a little bit lazy here and limit the max allocation to
SIZE_MAX/2, which is practically infinite anyway on 64 bit systems.
2014-01-03 00:34:15 +01:00
wm4
7639e05ea8 bstr: use mp_append_utf8_bstr()
Drop usage of the ugly PUT_UTF8() macro.
2013-12-30 22:49:51 +01:00
wm4
097fe8ea6f bstr: add bstr_xappend function
Apparently this can be really useful when being paranoid and trying to
avoid too much malloc/realloc, since it can be used to appending into a
buffer (with transparent realloc only if the buffer is too small).
2013-12-30 22:49:50 +01:00
wm4
0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00