Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Nov 2008 05:26:11 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184668 - head/usr.bin/tar/test
Message-ID:  <200811050526.mA55QBk4017410@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Wed Nov  5 05:26:11 2008
New Revision: 184668
URL: http://svn.freebsd.org/changeset/base/184668

Log:
  Fix compile warnings building on amd64.  This is modified slightly
  from Jaakko's original patch: I have misgivings about the portability
  of the 'z' printf modifier so opted to cast the arguments to (int)
  instead.
  
  PR:		bin/128561
  Submitted by:	Jaakko Heinonen
  MFC after:	30 days

Modified:
  head/usr.bin/tar/test/main.c

Modified: head/usr.bin/tar/test/main.c
==============================================================================
--- head/usr.bin/tar/test/main.c	Wed Nov  5 03:01:23 2008	(r184667)
+++ head/usr.bin/tar/test/main.c	Wed Nov  5 05:26:11 2008	(r184668)
@@ -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 %d)\n", v1 == NULL ? 0 : (int)strlen(v1));
 	fprintf(stderr, "      %s = ", e2);
 	strdump(v2);
-	fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : strlen(v2));
+	fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : (int)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, "%04x", (int)(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) : (ssize_t)st.st_size;
 		s = read(fd, buff, s);
 		hexdump(buff, NULL, s, 0);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811050526.mA55QBk4017410>