aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-25 20:05:25 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-25 20:05:25 +0200
commitf895f6c37937c17a73fa2b13211d2d52b94c79e5 (patch)
tree83bc5237fd6bedbd929a189b15884b57436db161 /src
parent2d22da9b531933db65f80ce12b11dd917a387eeb (diff)
downloadgnunet-f895f6c37937c17a73fa2b13211d2d52b94c79e5.tar.gz
gnunet-f895f6c37937c17a73fa2b13211d2d52b94c79e5.zip
move hexcode, eliminate redundant test
Diffstat (limited to 'src')
-rw-r--r--src/util/dnsparser.c14
-rw-r--r--src/util/test_hexcoder.c (renamed from src/dns/test_hexcoder.c)0
2 files changed, 8 insertions, 6 deletions
diff --git a/src/util/dnsparser.c b/src/util/dnsparser.c
index 9ed7e4d0e..55475b131 100644
--- a/src/util/dnsparser.c
+++ b/src/util/dnsparser.c
@@ -698,7 +698,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload,
698 if (n > 0) 698 if (n > 0)
699 { 699 {
700 p->queries = GNUNET_new_array (n, 700 p->queries = GNUNET_new_array (n,
701 struct GNUNET_DNSPARSER_Query) ; 701 struct GNUNET_DNSPARSER_Query);
702 p->num_queries = n; 702 p->num_queries = n;
703 for (unsigned int i=0;i<n;i++) 703 for (unsigned int i=0;i<n;i++)
704 if (GNUNET_OK != 704 if (GNUNET_OK !=
@@ -750,6 +750,7 @@ GNUNET_DNSPARSER_parse (const char *udp_payload,
750 &off, 750 &off,
751 &p->additional_records[i])) 751 &p->additional_records[i]))
752 goto error; 752 goto error;
753 }
753 } 754 }
754 return p; 755 return p;
755 error: 756 error:
@@ -957,7 +958,6 @@ GNUNET_DNSPARSER_builder_add_cert (char *dst,
957 struct GNUNET_TUN_DnsCertRecord dcert; 958 struct GNUNET_TUN_DnsCertRecord dcert;
958 959
959 if ( (cert->cert_type > UINT16_MAX) || 960 if ( (cert->cert_type > UINT16_MAX) ||
960 (cert->cert_tag > UINT16_MAX) ||
961 (cert->algorithm > UINT8_MAX) ) 961 (cert->algorithm > UINT8_MAX) )
962 { 962 {
963 GNUNET_break (0); 963 GNUNET_break (0);
@@ -1045,12 +1045,14 @@ GNUNET_DNSPARSER_builder_add_srv (char *dst,
1045 sd.prio = htons (srv->priority); 1045 sd.prio = htons (srv->priority);
1046 sd.weight = htons (srv->weight); 1046 sd.weight = htons (srv->weight);
1047 sd.port = htons (srv->port); 1047 sd.port = htons (srv->port);
1048 GNUNET_memcpy (&dst[*off], &sd, sizeof (sd)); 1048 GNUNET_memcpy (&dst[*off],
1049 &sd,
1050 sizeof (sd));
1049 (*off) += sizeof (sd); 1051 (*off) += sizeof (sd);
1050 if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst, 1052 if (GNUNET_OK != (ret = GNUNET_DNSPARSER_builder_add_name (dst,
1051 dst_len, 1053 dst_len,
1052 off, 1054 off,
1053 srv->target))) 1055 srv->target)))
1054 return ret; 1056 return ret;
1055 return GNUNET_OK; 1057 return GNUNET_OK;
1056} 1058}
diff --git a/src/dns/test_hexcoder.c b/src/util/test_hexcoder.c
index 441d7e200..441d7e200 100644
--- a/src/dns/test_hexcoder.c
+++ b/src/util/test_hexcoder.c