From patchwork Fri Sep 8 09:43:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 811423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xpXTB2N63z9s4s; Fri, 8 Sep 2017 19:43:58 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1dqFpN-0005aN-49; Fri, 08 Sep 2017 09:43:57 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1dqFpL-0005ZV-Mb for fwts-devel@lists.ubuntu.com; Fri, 08 Sep 2017 09:43:55 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dqFpL-0002rA-Bn; Fri, 08 Sep 2017 09:43:55 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib: fwts_formatting: make width parameter size_t Date: Fri, 8 Sep 2017 10:43:54 +0100 Message-Id: <20170908094354.16144-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Lengths of string objects should really be size_t rather than int. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/include/fwts_formatting.h | 2 +- src/lib/src/fwts_formatting.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/include/fwts_formatting.h b/src/lib/include/fwts_formatting.h index 3431c6aa..036f09e1 100644 --- a/src/lib/include/fwts_formatting.h +++ b/src/lib/include/fwts_formatting.h @@ -22,6 +22,6 @@ #include "fwts_list.h" -fwts_list *fwts_format_text(const char *text, const int width); +fwts_list *fwts_format_text(const char *text, const size_t width); #endif diff --git a/src/lib/src/fwts_formatting.c b/src/lib/src/fwts_formatting.c index 3b413bd3..0f661d5c 100644 --- a/src/lib/src/fwts_formatting.c +++ b/src/lib/src/fwts_formatting.c @@ -30,9 +30,9 @@ * duplicate a portion of a line of text, from start to end up to * a maximum of width characters */ -static char *dup_line(const char *start, const char *end, const int width) +static char *dup_line(const char *start, const char *end, const size_t width) { - int maxlen; + size_t maxlen; char *buffer; char *bufptr; @@ -83,9 +83,9 @@ static char *format_remove_multiple_whitespaces(const char *text) * given a text string, format it into a list of lines of * text to a given width. */ -fwts_list *fwts_format_text(const char *text, const int width) +fwts_list *fwts_format_text(const char *text, const size_t width) { - int linelen = 0; + size_t linelen = 0; char *lastspace = NULL; char *tidied_text; char *linestart;