]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/avstring.h
timer: K&R formatting cosmetics
[ffmpeg] / libavutil / avstring.h
index 44ed89d65437fd47b403e57655d1780675d9be9d..ed4e465cbce749564706469fa417d764cd824d6e 100644 (file)
 #include <stddef.h>
 #include "attributes.h"
 
+/**
+ * @addtogroup lavu_string
+ * @{
+ */
+
 /**
  * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
  * the address of the first character in str after the prefix.
@@ -72,7 +77,7 @@ char *av_stristr(const char *haystack, const char *needle);
  * @param size size of destination buffer
  * @return the length of src
  *
- * WARNING: since the return value is the length of src, src absolutely
+ * @warning since the return value is the length of src, src absolutely
  * _must_ be a properly 0-terminated string, otherwise this will read beyond
  * the end of the buffer and possibly crash.
  */
@@ -90,9 +95,9 @@ size_t av_strlcpy(char *dst, const char *src, size_t size);
  * @param size size of destination buffer
  * @return the total length of src and dst
  *
- * WARNING: since the return value use the length of src and dst, these absolutely
- * _must_ be a properly 0-terminated strings, otherwise this will read beyond
- * the end of the buffer and possibly crash.
+ * @warning since the return value use the length of src and dst, these
+ * absolutely _must_ be a properly 0-terminated strings, otherwise this
+ * will read beyond the end of the buffer and possibly crash.
  */
 size_t av_strlcat(char *dst, const char *src, size_t size);
 
@@ -131,4 +136,40 @@ char *av_d2str(double d);
  */
 char *av_get_token(const char **buf, const char *term);
 
+/**
+ * Locale-independent conversion of ASCII characters to uppercase.
+ */
+static inline int av_toupper(int c)
+{
+    if (c >= 'a' && c <= 'z')
+        c ^= 0x20;
+    return c;
+}
+
+/**
+ * Locale-independent conversion of ASCII characters to lowercase.
+ */
+static inline int av_tolower(int c)
+{
+    if (c >= 'A' && c <= 'Z')
+        c ^= 0x20;
+    return c;
+}
+
+/*
+ * Locale-independent case-insensitive compare.
+ * @note This means only ASCII-range characters are case-insensitive
+ */
+int av_strcasecmp(const char *a, const char *b);
+
+/**
+ * Locale-independent case-insensitive compare.
+ * @note This means only ASCII-range characters are case-insensitive
+ */
+int av_strncasecmp(const char *a, const char *b, size_t n);
+
+/**
+ * @}
+ */
+
 #endif /* AVUTIL_AVSTRING_H */