util: uri: Convert port number to unsigned integer

Negative ports don't make sense so use a unsigned integer.
This commit is contained in:
Peter Krempa 2017-07-20 12:42:53 +02:00
parent e8b69016b1
commit 1f920b9f02
3 changed files with 3 additions and 3 deletions

View File

@ -1356,7 +1356,7 @@ void virStringTrimOptionalNewline(char *str)
*/ */
int int
virStringParsePort(const char *str, virStringParsePort(const char *str,
int *port) unsigned int *port)
{ {
unsigned int p = 0; unsigned int p = 0;

View File

@ -297,7 +297,7 @@ char *virStringEncodeBase64(const uint8_t *buf, size_t buflen);
void virStringTrimOptionalNewline(char *str); void virStringTrimOptionalNewline(char *str);
int virStringParsePort(const char *str, int virStringParsePort(const char *str,
int *port) unsigned int *port)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
#endif /* __VIR_STRING_H__ */ #endif /* __VIR_STRING_H__ */

View File

@ -42,7 +42,7 @@ struct _virURI {
char *scheme; /* the URI scheme */ char *scheme; /* the URI scheme */
char *server; /* the server part */ char *server; /* the server part */
char *user; /* the user part */ char *user; /* the user part */
int port; /* the port number */ unsigned int port; /* the port number */
char *path; /* the path string */ char *path; /* the path string */
char *query; /* the query string */ char *query; /* the query string */
char *fragment; /* the fragment string */ char *fragment; /* the fragment string */