Commit 24deacb7ee7d4c77eaa4606afb21988d9fae8aa2

Edward Thomson 2014-10-13T11:01:52

Merge pull request #2618 from csware/msvc-no-z-prefix There is no "z" size specifier on MSVC

diff --git a/src/cc-compat.h b/src/cc-compat.h
index 0b66d8b..cefdc92 100644
--- a/src/cc-compat.h
+++ b/src/cc-compat.h
@@ -49,9 +49,11 @@
 #if defined(_MSC_VER) || defined(__MINGW32__)
 #	define PRIuZ "Iu"
 #	define PRIxZ "Ix"
+#	define PRIdZ "Id"
 #else
 #	define PRIuZ "zu"
 #	define PRIxZ "zx"
+#	define PRIdZ "zd"
 #endif
 
 /* Micosoft Visual C/C++ */
diff --git a/src/tree-cache.c b/src/tree-cache.c
index bf52b55..aaf8a13 100644
--- a/src/tree-cache.c
+++ b/src/tree-cache.c
@@ -278,7 +278,7 @@ static void write_tree(git_buf *out, git_tree_cache *tree)
 {
 	size_t i;
 
-	git_buf_printf(out, "%s%c%zd %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
+	git_buf_printf(out, "%s%c%"PRIdZ" %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
 
 	if (tree->entry_count != -1)
 		git_buf_put(out, (const char *) &tree->oid, GIT_OID_RAWSZ);