From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v5 02/21] rte_string_fns.h: fix gcc8.1 sign conv warning in lstrcpy Date: Thu, 17 May 2018 07:40:16 -0700 Message-ID: <20180517074016.7873db83@xeon-e3> References: <152656480225.46638.3271983577765861155.stgit@localhost.localdomain> <152656494207.46638.7698825480823239153.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Andy Green Return-path: Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by dpdk.org (Postfix) with ESMTP id 7EF8E47CD for ; Thu, 17 May 2018 16:40:19 +0200 (CEST) Received: by mail-pg0-f67.google.com with SMTP id n9-v6so1926418pgq.5 for ; Thu, 17 May 2018 07:40:19 -0700 (PDT) In-Reply-To: <152656494207.46638.7698825480823239153.stgit@localhost.localdomain> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 17 May 2018 21:49:02 +0800 Andy Green wrote: > In file included from ./dpdk/dpdk.c:88: > /projects/lagopus/src/dpdk/build/include/rte_string_fns.h: In > function 'rte_strlcpy': > /projects/lagopus/src/dpdk/build/include/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); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- > 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..97597a148 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 */ > I still like the BSD function better because it guarantees all data in the buffer is zero'd snprintf does not.