Re: [RFC PATCH v2 1/1] json-writer: add cast to uintmax_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 3/24/2018 2:38 PM, Wink Saville wrote:
Correct a compile error on Mac OSX by adding a cast to uintmax_t
in calls to strbuf_addf.

Helped-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
Tested-by: travis-ci
Signed-off-by: Wink Saville <wink@xxxxxxxxxxx>
---
  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)


FYI.  I included and squashed this change into V4 of my json-writer series.

Jeff




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux