mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Issue #11: uint16_t instead of unsigned short for URI port number
This commit is contained in:
parent
7a8d750a0e
commit
1c96164b62
@ -152,7 +152,7 @@ int cf_opt_rhizome_peer_from_uri(struct config_rhizome_peer *rpeer, const char *
|
||||
}
|
||||
const char *host;
|
||||
size_t hostlen;
|
||||
unsigned short port = RHIZOME_HTTP_PORT;
|
||||
uint16_t port = RHIZOME_HTTP_PORT;
|
||||
if (!str_uri_authority_hostname(auth, &host, &hostlen))
|
||||
return CFINVALID;
|
||||
str_uri_authority_port(auth, &port);
|
||||
|
4
str.c
4
str.c
@ -644,7 +644,7 @@ int str_uri_authority_hostname(const char *auth, const char **partp, size_t *len
|
||||
return 1;
|
||||
}
|
||||
|
||||
int str_uri_authority_port(const char *auth, unsigned short *portp)
|
||||
int str_uri_authority_port(const char *auth, uint16_t *portp)
|
||||
{
|
||||
const char *p;
|
||||
const char *q = auth;
|
||||
@ -657,7 +657,7 @@ int str_uri_authority_port(const char *auth, unsigned short *portp)
|
||||
if (r < p - 1 && *r == ':') {
|
||||
for (++r; *r == '0'; ++r)
|
||||
;
|
||||
int n;
|
||||
unsigned int n;
|
||||
if (p - r <= 5 && (n = atoi(r)) <= USHRT_MAX) {
|
||||
*portp = n;
|
||||
return 1;
|
||||
|
2
str.h
2
str.h
@ -347,7 +347,7 @@ int str_uri_hierarchical_path(const char *hier, const char **partp, size_t *lenp
|
||||
int str_uri_authority_username(const char *auth, const char **partp, size_t *lenp);
|
||||
int str_uri_authority_password(const char *auth, const char **partp, size_t *lenp);
|
||||
int str_uri_authority_hostname(const char *auth, const char **partp, size_t *lenp);
|
||||
int str_uri_authority_port(const char *auth, unsigned short *portp);
|
||||
int str_uri_authority_port(const char *auth, uint16_t *portp);
|
||||
|
||||
|
||||
int parse_argv(char *cmdline, char delim, char **argv, int max_argv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user