[FFmpeg-devel] [PATCH 1/2] avutil/avstring: add av_strnlen()

Stefano Sabatini stefasab at gmail.com
Sun Dec 22 21:49:16 CET 2013


On date Saturday 2013-12-21 17:18:42 +0100, Michael Niedermayer encoded:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavutil/avstring.h |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/libavutil/avstring.h b/libavutil/avstring.h
> index 882a2b5..fb8236f 100644
> --- a/libavutil/avstring.h
> +++ b/libavutil/avstring.h
> @@ -132,6 +132,17 @@ 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);
>  
>  /**
> + * Gets the count of continuous non zero chars starting from the begin.

Get

@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)
> +{

> +    int i;

size_t ?

> +    for (i = 0; i<len && s[i]; i++)

nit: i < len

> +        ;
> +    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
> -- 
> 1.7.9.5
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
FFmpeg = Fundamentalist and Fundamental Magnificient Portentous Enlightened Guide


More information about the ffmpeg-devel mailing list