From 0e7c2a36b22b0047cba1b03545dc6d49c28d4c09 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Wed, 20 Mar 2013 14:12:23 -0400 Subject: [PATCH] Enable warnings; fix many of them --- Makefile.am | 1 + common/tr_dh.c | 1 + common/tr_msg.c | 8 ++++---- include/tr_dh.h | 2 +- include/trust_router/tid.h | 2 +- tid/example/tidc_main.c | 4 ++-- tid/example/tids_main.c | 2 +- tid/tidc.c | 2 +- tid/tids.c | 4 ++-- tr/tr_main.c | 2 +- 10 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index 82a136c..4e501b1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ bin_PROGRAMS= tr/tr tid/example/tidc tid/example/tids common/dh_test/tr_dh_test AM_CPPFLAGS=-I$(srcdir)/include +AM_CFLAGS = -Wall -Werror=missing-prototypes -Werror=strict-prototypes -Wno-parentheses SUBDIRS = gsscon common_srcs = common/tr_name.c \ common/tr_msg.c \ diff --git a/common/tr_dh.c b/common/tr_dh.c index a6b5867..ab3a7a4 100644 --- a/common/tr_dh.c +++ b/common/tr_dh.c @@ -33,6 +33,7 @@ */ #include +#include unsigned char tr_2048_dhprime[2048/8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, diff --git a/common/tr_msg.c b/common/tr_msg.c index b475c02..0554d5a 100644 --- a/common/tr_msg.c +++ b/common/tr_msg.c @@ -98,7 +98,7 @@ static DH *tr_msg_decode_dh(json_t *jdh) return dh; } -json_t *tr_msg_encode_tidreq(TID_REQ *req) +static json_t * tr_msg_encode_tidreq(TID_REQ *req) { json_t *jreq = NULL; json_t *jstr = NULL; @@ -122,7 +122,7 @@ json_t *tr_msg_encode_tidreq(TID_REQ *req) return jreq; } -TID_REQ *tr_msg_decode_tidreq(json_t *jreq) +static TID_REQ *tr_msg_decode_tidreq(json_t *jreq) { TID_REQ *treq = NULL; json_error_t rc; @@ -169,7 +169,7 @@ TID_REQ *tr_msg_decode_tidreq(json_t *jreq) return treq; } -json_t *tr_msg_encode_tidresp(TID_RESP *resp) +static json_t * tr_msg_encode_tidresp(TID_RESP *resp) { json_t *jresp = NULL; json_t *jstr = NULL; @@ -201,7 +201,7 @@ json_t *tr_msg_encode_tidresp(TID_RESP *resp) return jresp; } -TID_RESP *tr_msg_decode_tidresp(json_t *jresp) +static TID_RESP *tr_msg_decode_tidresp(json_t *jresp) { TID_RESP *tresp = NULL; json_error_t rc; diff --git a/include/tr_dh.h b/include/tr_dh.h index ef3f0a9..b027e83 100644 --- a/include/tr_dh.h +++ b/include/tr_dh.h @@ -41,6 +41,6 @@ DH *tr_create_dh_params(char *key, size_t len); DH *tr_create_matching_dh(char *key, size_t len, DH *in_dh); void tr_destroy_dh_params(DH *dh); -int tr_compute_dh_key(char *buf, size_t buflen, BIGNUM *pub_key, DH *priv_dh); +int tr_compute_dh_key(unsigned char *buf, size_t buflen, BIGNUM *pub_key, DH *priv_dh); #endif diff --git a/include/trust_router/tid.h b/include/trust_router/tid.h index a6e510a..2c37e18 100644 --- a/include/trust_router/tid.h +++ b/include/trust_router/tid.h @@ -96,7 +96,7 @@ TR_EXPORT int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, gss_ctx_i TR_EXPORT int tidc_send_request (TIDC_INSTANCE *tidc, int conn, gss_ctx_id_t gssctx, char *rp_realm, char *realm, char *coi, TIDC_RESP_FUNC *resp_handler, void *cookie); TR_EXPORT void tidc_destroy (TIDC_INSTANCE *tidc); -TR_EXPORT TIDS_INSTANCE *tids_create (); +TR_EXPORT TIDS_INSTANCE *tids_create (void); TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, void *cookie); TR_EXPORT void tids_destroy (TIDS_INSTANCE *tids); diff --git a/tid/example/tidc_main.c b/tid/example/tidc_main.c index e6c1579..b3da638 100644 --- a/tid/example/tidc_main.c +++ b/tid/example/tidc_main.c @@ -40,12 +40,12 @@ static int tidc_response_received = 0; -void tidc_print_usage (const char *name) +void static tidc_print_usage (const char *name) { printf("Usage: %s \n", name); } -void tidc_resp_handler (TIDC_INSTANCE * tidc, +static void tidc_resp_handler (TIDC_INSTANCE * tidc, TID_RESP *resp, void *cookie) { diff --git a/tid/example/tids_main.c b/tid/example/tids_main.c index b35f37a..26bb10e 100644 --- a/tid/example/tids_main.c +++ b/tid/example/tids_main.c @@ -36,7 +36,7 @@ #include -int tids_req_handler (TIDS_INSTANCE * tids, +static int tids_req_handler (TIDS_INSTANCE * tids, TID_REQ *req, TID_RESP *resp, void *cookie) diff --git a/tid/tidc.c b/tid/tidc.c index bb97ebd..4e94990 100644 --- a/tid/tidc.c +++ b/tid/tidc.c @@ -162,7 +162,7 @@ int tidc_send_request (TIDC_INSTANCE *tidc, return -1; } - fprintf(stdout, "Response Received, %d bytes.\n", resp_buflen); + fprintf(stdout, "Response Received, %u bytes.\n", (unsigned) resp_buflen); /* Parse response -- TBD */ diff --git a/tid/tids.c b/tid/tids.c index 7ffac8c..f9d20b2 100644 --- a/tid/tids.c +++ b/tid/tids.c @@ -104,7 +104,7 @@ static int tids_read_request (int conn, gss_ctx_id_t *gssctx, TID_REQ *req) return -1; } - fprintf(stdout, "Request Received, %d bytes.\n", buflen); + fprintf(stdout, "Request Received, %u bytes.\n", (unsigned) buflen); /* Parse request -- TBD */ @@ -203,7 +203,7 @@ static void tids_handle_connection (int conn) return; } -TIDS_INSTANCE *tids_create () +TIDS_INSTANCE *tids_create (void) { TIDS_INSTANCE *tids = 0; if (tids = malloc(sizeof(TIDS_INSTANCE))) diff --git a/tr/tr_main.c b/tr/tr_main.c index 8625383..90bfd13 100644 --- a/tr/tr_main.c +++ b/tr/tr_main.c @@ -36,7 +36,7 @@ #include -int tids_req_handler (TIDS_INSTANCE * tids, +int static tids_req_handler (TIDS_INSTANCE * tids, TID_REQ *req, TID_RESP *resp, void *cookie) -- 2.1.4