summaryrefslogtreecommitdiffstats
path: root/bstr
Commit message (Collapse)AuthorAgeFilesLines
* build: include <strings.h> for strcasecmp()wm42014-07-101-0/+1
| | | | | | | 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.
* Audit and replace all ctype.h useswm42014-07-011-4/+4
| | | | | | | | | | | | | | | | 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.)
* bstr: add function for splitting UTF-8wm42014-01-152-1/+18
|
* bstr: check for overflow in buffer allocationwm42014-01-031-0/+4
| | | | | 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.
* bstr: use mp_append_utf8_bstr()wm42013-12-301-19/+4
| | | | Drop usage of the ugly PUT_UTF8() macro.
* bstr: add bstr_xappend functionwm42013-12-302-0/+59
| | | | | | 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).
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-172-0/+585