diff --git a/examples/client.c b/examples/client.c index a08d943a..a008ba54 100644 --- a/examples/client.c +++ b/examples/client.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -144,8 +145,8 @@ static void diec(const char *func, int error_code) * bytes actually written. See the documentation of * nghttp2_send_callback for the details. */ -static ssize_t send_callback(nghttp2_session *session, - const uint8_t *data, size_t length, int flags, +static ssize_t send_callback(nghttp2_session *session _U_, + const uint8_t *data, size_t length, int flags _U_, void *user_data) { struct Connection *connection; @@ -173,8 +174,8 @@ static ssize_t send_callback(nghttp2_session *session, * |length| bytes. Returns the number of bytes stored in |buf|. See * the documentation of nghttp2_recv_callback for the details. */ -static ssize_t recv_callback(nghttp2_session *session, - uint8_t *buf, size_t length, int flags, +static ssize_t recv_callback(nghttp2_session *session _U_, + uint8_t *buf, size_t length, int flags _U_, void *user_data) { struct Connection *connection; @@ -199,7 +200,7 @@ static ssize_t recv_callback(nghttp2_session *session, } static int on_frame_send_callback(nghttp2_session *session, - const nghttp2_frame *frame, void *user_data) + const nghttp2_frame *frame, void *user_data _U_) { size_t i; switch(frame->hd.type) { @@ -226,7 +227,7 @@ static int on_frame_send_callback(nghttp2_session *session, } static int on_frame_recv_callback(nghttp2_session *session, - const nghttp2_frame *frame, void *user_data) + const nghttp2_frame *frame, void *user_data _U_) { size_t i; switch(frame->hd.type) { @@ -264,8 +265,8 @@ static int on_frame_recv_callback(nghttp2_session *session, */ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, - nghttp2_error_code error_code, - void *user_data) + uint32_t error_code _U_, + void *user_data _U_) { struct Request *req; req = nghttp2_session_get_stream_user_data(session, stream_id); @@ -286,10 +287,10 @@ static int on_stream_close_callback(nghttp2_session *session, * The implementation of nghttp2_on_data_chunk_recv_callback type. We * use this function to print the received response body. */ -static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, +static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags _U_, int32_t stream_id, const uint8_t *data, size_t len, - void *user_data) + void *user_data _U_) { struct Request *req; req = nghttp2_session_get_stream_user_data(session, stream_id); @@ -332,10 +333,10 @@ static void setup_nghttp2_callbacks(nghttp2_session_callbacks *callbacks) * HTTP/2 protocol, if server does not offer HTTP/2 the nghttp2 * library supports, we terminate program. */ -static int select_next_proto_cb(SSL* ssl, +static int select_next_proto_cb(SSL* ssl _U_, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, - void *arg) + void *arg _U_) { int rv; /* nghttp2_select_next_protocol() selects HTTP/2 protocol the diff --git a/examples/deflate.c b/examples/deflate.c index b68f7ae9..2ca84f7f 100644 --- a/examples/deflate.c +++ b/examples/deflate.c @@ -22,6 +22,7 @@ * 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 #include #include @@ -38,7 +39,7 @@ static void deflate(nghttp2_hd_deflater *deflater, static int inflate_header_block(nghttp2_hd_inflater *inflater, uint8_t *in, size_t inlen, int final); -int main(int argc, char **argv) +int main(int argc _U_, char **argv _U_) { int rv; nghttp2_hd_deflater *deflater; diff --git a/examples/libevent-client.c b/examples/libevent-client.c index ef2dde8a..5dd8e356 100644 --- a/examples/libevent-client.c +++ b/examples/libevent-client.c @@ -23,6 +23,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include #include #include #include @@ -179,9 +180,9 @@ static void print_headers(FILE *f, nghttp2_nv *nva, size_t nvlen) /* nghttp2_send_callback. Here we transmit the |data|, |length| bytes, to the network. Because we are using libevent bufferevent, we just write those bytes into bufferevent buffer. */ -static ssize_t send_callback(nghttp2_session *session, +static ssize_t send_callback(nghttp2_session *session _U_, const uint8_t *data, size_t length, - int flags, void *user_data) + int flags _U_, void *user_data) { http2_session_data *session_data = (http2_session_data*)user_data; struct bufferevent *bev = session_data->bev; @@ -191,11 +192,11 @@ static ssize_t send_callback(nghttp2_session *session, /* nghttp2_on_header_callback: Called when nghttp2 library emits single header name/value pair. */ -static int on_header_callback(nghttp2_session *session, +static int on_header_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, - uint8_t flags, + uint8_t flags _U_, void *user_data) { http2_session_data *session_data = (http2_session_data*)user_data; @@ -213,7 +214,7 @@ static int on_header_callback(nghttp2_session *session, /* nghttp2_on_begin_headers_callback: Called when nghttp2 library gets started to receive header block. */ -static int on_begin_headers_callback(nghttp2_session *session, +static int on_begin_headers_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, void *user_data) { @@ -232,7 +233,7 @@ static int on_begin_headers_callback(nghttp2_session *session, /* nghttp2_on_frame_recv_callback: Called when nghttp2 library received a complete frame from the remote peer. */ -static int on_frame_recv_callback(nghttp2_session *session, +static int on_frame_recv_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, void *user_data) { http2_session_data *session_data = (http2_session_data*)user_data; @@ -252,7 +253,7 @@ static int on_frame_recv_callback(nghttp2_session *session, is meant to the stream we initiated, print the received data in stdout, so that the user can redirect its output to the file easily. */ -static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, +static int on_data_chunk_recv_callback(nghttp2_session *session _U_, uint8_t flags _U_, int32_t stream_id, const uint8_t *data, size_t len, void *user_data) @@ -290,10 +291,10 @@ static int on_stream_close_callback(nghttp2_session *session, /* NPN TLS extension client callback. We check that server advertised the HTTP/2 protocol the nghttp2 library supports. If not, exit the program. */ -static int select_next_proto_cb(SSL* ssl, +static int select_next_proto_cb(SSL* ssl _U_, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, - void *arg) + void *arg _U_) { if(nghttp2_select_next_protocol(out, outlen, in, inlen) <= 0) { errx(1, "Server did not advertise " NGHTTP2_PROTO_VERSION_ID); @@ -454,7 +455,7 @@ static void readcb(struct bufferevent *bev, void *ptr) receiving GOAWAY, we check the some conditions on the nghttp2 library and output buffer of bufferevent. If it indicates we have no business to this session, tear down the connection. */ -static void writecb(struct bufferevent *bev, void *ptr) +static void writecb(struct bufferevent *bev _U_, void *ptr) { http2_session_data *session_data = (http2_session_data*)ptr; if(nghttp2_session_want_read(session_data->session) == 0 && diff --git a/examples/libevent-server.c b/examples/libevent-server.c index 2d073ed7..7d7ab311 100644 --- a/examples/libevent-server.c +++ b/examples/libevent-server.c @@ -22,6 +22,7 @@ * 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 #include #include #include @@ -79,8 +80,8 @@ struct app_context { static unsigned char next_proto_list[256]; static size_t next_proto_list_len; -static int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len, - void *arg) +static int next_proto_cb(SSL *s _U_, const unsigned char **data, unsigned int *len, + void *arg _U_) { *data = next_proto_list; *len = (unsigned int)next_proto_list_len; @@ -140,7 +141,7 @@ static void add_stream(http2_session_data *session_data, } } -static void remove_stream(http2_session_data *session_data, +static void remove_stream(http2_session_data *session_data _U_, http2_stream_data *stream_data) { stream_data->prev->next = stream_data->next; @@ -259,9 +260,9 @@ static int session_recv(http2_session_data *session_data) return 0; } -static ssize_t send_callback(nghttp2_session *session, +static ssize_t send_callback(nghttp2_session *session _U_, const uint8_t *data, size_t length, - int flags, void *user_data) + int flags _U_, void *user_data) { http2_session_data *session_data = (http2_session_data*)user_data; struct bufferevent *bev = session_data->bev; @@ -330,9 +331,9 @@ static char* percent_decode(const uint8_t *value, size_t valuelen) } static ssize_t file_read_callback -(nghttp2_session *session, int32_t stream_id, +(nghttp2_session *session _U_, int32_t stream_id _U_, uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) + nghttp2_data_source *source, void *user_data _U_) { int fd = source->fd; ssize_t r; @@ -412,8 +413,8 @@ static int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, - uint8_t flags, - void *user_data) + uint8_t flags _U_, + void *user_data _U_) { http2_stream_data *stream_data; const char PATH[] = ":path"; @@ -536,7 +537,7 @@ static int on_frame_recv_callback(nghttp2_session *session, static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, - nghttp2_error_code error_code, + uint32_t error_code _U_, void *user_data) { http2_session_data *session_data = (http2_session_data*)user_data; @@ -607,7 +608,7 @@ static int send_server_connection_header(http2_session_data *session_data) /* readcb for bufferevent after client connection header was checked. */ -static void readcb(struct bufferevent *bev, void *ptr) +static void readcb(struct bufferevent *bev _U_, void *ptr) { http2_session_data *session_data = (http2_session_data*)ptr; if(session_recv(session_data) != 0) { @@ -642,7 +643,7 @@ static void writecb(struct bufferevent *bev, void *ptr) } /* eventcb for bufferevent */ -static void eventcb(struct bufferevent *bev, short events, void *ptr) +static void eventcb(struct bufferevent *bev _U_, short events, void *ptr) { http2_session_data *session_data = (http2_session_data*)ptr; if(events & BEV_EVENT_CONNECTED) { @@ -668,7 +669,7 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) } /* callback for evconnlistener */ -static void acceptcb(struct evconnlistener *listener, int fd, +static void acceptcb(struct evconnlistener *listener _U_, int fd, struct sockaddr *addr, int addrlen, void *arg) { app_context *app_ctx = (app_context*)arg; diff --git a/examples/tiny-nghttpd.c b/examples/tiny-nghttpd.c index 1bb86b63..d7d6dc27 100644 --- a/examples/tiny-nghttpd.c +++ b/examples/tiny-nghttpd.c @@ -27,6 +27,7 @@ * overhead of underlying I/O library (e.g., libevent, Boost ASIO). */ #define _GNU_SOURCE +#include #include #include #include @@ -532,7 +533,7 @@ static int io_loop_mod(io_loop *loop, int fd, uint32_t events, void *ptr) return io_loop_ctl(loop, EPOLL_CTL_MOD, fd, events, ptr); } -static int io_loop_run(io_loop *loop, server *serv) +static int io_loop_run(io_loop *loop, server *serv _U_) { #define NUM_EVENTS 1024 struct epoll_event events[NUM_EVENTS]; @@ -557,7 +558,7 @@ static int io_loop_run(io_loop *loop, server *serv) } } -static int handle_timer(io_loop *loop, uint32_t events, void *ptr) +static int handle_timer(io_loop *loop _U_, uint32_t events _U_, void *ptr) { timer *tmr = ptr; int64_t buf; @@ -572,7 +573,7 @@ static int handle_timer(io_loop *loop, uint32_t events, void *ptr) return 0; } -static int handle_accept(io_loop *loop, uint32_t events, void *ptr) +static int handle_accept(io_loop *loop, uint32_t events _U_, void *ptr) { int acfd; server *serv = ptr; @@ -629,9 +630,9 @@ static void stream_error } static ssize_t fd_read_callback -(nghttp2_session *session, int32_t stream_id, +(nghttp2_session *session _U_, int32_t stream_id _U_, uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) + nghttp2_data_source *source, void *user_data _U_) { stream *strm = source->ptr; ssize_t nread; @@ -651,9 +652,9 @@ static ssize_t fd_read_callback } static ssize_t resbuf_read_callback -(nghttp2_session *session, int32_t stream_id, +(nghttp2_session *session _U_, int32_t stream_id _U_, uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) + nghttp2_data_source *source, void *user_data _U_) { stream *strm = source->ptr; size_t left = strm->res_end - strm->res_begin; @@ -715,7 +716,7 @@ static int check_path(const char *path, size_t len) (len < 2 || memcmp(path + len - 2, "/.", 2) != 0); } -static int make_path(io_buf *pathbuf, const char *req, size_t reqlen) +static int make_path(io_buf *pathbuf, const char *req, size_t reqlen _U_) { uint8_t *p; @@ -953,7 +954,7 @@ static int on_begin_headers_callback static int on_header_callback (nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, - uint8_t flags, void *user_data) + uint8_t flags _U_, void *user_data) { connection *conn = user_data; stream *strm; @@ -1079,8 +1080,8 @@ static int on_frame_recv_callback } static int on_stream_close_callback -(nghttp2_session *session, int32_t stream_id, uint32_t error_code, - void *user_data) +(nghttp2_session *session, int32_t stream_id, uint32_t error_code _U_, + void *user_data _U_) { stream *strm; @@ -1096,7 +1097,7 @@ static int on_stream_close_callback } static int on_frame_not_send_callback -(nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code, +(nghttp2_session *session _U_, const nghttp2_frame *frame, int lib_error_code _U_, void *user_data) { connection *conn = user_data; diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index 9a661a08..906053f0 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -94,7 +94,7 @@ void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id, frame->pri_spec = *pri_spec; } -void nghttp2_frame_priority_free(nghttp2_priority *frame) +void nghttp2_frame_priority_free(nghttp2_priority *frame _U_) {} void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame, @@ -106,7 +106,7 @@ void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame, frame->error_code = error_code; } -void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame) +void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame _U_) {} @@ -153,7 +153,7 @@ void nghttp2_frame_ping_init(nghttp2_ping *frame, uint8_t flags, } } -void nghttp2_frame_ping_free(nghttp2_ping *frame) +void nghttp2_frame_ping_free(nghttp2_ping *frame _U_) {} void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id, @@ -185,7 +185,7 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame, frame->reserved = 0; } -void nghttp2_frame_window_update_free(nghttp2_window_update *frame) +void nghttp2_frame_window_update_free(nghttp2_window_update *frame _U_) {} void nghttp2_frame_altsvc_init(nghttp2_extension *frame, int32_t stream_id, @@ -242,7 +242,7 @@ void nghttp2_frame_data_init(nghttp2_data *frame, uint8_t flags, frame->padlen = 0; } -void nghttp2_frame_data_free(nghttp2_data *frame) +void nghttp2_frame_data_free(nghttp2_data *frame _U_) {} size_t nghttp2_frame_priority_len(uint8_t flags) @@ -382,9 +382,9 @@ void nghttp2_frame_pack_priority_spec(uint8_t *buf, } void nghttp2_frame_unpack_priority_spec(nghttp2_priority_spec *pri_spec, - uint8_t flags, + uint8_t flags _U_, const uint8_t *payload, - size_t payloadlen) + size_t payloadlen _U_) { int32_t dep_stream_id; uint8_t exclusive; @@ -466,7 +466,7 @@ int nghttp2_frame_pack_rst_stream(nghttp2_bufs *bufs, void nghttp2_frame_unpack_rst_stream_payload(nghttp2_rst_stream *frame, const uint8_t *payload, - size_t payloadlen) + size_t payloadlen _U_) { frame->error_code = nghttp2_get_uint32(payload); } @@ -602,7 +602,7 @@ int nghttp2_frame_pack_push_promise(nghttp2_bufs *bufs, int nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame, const uint8_t *payload, - size_t payloadlen) + size_t payloadlen _U_) { frame->promised_stream_id = nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; @@ -633,7 +633,7 @@ int nghttp2_frame_pack_ping(nghttp2_bufs *bufs, nghttp2_ping *frame) void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame, const uint8_t *payload, - size_t payloadlen) + size_t payloadlen _U_) { memcpy(frame->opaque_data, payload, sizeof(frame->opaque_data)); } @@ -672,7 +672,7 @@ int nghttp2_frame_pack_goaway(nghttp2_bufs *bufs, nghttp2_goaway *frame) void nghttp2_frame_unpack_goaway_payload(nghttp2_goaway *frame, const uint8_t *payload, - size_t payloadlen, + size_t payloadlen _U_, uint8_t *var_gift_payload, size_t var_gift_payloadlen) { @@ -739,7 +739,7 @@ int nghttp2_frame_pack_window_update(nghttp2_bufs *bufs, void nghttp2_frame_unpack_window_update_payload(nghttp2_window_update *frame, const uint8_t *payload, - size_t payloadlen) + size_t payloadlen _U_) { frame->window_size_increment = nghttp2_get_uint32(payload) & NGHTTP2_WINDOW_SIZE_INCREMENT_MASK; @@ -803,7 +803,7 @@ int nghttp2_frame_pack_altsvc(nghttp2_bufs *bufs, nghttp2_extension *frame) int nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame, const uint8_t *payload, - size_t payloadlen, + size_t payloadlen _U_, uint8_t *var_gift_payload, size_t var_gift_payloadlen) { diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index ff882790..b687d67e 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -1141,7 +1141,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, return (ssize_t)buflen; } -size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater, +size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater _U_, const nghttp2_nv *nva, size_t nvlen) { size_t n = 0; diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 3f23cfd3..b0dd9fcf 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -1233,7 +1233,7 @@ static int stream_predicate_for_send(nghttp2_stream *stream) * received. */ static int session_predicate_request_headers_send -(nghttp2_session *session, nghttp2_headers *frame) +(nghttp2_session *session, nghttp2_headers *frame _U_) { if(session->goaway_flags) { /* When GOAWAY is sent or received, peer must not send new request @@ -1302,7 +1302,7 @@ static int session_predicate_response_headers_send * RST_STREAM was queued for this stream. */ static int session_predicate_push_response_headers_send -(nghttp2_session *session, nghttp2_stream *stream) +(nghttp2_session *session _U_, nghttp2_stream *stream) { int rv; /* TODO Should disallow HEADERS if GOAWAY has already been issued? */ @@ -1506,8 +1506,8 @@ static int session_predicate_altsvc_send * * Currently this function always returns 0. */ -static int nghttp2_session_predicate_settings_send(nghttp2_session *session, - nghttp2_frame *frame) +static int nghttp2_session_predicate_settings_send(nghttp2_session *session _U_, + nghttp2_frame *frame _U_) { return 0; } @@ -2815,7 +2815,7 @@ static int session_call_on_header(nghttp2_session *session, * Out of memory. */ static int session_handle_frame_size_error(nghttp2_session *session, - nghttp2_frame *frame) + nghttp2_frame *frame _U_) { /* TODO Currently no callback is called for this error, because we call this callback before reading any payload */ @@ -2998,7 +2998,7 @@ static int inflate_header_block(nghttp2_session *session, * NGHTTP2_ERR_NOMEM * Out of memory. */ -int nghttp2_session_end_request_headers_received(nghttp2_session *session, +int nghttp2_session_end_request_headers_received(nghttp2_session *session _U_, nghttp2_frame *frame, nghttp2_stream *stream) { diff --git a/lib/nghttp2_stream.c b/lib/nghttp2_stream.c index 368d9d2f..3ee4e069 100644 --- a/lib/nghttp2_stream.c +++ b/lib/nghttp2_stream.c @@ -74,7 +74,7 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id, stream->root_next = NULL; } -void nghttp2_stream_free(nghttp2_stream *stream) +void nghttp2_stream_free(nghttp2_stream *stream _U_) { /* We don't free stream->data_item. If it is assigned to aob, then active_outbound_item_reset() will delete it. If it is queued, @@ -1060,7 +1060,7 @@ void nghttp2_stream_roots_init(nghttp2_stream_roots *roots) roots->num_streams = 0; } -void nghttp2_stream_roots_free(nghttp2_stream_roots *roots) +void nghttp2_stream_roots_free(nghttp2_stream_roots *roots _U_) {} void nghttp2_stream_roots_add(nghttp2_stream_roots *roots, diff --git a/lib/nghttp2_submit.c b/lib/nghttp2_submit.c index 497e421a..0ed6fce2 100644 --- a/lib/nghttp2_submit.c +++ b/lib/nghttp2_submit.c @@ -178,13 +178,13 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, } -int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags, +int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags _U_, const uint8_t *opaque_data) { return nghttp2_session_add_ping(session, NGHTTP2_FLAG_NONE, opaque_data); } -int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags, +int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags _U_, int32_t stream_id, const nghttp2_priority_spec *pri_spec) { @@ -229,7 +229,7 @@ int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags, return 0; } -int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags, +int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags _U_, int32_t stream_id, uint32_t error_code) { @@ -240,7 +240,7 @@ int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags, return nghttp2_session_add_rst_stream(session, stream_id, error_code); } -int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags, +int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags _U_, int32_t last_stream_id, uint32_t error_code, const uint8_t *opaque_data, size_t opaque_data_len) @@ -249,13 +249,13 @@ int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags, error_code, opaque_data, opaque_data_len); } -int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags, +int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags _U_, const nghttp2_settings_entry *iv, size_t niv) { return nghttp2_session_add_settings(session, NGHTTP2_FLAG_NONE, iv, niv); } -int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags, +int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags _U_, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen, void *promised_stream_user_data) @@ -366,7 +366,7 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, return 0; } -int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags, +int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_, int32_t stream_id, uint32_t max_age, uint16_t port, const uint8_t *protocol_id, size_t protocol_id_len, diff --git a/tests/main.c b/tests/main.c index 276abe60..95e3e988 100644 --- a/tests/main.c +++ b/tests/main.c @@ -54,7 +54,7 @@ static int clean_suite1(void) } -int main(int argc, char* argv[]) +int main(int argc _U_, char* argv[] _U_) { CU_pSuite pSuite = NULL; unsigned int num_tests_failed; diff --git a/tests/nghttp2_map_test.c b/tests/nghttp2_map_test.c index 4103640e..a2ee2763 100644 --- a/tests/nghttp2_map_test.c +++ b/tests/nghttp2_map_test.c @@ -103,7 +103,7 @@ static void shuffle(int *a, int n) } } -static int eachfun(nghttp2_map_entry *entry, void *ptr) +static int eachfun(nghttp2_map_entry *entry _U_, void *ptr _U_) { return 0; } @@ -152,7 +152,7 @@ void test_nghttp2_map_functional(void) nghttp2_map_free(&map); } -static int entry_free(nghttp2_map_entry *entry, void *ptr) +static int entry_free(nghttp2_map_entry *entry, void *ptr _U_) { free(entry); return 0; diff --git a/tests/nghttp2_pq_test.c b/tests/nghttp2_pq_test.c index 32ee893c..e7f698e5 100644 --- a/tests/nghttp2_pq_test.c +++ b/tests/nghttp2_pq_test.c @@ -89,7 +89,7 @@ static int node_compar(const void *lhs, const void *rhs) return ln->key - rn->key; } -static int node_update(void *item, void *arg) +static int node_update(void *item, void *arg _U_) { node *nd = (node*)item; if((nd->key % 2) == 0) { diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index 37904012..4dd76324 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -101,31 +101,31 @@ static void scripted_data_feed_init2(scripted_data_feed *df, df->feedseq[0] = len; } -static ssize_t null_send_callback(nghttp2_session *session, - const uint8_t* data, size_t len, int flags, - void *user_data) +static ssize_t null_send_callback(nghttp2_session *session _U_, + const uint8_t* data _U_, size_t len, int flags _U_, + void *user_data _U_) { return len; } -static ssize_t fail_send_callback(nghttp2_session *session, - const uint8_t *data, size_t len, int flags, - void *user_data) +static ssize_t fail_send_callback(nghttp2_session *session _U_, + const uint8_t *data _U_, size_t len _U_, int flags _U_, + void *user_data _U_) { return NGHTTP2_ERR_CALLBACK_FAILURE; } -static ssize_t fixed_bytes_send_callback(nghttp2_session *session, - const uint8_t *data, size_t len, - int flags, void *user_data) +static ssize_t fixed_bytes_send_callback(nghttp2_session *session _U_, + const uint8_t *data _U_, size_t len, + int flags _U_, void *user_data) { size_t fixed_sendlen = ((my_user_data*)user_data)->fixed_sendlen; return fixed_sendlen < len ? fixed_sendlen : len; } -static ssize_t scripted_recv_callback(nghttp2_session *session, - uint8_t* data, size_t len, int flags, +static ssize_t scripted_recv_callback(nghttp2_session *session _U_, + uint8_t* data, size_t len, int flags _U_, void *user_data) { scripted_data_feed *df = ((my_user_data*)user_data)->df; @@ -139,16 +139,16 @@ static ssize_t scripted_recv_callback(nghttp2_session *session, return wlen; } -static ssize_t eof_recv_callback(nghttp2_session *session, - uint8_t* data, size_t len, int flags, - void *user_data) +static ssize_t eof_recv_callback(nghttp2_session *session _U_, + uint8_t* data _U_, size_t len _U_, int flags _U_, + void *user_data _U_) { return NGHTTP2_ERR_EOF; } -static ssize_t accumulator_send_callback(nghttp2_session *session, +static ssize_t accumulator_send_callback(nghttp2_session *session _U_, const uint8_t *buf, size_t len, - int flags, void* user_data) + int flags _U_, void* user_data) { accumulator *acc = ((my_user_data*)user_data)->acc; assert(acc->length+len < sizeof(acc->buf)); @@ -157,8 +157,8 @@ static ssize_t accumulator_send_callback(nghttp2_session *session, return len; } -static int on_begin_frame_callback(nghttp2_session *session, - const nghttp2_frame_hd *hd, +static int on_begin_frame_callback(nghttp2_session *session _U_, + const nghttp2_frame_hd *hd _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -166,7 +166,7 @@ static int on_begin_frame_callback(nghttp2_session *session, return 0; } -static int on_frame_recv_callback(nghttp2_session *session, +static int on_frame_recv_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, void *user_data) { @@ -176,9 +176,9 @@ static int on_frame_recv_callback(nghttp2_session *session, return 0; } -static int on_invalid_frame_recv_callback(nghttp2_session *session, - const nghttp2_frame *frame, - nghttp2_error_code error_code, +static int on_invalid_frame_recv_callback(nghttp2_session *session _U_, + const nghttp2_frame *frame _U_, + nghttp2_error_code error_code _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -186,7 +186,7 @@ static int on_invalid_frame_recv_callback(nghttp2_session *session, return 0; } -static int on_frame_send_callback(nghttp2_session *session, +static int on_frame_send_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, void *user_data) { @@ -196,7 +196,7 @@ static int on_frame_send_callback(nghttp2_session *session, return 0; } -static int on_frame_not_send_callback(nghttp2_session *session, +static int on_frame_not_send_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, int lib_error, void *user_data) @@ -208,9 +208,9 @@ static int on_frame_not_send_callback(nghttp2_session *session, return 0; } -static int on_data_chunk_recv_callback(nghttp2_session *session, - uint8_t flags, int32_t stream_id, - const uint8_t *data, size_t len, +static int on_data_chunk_recv_callback(nghttp2_session *session _U_, + uint8_t flags _U_, int32_t stream_id _U_, + const uint8_t *data _U_, size_t len, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -219,9 +219,9 @@ static int on_data_chunk_recv_callback(nghttp2_session *session, return 0; } -static int pause_on_data_chunk_recv_callback(nghttp2_session *session, - uint8_t flags, int32_t stream_id, - const uint8_t *data, size_t len, +static int pause_on_data_chunk_recv_callback(nghttp2_session *session _U_, + uint8_t flags _U_, int32_t stream_id _U_, + const uint8_t *data _U_, size_t len _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -229,7 +229,7 @@ static int pause_on_data_chunk_recv_callback(nghttp2_session *session, return NGHTTP2_ERR_PAUSE; } -static ssize_t select_padding_callback(nghttp2_session *session, +static ssize_t select_padding_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, size_t max_payloadlen, void *user_data) @@ -239,23 +239,23 @@ static ssize_t select_padding_callback(nghttp2_session *session, } static ssize_t too_large_data_source_length_callback -(nghttp2_session *session, uint8_t frame_type, int32_t stream_id, - int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, void *user_data) { +(nghttp2_session *session _U_, uint8_t frame_type _U_, int32_t stream_id _U_, + int32_t session_remote_window_size _U_, int32_t stream_remote_window_size _U_, + uint32_t remote_max_frame_size _U_, void *user_data _U_) { return NGHTTP2_MAX_FRAME_SIZE_MAX + 1; } static ssize_t smallest_length_data_source_length_callback -(nghttp2_session *session, uint8_t frame_type, int32_t stream_id, - int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, void *user_data) { +(nghttp2_session *session _U_, uint8_t frame_type _U_, int32_t stream_id _U_, + int32_t session_remote_window_size _U_, int32_t stream_remote_window_size _U_, + uint32_t remote_max_frame_size _U_, void *user_data _U_) { return 1; } static ssize_t fixed_length_data_source_read_callback -(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t len, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) +(nghttp2_session *session _U_, int32_t stream_id _U_, + uint8_t *buf _U_, size_t len, uint32_t *data_flags, + nghttp2_data_source *source _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; size_t wlen; @@ -272,17 +272,17 @@ static ssize_t fixed_length_data_source_read_callback } static ssize_t temporal_failure_data_source_read_callback -(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t len, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) +(nghttp2_session *session _U_, int32_t stream_id _U_, + uint8_t *buf _U_, size_t len _U_, uint32_t *data_flags _U_, + nghttp2_data_source *source _U_, void *user_data _U_) { return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } static ssize_t fail_data_source_read_callback -(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t len, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) +(nghttp2_session *session _U_, int32_t stream_id _U_, + uint8_t *buf _U_, size_t len _U_, uint32_t *data_flags _U_, + nghttp2_data_source *source _U_, void *user_data _U_) { return NGHTTP2_ERR_CALLBACK_FAILURE; } @@ -297,9 +297,9 @@ static ssize_t fail_data_source_read_callback /* ++my_data->stream_close_cb_called; */ /* } */ -static ssize_t block_count_send_callback(nghttp2_session* session, - const uint8_t *data, size_t len, - int flags, +static ssize_t block_count_send_callback(nghttp2_session* session _U_, + const uint8_t *data _U_, size_t len, + int flags _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -313,11 +313,11 @@ static ssize_t block_count_send_callback(nghttp2_session* session, return r; } -static int on_header_callback(nghttp2_session *session, +static int on_header_callback(nghttp2_session *session _U_, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, - uint8_t flags, + uint8_t flags _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -356,8 +356,8 @@ static int temporal_failure_on_header_callback return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } -static int on_begin_headers_callback(nghttp2_session *session, - const nghttp2_frame *frame, +static int on_begin_headers_callback(nghttp2_session *session _U_, + const nghttp2_frame *frame _U_, void *user_data) { my_user_data *ud = (my_user_data*)user_data; @@ -366,15 +366,15 @@ static int on_begin_headers_callback(nghttp2_session *session, } static ssize_t defer_data_source_read_callback -(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t len, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) +(nghttp2_session *session _U_, int32_t stream_id _U_, + uint8_t *buf _U_, size_t len _U_, uint32_t *data_flags _U_, + nghttp2_data_source *source _U_, void *user_data _U_) { return NGHTTP2_ERR_DEFERRED; } static int stream_close_callback(nghttp2_session *session, int32_t stream_id, - nghttp2_error_code error_code, + nghttp2_error_code error_code _U_, void *user_data) { my_user_data* my_data = (my_user_data*)user_data; @@ -3307,9 +3307,9 @@ void test_nghttp2_submit_data_read_length_smallest(void) } static ssize_t submit_data_twice_data_source_read_callback -(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t len, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) +(nghttp2_session *session _U_, int32_t stream_id _U_, + uint8_t *buf _U_, size_t len, uint32_t *data_flags, + nghttp2_data_source *source _U_, void *user_data _U_) { *data_flags |= NGHTTP2_DATA_FLAG_EOF; return nghttp2_min(len, 16); @@ -3317,7 +3317,7 @@ static ssize_t submit_data_twice_data_source_read_callback static int submit_data_twice_on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, - void *user_data) + void *user_data _U_) { static int called = 0; int rv;