From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 3 18:00:14 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 591BC1065678 for ; Mon, 3 Nov 2008 18:00:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 310238FC1D for ; Mon, 3 Nov 2008 18:00:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mA3I0BdI021394 for ; Mon, 3 Nov 2008 18:00:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mA3I0BTE021393; Mon, 3 Nov 2008 18:00:11 GMT (envelope-from gnats) Resent-Date: Mon, 3 Nov 2008 18:00:11 GMT Resent-Message-Id: <200811031800.mA3I0BTE021393@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jaakko Heinonen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAD2B1065678 for ; Mon, 3 Nov 2008 17:50:19 +0000 (UTC) (envelope-from jaakko@saunalahti.fi) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by mx1.freebsd.org (Postfix) with ESMTP id 3BDBC8FC18 for ; Mon, 3 Nov 2008 17:50:19 +0000 (UTC) (envelope-from jaakko@saunalahti.fi) Received: from ws64.jh.dy.fi (a91-153-122-179.elisa-laajakaista.fi [91.153.122.179]) by gw03.mail.saunalahti.fi (Postfix) with ESMTP id E24662168C4 for ; Mon, 3 Nov 2008 19:50:16 +0200 (EET) Received: from ws64.jh.dy.fi (localhost [127.0.0.1]) by ws64.jh.dy.fi (8.14.2/8.14.2) with ESMTP id mA3HoGRn004518 for ; Mon, 3 Nov 2008 19:50:16 +0200 (EET) (envelope-from jaakko@ws64.jh.dy.fi) Received: (from jaakko@localhost) by ws64.jh.dy.fi (8.14.2/8.14.2/Submit) id mA3HoGQp004517; Mon, 3 Nov 2008 19:50:16 +0200 (EET) (envelope-from jaakko) Message-Id: <200811031750.mA3HoGQp004517@ws64.jh.dy.fi> Date: Mon, 3 Nov 2008 19:50:16 +0200 (EET) From: Jaakko Heinonen To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/128561: [patch] compile warning fixes for bsdtar test harness X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Nov 2008 18:00:14 -0000 >Number: 128561 >Category: bin >Synopsis: [patch] compile warning fixes for bsdtar test harness >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 03 18:00:11 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Jaakko Heinonen >Release: FreeBSD 8.0-CURRENT amd64 >Organization: >Environment: >Description: Compiling bsdtar test suite on amd64 gives some warnings: main.c: In function 'test_assert_equal_string': main.c:327: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' main.c:330: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' main.c: In function 'hexdump': main.c:405: warning: format '%04x' expects type 'unsigned int', but argument 3 has type 'size_t' main.c: In function 'test_assert_empty_file': main.c:497: warning: comparison between signed and unsigned main.c:497: warning: signed and unsigned type in conditional expression >How-To-Repeat: >Fix: --- bsdtar-test-compile-warnings.diff begins here --- Index: test/main.c =================================================================== --- test/main.c (revision 183511) +++ test/main.c (working copy) @@ -324,10 +324,10 @@ test_assert_equal_string(const char *fil file, line); fprintf(stderr, " %s = ", e1); strdump(v1); - fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : strlen(v1)); + fprintf(stderr, " (length %zd)\n", v1 == NULL ? 0 : strlen(v1)); fprintf(stderr, " %s = ", e2); strdump(v2); - fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : strlen(v2)); + fprintf(stderr, " (length %zd)\n", v2 == NULL ? 0 : strlen(v2)); report_failure(extra); return (0); } @@ -402,7 +402,7 @@ hexdump(const char *p, const char *ref, char sep; for(i=0; i < l; i+=16) { - fprintf(stderr, "%04x", i + offset); + fprintf(stderr, "%04zx", i + offset); sep = ' '; for (j = 0; j < 16 && i + j < l; j++) { if (ref != NULL && p[i + j] != ref[i + j]) @@ -494,7 +494,8 @@ test_assert_empty_file(const char *f1fmt if (fd < 0) { fprintf(stderr, " Unable to open %s\n", f1); } else { - s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; + s = (sizeof(buff) < (size_t)st.st_size) ? + (ssize_t)sizeof(buff) : st.st_size; s = read(fd, buff, s); hexdump(buff, NULL, s, 0); } --- bsdtar-test-compile-warnings.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: