From d386a4b496ead52f78d91372a1e063d5ecb61233 Mon Sep 17 00:00:00 2001 From: Radu Iliescu Date: Mon, 3 Dec 2018 08:20:51 -0500 Subject: [PATCH] build: fix all build warnings --- conn/dialer.c | 3 +-- include/libp2p/crypto/rsa.h | 4 ++-- peer/peer.c | 2 -- routing/dht.c | 5 ----- routing/dht_protocol.c | 1 - secio/secio.c | 4 ++-- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/conn/dialer.c b/conn/dialer.c index 758edca..34aa8e0 100644 --- a/conn/dialer.c +++ b/conn/dialer.c @@ -26,7 +26,6 @@ struct TransportDialer* libp2p_conn_tcp_transport_dialer_new(); * @returns a new Dialer struct */ struct Dialer* libp2p_conn_dialer_new(struct Libp2pPeer* peer, struct Peerstore* peerstore, struct RsaPrivateKey* rsa_private_key, struct SwarmContext* swarm) { - int success = 0; struct Dialer* dialer = (struct Dialer*)malloc(sizeof(struct Dialer)); if (dialer != NULL) { dialer->peerstore = peerstore; @@ -166,7 +165,7 @@ int libp2p_conn_dialer_join_swarm(const struct Dialer* dialer, struct Libp2pPeer return 0; } // then get an identify - struct Stream* identify_stream = libp2p_identify_stream_new(yamux_multistream, identify, 1); + libp2p_identify_stream_new(yamux_multistream, identify, 1); } } else { libp2p_logger_error("dialer", "Expected a yamux context, but got a context of type %d.\n", peer->sessionContext->default_stream->stream_type); diff --git a/include/libp2p/crypto/rsa.h b/include/libp2p/crypto/rsa.h index 878ce9c..e88e604 100644 --- a/include/libp2p/crypto/rsa.h +++ b/include/libp2p/crypto/rsa.h @@ -4,7 +4,7 @@ #include struct RsaPublicKey { - char* der; + unsigned char* der; size_t der_length; }; @@ -20,7 +20,7 @@ struct RsaPrivateKey { unsigned long long N; // the keys in DER format // private - char* der; + unsigned char* der; size_t der_length; // public char* public_key_der; diff --git a/peer/peer.c b/peer/peer.c index 82052f6..0f779c4 100644 --- a/peer/peer.c +++ b/peer/peer.c @@ -256,9 +256,7 @@ int libp2p_peer_protobuf_decode(unsigned char* in, size_t in_size, struct Libp2p int retVal = 0; char* buffer = NULL; size_t buffer_size = 0; - struct Libp2pLinkedList* current = NULL; struct Libp2pLinkedList* last = NULL; - struct MultiAddress* ma = NULL; *out = libp2p_peer_new(); if ( *out == NULL) diff --git a/routing/dht.c b/routing/dht.c index 0e210b6..2527b38 100644 --- a/routing/dht.c +++ b/routing/dht.c @@ -302,11 +302,6 @@ static int parse_message(const unsigned char *buf, int buflen, int *want_return); static const unsigned char zeroes[20] = {0}; -static const unsigned char ones[20] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF -}; static const unsigned char v4prefix[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 }; diff --git a/routing/dht_protocol.c b/routing/dht_protocol.c index e34383b..cb77c1c 100644 --- a/routing/dht_protocol.c +++ b/routing/dht_protocol.c @@ -334,7 +334,6 @@ int libp2p_routing_dht_handle_add_provider(struct Stream* stream, struct Kademli int libp2p_routing_dht_handle_get_value(struct Stream* stream, struct KademliaMessage* message, struct DhtContext* dht_context, unsigned char** result_buffer, size_t *result_buffer_size) { - struct Datastore* datastore = dht_context->datastore; struct Filestore* filestore = dht_context->filestore; size_t data_size = 0; unsigned char* data = NULL; diff --git a/secio/secio.c b/secio/secio.c index 865c37b..d9e799e 100644 --- a/secio/secio.c +++ b/secio/secio.c @@ -314,7 +314,7 @@ int libp2p_secio_verify_signature(struct PublicKey* public_key, const unsigned c if (public_key->type == KEYTYPE_RSA) { struct RsaPublicKey rsa_key = {0}; - rsa_key.der = (char*)public_key->data; + rsa_key.der = public_key->data; rsa_key.der_length = public_key->data_size; return libp2p_crypto_rsa_verify(&rsa_key, in, in_length, signature); } @@ -335,7 +335,7 @@ int libp2p_secio_sign(struct PrivateKey* private_key, const char* in, size_t in_ if (private_key->type == KEYTYPE_RSA) { struct RsaPrivateKey rsa_key = {0}; - rsa_key.der = (char*)private_key->data; + rsa_key.der = private_key->data; rsa_key.der_length = private_key->data_size; int retVal = libp2p_crypto_rsa_sign(&rsa_key, in, in_length, signature, signature_size); // debugging