From jaakko@saunalahti.fi  Mon Nov  3 17:50:19 2008
Return-Path: <jaakko@saunalahti.fi>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AAD2B1065678
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <jh@saunalahti.fi>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] compile warning fixes for bsdtar test harness
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         128561
>Category:       bin
>Synopsis:       [patch] compile warning fixes for bsdtar test harness
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kientzle
>State:          patched
>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:  Mon Nov 16 13:20:51 UTC 2009
>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:
Responsible-Changed-From-To: freebsd-bugs->kientzle 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Nov 4 15:43:35 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128561 
State-Changed-From-To: open->patched 
State-Changed-By: jh 
State-Changed-When: Mon Nov 16 13:20:01 UTC 2009 
State-Changed-Why:  
Patched in head and stable/8 (r184668). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=128561 
>Unformatted:
