Date: Mon, 3 Nov 2008 19:50:16 +0200 (EET) From: Jaakko Heinonen <jh@saunalahti.fi> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/128561: [patch] compile warning fixes for bsdtar test harness Message-ID: <200811031750.mA3HoGQp004517@ws64.jh.dy.fi> Resent-Message-ID: <200811031800.mA3I0BTE021393@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811031750.mA3HoGQp004517>