git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH] fast-import: Fix compile warnings
@ 2007-02-07 11:38 Johannes Schindelin
  2007-02-07 12:19 ` Alex Riesen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Johannes Schindelin @ 2007-02-07 11:38 UTC (permalink / raw)
  To: git, Shawn O. Pearce


Not on all platforms are size_t and unsigned long equivalent.
Since I do not know how portable %z is, I play safe, and just
cast the respective variables to unsigned long.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	I have no idea how portable %z is, but there are so many
	experts on this list. Care to enlighten me?

 fast-import.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index bc95a0d..2813ceb 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -882,7 +882,8 @@ static int store_object(
 	SHA_CTX c;
 	z_stream s;
 
-	hdrlen = sprintf((char*)hdr,"%s %lu",type_names[type],datlen) + 1;
+	hdrlen = sprintf((char*)hdr,"%s %lu", type_names[type],
+		(unsigned long)datlen) + 1;
 	SHA1_Init(&c);
 	SHA1_Update(&c, hdr, hdrlen);
 	SHA1_Update(&c, dat, datlen);
@@ -1427,7 +1428,8 @@ static void *cmd_data (size_t *size)
 		while (n < length) {
 			size_t s = fread(buffer + n, 1, length - n, stdin);
 			if (!s && feof(stdin))
-				die("EOF in data (%lu bytes remaining)", length - n);
+				die("EOF in data (%lu bytes remaining)",
+					(unsigned long)(length - n));
 			n += s;
 		}
 	}
@@ -2028,7 +2030,8 @@ int main(int argc, const char **argv)
 	fprintf(stderr, "      marks:     %10ju (%10ju unique    )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
 	fprintf(stderr, "      atoms:     %10u\n", atom_cnt);
 	fprintf(stderr, "Memory total:    %10ju KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
-	fprintf(stderr, "       pools:    %10lu KiB\n", total_allocd/1024);
+	fprintf(stderr, "       pools:    %10lu KiB\n",
+		(unsigned long)(total_allocd / 1024));
 	fprintf(stderr, "     objects:    %10ju KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
 	fprintf(stderr, "---------------------------------------------------------------------\n");
 	pack_report();
-- 
1.5.0.rc3.2124.g3861-dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-02-08  7:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-07 11:38 [RFC/PATCH] fast-import: Fix compile warnings Johannes Schindelin
2007-02-07 12:19 ` Alex Riesen
2007-02-07 17:24 ` Junio C Hamano
2007-02-07 17:35   ` Johannes Schindelin
2007-02-07 17:47     ` Junio C Hamano
2007-02-08  7:03 ` Shawn O. Pearce
2007-02-08  7:10   ` Junio C Hamano
2007-02-08  7:16     ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).