add a few more gcc warning flags and fix quite a few problems found by doing so

This commit is contained in:
Lennart Poettering 2008-08-19 22:39:54 +02:00
parent 047eb52b52
commit b7026bf248
99 changed files with 810 additions and 776 deletions

View file

@ -51,20 +51,29 @@ static char *parse_host(const char *s, uint16_t *ret_port) {
if (!(e = strchr(s+1, ']')))
return NULL;
if (e[1] == ':')
*ret_port = atoi(e+2);
else if (e[1] != 0)
if (e[1] == ':') {
uint32_t p;
if (pa_atou(e+2, &p) < 0)
return NULL;
*ret_port = (uint16_t) p;
} else if (e[1] != 0)
return NULL;
return pa_xstrndup(s+1, e-s-1);
return pa_xstrndup(s+1, (size_t) (e-s-1));
} else {
char *e;
uint32_t p;
if (!(e = strrchr(s, ':')))
return pa_xstrdup(s);
*ret_port = atoi(e+1);
return pa_xstrndup(s, e-s);
if (pa_atou(e+1, &p) < 0)
return NULL;
*ret_port = (uint16_t) p;
return pa_xstrndup(s, (size_t) (e-s));
}
}