aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-11-01 11:32:39 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-11-01 11:32:39 +0900
commit0f45038d25da3d3de3f83d04bcf30eca5da361d0 (patch)
tree7eb579ded346186c26e65ecd3ce0b882904f3301 /src/testing
parent3cf47c04e2de3e3f275398f4dbc223fdaeea6aff (diff)
downloadgnunet-0f45038d25da3d3de3f83d04bcf30eca5da361d0.tar.gz
gnunet-0f45038d25da3d3de3f83d04bcf30eca5da361d0.zip
-fix coverity
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index e6f073f63..d18197860 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -2499,8 +2499,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2499 } 2499 }
2500 else if (0 == strcmp (key, "K")) 2500 else if (0 == strcmp (key, "K"))
2501 { 2501 {
2502 struct GNUNET_ShortHashCode *hkey_k = GNUNET_new (struct 2502 struct GNUNET_ShortHashCode hkey_k;
2503 GNUNET_ShortHashCode);
2504 struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct 2503 struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
2505 GNUNET_TESTING_NetjailNode); 2504 GNUNET_TESTING_NetjailNode);
2506 2505
@@ -2512,18 +2511,18 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2512 out); 2511 out);
2513 k_node->node_n = out; 2512 k_node->node_n = out;
2514 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); 2513 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2515 memcpy (hkey_k, 2514 memcpy (&hkey_k,
2516 &hc, 2515 &hc,
2517 sizeof (*hkey_k)); 2516 sizeof (hkey_k));
2518 k_node->is_global = GNUNET_YES; 2517 k_node->is_global = GNUNET_YES;
2519 2518
2520 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( 2519 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2521 topo->map_globals, 2520 topo->map_globals,
2522 hkey_k)) 2521 &hkey_k))
2523 GNUNET_break (0); 2522 GNUNET_break (0);
2524 else 2523 else
2525 GNUNET_CONTAINER_multishortmap_put (topo->map_globals, 2524 GNUNET_CONTAINER_multishortmap_put (topo->map_globals,
2526 hkey_k, 2525 &hkey_k,
2527 k_node, 2526 k_node,
2528 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2527 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2529 LOG (GNUNET_ERROR_TYPE_DEBUG, 2528 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -2539,8 +2538,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2539 } 2538 }
2540 else if (0 == strcmp (key, "R")) 2539 else if (0 == strcmp (key, "R"))
2541 { 2540 {
2542 struct GNUNET_ShortHashCode *hkey_r = GNUNET_new (struct 2541 struct GNUNET_ShortHashCode hkey_r;
2543 GNUNET_ShortHashCode);
2544 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter); 2542 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
2545 2543
2546 LOG (GNUNET_ERROR_TYPE_DEBUG, 2544 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -2550,9 +2548,9 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2550 "R: %u\n", 2548 "R: %u\n",
2551 out); 2549 out);
2552 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); 2550 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2553 memcpy (hkey_r, 2551 memcpy (&hkey_r,
2554 &hc, 2552 &hc,
2555 sizeof (*hkey_r)); 2553 sizeof (hkey_r));
2556 LOG (GNUNET_ERROR_TYPE_DEBUG, 2554 LOG (GNUNET_ERROR_TYPE_DEBUG,
2557 "Get value for key tcp_port on R.\n"); 2555 "Get value for key tcp_port on R.\n");
2558 value = get_value ("tcp_port", token); 2556 value = get_value ("tcp_port", token);
@@ -2575,10 +2573,10 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2575 GNUNET_free (value2); 2573 GNUNET_free (value2);
2576 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( 2574 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2577 topo->map_namespaces, 2575 topo->map_namespaces,
2578 hkey_r)) 2576 &hkey_r))
2579 { 2577 {
2580 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, 2578 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
2581 hkey_r); 2579 &hkey_r);
2582 } 2580 }
2583 else 2581 else
2584 { 2582 {
@@ -2586,7 +2584,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2586 namespace->namespace_n = out; 2584 namespace->namespace_n = out;
2587 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); 2585 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2588 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, 2586 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
2589 hkey_r, 2587 &hkey_r,
2590 namespace, 2588 namespace,
2591 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2589 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2592 } 2590 }
@@ -2597,8 +2595,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2597 { 2595 {
2598 struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct 2596 struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
2599 GNUNET_TESTING_NetjailNode); 2597 GNUNET_TESTING_NetjailNode);
2600 struct GNUNET_ShortHashCode *hkey_p = GNUNET_new (struct 2598 struct GNUNET_ShortHashCode hkey_p;
2601 GNUNET_ShortHashCode);
2602 2599
2603 LOG (GNUNET_ERROR_TYPE_DEBUG, 2600 LOG (GNUNET_ERROR_TYPE_DEBUG,
2604 "Get first Value for P.\n"); 2601 "Get first Value for P.\n");
@@ -2607,16 +2604,16 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2607 "P: %u\n", 2604 "P: %u\n",
2608 out); 2605 out);
2609 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); 2606 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2610 memcpy (hkey_p, 2607 memcpy (&hkey_p,
2611 &hc, 2608 &hc,
2612 sizeof (*hkey_p)); 2609 sizeof (hkey_p));
2613 2610
2614 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( 2611 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2615 topo->map_namespaces, 2612 topo->map_namespaces,
2616 hkey_p)) 2613 &hkey_p))
2617 { 2614 {
2618 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, 2615 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
2619 hkey_p); 2616 &hkey_p);
2620 } 2617 }
2621 else 2618 else
2622 { 2619 {
@@ -2624,7 +2621,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2624 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); 2621 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2625 namespace->namespace_n = out; 2622 namespace->namespace_n = out;
2626 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, 2623 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
2627 hkey_p, 2624 &hkey_p,
2628 namespace, 2625 namespace,
2629 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2626 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2630 } 2627 }
@@ -2635,12 +2632,12 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2635 "P: %u\n", 2632 "P: %u\n",
2636 out); 2633 out);
2637 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); 2634 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2638 memcpy (hkey_p, 2635 memcpy (&hkey_p,
2639 &hc, 2636 &hc,
2640 sizeof (*hkey_p)); 2637 sizeof (hkey_p));
2641 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( 2638 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2642 namespace->nodes, 2639 namespace->nodes,
2643 hkey_p)) 2640 &hkey_p))
2644 { 2641 {
2645 GNUNET_break (0); 2642 GNUNET_break (0);
2646 } 2643 }
@@ -2648,7 +2645,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2648 { 2645 {
2649 2646
2650 GNUNET_CONTAINER_multishortmap_put (namespace->nodes, 2647 GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
2651 hkey_p, 2648 &hkey_p,
2652 p_node, 2649 p_node,
2653 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2650 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2654 LOG (GNUNET_ERROR_TYPE_DEBUG, 2651 LOG (GNUNET_ERROR_TYPE_DEBUG,