Commit 47fc264203b2bae9e8a674505ac3502c3e9e71e7

Philip Kelley 2013-01-22T09:25:15

Fix gen_pktline format specifier for Win32

diff --git a/src/cc-compat.h b/src/cc-compat.h
index cc7c908..a5e4ce1 100644
--- a/src/cc-compat.h
+++ b/src/cc-compat.h
@@ -38,8 +38,10 @@
 /* Define the printf format specifer to use for size_t output */
 #if defined(_MSC_VER) || defined(__MINGW32__)
 #	define PRIuZ "Iu"
+#	define PRIxZ "Ix"
 #else
 #	define PRIuZ "zu"
+#	define PRIxZ "zx"
 #endif
 
 /* Micosoft Visual C/C++ */
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 5896215..184b21a 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -541,7 +541,7 @@ static int gen_pktline(git_buf *buf, git_push *push)
 		git_oid_fmt(old_id, &spec->roid);
 		git_oid_fmt(new_id, &spec->loid);
 
-		git_buf_printf(buf, "%04zx%s %s %s", len, old_id, new_id, spec->rref);
+		git_buf_printf(buf, "%04"PRIxZ"%s %s %s", len, old_id, new_id, spec->rref);
 
 		if (i == 0) {
 			git_buf_putc(buf, '\0');