34 int av_strstart(
const char *str,
const char *pfx,
const char **ptr)
36 while (*pfx && *pfx == *str) {
45 int av_stristart(
const char *str,
const char *pfx,
const char **ptr)
59 return (
char*)(intptr_t)s1;
63 return (
char*)(intptr_t)s1;
69 char *
av_strnstr(
const char *haystack,
const char *needle,
size_t hay_length)
71 size_t needle_len = strlen(needle);
73 return (
char*)haystack;
74 while (hay_length >= needle_len) {
76 if (!memcmp(haystack, needle, needle_len))
77 return (
char*)haystack;
86 while (++len < size && *src)
90 return len + strlen(src) - 1;
95 size_t len = strlen(dst);
97 return len + strlen(src);
98 return len +
av_strlcpy(dst + len, src, size - len);
103 int len = strlen(dst);
107 len +=
vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
147 #define WHITESPACES " \n\t"
153 const char *p = *
buf;
158 while (*p && !strspn(p, term)) {
160 if (c ==
'\\' && *p) {
163 }
else if (c ==
'\'') {
164 while (*p && *p !=
'\'')
188 if (!s && !(s = *saveptr))
192 s += strspn(s, delim);
202 s += strcspn(s, delim);
219 }
while (c1 && c1 == c2);
225 const char *
end = a +
n;
230 }
while (a < end && c1 && c1 == c2);
236 char *p = strrchr(path,
'/');
239 char *q = strrchr(path,
'\\');
240 char *d = strchr(path,
':');
253 char *p = strrchr(path,
'/');
256 char *q = strrchr(path,
'\\');
257 char *d = strchr(path,
':');
291 return c >=
'0' && c <=
'9';
296 return c > 32 && c < 127;
301 return c ==
' ' || c ==
'\f' || c ==
'\n' || c ==
'\r' || c ==
'\t' ||
308 return av_isdigit(c) || (c >=
'a' && c <=
'f');
319 namelen = strlen(name);
320 while ((p = strchr(names,
','))) {
321 len =
FFMAX(p - names, namelen);
335 int ret = 0, tail_len;
336 uint32_t overlong_encoding_mins[6] = {
337 0x00000000, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000,
347 if ((code & 0xc0) == 0x80 || code >= 0xFE) {
351 top = (code & 128) >> 1;
368 code = (code<<6) + tmp;
371 code &= (top << 1) - 1;
375 if (code < overlong_encoding_mins[tail_len]) {
387 if (code > 0x10FFFF &&
390 if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD &&
393 if (code >= 0xD800 && code <= 0xDFFF &&
396 if ((code == 0xFFFE || code == 0xFFFF) &&
410 static const char *
const strings[] = {
426 "'foo : ' :blahblah",
432 " foo bar : blahblah",
434 "'foo : \\ \\ ' : blahblah",
435 "'\\fo\\o:': blahblah",
436 "\\'fo\\o\\:': foo ' :blahblah"
439 printf(
"Testing av_get_token()\n");
441 const char *p = strings[i];
445 printf(
" -> |%s|", q);
446 printf(
" + |%s|\n", p);