Fix error with maintainer-mode

This commit is contained in:
Tatsuhiro Tsujikawa 2013-10-22 00:50:09 +09:00
parent 88348a600b
commit 7f72aedae5
2 changed files with 11 additions and 8 deletions

View File

@ -104,7 +104,7 @@ static int deflate_hd(json_t *obj, nghttp2_hd_context *deflater, int seq)
static int perform(nghttp2_hd_side side) static int perform(nghttp2_hd_side side)
{ {
nghttp2_hd_context deflater; nghttp2_hd_context deflater;
int i = 0; size_t i;
json_t *json; json_t *json;
json_error_t error; json_error_t error;
size_t len; size_t len;
@ -112,7 +112,7 @@ static int perform(nghttp2_hd_side side)
json = json_loadf(stdin, 0, &error); json = json_loadf(stdin, 0, &error);
if(json == NULL) { if(json == NULL) {
fprintf(stderr, "JSON loading failed\n"); fprintf(stderr, "JSON loading failed\n");
return -1; exit(EXIT_FAILURE);
} }
nghttp2_hd_deflate_init(&deflater, side); nghttp2_hd_deflate_init(&deflater, side);
printf("[\n"); printf("[\n");
@ -120,7 +120,8 @@ static int perform(nghttp2_hd_side side)
for(i = 0; i < len; ++i) { for(i = 0; i < len; ++i) {
json_t *obj = json_array_get(json, i); json_t *obj = json_array_get(json, i);
if(!json_is_object(obj)) { 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; continue;
} }
if(deflate_hd(obj, &deflater, i) != 0) { if(deflate_hd(obj, &deflater, i) != 0) {
@ -136,7 +137,7 @@ static int perform(nghttp2_hd_side side)
return 0; return 0;
} }
static void print_help() static void print_help(void)
{ {
printf("Usage: deflatehd [-r] < INPUT\n\n" printf("Usage: deflatehd [-r] < INPUT\n\n"
"Reads JSON array from stdin and outputs deflated header block\n" "Reads JSON array from stdin and outputs deflated header block\n"

View File

@ -88,14 +88,15 @@ static int inflate_hd(json_t *obj, nghttp2_hd_context *inflater, int seq)
static int perform(nghttp2_hd_side side) static int perform(nghttp2_hd_side side)
{ {
nghttp2_hd_context inflater; nghttp2_hd_context inflater;
int i = 0; size_t i;
json_t *json; json_t *json;
json_error_t error; json_error_t error;
size_t len; size_t len;
json = json_loadf(stdin, 0, &error); json = json_loadf(stdin, 0, &error);
if(json == NULL) { if(json == NULL) {
return -1; fprintf(stderr, "JSON loading failed\n");
exit(EXIT_FAILURE);
} }
nghttp2_hd_inflate_init(&inflater, side); nghttp2_hd_inflate_init(&inflater, side);
printf("[\n"); printf("[\n");
@ -103,7 +104,8 @@ static int perform(nghttp2_hd_side side)
for(i = 0; i < len; ++i) { for(i = 0; i < len; ++i) {
json_t *obj = json_array_get(json, i); json_t *obj = json_array_get(json, i);
if(!json_is_object(obj)) { 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; continue;
} }
if(inflate_hd(obj, &inflater, i) != 0) { if(inflate_hd(obj, &inflater, i) != 0) {
@ -119,7 +121,7 @@ static int perform(nghttp2_hd_side side)
return 0; return 0;
} }
static void print_help() static void print_help(void)
{ {
printf("Usage: inflatehd [-r] < INPUT\n\n" printf("Usage: inflatehd [-r] < INPUT\n\n"
"Reads JSON array from stdin and outputs inflated name/value pairs\n" "Reads JSON array from stdin and outputs inflated name/value pairs\n"