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) &&
409 for (p = name; p && *p; ) {
410 for (q = list; q && *q; ) {
412 for (k = 0; p[k] == q[k] || (p[k]*q[k] == 0 && p[k]+q[k] == separator); k++)
413 if (k && (!p[k] || p[k] == separator))
415 q = strchr(q, separator);
418 p = strchr(p, separator);
430 static const char *
const strings[] = {
446 "'foo : ' :blahblah",
452 " foo bar : blahblah",
454 "'foo : \\ \\ ' : blahblah",
455 "'\\fo\\o:': blahblah",
456 "\\'fo\\o\\:': foo ' :blahblah"
459 printf(
"Testing av_get_token()\n");
461 const char *p = strings[i];
465 printf(
" -> |%s|", q);
466 printf(
" + |%s|\n", p);