Make sure the behavior does not change with the locale.
Signed-off-by: Martin Storsjö <martin@martin.st>
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
+#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/dict.h"
str = p = av_strdup(name);
while (*p) {
- *p = toupper(*p);
+ *p = av_toupper(*p);
p++;
}
str = p = av_strdup(name);
while (*p) {
- *p = toupper(*p);
+ *p = av_toupper(*p);
p++;
}
if (av_strncasecmp(p, "Pragma:", 7) == 0) {
const char *q = p + 7;
- while (*q && *q != '\n' && isspace(*q))
+ while (*q && *q != '\n' && av_isspace(*q))
q++;
if (av_strncasecmp(q, "stream-switch-entry=", 20) == 0) {
if (stream_no < ratelen && stream_no >= 0)
rates[stream_no] = rate_no;
- while (*q && *q != '\n' && !isspace(*q))
+ while (*q && *q != '\n' && !av_isspace(*q))
q++;
}
p = *pp;
skip_spaces(&p);
q = buf;
- while (!isspace(*p) && *p != '\0') {
+ while (!av_isspace(*p) && *p != '\0') {
if ((q - buf) < buf_size - 1)
*q++ = *p;
p++;
int quote;
p = *pp;
- while (isspace(*p)) p++;
+ while (av_isspace(*p)) p++;
q = buf;
quote = 0;
if (*p == '\"' || *p == '\'')
if (*p == quote)
break;
} else {
- if (isspace(*p))
+ if (av_isspace(*p))
break;
}
if (*p == '\0')
break;
line_num++;
p = line;
- while (isspace(*p))
+ while (av_isspace(*p))
p++;
if (*p == '\0' || *p == '#')
continue;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (av_strncasecmp(p, "User-Agent:", 11) == 0) {
useragent = p + 11;
- if (*useragent && *useragent != '\n' && isspace(*useragent))
+ if (*useragent && *useragent != '\n' && av_isspace(*useragent))
useragent++;
break;
}
char *eoh;
char hostbuf[260];
- while (isspace(*hostinfo))
+ while (av_isspace(*hostinfo))
hostinfo++;
eoh = strchr(hostinfo, '\n');
break;
line_num++;
p = line;
- while (isspace(*p))
+ while (av_isspace(*p))
p++;
if (*p == '\0' || *p == '#')
continue;
get_arg(arg, sizeof(arg), &p);
p1 = arg;
fsize = strtod(p1, &p1);
- switch(toupper(*p1)) {
+ switch(av_toupper(*p1)) {
case 'K':
fsize *= 1024;
break;
int read_yesno(void)
{
int c = getchar();
- int yesno = (toupper(c) == 'Y');
+ int yesno = (av_toupper(c) == 'Y');
while (c != '\n' && c != EOF)
c = getchar();
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
double res;
/* Skip leading spaces */
- while (isspace(*nptr))
+ while (av_isspace(*nptr))
nptr++;
if (!av_strncasecmp(nptr, "infinity", 8)) {
#include "dsputil.h"
#include "libavutil/colorspace.h"
#include "libavutil/imgutils.h"
+#include "libavutil/avstring.h"
//#define DEBUG
ctx->has_palette = 1;
for (i = 0; i < 16; i++) {
ctx->palette[i] = strtoul(p, &p, 16);
- while (*p == ',' || isspace(*p))
+ while (*p == ',' || av_isspace(*p))
p++;
}
} else if (!strncmp("size:", cur, 5)) {
unsigned int avpriv_toupper4(unsigned int x)
{
- return toupper(x & 0xFF)
- + (toupper((x >> 8) & 0xFF) << 8)
- + (toupper((x >> 16) & 0xFF) << 16)
- + (toupper((x >> 24) & 0xFF) << 24);
+ return av_toupper(x & 0xFF) +
+ (av_toupper((x >> 8) & 0xFF) << 8) +
+ (av_toupper((x >> 16) & 0xFF) << 16) +
+ (av_toupper((x >> 24) & 0xFF) << 24);
}
#if !HAVE_THREADS
} else {
char *dash = strchr(mapping, '-');
if (!dash) { // short mapping
- if (isdigit(*mapping))
+ if (av_isdigit(*mapping))
mode = MAP_ONE_INT;
else
mode = MAP_ONE_STR;
- } else if (isdigit(*mapping)) {
- if (isdigit(*(dash+1)))
+ } else if (av_isdigit(*mapping)) {
+ if (av_isdigit(*(dash+1)))
mode = MAP_PAIR_INT_INT;
else
mode = MAP_PAIR_INT_STR;
} else {
- if (isdigit(*(dash+1)))
+ if (av_isdigit(*(dash+1)))
mode = MAP_PAIR_STR_INT;
else
mode = MAP_PAIR_STR_STR;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
#include <string.h>
#include "libavutil/avassert.h"
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
#include <string.h>
#include <stdio.h>
p++;
break;
} else
- (*values)[*cols*i + j] = !!isgraph(*(p++));
+ (*values)[*cols*i + j] = !!av_isgraph(*(p++));
}
}
av_file_unmap(buf, size);
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
{
int len = ff_get_line(s, buf, maxlen);
- while (len > 0 && isspace(buf[len - 1]))
+ while (len > 0 && av_isspace(buf[len - 1]))
buf[--len] = '\0';
return len;
}
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
{
int len = ff_get_line(s, buf, maxlen);
- while (len > 0 && isspace(buf[len - 1]))
+ while (len > 0 && av_isspace(buf[len - 1]))
buf[--len] = '\0';
return len;
}
p = line;
if (line_count == 0) {
- while (!isspace(*p) && *p != '\0')
+ while (!av_isspace(*p) && *p != '\0')
p++;
- while (isspace(*p))
+ while (av_isspace(*p))
p++;
s->http_code = strtol(p, &end, 10);
*p = '\0';
tag = line;
p++;
- while (isspace(*p))
+ while (av_isspace(*p))
p++;
if (!av_strcasecmp(tag, "Location")) {
av_strlcpy(s->location, p, sizeof(s->location));
#include "libavutil/md5.h"
#include "urldecode.h"
#include "avformat.h"
-#include <ctype.h>
static void handle_basic_params(HTTPAuthState *state, const char *key,
int key_len, char **dest, int *dest_len)
char *ptr = strstr(qop, "auth");
char *end = ptr + strlen("auth");
- if (ptr && (!*end || isspace(*end) || *end == ',') &&
- (ptr == qop || isspace(ptr[-1]) || ptr[-1] == ',')) {
+ if (ptr && (!*end || av_isspace(*end) || *end == ',') &&
+ (ptr == qop || av_isspace(ptr[-1]) || ptr[-1] == ',')) {
av_strlcpy(qop, "auth", size);
} else {
qop[0] = 0;
}
for (j = 0; j < tl; j++)
- tt[j] = toupper(t[j]);
+ tt[j] = av_toupper(t[j]);
tt[tl] = 0;
memcpy(ct, v, vl);
goto fail;
}
}
- while (off > 0 && isspace(rt->client_id[off - 1]))
+ while (off > 0 && av_isspace(rt->client_id[off - 1]))
off--;
rt->client_id[off] = '\0';
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
#include <string.h>
#include "libavutil/mem.h"
if (c == '%' && s + 2 < url_len) {
char c2 = url[s++];
char c3 = url[s++];
- if (isxdigit(c2) && isxdigit(c3)) {
+ if (av_isxdigit(c2) && av_isxdigit(c3)) {
c2 = av_tolower(c2);
c3 = av_tolower(c3);
if (c == '%') {
do {
nd = 0;
- while (isdigit(*p)) {
+ while (av_isdigit(*p)) {
nd = nd * 10 + *p++ - '0';
}
c = *p++;
- } while (isdigit(c));
+ } while (av_isdigit(c));
switch(c) {
case '%':
p += strspn(p, SPACE_CHARS);
if (*p == '\0')
break;
- c = toupper((unsigned char) *p++);
+ c = av_toupper((unsigned char) *p++);
if (c >= '0' && c <= '9')
c = c - '0';
else if (c >= 'A' && c <= 'F')
int key_len, dest_len = 0;
/* Skip whitespace and potential commas. */
- while (*ptr && (isspace(*ptr) || *ptr == ','))
+ while (*ptr && (av_isspace(*ptr) || *ptr == ','))
ptr++;
if (!*ptr)
break;
if (*ptr == '\"')
ptr++;
} else {
- for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++)
+ for (; *ptr && !(av_isspace(*ptr) || *ptr == ','); ptr++)
if (dest && dest < dest_end)
*dest++ = *ptr;
}
#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++;
}
#ifndef AVUTIL_COMMON_H
#define AVUTIL_COMMON_H
-#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
#include <string.h>
#include "avstring.h"
for(; i<m->count; i++){
const char *s= m->elems[i].key;
if(flags & AV_DICT_MATCH_CASE) for(j=0; s[j] == key[j] && key[j]; j++);
- else for(j=0; toupper(s[j]) == toupper(key[j]) && key[j]; j++);
+ else for(j=0; av_toupper(s[j]) == av_toupper(key[j]) && key[j]; j++);
if(key[j])
continue;
if(s[j] && !(flags & AV_DICT_IGNORE_SUFFIX))
#include "eval.h"
#include "log.h"
#include "mathematics.h"
+#include "avstring.h"
typedef struct Parser {
const AVClass *class;
return AVERROR(ENOMEM);
while (*s)
- if (!isspace(*s++)) *wp++ = s[-1];
+ if (!av_isspace(*s++)) *wp++ = s[-1];
*wp++ = 0;
p.class = &class;
val = 0;
for(i = 0; i < len_max; i++) {
c = *p;
- if (!isdigit(c))
+ if (!av_isdigit(c))
break;
val = (val * 10) + c - '0';
p++;
int val, n;
q++;
for (val = 0, n = 100000; n >= 1; n /= 10, q++) {
- if (!isdigit(*q))
+ if (!av_isdigit(*q))
break;
val += n * (*q - '0');
}