[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 07/11: GNSRECORD: Fix compiler warnings in tests
From: |
gnunet |
Subject: |
[gnunet] 07/11: GNSRECORD: Fix compiler warnings in tests |
Date: |
Tue, 07 Nov 2023 19:06:41 +0100 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
commit 06608b2fbcf6728109886043d327edc358a3c443
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Mon Nov 6 18:11:48 2023 +0100
GNSRECORD: Fix compiler warnings in tests
---
src/lib/gnsrecord/test_gnsrecord_block_expiration.c | 14 +++++++++-----
src/lib/gnsrecord/test_gnsrecord_crypto.c | 8 ++++++--
src/lib/gnsrecord/test_gnsrecord_testvectors.c | 3 ---
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
index 3ef02e631..bc580954e 100644
--- a/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
+++ b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
@@ -49,6 +49,8 @@ run (void *cls, char *const *args, const char *cfgfile,
struct GNUNET_GNSRECORD_Data rd[2];
struct GNUNET_TIME_Absolute expiration_abs;
struct GNUNET_TIME_Absolute expiration_abs_shadow;
+ char *tmp_data0;
+ char *tmp_data1;
expiration_abs.abs_value_us = GNUNET_TIME_absolute_get ().abs_value_us
+ GNUNET_TIME_UNIT_SECONDS.rel_value_us;
@@ -59,14 +61,16 @@ run (void *cls, char *const *args, const char *cfgfile,
rd[0].expiration_time = expiration_abs.abs_value_us;
rd[0].record_type = TEST_RECORD_TYPE;
rd[0].data_size = TEST_RECORD_DATALEN;
- rd[0].data = GNUNET_malloc (TEST_RECORD_DATALEN);
+ tmp_data0 = GNUNET_malloc (TEST_RECORD_DATALEN);
+ rd[0].data = tmp_data0;
rd[0].flags = GNUNET_GNSRECORD_RF_NONE;
memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
rd[1].expiration_time = expiration_abs.abs_value_us;
rd[1].record_type = TEST_RECORD_TYPE;
rd[1].data_size = TEST_RECORD_DATALEN;
- rd[1].data = GNUNET_malloc (TEST_RECORD_DATALEN);
+ tmp_data1 = GNUNET_malloc (TEST_RECORD_DATALEN);
+ rd[1].data = tmp_data1;
rd[1].flags = GNUNET_GNSRECORD_RF_NONE;
memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
@@ -78,7 +82,7 @@ run (void *cls, char *const *args, const char *cfgfile,
rd[1].expiration_time = expiration_abs_shadow.abs_value_us;
rd[1].record_type = TEST_RECORD_TYPE;
rd[1].data_size = TEST_RECORD_DATALEN;
- GNUNET_free (rd[1].data);
+ GNUNET_free (tmp_data1);
rd[1].data = GNUNET_malloc (TEST_RECORD_DATALEN);
rd[1].flags = GNUNET_GNSRECORD_RF_SHADOW;
memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
@@ -87,8 +91,8 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_GNSRECORD_record_get_expiration_time (2,
rd,
GNUNET_TIME_UNIT_ZERO_ABS).abs_value_us);
- GNUNET_free (rd[0].data);
- GNUNET_free (rd[1].data);
+ GNUNET_free (tmp_data0);
+ GNUNET_free (tmp_data1);
res = 0;
}
diff --git a/src/lib/gnsrecord/test_gnsrecord_crypto.c
b/src/lib/gnsrecord/test_gnsrecord_crypto.c
index ed5394e60..34f5f35e5 100644
--- a/src/lib/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/test_gnsrecord_crypto.c
@@ -101,7 +101,7 @@ test_with_type (struct GNUNET_CRYPTO_PrivateKey *privkey)
struct GNUNET_HashCode query_priv;
struct GNUNET_HashCode query_block;
struct GNUNET_TIME_Absolute expire = GNUNET_TIME_UNIT_FOREVER_ABS;
-
+ char* tmp_data;
/* get public key */
GNUNET_CRYPTO_key_get_public (privkey,
@@ -143,7 +143,11 @@ test_with_type (struct GNUNET_CRYPTO_PrivateKey *privkey)
s_name,
&rd_decrypt_cb,
NULL));
- for (int i = 0; i < RECORDS; i++) GNUNET_free(s_rd[i].data);
+ for (int i = 0; i < RECORDS; i++)
+ {
+ tmp_data = (char*) s_rd[i].data;
+ GNUNET_free(tmp_data);
+ }
GNUNET_free (s_rd);
GNUNET_free (block);
}
diff --git a/src/lib/gnsrecord/test_gnsrecord_testvectors.c
b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
index 04fd7f8bd..21a7a83b0 100644
--- a/src/lib/gnsrecord/test_gnsrecord_testvectors.c
+++ b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
@@ -609,8 +609,6 @@ main ()
struct GNUNET_HashCode query;
struct GNUNET_HashCode expected_query;
struct GNUNET_TIME_Absolute expire;
- struct GNUNET_TIME_Relative exprel;
- struct GNUNET_REVOCATION_PowP *pow;
char label[128];
char rdata[8096];
char ztld[128];
@@ -706,6 +704,5 @@ main ()
break;
printf ("Good.\n");
}
-finish:
return res;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (a2e0b8212 -> 1b84baca9), gnunet, 2023/11/07
- [gnunet] 10/11: Hello: Change meson build file to use the new bootstrap hello file., gnunet, 2023/11/07
- [gnunet] 11/11: Merge branch 'master' of ssh://git.gnunet.org/gnunet, gnunet, 2023/11/07
- [gnunet] 08/11: build: move gana and handbook submodules back into contrib, gnunet, 2023/11/07
- [gnunet] 04/11: meson: same build order as autotools, gnunet, 2023/11/07
- [gnunet] 07/11: GNSRECORD: Fix compiler warnings in tests,
gnunet <=
- [gnunet] 05/11: REST: Fix warnings with new daemon macro API, gnunet, 2023/11/07
- [gnunet] 01/11: Hello: Changed bootstrap peer hello file to new bootstrap peer., gnunet, 2023/11/07
- [gnunet] 09/11: meson: fix for submodule change, gnunet, 2023/11/07
- [gnunet] 02/11: HELLO: Modify API to avoid unnecessary copies, gnunet, 2023/11/07
- [gnunet] 03/11: meson: add topology for build, gnunet, 2023/11/07
- [gnunet] 06/11: CONVERSATION: Fix warning for incorrect enum usage, gnunet, 2023/11/07