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

2018-03-26 Thread Jeff Hostetler



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 
Tested-by: travis-ci
Signed-off-by: Wink Saville 
---
  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



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

2018-03-24 Thread Wink Saville
Correct a compile error on Mac OSX by adding a cast to uintmax_t
in calls to strbuf_addf.

Helped-by: Ramsay Jones 
Tested-by: travis-ci
Signed-off-by: Wink Saville 
---
 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