[dpdk-dev] [PATCH v3 40/40] rte_string_fns.h: explicit cast for int return to size_t

Stephen Hemminger stephen at networkplumber.org
Thu May 10 21:17:42 CEST 2018


On Thu, 10 May 2018 10:49:40 +0800
Andy Green <andy at warmcat.com> wrote:

> Signed-off-by: Andy Green <andy at warmcat.com>
> ---
>  lib/librte_eal/common/include/rte_string_fns.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
> index fcbb42e00..51413a55e 100644
> --- a/lib/librte_eal/common/include/rte_string_fns.h
> +++ b/lib/librte_eal/common/include/rte_string_fns.h
> @@ -55,7 +55,7 @@ rte_strsplit(char *string, int stringlen,
>  static inline size_t
>  rte_strlcpy(char *dst, const char *src, size_t size)
>  {
> -	return snprintf(dst, size, "%s", src);
> +	return (size_t)(unsigned int)snprintf(dst, size, "%s", src);
>  }
>  
>  /* pull in a strlcpy function */
> 

I would rather see a proper version of strlcpy extracted from libbsd


More information about the dev mailing list