Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove else directly after return. #132

Merged
merged 1 commit into from
Sep 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ static int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port)
memcpy(data + 1, &ip_port->ip.ip4, SIZE_IP4);
memcpy(data + 1 + SIZE_IP4, &ip_port->port, sizeof(uint16_t));
return size;
} else if (ipv6 == 1) {
}

if (ipv6 == 1) {
uint32_t size = 1 + SIZE_IP6 + sizeof(uint16_t);

if (size > length) {
Expand All @@ -284,9 +286,9 @@ static int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port)
memcpy(data + 1, &ip_port->ip.ip6, SIZE_IP6);
memcpy(data + 1 + SIZE_IP6, &ip_port->port, sizeof(uint16_t));
return size;
} else {
return -1;
}

return -1;
}

/* Unpack IP_Port structure from data of max size length into ip_port.
Expand Down Expand Up @@ -338,7 +340,9 @@ static int unpack_ip_port(IP_Port *ip_port, const uint8_t *data, uint16_t length
memcpy(&ip_port->ip.ip4, data + 1, SIZE_IP4);
memcpy(&ip_port->port, data + 1 + SIZE_IP4, sizeof(uint16_t));
return size;
} else if (ipv6 == 1) {
}

if (ipv6 == 1) {
uint32_t size = 1 + SIZE_IP6 + sizeof(uint16_t);

if (size > length) {
Expand All @@ -349,9 +353,9 @@ static int unpack_ip_port(IP_Port *ip_port, const uint8_t *data, uint16_t length
memcpy(&ip_port->ip.ip6, data + 1, SIZE_IP6);
memcpy(&ip_port->port, data + 1 + SIZE_IP6, sizeof(uint16_t));
return size;
} else {
return -1;
}

return -1;
}

/* Pack number of nodes into data of maxlength length.
Expand Down