[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 2/6] util: uri: Convert port number to unsigned integer



Negative ports don't make sense so use a unsigned integer.
---
 src/util/virstring.c | 2 +-
 src/util/virstring.h | 2 +-
 src/util/viruri.h    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util/virstring.c b/src/util/virstring.c
index fe61a3516..69e0fd173 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -1356,7 +1356,7 @@ void virStringTrimOptionalNewline(char *str)
  */
 int
 virStringParsePort(const char *str,
-                   int *port)
+                   unsigned int *port)
 {
     unsigned int p = 0;

diff --git a/src/util/virstring.h b/src/util/virstring.h
index e562bf514..ff5f0148d 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -297,7 +297,7 @@ char *virStringEncodeBase64(const uint8_t *buf, size_t buflen);
 void virStringTrimOptionalNewline(char *str);

 int virStringParsePort(const char *str,
-                       int *port)
+                       unsigned int *port)
     ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

 #endif /* __VIR_STRING_H__ */
diff --git a/src/util/viruri.h b/src/util/viruri.h
index 1e53abb0b..7850c38c2 100644
--- a/src/util/viruri.h
+++ b/src/util/viruri.h
@@ -42,7 +42,7 @@ struct _virURI {
     char *scheme;       /* the URI scheme */
     char *server;       /* the server part */
     char *user;         /* the user part */
-    int port;           /* the port number */
+    unsigned int port;  /* the port number */
     char *path;         /* the path string */
     char *query;        /* the query string */
     char *fragment;     /* the fragment string */
-- 
2.13.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]