From patchwork Thu Dec 15 13:10:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: He Yong X-Patchwork-Id: 1716139 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::53b; helo=mail-pg1-x53b.google.com; envelope-from=swupdate+bncbaabbtvz5soamgqemgv4lna@googlegroups.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=MZwrXQpU; dkim-atps=neutral Received: from mail-pg1-x53b.google.com (mail-pg1-x53b.google.com [IPv6:2607:f8b0:4864:20::53b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NXszm4PYcz23yy for ; Fri, 16 Dec 2022 00:10:43 +1100 (AEDT) Received: by mail-pg1-x53b.google.com with SMTP id h185-20020a636cc2000000b004820a10a57bsf1383240pgc.22 for ; Thu, 15 Dec 2022 05:10:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671109840; cv=pass; d=google.com; s=arc-20160816; b=KJ34tDGSbaHDan1zWRTHHM5qQKWR5JhaGFCN+e9Wl7icfuD9H/rakNWo6GDNN3TjUn Fj5wFkFWlpzZwGJRdcG00haN3t68fsVP+4A0RX+woAFG0cciTwnhvVMYO8sF484/HDKC 8mWXm+UL6RmSYlk1cXrA0kIo8Mi5mCgWNUmv1PmZMKKdB+cGjCn4iUX7dRliXFY134fm lqr3gy4d/39Qe8LaKeVvp70ASwksLNhZd1oaKmPxDKuBNIidVN+n2v8M+fmauZFh6+5O EDjGAXKcBm7TQ481dM1cyE8wGeadsHYPSklyInmks530JEx+A8VIf01jLLgVh5mzJ+U+ QQEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:sender:dkim-signature; bh=0MGRGAvqTGftfolHSh9eBskdkqUCWSAbTTM32kvgjA8=; b=fubgEblkscVR/xmtcdR2vGxt1kTZoVcnq1bZHVgGOSo3UTsrupRK3j0+ZUFDAIztAM rOLSSIMA6QxQ+wfsh+SnEMFKIpgEWacsFiKON0wypdG5NKaHMJ3i88eH5RN9dyYya02n YSfjFoxobEpE9YWUMVol674GnBB6z1ydYU0jugcYn023XTzAUfLlJeqHw4ZDfCMYCJW9 ktm5x+c/gBkR/lqMRycSW1typEh9F2ovR5fvTHv1ToYlJ4epsj9koKLL7LGRa/sfJ/c0 aBXyHXLaFfx4CMZ90GQpXEVHOED7pOuGpkQfICcPkXG1q+MMBR3zoqdEQggBRf26f3Tj KHEQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=i+wUoTUn; spf=pass (google.com: domain of hyyoxhk@163.com designates 220.181.12.199 as permitted sender) smtp.mailfrom=hyyoxhk@163.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:mime-version:message-id :date:subject:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=0MGRGAvqTGftfolHSh9eBskdkqUCWSAbTTM32kvgjA8=; b=MZwrXQpUFyW9LrYlps/SpqEO4CwNOcGvCs3TAFFQIzQCasm2kRddSnVcqqnvit7fR9 8zS9YlBfhk6YFtKRG7WwFQpLyxRf5l0votIMdMzrkNTYPsXKIQYvssoBiK15j5Q1ygbz E0+VEyqeSocJn6uo7AUOHkRRCNng3SC4WHAm30lz3D0pSKfnk5ucQhHIKkAAcR182SAs d3AuNGdLz8ah6fuQQMEkSa3/w4BDAm7NAKzOU9Oi+F5oDxTKE40srLrsZb/9gU81XdVo RJtUaebBt2B61d1ktAkIQksbYek0Sjb1KS6b+P0m3v/hZiWG82MSbzZA/XzGBNK4LsZp PddA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=0MGRGAvqTGftfolHSh9eBskdkqUCWSAbTTM32kvgjA8=; b=I4XMGSFlIlKD147iSHwOl9giVlom5k38MbJGIGVrvD8FIL2fVBEHhjzj9jYzem1jbN jLSlWpgaZxA1FR7sEXnEt3YZH1D0McyAlmt8ko5REUAT6yYEKLSCfK4BSK4CFFQJp2Ci M2QqcqLAqb0UlpfKBq5BPQQYeqCe0/pR1B9dN45rFlv8QGgPyKshuuWVT1fl7Iu4f/vM 9zuUFcmac1H3+lN7gheFg1B5/+PlCunX1apbK+RzXppQWAeQ0SmdfZ+apsoIOmgI/NWS 8BeijVXp3xBB099UUpae7hbmLVKnV9emX/0rSew4XxJdCzmLypsye5AFENjtpkJoiwHE m/Dg== Sender: swupdate@googlegroups.com X-Gm-Message-State: ANoB5pkaVjAD8RgeWMtkQirklJQEtHSxTI02n5YT2m15FxBuJKR/E9Hy hfi1UFKdD11Se0FQ/WEIrc0= X-Google-Smtp-Source: AA0mqf4nPy55aHTHd+H3UISPTu2PyaShiSQ3BqZDd/AN+X0d4U0GOhesp2JDVr8y9JNhRLGTDZ3ahQ== X-Received: by 2002:a17:903:100c:b0:189:a682:c5a6 with SMTP id a12-20020a170903100c00b00189a682c5a6mr42727785plb.78.1671109840417; Thu, 15 Dec 2022 05:10:40 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:90a:1d46:b0:214:246b:918a with SMTP id u6-20020a17090a1d4600b00214246b918als2876800pju.2.-pod-canary-gmail; Thu, 15 Dec 2022 05:10:37 -0800 (PST) X-Received: by 2002:a17:902:bf04:b0:189:c4a9:c5ee with SMTP id bi4-20020a170902bf0400b00189c4a9c5eemr26902519plb.32.1671109837617; Thu, 15 Dec 2022 05:10:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671109837; cv=none; d=google.com; s=arc-20160816; b=FhkRXSGzJudEtlMElcTi92IlWDo9+2Q+b2SdYYIENTJ0nQNZxdKh6cOuzOj+h/2/Ih d+Zbn/Sv8/kZ1ZdLIhxll/GR0UrMuCre9EWIZ3eDSO8gtheFCBGmw+mOZf+fFPuRf+8F HdKoPqng+oYnFnlr+uIcg20sMIIM0OKK55zTrZTyBfgvp9W0iwb+27u4xU7BCmgIwJsw Rm7vmcYlEtxHhR0lZZsFpdED+U2o9ksb9gB+CfgFojletpap396wb93RGGv3wi4He5vK 9K7ywi7G1tWd0bJlXnbf3cKcfr5FtHxIlnxaMn8UOVGsb3yKnGim3kUfh7AVp5kmmXB1 +MBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:dkim-signature; bh=XDI04vB+CEHtntLIXnZ11MLY9/QptmzjSApZpV0xK9E=; b=ILjTvXPj4tbPYrUu0N1PHAP4WI8hplCyeQevbU1w+h0eBLzi8IQ7A7J2PpfxE4zvz1 60H/pPH4kdzSdWy+4iXp/t2gwcBKb+tPGhsDQW1m21JAtnesGaBSt681e6ObaNdjBX+Q pxirOxAJ3B734qfnO7jnKuaW+luOLDJLA0+AqXVQtzesV/fdWDIdNMFfW+PG2FV9VBlw WDxHJwMuTYlgU+lfpgvAlWSyDEMUKJ6t8mNOuyXqd9EFB9ip545LRLfl7y+/zfBsysxL sCWN6iz8AmK9qRMts6vBPDBWa2mbz+ERvpdFs7wbYcEhyWNLUGdB/v0uYWKY+Ggo5ONQ y2aw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=i+wUoTUn; spf=pass (google.com: domain of hyyoxhk@163.com designates 220.181.12.199 as permitted sender) smtp.mailfrom=hyyoxhk@163.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from m12.mail.163.com (m12.mail.163.com. [220.181.12.199]) by gmr-mx.google.com with ESMTP id c9-20020a170902d48900b00188a88cc62fsi674749plg.12.2022.12.15.05.10.37 for ; Thu, 15 Dec 2022 05:10:37 -0800 (PST) Received-SPF: pass (google.com: domain of hyyoxhk@163.com designates 220.181.12.199 as permitted sender) client-ip=220.181.12.199; Received: from nh50.. (unknown [182.148.5.245]) by zwqz-smtp-mta-g0-4 (Coremail) with SMTP id _____wD3_jLEHJtjbSZ+AA--.24445S2; Thu, 15 Dec 2022 21:10:29 +0800 (CST) From: He Yong To: swupdate@googlegroups.com Subject: [swupdate] [PATCH v1 1/1] Fix printf format warnings under 32-bit compilers Date: Thu, 15 Dec 2022 21:10:28 +0800 Message-Id: <20221215131028.12797-1-hyyoxhk@163.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANSID: _____wD3_jLEHJtjbSZ+AA--.24445S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxGFW5GFyUGr4UJF1kXr43Jrb_yoWrur43pF WUAFyUCrW5KrW3CF1xJayqkw1UK3WDG3WUur1DZr15AF90v3sxZrWvgryY9w4UXFsavF10 9rW7GF15Zw45Z3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jj38nUUUUU= X-Originating-IP: [182.148.5.245] X-CM-SenderInfo: pk1105lkn6il2tof0z/1tbiZQvY0l8ZWIeIuwAAsO X-Original-Sender: hyyoxhk@163.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=i+wUoTUn; spf=pass (google.com: domain of hyyoxhk@163.com designates 220.181.12.199 as permitted sender) smtp.mailfrom=hyyoxhk@163.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.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: , - use `PRIuPTR` instead of "%lu" for formatting size_t values - use `SCNu64` instead of "%lu" for formatting dev_t values - use `PRId64` instead of "%ld" for formatting uint64_t values - use `CURL_FORMAT_CURL_OFF_TU` instead of "%lu" for formatting curl_off_t values Solves the following warning: core/cpio_utils.c: In function ‘copy_write’: include/util.h:92:41: warning: format ‘%lu’ expects argument of type ‘long unsigned int’ but argument 7 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=] 92 | "ERROR %s : %s : %d : " format, \ | ^~~~~~~~~~~~~~~~~~~~~~~ include/util.h:110:9: note: in expansion of macro ‘swupdate_notify’ 110 | swupdate_notify(FAILURE, format, ERRORLEVEL, ## arg) | ^~~~~~~~~~~~~~~ core/cpio_utils.c:141:25: note: in expansion of macro ‘ERROR’ 141 | ERROR("cannot write %lu bytes: %s", len, strerror(errno)); | ^~~~~ include/util.h:99:49: warning: format ‘%lu’ expects argument of type ‘long unsigned int’ but argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=] 99 | "ERROR : " format, ## arg); \ ... include/util.h:103:41: warning: format ‘%ld’ expects argument of type ‘long int’ but argument 5 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Wformat=] 103 | "[%s] : " format, __func__, ## arg); \ | ^~~~~~~~~ include/util.h:110:9: note: in expansion of macro ‘swupdate_notify’ 110 | swupdate_notify(FAILURE, format, ERRORLEVEL, ## arg) | ^~~~~~~~~~~~~~~ mongoose/mongoose_interface.c:538:17: note: in expansion of macro ‘ERROR’ 538 | ERROR("Connection lost, no data for %ld seconds, closing..." Signed-off-by: He Yong --- core/cpio_utils.c | 5 +++-- core/notifier.c | 3 ++- corelib/channel_curl.c | 2 +- mongoose/mongoose_interface.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/cpio_utils.c b/core/cpio_utils.c index a31f254..489a12c 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -138,12 +139,12 @@ int copy_write(void *out, const void *buf, size_t len) if (ret < 0) { if (errno == EINTR) continue; - ERROR("cannot write %lu bytes: %s", len, strerror(errno)); + ERROR("cannot write %" PRIuPTR " bytes: %s", len, strerror(errno)); return -1; } if (ret == 0) { - ERROR("cannot write %lu bytes: %s", len, strerror(errno)); + ERROR("cannot write %" PRIuPTR " bytes: %s", len, strerror(errno)); return -1; } diff --git a/core/notifier.c b/core/notifier.c index 87acb01..2ff2013 100644 --- a/core/notifier.c +++ b/core/notifier.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -492,7 +493,7 @@ void notify_init(void) if (sd_booted() && getenv("JOURNAL_STREAM") != NULL) { dev_t device; ino_t inode; - if (sscanf(getenv("JOURNAL_STREAM"), "%lu:%lu", &device, &inode) == 2) { + if (sscanf(getenv("JOURNAL_STREAM"), "%" SCNu64 ":%lu", &device, &inode) == 2) { struct stat statbuffer; if (fstat(fileno(stderr), &statbuffer) == 0) { if (inode == statbuffer.st_ino && device == statbuffer.st_dev) { diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index 81808f8..0435f15 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -1171,7 +1171,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data) WARN("Failed to get total download size for URL %s.", channel_data->url); } else - INFO("Total download size is %lu kB.", + INFO("Total download size is %" CURL_FORMAT_CURL_OFF_TU " kB.", download_data.total_download_size / 1024); } diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 71c394f..a17d9bd 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -535,7 +535,7 @@ static void timer_ev_handler(void *fn_data) if (fus && (watchdog_conn > 0) && (mg_millis() - fus->last_io_time > (watchdog_conn * 1000))) { /* Connection lost, drop data */ - ERROR("Connection lost, no data for %ld seconds, closing...", + ERROR("Connection lost, no data for %" PRId64 " seconds, closing...", (mg_millis() - fus->last_io_time) / 1000); mg_http_reply(fus->c, 408, "", "%s", "Request Timeout\n"); fus->c->is_draining = 1;