From cb05b249ba0eea3c7f0ef5e554721ccf607459ee Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Mon, 17 Jul 2017 16:14:40 -0500 Subject: [PATCH] Fixed warnings --- namesys/namesys.c | 2 +- test/node/test_resolver.h | 3 ++- test/routing/test_routing.h | 6 +++--- test/routing/test_supernode.h | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/namesys/namesys.c b/namesys/namesys.c index f2468cb..c4c2756 100644 --- a/namesys/namesys.c +++ b/namesys/namesys.c @@ -48,7 +48,7 @@ int ipfs_namesys_resolve_n(char **path, char *name, int depth) { char ipfs_prefix[] = "/ipfs/"; char p[500]; - int err; + int err = 0;; if (memcmp(name, ipfs_prefix, strlen(ipfs_prefix)) == 0) { ipfs_path_parse(p, name); diff --git a/test/node/test_resolver.h b/test/node/test_resolver.h index 48e29b1..936c609 100644 --- a/test/node/test_resolver.h +++ b/test/node/test_resolver.h @@ -91,6 +91,7 @@ int test_resolver_remote_get() { int thread_started = 0; int retVal = 0; struct FSRepo* fs_repo = NULL; + struct HashtableNode* result = NULL; // this should point to a test directory with files and directories char* home_dir = os_utils_get_homedir(); @@ -137,7 +138,7 @@ int test_resolver_remote_get() { strcpy(path, "/ipfs/"); strcat(path, remote_peer_id); strcat(path, "/QmZBvycPAYScBoPEzm35zXHt6gYYV5t9PyWmr4sksLPNFS/hello_world.txt"); - struct HashtableNode* result = ipfs_resolver_get(path, NULL, &local_node); + result = ipfs_resolver_get(path, NULL, &local_node); if (result == NULL) { goto exit; } diff --git a/test/routing/test_routing.h b/test/routing/test_routing.h index e99fe0a..1b15356 100644 --- a/test/routing/test_routing.h +++ b/test/routing/test_routing.h @@ -155,6 +155,8 @@ int test_routing_find_providers() { struct Libp2pVector* ma_vector2 = NULL, *ma_vector3 = NULL; struct IpfsNode local_node; struct FSRepo* fs_repo = NULL; + struct HashtableNode* node = NULL; + struct Libp2pVector* result = NULL; // create peer 1 drop_and_build_repository(ipfs_path, 4001, NULL, &peer_id_1); @@ -180,7 +182,6 @@ int test_routing_find_providers() { //TODO: Find a better way to do this... size_t bytes_written = 0; ipfs_node_online_new(ipfs_path, &local_node2); - struct HashtableNode* node = NULL; ipfs_import_file(NULL, "/home/parallels/ipfstest/hello_world.txt", &node, local_node2, &bytes_written, 0); ipfs_node_free(local_node2); // start the daemon in a separate thread @@ -215,7 +216,6 @@ int test_routing_find_providers() { local_node.routing->Bootstrap(local_node.routing); - struct Libp2pVector* result; if (!local_node.routing->FindProviders(local_node.routing, node->hash, node->hash_size, &result)) { fprintf(stderr, "Unable to find a provider\n"); goto exit; @@ -308,6 +308,7 @@ int test_routing_provide() { int thread1_started = 0, thread2_started = 0; struct MultiAddress* ma_peer1 = NULL; struct Libp2pVector* ma_vector2 = NULL; + struct HashtableNode* node = NULL; // create peer 1 drop_and_build_repository(ipfs_path, 4001, NULL, &peer_id_1); @@ -333,7 +334,6 @@ int test_routing_provide() { //TODO: Find a better way to do this... size_t bytes_written = 0; ipfs_node_online_new(ipfs_path, &local_node2); - struct HashtableNode* node = NULL; ipfs_import_file(NULL, "/home/parallels/ipfstest/hello_world.txt", &node, local_node2, &bytes_written, 0); ipfs_node_free(local_node2); // start the daemon in a separate thread diff --git a/test/routing/test_supernode.h b/test/routing/test_supernode.h index 5f1512f..3ea345a 100644 --- a/test/routing/test_supernode.h +++ b/test/routing/test_supernode.h @@ -165,13 +165,15 @@ int test_routing_supernode_get_value() { char* fullFileName = "/tmp/temp_file.bin"; struct HashtableNode* write_node = NULL; size_t bytes_written = 0; - struct Libp2pVector* multiaddresses; + struct Libp2pVector* multiaddresses = NULL; unsigned char* results; size_t results_size = 0; struct HashtableNode* node = NULL; char* ip = NULL; pthread_t thread; int thread_started = 0; + struct MultiAddress* addr = NULL; + if (!drop_build_and_open_repo("/tmp/.ipfs", &fs_repo)) goto exit; @@ -218,7 +220,6 @@ int test_routing_supernode_get_value() { if (!ipfs_node->routing->FindProviders(ipfs_node->routing, write_node->hash, write_node->hash_size, &multiaddresses)) goto exit; - struct MultiAddress* addr = NULL; for(int i = 0; i < multiaddresses->total; i++) { addr = (struct MultiAddress*) libp2p_utils_vector_get(multiaddresses, i); if (multiaddress_is_ip4(addr)) {