From 12c5c1d3e3906e18a96ec380605d2f1504fc3d3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= <Reimar.Doeffinger@gmx.de>
Date: Wed, 6 Mar 2013 14:00:22 +0200
Subject: [PATCH] avstring: Add locale independent versions of some ctype.h
 functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 doc/APIchanges       |  3 +++
 libavutil/avstring.c | 22 ++++++++++++++++++++++
 libavutil/avstring.h | 20 ++++++++++++++++++++
 libavutil/version.h  |  2 +-
 4 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index b58f4da5229..d7d95df4756 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2012-10-22
 
 API changes, most recent first:
 
+2013-xx-xx - xxxxxxx - lavu 52.8.0 - avstring.h
+  Add av_isdigit, av_isgraph, av_isspace, av_isxdigit.
+
 2013-xx-xx - xxxxxxx - lavfi 3.4.0 - avfiltergraph.h
   Add resample_lavr_opts to AVFilterGraph for setting libavresample options
   for auto-inserted resample filters.
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 625f723686e..6ce0310c1a8 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -213,6 +213,28 @@ const char *av_dirname(char *path)
     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 <= 'z');
+}
+
 #ifdef TEST
 
 int main(void)
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index e0e6ed26f57..b7d10983c39 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -151,6 +151,21 @@ char *av_d2str(double d);
  */
 char *av_get_token(const char **buf, const char *term);
 
+/**
+ * Locale-independent conversion of ASCII isdigit.
+ */
+int av_isdigit(int c);
+
+/**
+ * Locale-independent conversion of ASCII isgraph.
+ */
+int av_isgraph(int c);
+
+/**
+ * Locale-independent conversion of ASCII isspace.
+ */
+int av_isspace(int c);
+
 /**
  * Locale-independent conversion of ASCII characters to uppercase.
  */
@@ -171,6 +186,11 @@ static inline int av_tolower(int c)
     return c;
 }
 
+/**
+ * Locale-independent conversion of ASCII isxdigit.
+ */
+int av_isxdigit(int c);
+
 /*
  * Locale-independent case-insensitive compare.
  * @note This means only ASCII-range characters are case-insensitive
diff --git a/libavutil/version.h b/libavutil/version.h
index 8d7e3789941..38b11a408d3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -37,7 +37,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR  7
+#define LIBAVUTIL_VERSION_MINOR  8
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
GitLab