From patchwork Fri Oct 20 23:42:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kalashnikov X-Patchwork-Id: 828870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:400c:c05::239; helo=mail-vk0-x239.google.com; envelope-from=swupdate+bncbd7ivpnd34mbb5etvlhqkgqedrav46i@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="a2qXhmW0"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qUwl41dj"; dkim-atps=neutral Received: from mail-vk0-x239.google.com (mail-vk0-x239.google.com [IPv6:2607:f8b0:400c:c05::239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yJj5g1LMGz9t3H for ; Sat, 21 Oct 2017 10:42:47 +1100 (AEDT) Received: by mail-vk0-x239.google.com with SMTP id k195sf5673914vke.7 for ; Fri, 20 Oct 2017 16:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=rf36x2h+ASqo9GRJEU6u0kcfaYoN+sXFOjKEMMsxO/8=; b=a2qXhmW0lR5U/AijtAyxjPA/N460lcr4dMs8CHbJjzONEz6SSgvyyhZaYQapHv0Mkx QViIQbVbCMGvZ9zG36egcwodpxBrndiS4Pym1Rt97F48M1r9SI9e3TEjeZ++29coizEM 8s0XSX6Tc1p3co1xaHH2WuziNCOkS3Zk02d9HHW2aMlWeP2iDFJQU8SS0UKNIYHyvE71 dOg7Plz7b3f9ESntJxBnSVwxhR/DTS9IjlCHinEQuCPR0Ola1IJjXieBEssHKxCupQ95 t9bFnT5ldF1Z/XnACGBqy2ZgUP450oDWQQgVRXjKIgIiTs8M9hFW3pTYWAp0uLV6Waf9 CsYw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:precedence:mailing-list:list-id:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=rf36x2h+ASqo9GRJEU6u0kcfaYoN+sXFOjKEMMsxO/8=; b=qUwl41dj2sEN1ZCWU4RGu9wqWNweHNy+A3vU3WR8IQoasnIAnUILI1wos6aUjP2zSB 6MsuHL/toZt6DOOA0/kkq32VQJWVHdWHgdBlW9hboz85TftHFj/76xf0xn9bkxheAp+v 0dAFH7k3DKZNUhSD6WQ4hD+XOmzEeuyPAB49c/sJ7jUQbeSsdsCvo0b+kweRPrgAEIaG 55EQVCc/f4RsPeN0H07e6Gr4xjTxgaO8R2heBVCwk7hpQyIL8Th2AEInF3KU+LmN9Pce VEYSL82RW8m17gPlFq3odO0nh0SJRJhHdjGoNiGWHTo5MGgy7xemrll6NwyUuVI0jTOJ IaGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=rf36x2h+ASqo9GRJEU6u0kcfaYoN+sXFOjKEMMsxO/8=; b=j25uwzkqzM7uT1HpCi57kayecBNfbs3NNtgurRRvrpFjpC/Q0xzPbH8ilbNRsJvBqK VSvByPSlBSK9PoVacLO8WtTObZviwZdKl5vn4YqT/8x+kL/wyfnYHaAqITs7NmJUCpiV pxSQ/29Cld5XgPOeby2wyflq/Kq1WWH7WxW94gVi23YHq8z/ipZgzhjwxY6z/nA8ifHV xkWVfqnND4OHcPuMpkQjtkfUHeiBuCrQQ5sC/ZKiQJbXGrr8YwrcE8o4iccxJxAVeh4F izMURtxBWjvxDyC5I6BFGk0p8uWRh7h+hDDZGtRhEmPxRcalfcuPk391rfxwwPa8rxDU jBmA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AMCzsaXGj1tZP4arwYPv0je64fzbxEQQufMxLf4img5MyD8PXiokf4x5 D4BL7QXomUV3SAcI4c+097I= X-Google-Smtp-Source: ABhQp+Sah3bY6CmNc9ocUtaVkvsDBGSw8AdEuPGCrmaGCu3Tyn7/7MsFdeKh00o441MjxWP5UGId2A== X-Received: by 10.31.165.204 with SMTP id o195mr421228vke.4.1508542965109; Fri, 20 Oct 2017 16:42:45 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 10.176.86.69 with SMTP id z5ls2904242uaa.6.gmail; Fri, 20 Oct 2017 16:42:44 -0700 (PDT) X-Received: by 10.31.168.133 with SMTP id r127mr471683vke.8.1508542964817; Fri, 20 Oct 2017 16:42:44 -0700 (PDT) Date: Fri, 20 Oct 2017 16:42:44 -0700 (PDT) From: Roman Kalashnikov To: swupdate Message-Id: <54c9adf4-abf7-4886-977e-b6cb93b62a14@googlegroups.com> In-Reply-To: References: Subject: [swupdate] Re: WIP: [PATCH] Fix types mistmatch MIME-Version: 1.0 X-Original-Sender: lunix0x@gmail.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Wow, i just forget to add include/util.h into commit. From: Roman Kalashnikov Date: Sat, 21 Oct 2017 02:38:05 +0300 Subject: [PATCH] Fix types mistmatch Signed-off-by: Roman Kalashnikov --- archival/gun.c | 31 +++++++++++++++++-------------- include/util.h | 6 +++--- 2 files changed, 20 insertions(+), 17 deletions(-) uint32_t __attribute__ ((__unused__)) *checksum, void __attribute__ ((__unused__)) *dgst) { -- 2.14.2 diff --git a/archival/gun.c b/archival/gun.c index ade0379..3c09ad5 100644 --- a/archival/gun.c +++ b/archival/gun.c @@ -45,8 +45,8 @@ struct ind { unsigned char *inbuf; unsigned long *offs; unsigned long *checksum; - int nbytes; - int total; + unsigned int nbytes; + unsigned int total; int percent; void *dgst; }; @@ -56,6 +56,7 @@ struct ind { returns end-of-file or error. Return 0 on error. */ static unsigned in(void *in_desc, unsigned char **buf) { + unsigned int piece; int ret; unsigned len; unsigned char *next; @@ -66,20 +67,22 @@ static unsigned in(void *in_desc, unsigned char **buf) *buf = next; len = 0; do { - ret = PIECE; - if ((unsigned)ret > SIZE - len) - ret = (int)(SIZE - len); - if (ret > me->nbytes) - ret = me->nbytes; - ret = fill_buffer(me->infile, next, ret, me->offs, (uint32_t *)me->checksum, me->dgst); + piece = PIECE; + if (piece > SIZE - len) + piece = (int)(SIZE - len); + if (piece > me->nbytes) + piece = me->nbytes; + ret = fill_buffer(me->infile, next, ret, me->offs, (uint32_t *)me->checksum, me->dgst); if (ret < 0) { len = 0; break; } - next += ret; - len += ret; - me->nbytes -= ret; - } while (ret != 0 && len < SIZE); + else + piece = ret; + next += piece; + len += piece; + me->nbytes -= piece; + } while (piece != 0 && len < SIZE); percent = (unsigned int)(((double)(me->total - me->nbytes)) * 100 / (me->total ? me->total : 1)); if (percent != (unsigned int)me->percent) { @@ -354,7 +357,7 @@ static int lunpipe(unsigned have, unsigned char *next, struct ind *indp, prematurely or a write error occurs, or Z_ERRNO if junk (not a another gzip stream) follows a valid gzip stream. */ -static int gunpipe(z_stream *strm, int infile, unsigned long *offs, int nbytes, int outfile, uint32_t *checksum, void *dgst) +static int gunpipe(z_stream *strm, int infile, unsigned long *offs, unsigned int nbytes, int outfile, uint32_t *checksum, void *dgst) { int ret, first, last; unsigned have, flags, len; @@ -492,7 +495,7 @@ static int gunpipe(z_stream *strm, int infile, unsigned long *offs, int nbytes, /* Process the gun command line arguments. See the command syntax near the beginning of this source file. */ -int decompress_image(int infile, unsigned long *offs, int nbytes, +int decompress_image(int infile, unsigned long *offs, unsigned int nbytes, int outfile, uint32_t *checksum, void *dgst) { int ret; diff --git a/include/util.h b/include/util.h index 3abc84b..b64d1f9 100644 --- a/include/util.h +++ b/include/util.h @@ -32,7 +32,7 @@ extern int loglevel; /* * loglevel is used into TRACE / ERROR - * for values > LASTLOGLEVEL, it is an encoded field + * for values > LASTLOGLEVEL, it is an encoded field * to inform the installer about a change in a subprocess */ typedef enum { @@ -179,12 +179,12 @@ int get_install_info(sourcetype *source, char *buf, size_t len); unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base); #ifdef CONFIG_GUNZIP -int decompress_image(int infile, unsigned long *offs, int nbytes, +int decompress_image(int infile, unsigned long *offs, unsigned int nbytes, int outfile, uint32_t *checksum, void *dgst); #else static inline int decompress_image(int __attribute__ ((__unused__))infile, unsigned long __attribute__ ((__unused__)) *offs, - int __attribute__ ((__unused__)) nbytes, + unsigned int __attribute__ ((__unused__)) nbytes, int __attribute__ ((__unused__)) outfile,