diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2013-03-03 11:17:50 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2013-03-03 21:44:10 +0100 |
commit | 88d55b827d5ecac94c9ec399d219cc02b46ed694 (patch) | |
tree | 6aa644bd0328757eae325c5ba61df169d75cfa6e | |
parent | 2cffe38df3df8ee1ec0fea0b2a2d3fed6e75da0d (diff) | |
download | ffmpeg-88d55b827d5ecac94c9ec399d219cc02b46ed694.tar.gz |
Remove incorrect use of ctype.h functions.
As far as I can tell the code should not change behaviour
depending on locale in any of these places.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
-rw-r--r-- | cmdutils.c | 2 | ||||
-rw-r--r-- | compat/strtod.c | 1 | ||||
-rw-r--r-- | ffserver.c | 20 | ||||
-rw-r--r-- | libavcodec/dvdsubdec.c | 3 | ||||
-rw-r--r-- | libavcodec/realtextdec.c | 4 | ||||
-rw-r--r-- | libavcodec/samidec.c | 10 | ||||
-rw-r--r-- | libavcodec/utils.c | 8 | ||||
-rw-r--r-- | libavcodec/xbmdec.c | 5 | ||||
-rw-r--r-- | libavfilter/avfiltergraph.c | 1 | ||||
-rw-r--r-- | libavfilter/graphparser.c | 1 | ||||
-rw-r--r-- | libavfilter/vsrc_cellauto.c | 3 | ||||
-rw-r--r-- | libavfilter/vsrc_life.c | 3 | ||||
-rw-r--r-- | libavformat/hls.c | 2 | ||||
-rw-r--r-- | libavformat/hlsproto.c | 2 | ||||
-rw-r--r-- | libavformat/http.c | 6 | ||||
-rw-r--r-- | libavformat/httpauth.c | 5 | ||||
-rw-r--r-- | libavformat/oggparsevorbis.c | 2 | ||||
-rw-r--r-- | libavformat/rtmphttp.c | 2 | ||||
-rw-r--r-- | libavformat/subtitles.c | 4 | ||||
-rw-r--r-- | libavformat/urldecode.c | 3 | ||||
-rw-r--r-- | libavformat/utils.c | 10 | ||||
-rw-r--r-- | libavutil/avstring.c | 3 | ||||
-rw-r--r-- | libavutil/avstring.h | 33 | ||||
-rw-r--r-- | libavutil/common.h | 1 | ||||
-rw-r--r-- | libavutil/dict.c | 3 | ||||
-rw-r--r-- | libavutil/eval.c | 3 | ||||
-rw-r--r-- | libavutil/parseutils.c | 10 |
27 files changed, 90 insertions, 60 deletions
diff --git a/cmdutils.c b/cmdutils.c index c6fde336bd..2668ee1486 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1628,7 +1628,7 @@ int show_help(void *optctx, const char *opt, const char *arg) 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(); diff --git a/compat/strtod.c b/compat/strtod.c index d0f9b3d41b..856866564c 100644 --- a/compat/strtod.c +++ b/compat/strtod.c @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <ctype.h> #include <limits.h> #include <stdlib.h> diff --git a/ffserver.c b/ffserver.c index f2cf67f694..eee83e5695 100644 --- a/ffserver.c +++ b/ffserver.c @@ -1125,7 +1125,7 @@ static int extract_rates(char *rates, int ratelen, const char *request) 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) { @@ -1147,7 +1147,7 @@ static int extract_rates(char *rates, int ratelen, const char *request) 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++; } @@ -1258,7 +1258,7 @@ static void get_word(char *buf, int buf_size, const char **pp) 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++; @@ -1275,7 +1275,7 @@ static void get_arg(char *buf, int buf_size, const char **pp) int quote; p = *pp; - while (isspace(*p)) p++; + while (av_isspace(*p)) p++; q = buf; quote = 0; if (*p == '\"' || *p == '\'') @@ -1285,7 +1285,7 @@ static void get_arg(char *buf, int buf_size, const char **pp) if (*p == quote) break; } else { - if (isspace(*p)) + if (av_isspace(*p)) break; } if (*p == '\0') @@ -1389,7 +1389,7 @@ static IPAddressACL* parse_dynamic_acl(FFStream *stream, HTTPContext *c) break; line_num++; p = line; - while (isspace(*p)) + while (av_isspace(*p)) p++; if (*p == '\0' || *p == '#') continue; @@ -1540,7 +1540,7 @@ static int http_parse_request(HTTPContext *c) 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; } @@ -1668,7 +1668,7 @@ static int http_parse_request(HTTPContext *c) char *eoh; char hostbuf[260]; - while (isspace(*hostinfo)) + while (av_isspace(*hostinfo)) hostinfo++; eoh = strchr(hostinfo, '\n'); @@ -4100,7 +4100,7 @@ static int parse_ffconfig(const char *filename) break; line_num++; p = line; - while (isspace(*p)) + while (av_isspace(*p)) p++; if (*p == '\0' || *p == '#') continue; @@ -4237,7 +4237,7 @@ static int parse_ffconfig(const char *filename) get_arg(arg, sizeof(arg), &p); p1 = arg; fsize = strtod(p1, &p1); - switch(toupper(*p1)) { + switch(av_toupper(*p1)) { case 'K': fsize *= 1024; break; diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index a5c90cd7fa..cb268b8dfe 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -24,6 +24,7 @@ #include "libavutil/colorspace.h" #include "libavutil/opt.h" #include "libavutil/imgutils.h" +#include "libavutil/avstring.h" //#define DEBUG @@ -523,7 +524,7 @@ static void parse_palette(DVDSubContext *ctx, char *p) 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++; } } diff --git a/libavcodec/realtextdec.c b/libavcodec/realtextdec.c index 102e0d924f..45788977b5 100644 --- a/libavcodec/realtextdec.c +++ b/libavcodec/realtextdec.c @@ -35,11 +35,11 @@ static int rt_event_to_ass(AVBPrint *buf, const char *p) while (*p) { if (*p != '<') { - if (!isspace(*p)) + if (!av_isspace(*p)) av_bprint_chars(buf, *p, 1); else if (!prev_chr_is_space) av_bprint_chars(buf, ' ', 1); - prev_chr_is_space = isspace(*p); + prev_chr_is_space = av_isspace(*p); } else { const char *end = strchr(p, '>'); if (!end) diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index c04b8a336e..39ac6082bc 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -52,7 +52,7 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) p = av_stristr(p, "<P"); if (!p) break; - if (p[2] != '>' && !isspace(p[2])) { // avoid confusion with tags such as <PRE> + if (p[2] != '>' && !av_isspace(p[2])) { // avoid confusion with tags such as <PRE> p++; continue; } @@ -70,7 +70,7 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) } /* if empty event -> skip subtitle */ - while (isspace(*p)) + while (av_isspace(*p)) p++; if (!strncmp(p, " ", 6)) { ret = -1; @@ -80,7 +80,7 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) /* extract the text, stripping most of the tags */ while (*p) { if (*p == '<') { - if (!av_strncasecmp(p, "<P", 2) && (p[2] == '>' || isspace(p[2]))) + if (!av_strncasecmp(p, "<P", 2) && (p[2] == '>' || av_isspace(p[2]))) break; if (!av_strncasecmp(p, "<BR", 3)) av_bprintf(dst, "\\N"); @@ -92,11 +92,11 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) if (*p == '>') p++; } - if (!isspace(*p)) + if (!av_isspace(*p)) av_bprint_chars(dst, *p, 1); else if (!prev_chr_is_space) av_bprint_chars(dst, ' ', 1); - prev_chr_is_space = isspace(*p); + prev_chr_is_space = av_isspace(*p); p++; } } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d680f5ae48..0cf60910cc 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2777,10 +2777,10 @@ int avpriv_unlock_avformat(void) 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 diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c index 2a41836492..8632db7b0f 100644 --- a/libavcodec/xbmdec.c +++ b/libavcodec/xbmdec.c @@ -23,6 +23,7 @@ #include "avcodec.h" #include "internal.h" #include "mathops.h" +#include "libavutil/avstring.h" static av_cold int xbm_decode_init(AVCodecContext *avctx) { @@ -94,10 +95,10 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data, uint8_t val; ptr += strcspn(ptr, "x") + 1; - if (ptr < end && isxdigit(*ptr)) { + if (ptr < end && av_isxdigit(*ptr)) { val = convert(*ptr); ptr++; - if (isxdigit(*ptr)) + if (av_isxdigit(*ptr)) val = (val << 4) + convert(*ptr); *dst++ = ff_reverse[val]; } else { diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 8b18c6f729..2764b8c85a 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <ctype.h> #include <string.h> #include "libavutil/avassert.h" diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c index 0ce823a10d..3e85261c38 100644 --- a/libavfilter/graphparser.c +++ b/libavfilter/graphparser.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <ctype.h> #include <string.h> #include <stdio.h> diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 06d9f9aa13..1431717a5f 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -30,6 +30,7 @@ #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "libavutil/random_seed.h" +#include "libavutil/avstring.h" #include "avfilter.h" #include "internal.h" #include "formats.h" @@ -133,7 +134,7 @@ static int init_pattern_from_string(AVFilterContext *ctx) if (*p == '\n' || !*p) break; else - cellauto->buf[i] = !!isgraph(*(p++)); + cellauto->buf[i] = !!av_isgraph(*(p++)); } return 0; diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index d8b8355126..d548ab46e0 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -31,6 +31,7 @@ #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "libavutil/random_seed.h" +#include "libavutil/avstring.h" #include "avfilter.h" #include "internal.h" #include "formats.h" @@ -212,7 +213,7 @@ static int init_pattern_from_file(AVFilterContext *ctx) if (*p == '\n') { p++; break; } else - life->buf[0][i*life->w + j] = isgraph(*(p++)) ? ALIVE_CELL : 0; + life->buf[0][i*life->w + j] = av_isgraph(*(p++)) ? ALIVE_CELL : 0; } } life->buf_idx = 0; diff --git a/libavformat/hls.c b/libavformat/hls.c index 0b7d050a5e..4e7af90f33 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -110,7 +110,7 @@ typedef struct HLSContext { 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; } diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c index 79cf0e498b..8dedcfd7ca 100644 --- a/libavformat/hlsproto.c +++ b/libavformat/hlsproto.c @@ -71,7 +71,7 @@ typedef struct HLSContext { 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; } diff --git a/libavformat/http.c b/libavformat/http.c index 59460005d3..1e3cff7947 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -298,9 +298,9 @@ static int process_line(URLContext *h, char *line, int line_count, 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); @@ -325,7 +325,7 @@ static int process_line(URLContext *h, char *line, int line_count, *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)); diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c index e97aee1f66..5ca48b9c1d 100644 --- a/libavformat/httpauth.c +++ b/libavformat/httpauth.c @@ -27,7 +27,6 @@ #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) @@ -80,8 +79,8 @@ static void choose_qop(char *qop, int size) 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; diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 0b52bc7c17..da029a47df 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -122,7 +122,7 @@ ff_vorbis_comment(AVFormatContext * as, AVDictionary **m, const uint8_t *buf, in } for (j = 0; j < tl; j++) - tt[j] = toupper(t[j]); + tt[j] = av_toupper(t[j]); tt[tl] = 0; memcpy(ct, v, vl); diff --git a/libavformat/rtmphttp.c b/libavformat/rtmphttp.c index d21ac67315..3a51f7c429 100644 --- a/libavformat/rtmphttp.c +++ b/libavformat/rtmphttp.c @@ -236,7 +236,7 @@ static int rtmp_http_open(URLContext *h, const char *uri, int flags) 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'; diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 546261605f..37ba0cb0b6 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -170,12 +170,12 @@ const char *ff_smil_get_attr_ptr(const char *s, const char *attr) while (*s) { while (*s) { - if (!in_quotes && isspace(*s)) + if (!in_quotes && av_isspace(*s)) break; in_quotes ^= *s == '"'; // XXX: support escaping? s++; } - while (isspace(*s)) + while (av_isspace(*s)) s++; if (!av_strncasecmp(s, attr, len) && s[len] == '=') return s + len + 1 + (s[len + 1] == '"'); diff --git a/libavformat/urldecode.c b/libavformat/urldecode.c index b1009037a8..283d912671 100644 --- a/libavformat/urldecode.c +++ b/libavformat/urldecode.c @@ -26,7 +26,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <ctype.h> #include <string.h> #include "libavutil/mem.h" @@ -54,7 +53,7 @@ char *ff_urldecode(const char *url) 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); diff --git a/libavformat/utils.c b/libavformat/utils.c index 7f90a9a5e0..1be391fbbf 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3641,11 +3641,11 @@ int av_get_frame_filename(char *buf, int buf_size, 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 '%': @@ -3866,7 +3866,7 @@ int ff_hex_to_data(uint8_t *data, const char *p) 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') @@ -3989,7 +3989,7 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, 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; @@ -4022,7 +4022,7 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, if (*ptr == '\"') ptr++; } else { - for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++) + for (; *ptr && !(av_isspace(*ptr) || *ptr == ','); ptr++) if (dest && dest < dest_end) *dest++ = *ptr; } diff --git a/libavutil/avstring.c b/libavutil/avstring.c index e2422c0a59..9ad1e12711 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -23,7 +23,6 @@ #include <stdint.h> #include <stdio.h> #include <string.h> -#include <ctype.h> #include "config.h" #include "common.h" @@ -43,7 +42,7 @@ int av_strstart(const char *str, const char *pfx, const char **ptr) 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++; } diff --git a/libavutil/avstring.h b/libavutil/avstring.h index b08d78ee8c..3896b5f2bb 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -186,6 +186,30 @@ char *av_get_token(const char **buf, const char *term); char *av_strtok(char *s, const char *delim, char **saveptr); /** + * Locale-independent conversion of ASCII isdigit. + */ +static inline int av_isdigit(int c) +{ + return c >= '0' && c <= '9'; +} + +/** + * Locale-independent conversion of ASCII isgraph. + */ +static inline int av_isgraph(int c) +{ + return c > 32 && c < 127; +} + +/** + * Locale-independent conversion of ASCII isspace. + */ +static inline int av_isspace(int c) +{ + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; +} + +/** * Locale-independent conversion of ASCII characters to uppercase. */ static inline int av_toupper(int c) @@ -206,6 +230,15 @@ static inline int av_tolower(int c) } /** + * Locale-independent conversion of ASCII isxdigit. + */ +static inline int av_isxdigit(int c) +{ + c = av_tolower(c); + return av_isdigit(c) || (c >= 'a' && c <= 'z'); +} + +/** * Locale-independent case-insensitive compare. * @note This means only ASCII-range characters are case-insensitive */ diff --git a/libavutil/common.h b/libavutil/common.h index 778c757b69..beaf9f7635 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -26,7 +26,6 @@ #ifndef AVUTIL_COMMON_H #define AVUTIL_COMMON_H -#include <ctype.h> #include <errno.h> #include <inttypes.h> #include <limits.h> diff --git a/libavutil/dict.c b/libavutil/dict.c index 967c9e2fff..3cd7156a04 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <ctype.h> #include <string.h> #include "avstring.h" @@ -50,7 +49,7 @@ av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int 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)) diff --git a/libavutil/eval.c b/libavutil/eval.c index 5d202249f0..1449e49468 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -33,6 +33,7 @@ #include "log.h" #include "mathematics.h" #include "time.h" +#include "avstring.h" typedef struct Parser { const AVClass *class; @@ -637,7 +638,7 @@ int av_expr_parse(AVExpr **expr, const char *s, return AVERROR(ENOMEM); while (*s) - if (!isspace(*s++)) *wp++ = s[-1]; + if (!av_isspace(*s++)) *wp++ = s[-1]; *wp++ = 0; p.class = &class; diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index c67f971792..494801e2de 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -426,7 +426,7 @@ static int date_get_num(const char **pp, 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++; @@ -446,8 +446,8 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt) for(;;) { /* consume time string until a non whitespace char is found */ - while (isspace(*fmt)) { - while (isspace(*p)) + while (av_isspace(*fmt)) { + while (av_isspace(*p)) p++; fmt++; } @@ -611,11 +611,11 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration) int n; q++; for (n = 100000; n >= 1; n /= 10, q++) { - if (!isdigit(*q)) + if (!av_isdigit(*q)) break; microseconds += n * (*q - '0'); } - while (isdigit(*q)) + while (av_isdigit(*q)) q++; } |