[FFmpeg-cvslog] avutil/avstring: add av_strnlen()

Michael Niedermayer git at videolan.org
Sun Dec 22 22:52:54 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Dec 21 15:42:04 2013 +0100| [911676c64374af3959ef01609047503a42d5bf87] | committer: Michael Niedermayer

avutil/avstring: add av_strnlen()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=911676c64374af3959ef01609047503a42d5bf87
---

 doc/APIchanges       |    4 ++++
 libavutil/avstring.h |   14 ++++++++++++++
 libavutil/version.h  |    4 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 7139f7a..21a8c4c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil:     2012-10-22
 
 
 API changes, most recent first:
+
+2013-12-22 - xxxxxxx - lavu 52.59.100 - avstring.h
+  Add av_strnlen() function.
+
 2013-12-xx - xxxxxxx - lavu 52.57.100 - opencl.h
   Add av_opencl_benchmark() function.
 
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 882a2b5..de2f71d 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -132,6 +132,20 @@ size_t av_strlcat(char *dst, const char *src, size_t size);
 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
 
 /**
+ * Get the count of continuous non zero chars starting from the beginning.
+ *
+ * @param len maximum number of characters to check in the string, that
+ *            is the maximum value which is returned by the function
+ */
+static inline size_t av_strnlen(const char *s, size_t len)
+{
+    size_t i;
+    for (i = 0; i < len && s[i]; i++)
+        ;
+    return i;
+}
+
+/**
  * Print arguments following specified format into a large enough auto
  * allocated buffer. It is similar to GNU asprintf().
  * @param fmt printf-compatible format string, specifying how the
diff --git a/libavutil/version.h b/libavutil/version.h
index e7bad6f..a70a110 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -75,8 +75,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  52
-#define LIBAVUTIL_VERSION_MINOR  58
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR  59
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list