u = url_hdup(home, (url_t*)"SIP:test@127.0.0.1:55"); TEST_1(u);
TEST(u->url_type, url_sip);
+ u = url_hdup(home, (url_t*)"SIP:test@127.0.0.1:"); TEST_1(u);
+ TEST(u->url_type, url_sip);
+
TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1::55"), NULL);
TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1:55:"), NULL);
TEST_P(url_hdup(home, (url_t*)"sip:test@127.0.0.1:sip"), NULL);
while (*port >= '0' && *port <= '9')
port++;
- if (port != url->url_port ? port[0] != '\0'
- : (port[0] != '*' || port[1] != '\0'))
+ if (port != url->url_port) {
+ if (port[0] != '\0')
+ return -1;
+ }
+ else if (port[0] == '\0')
+ /* empty string */;
+ else if (port[0] == '*' && port[1] == '\0')
+ /* wildcard */;
+ else
return -1;
}
host[n] = 0;