aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/avstring.h
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2013-03-03 11:17:50 +0100
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2013-03-03 21:44:10 +0100
commit88d55b827d5ecac94c9ec399d219cc02b46ed694 (patch)
tree6aa644bd0328757eae325c5ba61df169d75cfa6e /libavutil/avstring.h
parent2cffe38df3df8ee1ec0fea0b2a2d3fed6e75da0d (diff)
downloadffmpeg-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>
Diffstat (limited to 'libavutil/avstring.h')
-rw-r--r--libavutil/avstring.h33
1 files changed, 33 insertions, 0 deletions
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
*/