Polish code

code issues found by Clang with
CFLAGS="-Os -Wall -Wextra -Werror=unused-const-variable -Wno-error=unused-parameter"
enabled

The details as follows:
- variable initialization issue, modified them as Clang suggested
- data type mismatch when comparing, fix them either by casting or changing
  the data type of index of iterator
- get_sockaddr() in netutils may return -1 thus changed returning type from
  size_t to ssize_t, which makes Clang happier
- recvfrom() in udprelay is identical, fix this by creating local variable
  for comparison  and assign back to buf->len when returning value is acceptable

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
Syrone Wong
2016-04-07 21:28:23 -07:00
committed by Max Lv
parent 86aeb31229
commit 58264c77fc
8 changed files with 34 additions and 26 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ size_t get_sockaddr_len(struct sockaddr *addr)
return 0;
}
size_t get_sockaddr(char *host, char *port, struct sockaddr_storage *storage, int block)
ssize_t get_sockaddr(char *host, char *port, struct sockaddr_storage *storage, int block)
{
struct cork_ip ip;
if (cork_ip_init(&ip, host) != -1) {