From 9e716eb63559894b9eb5b4c4c19f8994f49cc315 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 23 Mar 2012 02:17:48 +0900 Subject: [PATCH] Code cleanup: C89 and old-style-prototypes and definition. --- lib/includes/spdylay/spdylay.h | 4 +- lib/spdylay_frame.c | 18 ++-- lib/spdylay_helper.c | 3 +- lib/spdylay_npn.c | 2 +- lib/spdylay_pq.c | 2 +- lib/spdylay_queue.c | 13 +-- lib/spdylay_session.c | 13 +-- lib/spdylay_submit.c | 3 +- tests/main.c | 4 +- tests/spdylay_buffer_test.c | 2 +- tests/spdylay_buffer_test.h | 4 +- tests/spdylay_frame_test.c | 63 ++++++------ tests/spdylay_frame_test.h | 42 ++++---- tests/spdylay_map_test.c | 2 +- tests/spdylay_map_test.h | 2 +- tests/spdylay_npn_test.c | 9 +- tests/spdylay_npn_test.h | 4 +- tests/spdylay_pq_test.c | 2 +- tests/spdylay_pq_test.h | 2 +- tests/spdylay_queue_test.c | 2 +- tests/spdylay_queue_test.h | 4 +- tests/spdylay_session_test.c | 173 +++++++++++++++------------------ tests/spdylay_session_test.h | 80 +++++++-------- tests/spdylay_stream_test.c | 4 +- tests/spdylay_stream_test.h | 2 +- tests/spdylay_zlib_test.c | 6 +- tests/spdylay_zlib_test.h | 6 +- 27 files changed, 233 insertions(+), 238 deletions(-) diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h index 94f17cf8..9758e5ad 100644 --- a/lib/includes/spdylay/spdylay.h +++ b/lib/includes/spdylay/spdylay.h @@ -156,7 +156,7 @@ typedef enum { /** * The user callback function failed. This is a fatal error. */ - SPDYLAY_ERR_CALLBACK_FAILURE = -902, + SPDYLAY_ERR_CALLBACK_FAILURE = -902 } spdylay_error; typedef enum { @@ -207,7 +207,7 @@ typedef enum { /** * The DATA frame. */ - SPDYLAY_DATA = 100, + SPDYLAY_DATA = 100 } spdylay_frame_type; /** diff --git a/lib/spdylay_frame.c b/lib/spdylay_frame.c index 8331f31e..d0476228 100644 --- a/lib/spdylay_frame.c +++ b/lib/spdylay_frame.c @@ -127,7 +127,7 @@ int spdylay_frame_count_unpack_nv_space size_t buflen = 0; size_t nvlen = 0; size_t off = 0; - int i; + size_t i; if(inlen < len_size) { return SPDYLAY_ERR_INVALID_FRAME; } @@ -136,7 +136,7 @@ int spdylay_frame_count_unpack_nv_space off += len_size; for(i = 0; i < n; ++i) { uint32_t len; - int j; + size_t j; for(j = 0; j < 2; ++j) { if(inlen-off < len_size) { return SPDYLAY_ERR_INVALID_FRAME; @@ -169,7 +169,8 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen, size_t len_size) { size_t nvlen, buflen; - int r, i; + int r; + size_t i; char *buf, **index, *data; uint32_t n; r = spdylay_frame_count_unpack_nv_space(&nvlen, &buflen, in, inlen, len_size); @@ -217,7 +218,7 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen, *index++ = val; } *index = NULL; - assert((char*)index-buf == (nvlen*2)*sizeof(char*)); + assert((size_t)((char*)index - buf) == (nvlen*2)*sizeof(char*)); *nv_ptr = (char**)buf; return 0; } @@ -900,7 +901,8 @@ ssize_t spdylay_frame_pack_settings(uint8_t **buf_ptr, size_t *buflen_ptr, spdylay_settings *frame) { ssize_t framelen = SPDYLAY_FRAME_HEAD_LENGTH+frame->hd.length; - int i, r; + size_t i; + int r; if(frame->hd.version != SPDYLAY_PROTO_SPDY2 && frame->hd.version != SPDYLAY_PROTO_SPDY3) { return SPDYLAY_ERR_UNSUPPORTED_VERSION; @@ -943,7 +945,7 @@ int spdylay_frame_unpack_settings(spdylay_settings *frame, const uint8_t *head, size_t headlen, const uint8_t *payload, size_t payloadlen) { - int i; + size_t i; if(payloadlen < 4) { return SPDYLAY_ERR_INVALID_FRAME; } @@ -962,7 +964,7 @@ int spdylay_frame_unpack_settings(spdylay_settings *frame, } if(frame->hd.version == SPDYLAY_PROTO_SPDY2) { for(i = 0; i < frame->niv; ++i) { - int off = i*8; + size_t off = i*8; /* ID is little endian. See comments in spdylay_frame_pack_settings(). */ frame->iv[i].settings_id = 0; @@ -978,7 +980,7 @@ int spdylay_frame_unpack_settings(spdylay_settings *frame, } } else { for(i = 0; i < frame->niv; ++i) { - int off = i*8; + size_t off = i*8; frame->iv[i].settings_id = spdylay_get_uint32(&payload[4+off]) & SPDYLAY_SETTINGS_ID_MASK; frame->iv[i].flags = payload[4+off]; diff --git a/lib/spdylay_helper.c b/lib/spdylay_helper.c index 9243886d..8c47f059 100644 --- a/lib/spdylay_helper.c +++ b/lib/spdylay_helper.c @@ -57,8 +57,9 @@ int spdylay_reserve_buffer(uint8_t **buf_ptr, size_t *buflen_ptr, size_t min_length) { if(min_length > *buflen_ptr) { + uint8_t *temp; min_length = (min_length+4095)/4096*4096; - uint8_t *temp = malloc(min_length); + temp = malloc(min_length); if(temp == NULL) { return SPDYLAY_ERR_NOMEM; } else { diff --git a/lib/spdylay_npn.c b/lib/spdylay_npn.c index 73f664ce..5d3473c7 100644 --- a/lib/spdylay_npn.c +++ b/lib/spdylay_npn.c @@ -42,7 +42,7 @@ int spdylay_select_next_protocol(unsigned char **out, unsigned char *outlen, { (const unsigned char*)"spdy/3", 6, SPDYLAY_PROTO_SPDY3 } }; for(; i < inlen; i += in[i]+1) { - int j; + unsigned int j; for(j = 0; j < sizeof(proto_list)/sizeof(spdylay_npn_proto); ++j) { if(in[i] == proto_list[j].len && memcmp(&in[i+1], proto_list[j].proto, in[i]) == 0) { diff --git a/lib/spdylay_pq.c b/lib/spdylay_pq.c index 8422596d..a85ef8c4 100644 --- a/lib/spdylay_pq.c +++ b/lib/spdylay_pq.c @@ -91,7 +91,7 @@ static void bubble_down(spdylay_pq *pq, size_t index) { size_t lchild = index*2+1; size_t minindex = index; - int i, j; + size_t i, j; for(i = 0; i < 2; ++i) { j = lchild+i; if(j >= pq->length) { diff --git a/lib/spdylay_queue.c b/lib/spdylay_queue.c index d718e588..a0881475 100644 --- a/lib/spdylay_queue.c +++ b/lib/spdylay_queue.c @@ -36,12 +36,13 @@ void spdylay_queue_free(spdylay_queue *queue) { if(!queue) { return; - } - spdylay_queue_cell *p = queue->front; - while(p) { - spdylay_queue_cell *next = p->next; - free(p); - p = next; + } else { + spdylay_queue_cell *p = queue->front; + while(p) { + spdylay_queue_cell *next = p->next; + free(p); + p = next; + } } } diff --git a/lib/spdylay_session.c b/lib/spdylay_session.c index b4d19b47..5d701f89 100644 --- a/lib/spdylay_session.c +++ b/lib/spdylay_session.c @@ -475,7 +475,7 @@ void spdylay_session_close_pushed_streams(spdylay_session *session, spdylay_stream *stream; stream = spdylay_session_get_stream(session, stream_id); if(stream) { - int i; + size_t i; for(i = 0; i < stream->pushed_streams_length; ++i) { spdylay_session_close_stream(session, stream->pushed_streams[i], status_code); @@ -1290,7 +1290,7 @@ static ssize_t spdylay_recv(spdylay_session *session, uint8_t *buf, size_t len) r = session->callbacks.recv_callback (session, buf, len, 0, session->user_data); if(r > 0) { - if(r > len) { + if((size_t)r > len) { return SPDYLAY_ERR_CALLBACK_FAILURE; } } else if(r < 0) { @@ -1602,7 +1602,7 @@ void spdylay_session_update_local_settings(spdylay_session *session, spdylay_settings_entry *iv, size_t niv) { - int i; + size_t i; for(i = 0; i < niv; ++i) { assert(iv[i].settings_id > 0 && iv[i].settings_id <= SPDYLAY_SETTINGS_MAX); session->local_settings[iv[i].settings_id] = iv[i].value; @@ -1612,7 +1612,8 @@ void spdylay_session_update_local_settings(spdylay_session *session, int spdylay_session_on_settings_received(spdylay_session *session, spdylay_frame *frame) { - int i, check[SPDYLAY_SETTINGS_MAX+1]; + size_t i; + int check[SPDYLAY_SETTINGS_MAX+1]; if(!spdylay_session_check_version(session, frame->settings.hd.version)) { return 0; } @@ -2011,7 +2012,7 @@ static int spdylay_session_update_recv_window_size(spdylay_session *session, if(stream) { stream->recv_window_size += delta_size; /* This is just a heuristics. */ - if(stream->recv_window_size*2 >= + if((size_t)stream->recv_window_size*2 >= session->remote_settings[SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE]) { int r; r = spdylay_session_add_window_update(session, stream_id, @@ -2267,7 +2268,7 @@ ssize_t spdylay_session_pack_data(spdylay_session *session, &eof, &frame->data_prd.source, session->user_data); if(r < 0) { return r; - } else if(datamax < r) { + } else if(datamax < (size_t)r) { return SPDYLAY_ERR_CALLBACK_FAILURE; } memset(*buf_ptr, 0, SPDYLAY_HEAD_LEN); diff --git a/lib/spdylay_submit.c b/lib/spdylay_submit.c index d99cf741..d58e985d 100644 --- a/lib/spdylay_submit.c +++ b/lib/spdylay_submit.c @@ -195,7 +195,8 @@ int spdylay_submit_settings(spdylay_session *session, uint8_t flags, spdylay_frame *frame; spdylay_settings_entry *iv_copy; int check[SPDYLAY_SETTINGS_MAX+1]; - int i, r; + size_t i; + int r; memset(check, 0, sizeof(check)); for(i = 0; i < niv; ++i) { if(iv[i].settings_id > SPDYLAY_SETTINGS_MAX || iv[i].settings_id == 0 || diff --git a/tests/main.c b/tests/main.c index f2b2549a..924f9029 100644 --- a/tests/main.c +++ b/tests/main.c @@ -36,12 +36,12 @@ #include "spdylay_stream_test.h" #include "spdylay_npn_test.h" -int init_suite1(void) +static int init_suite1(void) { return 0; } -int clean_suite1(void) +static int clean_suite1(void) { return 0; } diff --git a/tests/spdylay_buffer_test.c b/tests/spdylay_buffer_test.c index 8d992b0f..dc3c6169 100644 --- a/tests/spdylay_buffer_test.c +++ b/tests/spdylay_buffer_test.c @@ -30,7 +30,7 @@ #include "spdylay_buffer.h" -void test_spdylay_buffer() +void test_spdylay_buffer(void) { spdylay_buffer buffer; uint8_t out[1024]; diff --git a/tests/spdylay_buffer_test.h b/tests/spdylay_buffer_test.h index 99ea4850..312b404e 100644 --- a/tests/spdylay_buffer_test.h +++ b/tests/spdylay_buffer_test.h @@ -25,6 +25,6 @@ #ifndef SPDYLAY_BUFFER_TEST_H #define SPDYLAY_BUFFER_TEST_H -void test_spdylay_buffer(); +void test_spdylay_buffer(void); -#endif // SPDYLAY_BUFFER_TEST_H +#endif /* SPDYLAY_BUFFER_TEST_H */ diff --git a/tests/spdylay_frame_test.c b/tests/spdylay_frame_test.c index 251ce098..66063954 100644 --- a/tests/spdylay_frame_test.c +++ b/tests/spdylay_frame_test.c @@ -39,7 +39,7 @@ static const char *headers[] = { NULL }; -void test_spdylay_frame_unpack_nv_with(size_t len_size) +static void test_spdylay_frame_unpack_nv_with(size_t len_size) { uint8_t out[1024]; char **nv; @@ -60,17 +60,17 @@ void test_spdylay_frame_unpack_nv_with(size_t len_size) spdylay_frame_nv_del(nv); } -void test_spdylay_frame_unpack_nv_spdy2() +void test_spdylay_frame_unpack_nv_spdy2(void) { test_spdylay_frame_unpack_nv_with(2); } -void test_spdylay_frame_unpack_nv_spdy3() +void test_spdylay_frame_unpack_nv_spdy3(void) { test_spdylay_frame_unpack_nv_with(4); } -void test_spdylay_frame_pack_nv_duplicate_keys() +void test_spdylay_frame_pack_nv_duplicate_keys(void) { uint8_t out[1024]; size_t len_size = 2; @@ -84,13 +84,16 @@ void test_spdylay_frame_pack_nv_duplicate_keys() NULL }; char **nv = spdylay_frame_nv_norm_copy(nv_src); + const uint8_t *outptr; + int pairs, len; /* size_t inlen = */ spdylay_frame_pack_nv(out, nv, len_size); - const uint8_t *outptr = out; - int pairs = spdylay_get_uint16(outptr); + outptr = out; + + pairs = spdylay_get_uint16(outptr); CU_ASSERT(pairs == 5); outptr += 2; - int len = spdylay_get_uint16(outptr); + len = spdylay_get_uint16(outptr); outptr += 2; CU_ASSERT(len == 6); CU_ASSERT(memcmp(outptr, "method", len) == 0); @@ -154,7 +157,7 @@ void test_spdylay_frame_pack_nv_duplicate_keys() spdylay_frame_nv_del(nv); } -void test_spdylay_frame_count_nv_space() +void test_spdylay_frame_count_nv_space(void) { size_t len_size = 2; CU_ASSERT(74 == spdylay_frame_count_nv_space((char**)headers, len_size)); @@ -162,7 +165,7 @@ void test_spdylay_frame_count_nv_space() CU_ASSERT(96 == spdylay_frame_count_nv_space((char**)headers, len_size)); } -void test_spdylay_frame_count_unpack_nv_space() +void test_spdylay_frame_count_unpack_nv_space(void) { size_t nvlen, buflen; uint8_t out[1024]; @@ -199,7 +202,7 @@ void test_spdylay_frame_count_unpack_nv_space() len_size)); } -void test_spdylay_frame_pack_ping() +void test_spdylay_frame_pack_ping(void) { spdylay_frame frame, oframe; uint8_t *buf = NULL; @@ -218,7 +221,7 @@ void test_spdylay_frame_pack_ping() spdylay_frame_ping_free(&frame.ping); } -void test_spdylay_frame_pack_goaway_version(uint16_t version) +static void test_spdylay_frame_pack_goaway_version(uint16_t version) { spdylay_frame frame, oframe; uint8_t *buf = NULL; @@ -248,17 +251,17 @@ void test_spdylay_frame_pack_goaway_version(uint16_t version) spdylay_frame_goaway_free(&frame.goaway); } -void test_spdylay_frame_pack_goaway_spdy2() +void test_spdylay_frame_pack_goaway_spdy2(void) { test_spdylay_frame_pack_goaway_version(SPDYLAY_PROTO_SPDY2); } -void test_spdylay_frame_pack_goaway_spdy3() +void test_spdylay_frame_pack_goaway_spdy3(void) { test_spdylay_frame_pack_goaway_version(SPDYLAY_PROTO_SPDY3); } -void test_spdylay_frame_pack_syn_stream_version(uint16_t version) +static void test_spdylay_frame_pack_syn_stream_version(uint16_t version) { spdylay_zlib deflater, inflater; spdylay_frame frame, oframe; @@ -301,17 +304,17 @@ void test_spdylay_frame_pack_syn_stream_version(uint16_t version) spdylay_buffer_free(&inflatebuf); } -void test_spdylay_frame_pack_syn_stream_spdy2() +void test_spdylay_frame_pack_syn_stream_spdy2(void) { test_spdylay_frame_pack_syn_stream_version(SPDYLAY_PROTO_SPDY2); } -void test_spdylay_frame_pack_syn_stream_spdy3() +void test_spdylay_frame_pack_syn_stream_spdy3(void) { test_spdylay_frame_pack_syn_stream_version(SPDYLAY_PROTO_SPDY3); } -void test_spdylay_frame_pack_syn_reply_version(uint16_t version) +static void test_spdylay_frame_pack_syn_reply_version(uint16_t version) { spdylay_zlib deflater, inflater; spdylay_frame frame, oframe; @@ -353,17 +356,17 @@ void test_spdylay_frame_pack_syn_reply_version(uint16_t version) spdylay_buffer_free(&inflatebuf); } -void test_spdylay_frame_pack_syn_reply_spdy2() +void test_spdylay_frame_pack_syn_reply_spdy2(void) { test_spdylay_frame_pack_syn_reply_version(SPDYLAY_PROTO_SPDY2); } -void test_spdylay_frame_pack_syn_reply_spdy3() +void test_spdylay_frame_pack_syn_reply_spdy3(void) { test_spdylay_frame_pack_syn_reply_version(SPDYLAY_PROTO_SPDY3); } -void test_spdylay_frame_pack_headers_version(uint16_t version) +static void test_spdylay_frame_pack_headers_version(uint16_t version) { spdylay_zlib deflater, inflater; spdylay_frame frame, oframe; @@ -405,17 +408,17 @@ void test_spdylay_frame_pack_headers_version(uint16_t version) spdylay_buffer_free(&inflatebuf); } -void test_spdylay_frame_pack_headers_spdy2() +void test_spdylay_frame_pack_headers_spdy2(void) { test_spdylay_frame_pack_headers_version(SPDYLAY_PROTO_SPDY2); } -void test_spdylay_frame_pack_headers_spdy3() +void test_spdylay_frame_pack_headers_spdy3(void) { test_spdylay_frame_pack_headers_version(SPDYLAY_PROTO_SPDY3); } -void test_spdylay_frame_pack_window_update() +void test_spdylay_frame_pack_window_update(void) { spdylay_frame frame, oframe; uint8_t *buf = NULL; @@ -442,7 +445,7 @@ void test_spdylay_frame_pack_window_update() } -void test_spdylay_frame_pack_settings_version(uint16_t version) +static void test_spdylay_frame_pack_settings_version(uint16_t version) { spdylay_frame frame, oframe; uint8_t *buf = NULL; @@ -489,17 +492,17 @@ void test_spdylay_frame_pack_settings_version(uint16_t version) spdylay_frame_settings_free(&oframe.settings); } -void test_spdylay_frame_pack_settings_spdy2() +void test_spdylay_frame_pack_settings_spdy2(void) { test_spdylay_frame_pack_settings_version(SPDYLAY_PROTO_SPDY2); } -void test_spdylay_frame_pack_settings_spdy3() +void test_spdylay_frame_pack_settings_spdy3(void) { test_spdylay_frame_pack_settings_version(SPDYLAY_PROTO_SPDY3); } -void test_spdylay_frame_nv_sort() +void test_spdylay_frame_nv_sort(void) { char *nv[7]; nv[0] = (char*)"version"; @@ -518,7 +521,7 @@ void test_spdylay_frame_nv_sort() CU_ASSERT(strcmp("HTTP/1.1", nv[5]) == 0); } -void test_spdylay_frame_nv_downcase() +void test_spdylay_frame_nv_downcase(void) { const char *nv_src[] = { "VERSION", "HTTP/1.1", @@ -535,7 +538,7 @@ void test_spdylay_frame_nv_downcase() spdylay_frame_nv_del(nv); } -void test_spdylay_frame_nv_2to3() +void test_spdylay_frame_nv_2to3(void) { const char *nv_src[] = { "host", "localhost", @@ -560,7 +563,7 @@ void test_spdylay_frame_nv_2to3() spdylay_frame_nv_del(nv); } -void test_spdylay_frame_nv_3to2() +void test_spdylay_frame_nv_3to2(void) { const char *nv_src[] = { ":host", "localhost", diff --git a/tests/spdylay_frame_test.h b/tests/spdylay_frame_test.h index a53aa4a4..da8fb1fb 100644 --- a/tests/spdylay_frame_test.h +++ b/tests/spdylay_frame_test.h @@ -25,26 +25,26 @@ #ifndef SPDYLAY_FRAME_TEST_H #define SPDYLAY_FRAME_TEST_H -void test_spdylay_frame_unpack_nv_spdy2(); -void test_spdylay_frame_unpack_nv_spdy3(); -void test_spdylay_frame_pack_nv_duplicate_keys(); -void test_spdylay_frame_count_nv_space(); -void test_spdylay_frame_count_unpack_nv_space(); -void test_spdylay_frame_pack_ping(); -void test_spdylay_frame_pack_goaway_spdy2(); -void test_spdylay_frame_pack_goaway_spdy3(); -void test_spdylay_frame_pack_syn_stream_spdy2(); -void test_spdylay_frame_pack_syn_stream_spdy3(); -void test_spdylay_frame_pack_syn_reply_spdy2(); -void test_spdylay_frame_pack_syn_reply_spdy3(); -void test_spdylay_frame_pack_headers_spdy2(); -void test_spdylay_frame_pack_headers_spdy3(); -void test_spdylay_frame_pack_window_update(); -void test_spdylay_frame_pack_settings_spdy2(); -void test_spdylay_frame_pack_settings_spdy3(); -void test_spdylay_frame_nv_sort(); -void test_spdylay_frame_nv_downcase(); -void test_spdylay_frame_nv_2to3(); -void test_spdylay_frame_nv_3to2(); +void test_spdylay_frame_unpack_nv_spdy2(void); +void test_spdylay_frame_unpack_nv_spdy3(void); +void test_spdylay_frame_pack_nv_duplicate_keys(void); +void test_spdylay_frame_count_nv_space(void); +void test_spdylay_frame_count_unpack_nv_space(void); +void test_spdylay_frame_pack_ping(void); +void test_spdylay_frame_pack_goaway_spdy2(void); +void test_spdylay_frame_pack_goaway_spdy3(void); +void test_spdylay_frame_pack_syn_stream_spdy2(void); +void test_spdylay_frame_pack_syn_stream_spdy3(void); +void test_spdylay_frame_pack_syn_reply_spdy2(void); +void test_spdylay_frame_pack_syn_reply_spdy3(void); +void test_spdylay_frame_pack_headers_spdy2(void); +void test_spdylay_frame_pack_headers_spdy3(void); +void test_spdylay_frame_pack_window_update(void); +void test_spdylay_frame_pack_settings_spdy2(void); +void test_spdylay_frame_pack_settings_spdy3(void); +void test_spdylay_frame_nv_sort(void); +void test_spdylay_frame_nv_downcase(void); +void test_spdylay_frame_nv_2to3(void); +void test_spdylay_frame_nv_3to2(void); #endif /* SPDYLAY_FRAME_TEST_H */ diff --git a/tests/spdylay_map_test.c b/tests/spdylay_map_test.c index 99b2cb92..9f9f9d28 100644 --- a/tests/spdylay_map_test.c +++ b/tests/spdylay_map_test.c @@ -28,7 +28,7 @@ #include "spdylay_map.h" -void test_spdylay_map() +void test_spdylay_map(void) { spdylay_map map; spdylay_map_init(&map); diff --git a/tests/spdylay_map_test.h b/tests/spdylay_map_test.h index 65900a92..1615ff35 100644 --- a/tests/spdylay_map_test.h +++ b/tests/spdylay_map_test.h @@ -25,6 +25,6 @@ #ifndef SPDYLAY_MAP_TEST_H #define SPDYLAY_MAP_TEST_H -void test_spdylay_map(); +void test_spdylay_map(void); #endif /* SPDYLAY_MAP_TEST_H */ diff --git a/tests/spdylay_npn_test.c b/tests/spdylay_npn_test.c index 3b28cc30..726da03f 100644 --- a/tests/spdylay_npn_test.c +++ b/tests/spdylay_npn_test.c @@ -22,12 +22,13 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "spdylay_npn_test.h" #include #include #include -static void spdy2() +static void spdy2(void) { const unsigned char spdy[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '1', @@ -42,7 +43,7 @@ static void spdy2() CU_ASSERT(memcmp("spdy/2", out, outlen) == 0); } -static void http11() +static void http11(void) { const unsigned char spdy[] = { 6, 's', 'p', 'd', 'y', '/', '4', @@ -57,7 +58,7 @@ static void http11() CU_ASSERT(memcmp("http/1.1", out, outlen) == 0); } -static void no_overlap() +static void no_overlap(void) { const unsigned char spdy[] = { 6, 's', 'p', 'd', 'y', '/', '4', @@ -72,7 +73,7 @@ static void no_overlap() CU_ASSERT(NULL == out); } -void test_spdylay_npn() +void test_spdylay_npn(void) { spdy2(); http11(); diff --git a/tests/spdylay_npn_test.h b/tests/spdylay_npn_test.h index 59a6c454..890b7d2c 100644 --- a/tests/spdylay_npn_test.h +++ b/tests/spdylay_npn_test.h @@ -25,6 +25,6 @@ #ifndef SPDYLAY_NPN_TEST_H #define SPDYLAY_NPN_TEST_H -void test_spdylay_npn(); +void test_spdylay_npn(void); -#endif // SPDYLAY_NPN_TEST_H +#endif /* SPDYLAY_NPN_TEST_H */ diff --git a/tests/spdylay_pq_test.c b/tests/spdylay_pq_test.c index e5bfef6c..978864b4 100644 --- a/tests/spdylay_pq_test.c +++ b/tests/spdylay_pq_test.c @@ -33,7 +33,7 @@ static int pq_compar(const void *lhs, const void *rhs) return strcmp(lhs, rhs); } -void test_spdylay_pq() +void test_spdylay_pq(void) { spdylay_pq pq; spdylay_pq_init(&pq, pq_compar); diff --git a/tests/spdylay_pq_test.h b/tests/spdylay_pq_test.h index 1856c042..94b3a106 100644 --- a/tests/spdylay_pq_test.h +++ b/tests/spdylay_pq_test.h @@ -25,6 +25,6 @@ #ifndef SPDYLAY_PQ_TEST_H #define SPDYLAY_PQ_TEST_H -void test_spdylay_pq(); +void test_spdylay_pq(void); #endif /* SPDYLAY_PQ_TEST_H */ diff --git a/tests/spdylay_queue_test.c b/tests/spdylay_queue_test.c index d46526ff..772357aa 100644 --- a/tests/spdylay_queue_test.c +++ b/tests/spdylay_queue_test.c @@ -28,7 +28,7 @@ #include "spdylay_queue.h" -void test_spdylay_queue() +void test_spdylay_queue(void) { int ints[] = { 1, 2, 3, 4, 5 }; int i; diff --git a/tests/spdylay_queue_test.h b/tests/spdylay_queue_test.h index 3540837f..05a61c2b 100644 --- a/tests/spdylay_queue_test.h +++ b/tests/spdylay_queue_test.h @@ -25,6 +25,6 @@ #ifndef SPDYLAY_QUEUE_TEST_H #define SPDYLAY_QUEUE_TEST_H -void test_spdylay_queue(); +void test_spdylay_queue(void); -#endif // SPDYLAY_QUEUE_TEST_H +#endif /* SPDYLAY_QUEUE_TEST_H */ diff --git a/tests/spdylay_session_test.c b/tests/spdylay_session_test.c index fbe6c7a6..83f060ae 100644 --- a/tests/spdylay_session_test.c +++ b/tests/spdylay_session_test.c @@ -200,7 +200,7 @@ static spdylay_settings_entry* dup_iv(const spdylay_settings_entry *iv, return spdylay_frame_iv_copy(iv, niv); } -void test_spdylay_session_recv() +void test_spdylay_session_recv(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -238,20 +238,17 @@ void test_spdylay_session_recv() spdylay_frame_syn_stream_free(&frame.syn_stream); user_data.ctrl_recv_cb_called = 0; - while(df.seqidx < framelen) { + while((ssize_t)df.seqidx < framelen) { CU_ASSERT(0 == spdylay_session_recv(session)); } CU_ASSERT(1 == user_data.ctrl_recv_cb_called); spdylay_session_del(session); } -void test_spdylay_session_add_frame() +void test_spdylay_session_add_frame(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - accumulator_send_callback, - NULL, - }; + spdylay_session_callbacks callbacks; accumulator acc; my_user_data user_data; const char *nv[] = { @@ -268,6 +265,8 @@ void test_spdylay_session_add_frame() 0x80, 0x02, 0x00, 0x01 }; uint32_t temp32; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.send_callback = accumulator_send_callback; memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data)); acc.length = 0; user_data.acc = &acc; @@ -298,15 +297,10 @@ void test_spdylay_session_add_frame() spdylay_session_del(session); } -void test_spdylay_session_recv_invalid_stream_id() +void test_spdylay_session_recv_invalid_stream_id(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - NULL, - scripted_recv_callback, - NULL, - on_invalid_ctrl_recv_callback - }; + spdylay_session_callbacks callbacks; scripted_data_feed df; my_user_data user_data; const char *nv[] = { NULL }; @@ -314,6 +308,9 @@ void test_spdylay_session_recv_invalid_stream_id() size_t framedatalen = 0, nvbuflen = 0; ssize_t framelen; spdylay_frame frame; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.recv_callback = scripted_recv_callback; + callbacks.on_invalid_ctrl_recv_callback = on_invalid_ctrl_recv_callback; user_data.df = &df; user_data.invalid_ctrl_recv_cb_called = 0; @@ -348,7 +345,7 @@ void test_spdylay_session_recv_invalid_stream_id() spdylay_session_del(session); } -void test_spdylay_session_on_syn_stream_received() +void test_spdylay_session_on_syn_stream_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -416,7 +413,7 @@ void test_spdylay_session_on_syn_stream_received() spdylay_session_del(session); } -void test_spdylay_session_on_syn_stream_received_with_push() +void test_spdylay_session_on_syn_stream_received_with_push(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -470,7 +467,7 @@ void test_spdylay_session_on_syn_stream_received_with_push() spdylay_session_del(session); } -void test_spdylay_session_on_syn_reply_received() +void test_spdylay_session_on_syn_reply_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -547,21 +544,18 @@ void test_spdylay_session_on_syn_reply_received() spdylay_session_del(session); } -void test_spdylay_session_send_syn_stream() +void test_spdylay_session_send_syn_stream(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - null_send_callback, - NULL, - NULL, - NULL - }; + spdylay_session_callbacks callbacks; const char *nv[] = { NULL }; spdylay_frame *frame = malloc(sizeof(spdylay_frame)); spdylay_stream *stream; spdylay_syn_stream_aux_data *aux_data = malloc(sizeof(spdylay_syn_stream_aux_data)); memset(aux_data, 0, sizeof(spdylay_syn_stream_aux_data)); + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.send_callback = null_send_callback; spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, NULL); spdylay_frame_syn_stream_init(&frame->syn_stream, SPDYLAY_PROTO_SPDY2, @@ -574,19 +568,17 @@ void test_spdylay_session_send_syn_stream() spdylay_session_del(session); } -void test_spdylay_session_send_syn_reply() +void test_spdylay_session_send_syn_reply(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - null_send_callback, - NULL, - NULL, - NULL - }; + spdylay_session_callbacks callbacks; const char *nv[] = { NULL }; spdylay_frame *frame = malloc(sizeof(spdylay_frame)); spdylay_stream *stream; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.send_callback = null_send_callback; + CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, NULL)); spdylay_session_open_stream(session, 2, SPDYLAY_CTRL_FLAG_NONE, 3, @@ -601,21 +593,19 @@ void test_spdylay_session_send_syn_reply() spdylay_session_del(session); } -void test_spdylay_submit_response() +void test_spdylay_submit_response(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - null_send_callback, - NULL, - NULL, - NULL - }; + spdylay_session_callbacks callbacks; const char *nv[] = { "Content-Length", "1024", NULL }; int32_t stream_id = 2; spdylay_data_provider data_prd; my_user_data ud; spdylay_outbound_item *item; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.send_callback = null_send_callback; + data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 64*1024; CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, @@ -629,7 +619,7 @@ void test_spdylay_submit_response() spdylay_session_del(session); } -void test_spdylay_submit_response_with_null_data_read_callback() +void test_spdylay_submit_response_with_null_data_read_callback(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -668,20 +658,18 @@ void test_spdylay_submit_response_with_null_data_read_callback() spdylay_session_del(session); } -void test_spdylay_submit_request_with_data() +void test_spdylay_submit_request_with_data(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - null_send_callback, - NULL, - NULL, - NULL - }; + spdylay_session_callbacks callbacks; const char *nv[] = { "Version", "HTTP/1.1", NULL }; spdylay_data_provider data_prd; my_user_data ud; spdylay_outbound_item *item; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.send_callback = null_send_callback; + data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 64*1024; CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, @@ -695,7 +683,7 @@ void test_spdylay_submit_request_with_data() spdylay_session_del(session); } -void test_spdylay_submit_request_with_null_data_read_callback() +void test_spdylay_submit_request_with_null_data_read_callback(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -732,7 +720,7 @@ void test_spdylay_submit_request_with_null_data_read_callback() spdylay_session_del(session); } -void test_spdylay_submit_syn_stream() +void test_spdylay_submit_syn_stream(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -771,7 +759,7 @@ void test_spdylay_submit_syn_stream() spdylay_session_del(session); } -void test_spdylay_submit_syn_reply() +void test_spdylay_submit_syn_reply(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -810,7 +798,7 @@ void test_spdylay_submit_syn_reply() spdylay_session_del(session); } -void test_spdylay_submit_headers() +void test_spdylay_submit_headers(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -862,20 +850,18 @@ void test_spdylay_submit_headers() spdylay_session_del(session); } -void test_spdylay_session_reply_fail() +void test_spdylay_session_reply_fail(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - fail_send_callback, - NULL, - NULL, - NULL - }; + spdylay_session_callbacks callbacks; const char *nv[] = { NULL }; int32_t stream_id = 2; spdylay_data_provider data_prd; my_user_data ud; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.send_callback = fail_send_callback; + data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 4*1024; CU_ASSERT(0 == spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, @@ -885,7 +871,7 @@ void test_spdylay_session_reply_fail() spdylay_session_del(session); } -void test_spdylay_session_on_headers_received() +void test_spdylay_session_on_headers_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -965,7 +951,7 @@ void test_spdylay_session_on_headers_received() spdylay_session_del(session); } -void test_spdylay_session_on_window_update_received() +void test_spdylay_session_on_window_update_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1003,15 +989,10 @@ void test_spdylay_session_on_window_update_received() spdylay_session_del(session); } -void test_spdylay_session_on_ping_received() +void test_spdylay_session_on_ping_received(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - NULL, - NULL, - on_ctrl_recv_callback, - on_invalid_ctrl_recv_callback - }; + spdylay_session_callbacks callbacks; my_user_data user_data; spdylay_frame frame; spdylay_outbound_item *top; @@ -1019,6 +1000,10 @@ void test_spdylay_session_on_ping_received() user_data.ctrl_recv_cb_called = 0; user_data.invalid_ctrl_recv_cb_called = 0; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.on_ctrl_recv_callback = on_ctrl_recv_callback; + callbacks.on_invalid_ctrl_recv_callback = on_invalid_ctrl_recv_callback; + spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, &user_data); unique_id = 2; @@ -1040,21 +1025,20 @@ void test_spdylay_session_on_ping_received() spdylay_session_del(session); } -void test_spdylay_session_on_goaway_received() +void test_spdylay_session_on_goaway_received(void) { spdylay_session *session; - spdylay_session_callbacks callbacks = { - NULL, - NULL, - on_ctrl_recv_callback, - on_invalid_ctrl_recv_callback, - }; + spdylay_session_callbacks callbacks; my_user_data user_data; spdylay_frame frame; int32_t stream_id = 1000000007; user_data.ctrl_recv_cb_called = 0; user_data.invalid_ctrl_recv_cb_called = 0; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + callbacks.on_ctrl_recv_callback = on_ctrl_recv_callback; + callbacks.on_invalid_ctrl_recv_callback = on_invalid_ctrl_recv_callback; + spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, &user_data); spdylay_frame_goaway_init(&frame.goaway, SPDYLAY_PROTO_SPDY2, stream_id, @@ -1068,16 +1052,17 @@ void test_spdylay_session_on_goaway_received() spdylay_session_del(session); } -void test_spdylay_session_on_data_received() +void test_spdylay_session_on_data_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; - memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); my_user_data user_data; spdylay_outbound_item *top; int32_t stream_id = 2; spdylay_stream *stream; + memset(&callbacks, 0, sizeof(spdylay_session_callbacks)); + spdylay_session_client_new(&session, SPDYLAY_PROTO_SPDY2, &callbacks, &user_data); stream = spdylay_session_open_stream(session, stream_id, @@ -1117,7 +1102,7 @@ void test_spdylay_session_on_data_received() spdylay_session_del(session); } -void test_spdylay_session_is_my_stream_id() +void test_spdylay_session_is_my_stream_id(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1139,7 +1124,7 @@ void test_spdylay_session_is_my_stream_id() spdylay_session_del(session); } -void test_spdylay_session_on_rst_received() +void test_spdylay_session_on_rst_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1172,7 +1157,7 @@ void test_spdylay_session_on_rst_received() spdylay_session_del(session); } -void test_spdylay_session_send_rst_stream() +void test_spdylay_session_send_rst_stream(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1206,7 +1191,7 @@ void test_spdylay_session_send_rst_stream() spdylay_session_del(session); } -void test_spdylay_session_get_next_ob_item() +void test_spdylay_session_get_next_ob_item(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1247,7 +1232,7 @@ void test_spdylay_session_get_next_ob_item() spdylay_session_del(session); } -void test_spdylay_session_pop_next_ob_item() +void test_spdylay_session_pop_next_ob_item(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1299,7 +1284,7 @@ void test_spdylay_session_pop_next_ob_item() spdylay_session_del(session); } -void test_spdylay_session_on_request_recv_callback() +void test_spdylay_session_on_request_recv_callback(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1366,7 +1351,7 @@ static void stream_close_callback(spdylay_session *session, int32_t stream_id, CU_ASSERT(stream_data != NULL); } -void test_spdylay_session_on_stream_close() +void test_spdylay_session_on_stream_close(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1390,7 +1375,7 @@ void test_spdylay_session_on_stream_close() spdylay_session_del(session); } -void test_spdylay_session_max_concurrent_streams() +void test_spdylay_session_max_concurrent_streams(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1433,7 +1418,7 @@ static ssize_t block_count_send_callback(spdylay_session* session, return r; } -void test_spdylay_session_data_backoff_by_high_pri_frame() +void test_spdylay_session_data_backoff_by_high_pri_frame(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1478,7 +1463,7 @@ void test_spdylay_session_data_backoff_by_high_pri_frame() spdylay_session_del(session); } -void test_spdylay_session_stop_data_with_rst_stream() +void test_spdylay_session_stop_data_with_rst_stream(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1529,7 +1514,7 @@ void test_spdylay_session_stop_data_with_rst_stream() * Check that on_stream_close_callback is called when server pushed * SYN_STREAM have SPDYLAY_CTRL_FLAG_FIN. */ -void test_spdylay_session_stream_close_on_syn_stream() +void test_spdylay_session_stream_close_on_syn_stream(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1556,7 +1541,7 @@ void test_spdylay_session_stream_close_on_syn_stream() spdylay_session_del(session); } -void test_spdylay_session_recv_invalid_frame() +void test_spdylay_session_recv_invalid_frame(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1614,7 +1599,7 @@ static ssize_t defer_data_source_read_callback return SPDYLAY_ERR_DEFERRED; } -void test_spdylay_session_defer_data() +void test_spdylay_session_defer_data(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1681,7 +1666,7 @@ void test_spdylay_session_defer_data() spdylay_session_del(session); } -void test_spdylay_session_flow_control() +void test_spdylay_session_flow_control(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1756,7 +1741,7 @@ void test_spdylay_session_flow_control() spdylay_session_del(session); } -void test_spdylay_session_on_ctrl_not_send() +void test_spdylay_session_on_ctrl_not_send(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1881,7 +1866,7 @@ void test_spdylay_session_on_ctrl_not_send() spdylay_session_del(session); } -void test_spdylay_session_on_settings_received() +void test_spdylay_session_on_settings_received(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -1889,7 +1874,7 @@ void test_spdylay_session_on_settings_received() spdylay_stream *stream1, *stream2; spdylay_frame frame; const size_t niv = 5; - spdylay_settings_entry iv[niv]; + spdylay_settings_entry iv[255]; iv[0].settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS; iv[0].value = 1000000009; @@ -1949,7 +1934,7 @@ void test_spdylay_session_on_settings_received() spdylay_session_del(session); } -void test_spdylay_submit_settings() +void test_spdylay_submit_settings(void) { spdylay_session *session; spdylay_session_callbacks callbacks; @@ -2023,7 +2008,7 @@ void test_spdylay_submit_settings() spdylay_session_del(session); } -void test_spdylay_session_get_outbound_queue_size() +void test_spdylay_session_get_outbound_queue_size(void) { spdylay_session *session; spdylay_session_callbacks callbacks; diff --git a/tests/spdylay_session_test.h b/tests/spdylay_session_test.h index d4636a2f..8deeee98 100644 --- a/tests/spdylay_session_test.h +++ b/tests/spdylay_session_test.h @@ -25,44 +25,44 @@ #ifndef SPDYLAY_SESSION_TEST_H #define SPDYLAY_SESSION_TEST_H -void test_spdylay_session_recv(); -void test_spdylay_session_recv_invalid_stream_id(); -void test_spdylay_session_add_frame(); -void test_spdylay_session_on_syn_stream_received(); -void test_spdylay_session_on_syn_stream_received_with_push(); -void test_spdylay_session_on_syn_reply_received(); -void test_spdylay_session_on_window_update_received(); -void test_spdylay_session_send_syn_stream(); -void test_spdylay_session_send_syn_reply(); -void test_spdylay_submit_response(); -void test_spdylay_submit_response_with_null_data_read_callback(); -void test_spdylay_submit_request_with_data(); -void test_spdylay_submit_request_with_null_data_read_callback(); -void test_spdylay_submit_syn_stream(); -void test_spdylay_submit_syn_reply(); -void test_spdylay_submit_headers(); -void test_spdylay_session_reply_fail(); -void test_spdylay_session_on_headers_received(); -void test_spdylay_session_on_ping_received(); -void test_spdylay_session_on_goaway_received(); -void test_spdylay_session_on_data_received(); -void test_spdylay_session_on_rst_received(); -void test_spdylay_session_is_my_stream_id(); -void test_spdylay_session_send_rst_stream(); -void test_spdylay_session_get_next_ob_item(); -void test_spdylay_session_pop_next_ob_item(); -void test_spdylay_session_on_request_recv_callback(); -void test_spdylay_session_on_stream_close(); -void test_spdylay_session_max_concurrent_streams(); -void test_spdylay_session_data_backoff_by_high_pri_frame(); -void test_spdylay_session_stop_data_with_rst_stream(); -void test_spdylay_session_stream_close_on_syn_stream(); -void test_spdylay_session_recv_invalid_frame(); -void test_spdylay_session_defer_data(); -void test_spdylay_session_flow_control(); -void test_spdylay_session_on_ctrl_not_send(); -void test_spdylay_session_on_settings_received(); -void test_spdylay_submit_settings(); -void test_spdylay_session_get_outbound_queue_size(); +void test_spdylay_session_recv(void); +void test_spdylay_session_recv_invalid_stream_id(void); +void test_spdylay_session_add_frame(void); +void test_spdylay_session_on_syn_stream_received(void); +void test_spdylay_session_on_syn_stream_received_with_push(void); +void test_spdylay_session_on_syn_reply_received(void); +void test_spdylay_session_on_window_update_received(void); +void test_spdylay_session_send_syn_stream(void); +void test_spdylay_session_send_syn_reply(void); +void test_spdylay_submit_response(void); +void test_spdylay_submit_response_with_null_data_read_callback(void); +void test_spdylay_submit_request_with_data(void); +void test_spdylay_submit_request_with_null_data_read_callback(void); +void test_spdylay_submit_syn_stream(void); +void test_spdylay_submit_syn_reply(void); +void test_spdylay_submit_headers(void); +void test_spdylay_session_reply_fail(void); +void test_spdylay_session_on_headers_received(void); +void test_spdylay_session_on_ping_received(void); +void test_spdylay_session_on_goaway_received(void); +void test_spdylay_session_on_data_received(void); +void test_spdylay_session_on_rst_received(void); +void test_spdylay_session_is_my_stream_id(void); +void test_spdylay_session_send_rst_stream(void); +void test_spdylay_session_get_next_ob_item(void); +void test_spdylay_session_pop_next_ob_item(void); +void test_spdylay_session_on_request_recv_callback(void); +void test_spdylay_session_on_stream_close(void); +void test_spdylay_session_max_concurrent_streams(void); +void test_spdylay_session_data_backoff_by_high_pri_frame(void); +void test_spdylay_session_stop_data_with_rst_stream(void); +void test_spdylay_session_stream_close_on_syn_stream(void); +void test_spdylay_session_recv_invalid_frame(void); +void test_spdylay_session_defer_data(void); +void test_spdylay_session_flow_control(void); +void test_spdylay_session_on_ctrl_not_send(void); +void test_spdylay_session_on_settings_received(void); +void test_spdylay_submit_settings(void); +void test_spdylay_session_get_outbound_queue_size(void); -#endif // SPDYLAY_SESSION_TEST_H +#endif /* SPDYLAY_SESSION_TEST_H */ diff --git a/tests/spdylay_stream_test.c b/tests/spdylay_stream_test.c index 76b9a26d..eadb8b59 100644 --- a/tests/spdylay_stream_test.c +++ b/tests/spdylay_stream_test.c @@ -28,7 +28,7 @@ #include "spdylay_stream.h" -void test_spdylay_stream_add_pushed_stream() +void test_spdylay_stream_add_pushed_stream(void) { spdylay_stream stream; int i, n; @@ -37,7 +37,7 @@ void test_spdylay_stream_add_pushed_stream() n = 26; for(i = 2; i < n; i += 2) { CU_ASSERT(0 == spdylay_stream_add_pushed_stream(&stream, i)); - CU_ASSERT(i/2 == stream.pushed_streams_length); + CU_ASSERT((size_t)i/2 == stream.pushed_streams_length); } for(i = 2; i < n; i += 2) { CU_ASSERT(i == stream.pushed_streams[i/2-1]); diff --git a/tests/spdylay_stream_test.h b/tests/spdylay_stream_test.h index 1326063e..d60b1d06 100644 --- a/tests/spdylay_stream_test.h +++ b/tests/spdylay_stream_test.h @@ -25,6 +25,6 @@ #ifndef SPDYLAY_STREAM_TEST_H #define SPDYLAY_STREAM_TEST_H -void test_spdylay_stream_add_pushed_stream(); +void test_spdylay_stream_add_pushed_stream(void); #endif /* SPDYLAY_STREAM_TEST_H */ diff --git a/tests/spdylay_zlib_test.c b/tests/spdylay_zlib_test.c index 5ed02315..009fc843 100644 --- a/tests/spdylay_zlib_test.c +++ b/tests/spdylay_zlib_test.c @@ -30,7 +30,7 @@ #include "spdylay_zlib.h" -void test_spdylay_zlib_with(uint16_t version) +static void test_spdylay_zlib_with(uint16_t version) { spdylay_zlib deflater, inflater; const char msg[] = @@ -70,12 +70,12 @@ void test_spdylay_zlib_with(uint16_t version) spdylay_buffer_free(&buf); } -void test_spdylay_zlib_spdy2() +void test_spdylay_zlib_spdy2(void) { test_spdylay_zlib_with(SPDYLAY_PROTO_SPDY2); } -void test_spdylay_zlib_spdy3() +void test_spdylay_zlib_spdy3(void) { test_spdylay_zlib_with(SPDYLAY_PROTO_SPDY3); } diff --git a/tests/spdylay_zlib_test.h b/tests/spdylay_zlib_test.h index b610663e..4ae113fa 100644 --- a/tests/spdylay_zlib_test.h +++ b/tests/spdylay_zlib_test.h @@ -25,7 +25,7 @@ #ifndef SPDYLAY_ZLIB_TEST_H #define SPDYLAY_ZLIB_TEST_H -void test_spdylay_zlib_spdy2(); -void test_spdylay_zlib_spdy3(); +void test_spdylay_zlib_spdy2(void); +void test_spdylay_zlib_spdy3(void); -#endif // SPDYLAY_ZLIB_TEST_H +#endif /* SPDYLAY_ZLIB_TEST_H */