aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord/gnsrecord_serialization.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnsrecord/gnsrecord_serialization.c')
-rw-r--r--src/gnsrecord/gnsrecord_serialization.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gnsrecord/gnsrecord_serialization.c b/src/gnsrecord/gnsrecord_serialization.c
index 3da24d72a..56521945d 100644
--- a/src/gnsrecord/gnsrecord_serialization.c
+++ b/src/gnsrecord/gnsrecord_serialization.c
@@ -84,11 +84,10 @@ size_t
84GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, 84GNUNET_GNSRECORD_records_get_size (unsigned int rd_count,
85 const struct GNUNET_GNSRECORD_Data *rd) 85 const struct GNUNET_GNSRECORD_Data *rd)
86{ 86{
87 unsigned int i;
88 size_t ret; 87 size_t ret;
89 88
90 ret = sizeof (struct NetworkRecord) * rd_count; 89 ret = sizeof (struct NetworkRecord) * rd_count;
91 for (i=0;i<rd_count;i++) 90 for (unsigned int i=0;i<rd_count;i++)
92 { 91 {
93 GNUNET_assert ((ret + rd[i].data_size) >= ret); 92 GNUNET_assert ((ret + rd[i].data_size) >= ret);
94 ret += rd[i].data_size; 93 ret += rd[i].data_size;
@@ -113,11 +112,10 @@ GNUNET_GNSRECORD_records_serialize (unsigned int rd_count,
113 char *dest) 112 char *dest)
114{ 113{
115 struct NetworkRecord rec; 114 struct NetworkRecord rec;
116 unsigned int i;
117 size_t off; 115 size_t off;
118 116
119 off = 0; 117 off = 0;
120 for (i=0;i<rd_count;i++) 118 for (unsigned int i=0;i<rd_count;i++)
121 { 119 {
122 LOG (GNUNET_ERROR_TYPE_DEBUG, 120 LOG (GNUNET_ERROR_TYPE_DEBUG,
123 "Serializing record %u with flags %d and expiration time %llu\n", 121 "Serializing record %u with flags %d and expiration time %llu\n",
@@ -168,7 +166,9 @@ GNUNET_GNSRECORD_records_deserialize (size_t len,
168 { 166 {
169 if (off + sizeof (rec) > len) 167 if (off + sizeof (rec) > len)
170 return GNUNET_SYSERR; 168 return GNUNET_SYSERR;
171 GNUNET_memcpy (&rec, &src[off], sizeof (rec)); 169 GNUNET_memcpy (&rec,
170 &src[off],
171 sizeof (rec));
172 dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time); 172 dest[i].expiration_time = GNUNET_ntohll (rec.expiration_time);
173 dest[i].data_size = ntohl ((uint32_t) rec.data_size); 173 dest[i].data_size = ntohl ((uint32_t) rec.data_size);
174 dest[i].record_type = ntohl (rec.record_type); 174 dest[i].record_type = ntohl (rec.record_type);