Commit 3a33c7b3 by Ramsay Jones Committed by Shawn O. Pearce

Fix snprintf compiler warning on cygwin

As far as gcc is concerned, the "z size specifier" is available as
an extension to the language, which is available with or without any
-std= switch.  (I think you have to go back to 2.95 for a version
of gcc which doesn't work.)  Many other compilers have this as an
extension as well (ie without the equivalent of -std=c99).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
parent 51eb2f90
......@@ -14,10 +14,6 @@
#include <unistd.h>
#include <string.h>
#ifndef PRIuPTR
# define PRIuPTR "lu"
#endif
#include "cc-compat.h"
#include "git/common.h"
#include "util.h"
......
......@@ -102,7 +102,7 @@ int git_obj__loose_object_type(git_otype type)
static int format_object_header(char *hdr, size_t n, git_obj *obj)
{
const char *type_str = git_obj_type_to_string(obj->type);
int len = snprintf(hdr, n, "%s %" PRIuPTR, type_str, obj->len);
int len = snprintf(hdr, n, "%s %zu", type_str, obj->len);
assert(len > 0); /* otherwise snprintf() is broken */
assert(len < n); /* otherwise the caller is broken! */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment