#include <stdint.h>
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
#include "config.h"
#include "common.h"
int av_stristart(const char *str, const char *pfx, const char **ptr)
{
- while (*pfx && toupper((unsigned)*pfx) == toupper((unsigned)*str)) {
+ while (*pfx && av_toupper((unsigned)*pfx) == av_toupper((unsigned)*str)) {
pfx++;
str++;
}
return NULL;
}
+char *av_strnstr(const char *haystack, const char *needle, size_t hay_length)
+{
+ size_t needle_len = strlen(needle);
+ if (!needle_len)
+ return haystack;
+ while (hay_length >= needle_len) {
+ hay_length--;
+ if (!memcmp(haystack, needle, needle_len))
+ return haystack;
+ haystack++;
+ }
+ return NULL;
+}
+
size_t av_strlcpy(char *dst, const char *src, size_t size)
{
size_t len = 0;
return path;
}
+int av_isdigit(int c)
+{
+ return c >= '0' && c <= '9';
+}
+
+int av_isgraph(int c)
+{
+ return c > 32 && c < 127;
+}
+
+int av_isspace(int c)
+{
+ return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
+ c == '\v';
+}
+
+int av_isxdigit(int c)
+{
+ c = av_tolower(c);
+ return av_isdigit(c) || (c >= 'a' && c <= 'f');
+}
+
+int av_match_name(const char *name, const char *names)
+{
+ const char *p;
+ int len, namelen;
+
+ if (!name || !names)
+ return 0;
+
+ namelen = strlen(name);
+ while ((p = strchr(names, ','))) {
+ len = FFMAX(p - names, namelen);
+ if (!av_strncasecmp(name, names, len))
+ return 1;
+ names = p + 1;
+ }
+ return !av_strcasecmp(name, names);
+}
+
+
+
#ifdef TEST
int main(void)
printf("Testing av_get_token()\n");
for (i = 0; i < FF_ARRAY_ELEMS(strings); i++) {
- const char *p = strings[i], *q;
+ const char *p = strings[i];
+ char *q;
printf("|%s|", p);
q = av_get_token(&p, ":");
printf(" -> |%s|", q);