From 622a7305d1fd1e0150034b82ef92e62250befcd8 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 17 May 2018 22:03:48 +0800 Subject: [PATCH] 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 --- 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 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 */ -- 2.20.1