aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord/gnsrecord_misc.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2020-11-10 16:28:23 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2020-11-10 16:28:23 +0900
commit10081ef560ef3e624d4dcadf5e19f0330b078d64 (patch)
tree96457f981278c76a10c95befb323bdc890b81a87 /src/gnsrecord/gnsrecord_misc.c
parent5306c3356854b535fe09654b270f06615bf94e94 (diff)
downloadgnunet-10081ef560ef3e624d4dcadf5e19f0330b078d64.tar.gz
gnunet-10081ef560ef3e624d4dcadf5e19f0330b078d64.zip
-fix tests
Diffstat (limited to 'src/gnsrecord/gnsrecord_misc.c')
-rw-r--r--src/gnsrecord/gnsrecord_misc.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 2e00141a3..82c38f19a 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -107,8 +107,8 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a,
107 { 107 {
108 LOG (GNUNET_ERROR_TYPE_DEBUG, 108 LOG (GNUNET_ERROR_TYPE_DEBUG,
109 "Expiration time %llu != %llu\n", 109 "Expiration time %llu != %llu\n",
110 a->expiration_time, 110 (unsigned long long) a->expiration_time,
111 b->expiration_time); 111 (unsigned long long) b->expiration_time);
112 return GNUNET_NO; 112 return GNUNET_NO;
113 } 113 }
114 if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS) 114 if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)
@@ -282,11 +282,13 @@ GNUNET_GNSRECORD_identity_from_data (const char *data,
282 return GNUNET_SYSERR; 282 return GNUNET_SYSERR;
283 if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey)) 283 if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey))
284 return GNUNET_SYSERR; 284 return GNUNET_SYSERR;
285 return (GNUNET_IDENTITY_read_key_from_buffer(key, data, data_size) == data_size? 285 return (GNUNET_IDENTITY_read_key_from_buffer (key, data, data_size) ==
286 GNUNET_OK : 286 data_size?
287 GNUNET_SYSERR); 287 GNUNET_OK :
288 GNUNET_SYSERR);
288} 289}
289 290
291
290enum GNUNET_GenericReturnValue 292enum GNUNET_GenericReturnValue
291GNUNET_GNSRECORD_data_from_identity (const struct 293GNUNET_GNSRECORD_data_from_identity (const struct
292 GNUNET_IDENTITY_PublicKey *key, 294 GNUNET_IDENTITY_PublicKey *key,
@@ -294,14 +296,15 @@ GNUNET_GNSRECORD_data_from_identity (const struct
294 size_t *data_size, 296 size_t *data_size,
295 uint32_t *type) 297 uint32_t *type)
296{ 298{
297 *type = key->type; 299 *type = ntohl (key->type);
298 *data_size = GNUNET_IDENTITY_key_get_length (key); 300 *data_size = GNUNET_IDENTITY_key_get_length (key);
299 if (0 == *data_size) 301 if (0 == *data_size)
300 return GNUNET_SYSERR; 302 return GNUNET_SYSERR;
301 *data = GNUNET_malloc (*data_size); 303 *data = GNUNET_malloc (*data_size);
302 return (GNUNET_IDENTITY_write_key_to_buffer(key, data, *data_size) == *data_size? 304 return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) ==
303 GNUNET_OK : 305 *data_size?
304 GNUNET_SYSERR); 306 GNUNET_OK :
307 GNUNET_SYSERR);
305} 308}
306 309
307 310
@@ -310,14 +313,15 @@ GNUNET_GNSRECORD_is_zonekey_type (uint32_t type)
310{ 313{
311 switch (type) 314 switch (type)
312 { 315 {
313 case GNUNET_GNSRECORD_TYPE_PKEY: 316 case GNUNET_GNSRECORD_TYPE_PKEY:
314 case GNUNET_GNSRECORD_TYPE_EDKEY: 317 case GNUNET_GNSRECORD_TYPE_EDKEY:
315 return GNUNET_YES; 318 return GNUNET_YES;
316 default: 319 default:
317 return GNUNET_NO; 320 return GNUNET_NO;
318 } 321 }
319} 322}
320 323
324
321size_t 325size_t
322GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block) 326GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block)
323{ 327{