git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wink Saville <wink@saville.com>
To: git@vger.kernel.org
Cc: Wink Saville <wink@saville.com>,
	gitster@pobox.com, jeffhost@microsoft.com,
	ramsay@ramsayjones.plus.com
Subject: [RFC PATCH v2 1/1] json-writer: add cast to uintmax_t
Date: Sat, 24 Mar 2018 11:38:32 -0700	[thread overview]
Message-ID: <1a6a4983b824e7b9f4eb1f7b83a39d24f72e552f.1521916335.git.wink@saville.com> (raw)
In-Reply-To: <cover.1521916335.git.wink@saville.com>
In-Reply-To: <cover.1521916335.git.wink@saville.com>

Correct a compile error on Mac OSX by adding a cast to uintmax_t
in calls to strbuf_addf.

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Tested-by: travis-ci
Signed-off-by: Wink Saville <wink@saville.com>
---
 json-writer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/json-writer.c b/json-writer.c
index 89a6abb57..1f40482ff 100644
--- a/json-writer.c
+++ b/json-writer.c
@@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)
 	maybe_add_comma(jw);
 
 	append_quoted_string(&jw->json, key);
-	strbuf_addf(&jw->json, ":%"PRIuMAX, value);
+	strbuf_addf(&jw->json, ":%"PRIuMAX, (uintmax_t)value);
 }
 
 void jw_object_double(struct json_writer *jw, const char *fmt,
@@ -225,7 +225,7 @@ void jw_array_uint64(struct json_writer *jw, uint64_t value)
 	assert_in_array(jw);
 	maybe_add_comma(jw);
 
-	strbuf_addf(&jw->json, "%"PRIuMAX, value);
+	strbuf_addf(&jw->json, "%"PRIuMAX, (uintmax_t)value);
 }
 
 void jw_array_double(struct json_writer *jw, const char *fmt, double value)
-- 
2.16.2


  parent reply	other threads:[~2018-03-24 18:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24  5:37 [RFC PATCH 0/1] json-writer: incorrect format specifier Wink Saville
2018-03-24  5:37 ` [RFC PATCH 1/1] " Wink Saville
2018-03-24 11:11   ` Jeff Hostetler
2018-03-24 15:14   ` Ramsay Jones
2018-03-24 16:07     ` Ramsay Jones
2018-03-26 17:04       ` Junio C Hamano
2018-03-26 17:39         ` Jeff Hostetler
2018-03-27  3:26         ` Ramsay Jones
2018-03-27 10:24           ` Jeff Hostetler
2018-03-24 18:38 ` [RFC PATCH 0/1] json-writer: add cast to uintmax_t Wink Saville
2018-03-24 18:38 ` Wink Saville [this message]
2018-03-26 17:36   ` [RFC PATCH v2 1/1] " Jeff Hostetler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a6a4983b824e7b9f4eb1f7b83a39d24f72e552f.1521916335.git.wink@saville.com \
    --to=wink@saville.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).