29 int av_strstart(
const char *str,
const char *pfx,
const char **ptr)
31 while (*pfx && *pfx == *str) {
40 int av_stristart(
const char *str,
const char *pfx,
const char **ptr)
42 while (*pfx && toupper((
unsigned)*pfx) == toupper((
unsigned)*str)) {
67 while (++len < size && *src)
71 return len + strlen(src) - 1;
76 size_t len = strlen(dst);
78 return len + strlen(src);
79 return len +
av_strlcpy(dst + len, src, size - len);
84 int len = strlen(dst);
88 len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
97 if(str) snprintf(str, 16,
"%f", d);
101 #define WHITESPACES " \n\t"
106 char *ret= out, *end= out;
107 const char *p = *buf;
108 if (!out)
return NULL;
111 while(*p && !strspn(p, term)) {
117 while(*p && *p !=
'\'')
143 }
while (c1 && c1 == c2);
149 const char *end = a + n;
154 }
while (a < end && c1 && c1 == c2);
166 printf(
"Testing av_get_token()\n");
168 const char *strings[] = {
184 "'foo : ' :blahblah",
190 " foo bar : blahblah",
192 "'foo : \\ \\ ' : blahblah",
193 "'\\fo\\o:': blahblah",
194 "\\'fo\\o\\:': foo ' :blahblah"
198 const char *p= strings[i];
memory handling functions
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle...
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
#define FF_ARRAY_ELEMS(a)
int av_stristart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str independent of case.
static int av_tolower(int c)
Locale-independent conversion of ASCII characters to lowercase.
int main(int argc, char **argv)
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
int av_strcasecmp(const char *a, const char *b)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
char * av_d2str(double d)
Convert a number to a av_malloced string.
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.