From 7f72aedae55ce275649de98113ea70b69412c7db Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 22 Oct 2013 00:50:09 +0900 Subject: [PATCH] Fix error with maintainer-mode --- hdtest/deflatehd.c | 9 +++++---- hdtest/inflatehd.c | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hdtest/deflatehd.c b/hdtest/deflatehd.c index 512c9af3..5395e25c 100644 --- a/hdtest/deflatehd.c +++ b/hdtest/deflatehd.c @@ -104,7 +104,7 @@ static int deflate_hd(json_t *obj, nghttp2_hd_context *deflater, int seq) static int perform(nghttp2_hd_side side) { nghttp2_hd_context deflater; - int i = 0; + size_t i; json_t *json; json_error_t error; size_t len; @@ -112,7 +112,7 @@ static int perform(nghttp2_hd_side side) json = json_loadf(stdin, 0, &error); if(json == NULL) { fprintf(stderr, "JSON loading failed\n"); - return -1; + exit(EXIT_FAILURE); } nghttp2_hd_deflate_init(&deflater, side); printf("[\n"); @@ -120,7 +120,8 @@ static int perform(nghttp2_hd_side side) for(i = 0; i < len; ++i) { json_t *obj = json_array_get(json, i); if(!json_is_object(obj)) { - fprintf(stderr, "Unexpected JSON type at %d. It should be object.\n", i); + fprintf(stderr, "Unexpected JSON type at %zu. It should be object.\n", + i); continue; } if(deflate_hd(obj, &deflater, i) != 0) { @@ -136,7 +137,7 @@ static int perform(nghttp2_hd_side side) return 0; } -static void print_help() +static void print_help(void) { printf("Usage: deflatehd [-r] < INPUT\n\n" "Reads JSON array from stdin and outputs deflated header block\n" diff --git a/hdtest/inflatehd.c b/hdtest/inflatehd.c index b7b4ee9e..f18df069 100644 --- a/hdtest/inflatehd.c +++ b/hdtest/inflatehd.c @@ -88,14 +88,15 @@ static int inflate_hd(json_t *obj, nghttp2_hd_context *inflater, int seq) static int perform(nghttp2_hd_side side) { nghttp2_hd_context inflater; - int i = 0; + size_t i; json_t *json; json_error_t error; size_t len; json = json_loadf(stdin, 0, &error); if(json == NULL) { - return -1; + fprintf(stderr, "JSON loading failed\n"); + exit(EXIT_FAILURE); } nghttp2_hd_inflate_init(&inflater, side); printf("[\n"); @@ -103,7 +104,8 @@ static int perform(nghttp2_hd_side side) for(i = 0; i < len; ++i) { json_t *obj = json_array_get(json, i); if(!json_is_object(obj)) { - fprintf(stderr, "Unexpected JSON type at %d. It should be object.\n", i); + fprintf(stderr, "Unexpected JSON type at %zu. It should be object.\n", + i); continue; } if(inflate_hd(obj, &inflater, i) != 0) { @@ -119,7 +121,7 @@ static int perform(nghttp2_hd_side side) return 0; } -static void print_help() +static void print_help(void) { printf("Usage: inflatehd [-r] < INPUT\n\n" "Reads JSON array from stdin and outputs inflated name/value pairs\n"