From: Andy Green Date: Thu, 17 May 2018 14:03:48 +0000 (+0800) Subject: eal: explicit cast of strlcpy return X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=622a7305d1fd1e0150034b82ef92e62250befcd8;p=dpdk.git eal: explicit cast of strlcpy return GCC 8.1 warns: rte_string_fns.h: In function 'rte_strlcpy': rte_string_fns.h:58:9: warning: conversion to 'size_t' {aka 'long unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion] return snprintf(dst, size, "%s", src); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 5364de644a4b ("eal: support strlcpy function") Signed-off-by: Andy Green Acked-by: Bruce Richardson --- diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h index fcbb42e004..97597a1483 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)snprintf(dst, size, "%s", src); } /* pull in a strlcpy function */