summaryrefslogtreecommitdiff
path: root/libavutil/avstring.h
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2011-11-05 17:15:43 +0200
committerMartin Storsjö <martin@martin.st>2011-11-06 11:52:54 +0200
commit07b172fe8f6a5d567edc4dac3f813b210874d3b1 (patch)
tree71ca31415be8da95b8bb8ad6313e8dd7dfe2f7b2 /libavutil/avstring.h
parent66760b30a393388490a9bd87ef27ef211ca627f6 (diff)
avstring: Add locale independent implementations of toupper/tolower
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/avstring.h')
-rw-r--r--libavutil/avstring.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 44ed89d654..8d97e1f768 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -131,4 +131,24 @@ char *av_d2str(double d);
*/
char *av_get_token(const char **buf, const char *term);
+/**
+ * Locale independent conversion of ASCII characters to upper case.
+ */
+static inline int av_toupper(int c)
+{
+ if (c >= 'a' && c <= 'z')
+ c ^= 0x20;
+ return c;
+}
+
+/**
+ * Locale independent conversion of ASCII characters to lower case.
+ */
+static inline int av_tolower(int c)
+{
+ if (c >= 'A' && c <= 'Z')
+ c ^= 0x20;
+ return c;
+}
+
#endif /* AVUTIL_AVSTRING_H */