33 int av_strstart(
const char *str,
const char *pfx,
const char **ptr)
35 while (*pfx && *pfx == *str) {
44 int av_stristart(
const char *str,
const char *pfx,
const char **ptr)
58 return (
char*)(intptr_t)s1;
62 return (
char*)(intptr_t)s1;
68 char *
av_strnstr(
const char *haystack,
const char *needle,
size_t hay_length)
70 size_t needle_len = strlen(needle);
72 return (
char*)haystack;
73 while (hay_length >= needle_len) {
75 if (!memcmp(haystack, needle, needle_len))
76 return (
char*)haystack;
85 while (++len < size && *src)
89 return len + strlen(src) - 1;
94 size_t len = strlen(dst);
96 return len + strlen(src);
97 return len +
av_strlcpy(dst + len, src, size - len);
102 int len = strlen(dst);
106 len +=
vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
146 #define WHITESPACES " \n\t"
152 const char *p = *
buf;
157 while (*p && !strspn(p, term)) {
159 if (c ==
'\\' && *p) {
162 }
else if (c ==
'\'') {
163 while (*p && *p !=
'\'')
187 if (!s && !(s = *saveptr))
191 s += strspn(s, delim);
201 s += strcspn(s, delim);
218 }
while (c1 && c1 == c2);
224 const char *
end = a +
n;
229 }
while (a < end && c1 && c1 == c2);
235 char *p = strrchr(path,
'/');
238 char *q = strrchr(path,
'\\');
239 char *d = strchr(path,
':');
252 char *p = strrchr(path,
'/');
255 char *q = strrchr(path,
'\\');
256 char *d = strchr(path,
':');
290 return c >=
'0' && c <=
'9';
295 return c > 32 && c < 127;
300 return c ==
' ' || c ==
'\f' || c ==
'\n' || c ==
'\r' || c ==
'\t' ||
307 return av_isdigit(c) || (c >=
'a' && c <=
'f');
325 if ((code & 0xc0) == 0x80 || code >= 0xFE) {
329 top = (code & 128) >> 1;
344 code = (code<<6) + tmp;
347 code &= (top << 1) - 1;
356 if (code > 0x10FFFF &&
359 if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD &&
362 if (code >= 0xD800 && code <= 0xDFFF &&
365 if ((code == 0xFFFE || code == 0xFFFF) &&
379 static const char *
const strings[] = {
395 "'foo : ' :blahblah",
401 " foo bar : blahblah",
403 "'foo : \\ \\ ' : blahblah",
404 "'\\fo\\o:': blahblah",
405 "\\'fo\\o\\:': foo ' :blahblah"
408 printf(
"Testing av_get_token()\n");
410 const char *p = strings[i];
414 printf(
" -> |%s|", q);
415 printf(
" + |%s|\n", p);