Replace all in_port_t with uint16_t to avoid compilation issues on different systems.

llvm-svn: 196586
diff --git a/lldb/include/lldb/Core/ConnectionFileDescriptor.h b/lldb/include/lldb/Core/ConnectionFileDescriptor.h
index 01cc40a..15598c9 100644
--- a/lldb/include/lldb/Core/ConnectionFileDescriptor.h
+++ b/lldb/include/lldb/Core/ConnectionFileDescriptor.h
@@ -11,9 +11,7 @@
 #define liblldb_ConnectionFileDescriptor_h_
 
 // C Includes
-#ifdef _WIN32
-typedef unsigned short in_port_t;
-#else
+#ifndef _WIN32
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <netinet/in.h>
@@ -68,15 +66,15 @@
 
     // If the read file descriptor is a socket, then return
     // the port number that is being used by the socket.
-    in_port_t
+    uint16_t
     GetReadPort () const;
     
     // If the write file descriptor is a socket, then return
     // the port number that is being used by the socket.
-    in_port_t
+    uint16_t
     GetWritePort () const;
 
-    in_port_t
+    uint16_t
     GetBoundPort (uint32_t timeout_sec);
 
 protected:
@@ -124,12 +122,12 @@
     int m_pipe_read;            // A pipe that we select on the reading end of along with
     int m_pipe_write;           // m_fd_recv so we can force ourselves out of the select.
     Mutex m_mutex;
-    Predicate<in_port_t> m_port_predicate; // Used when binding to port zero to wait for the thread that creates the socket, binds and listens to resolve the port number
+    Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread that creates the socket, binds and listens to resolve the port number
     bool m_should_close_fd;     // True if this class should close the file descriptor when it goes away.
     bool m_shutting_down;       // This marks that we are shutting down so if we get woken up from BytesAvailable
                                 // to disconnect, we won't try to read again.
     
-    static in_port_t
+    static uint16_t
     GetSocketPort (int fd);
 
     static int
diff --git a/lldb/include/lldb/Host/SocketAddress.h b/lldb/include/lldb/Host/SocketAddress.h
index 02d24a3..4dc6210 100644
--- a/lldb/include/lldb/Host/SocketAddress.h
+++ b/lldb/include/lldb/Host/SocketAddress.h
@@ -18,7 +18,6 @@
 #include <winsock2.h>
 #include <WS2tcpip.h>
 typedef ADDRESS_FAMILY sa_family_t;
-typedef USHORT in_port_t;
 #else
 #include <sys/socket.h>
 #include <netdb.h>
@@ -103,7 +102,7 @@
     //------------------------------------------------------------------
     // Get the port if the socket address for the family has a port
     //------------------------------------------------------------------
-    in_port_t
+    uint16_t
     GetPort () const;
 
     //------------------------------------------------------------------
@@ -111,7 +110,7 @@
     // The family must be set correctly prior to calling this function.
     //------------------------------------------------------------------
     bool
-    SetPort (in_port_t port);
+    SetPort (uint16_t port);
 
     //------------------------------------------------------------------
     // Set the socket address according to the first match from a call
@@ -135,11 +134,11 @@
     //------------------------------------------------------------------
     bool
     SetToLocalhost (sa_family_t family, 
-                    in_port_t port);
+                    uint16_t port);
 
     bool
     SetToAnyAddress (sa_family_t family,
-                     in_port_t port);
+                     uint16_t port);
 
     //------------------------------------------------------------------
     // Returns true if there is a valid socket address in this object.
diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp
index d711ef8..3fb43cf 100644
--- a/lldb/source/Core/ConnectionFileDescriptor.cpp
+++ b/lldb/source/Core/ConnectionFileDescriptor.cpp
@@ -1675,7 +1675,7 @@
     return false;
 }
 
-in_port_t
+uint16_t
 ConnectionFileDescriptor::GetSocketPort (int fd)
 {
     // We bound to port zero, so we need to figure out which port we actually bound to
@@ -1691,7 +1691,7 @@
 
 // If the read file descriptor is a socket, then return
 // the port number that is being used by the socket.
-in_port_t
+uint16_t
 ConnectionFileDescriptor::GetReadPort () const
 {
     return ConnectionFileDescriptor::GetSocketPort (m_fd_recv);
@@ -1699,16 +1699,16 @@
 
 // If the write file descriptor is a socket, then return
 // the port number that is being used by the socket.
-in_port_t
+uint16_t
 ConnectionFileDescriptor::GetWritePort () const
 {
     return ConnectionFileDescriptor::GetSocketPort (m_fd_send);
 }
 
-in_port_t
+uint16_t
 ConnectionFileDescriptor::GetBoundPort (uint32_t timeout_sec)
 {
-    in_port_t bound_port = 0;
+    uint16_t bound_port = 0;
     if (timeout_sec == UINT32_MAX)
         m_port_predicate.WaitForValueNotEqualTo (0, bound_port);
     else
diff --git a/lldb/source/Host/common/SocketAddress.cpp b/lldb/source/Host/common/SocketAddress.cpp
index f5a58a6..5d6243e 100644
--- a/lldb/source/Host/common/SocketAddress.cpp
+++ b/lldb/source/Host/common/SocketAddress.cpp
@@ -123,7 +123,7 @@
 #endif
 }
 
-in_port_t
+uint16_t
 SocketAddress::GetPort () const
 {
     switch (GetFamily())
@@ -135,7 +135,7 @@
 }
 
 bool
-SocketAddress::SetPort (in_port_t port)
+SocketAddress::SetPort (uint16_t port)
 {
     switch (GetFamily())
     {
@@ -233,7 +233,7 @@
 
 
 bool
-SocketAddress::SetToLocalhost (sa_family_t family, in_port_t port)
+SocketAddress::SetToLocalhost (sa_family_t family, uint16_t port)
 {
     switch (family)
     {
@@ -261,7 +261,7 @@
 }
 
 bool
-SocketAddress::SetToAnyAddress (sa_family_t family, in_port_t port)
+SocketAddress::SetToAnyAddress (sa_family_t family, uint16_t port)
 {
     switch (family)
     {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 04de58b..5966cca 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -542,7 +542,7 @@
 }
 
 Error
-GDBRemoteCommunication::StartListenThread (const char *hostname, in_port_t port)
+GDBRemoteCommunication::StartListenThread (const char *hostname, uint16_t port)
 {
     Error error;
     if (IS_VALID_LLDB_HOST_THREAD(m_listen_thread))
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
index a21679e..fb1955e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -258,7 +258,7 @@
 
     lldb_private::Error
     StartListenThread (const char *hostname = "localhost",
-                       in_port_t port = 0);
+                       uint16_t port = 0);
 
     bool
     JoinListenThread ();
diff --git a/lldb/tools/debugserver/source/RNBSocket.cpp b/lldb/tools/debugserver/source/RNBSocket.cpp
index 448db257..7772d68 100644
--- a/lldb/tools/debugserver/source/RNBSocket.cpp
+++ b/lldb/tools/debugserver/source/RNBSocket.cpp
@@ -67,7 +67,7 @@
 }
 
 rnb_err_t
-RNBSocket::Listen (const char *listen_host, in_port_t port, PortBoundCallback callback, const void *callback_baton)
+RNBSocket::Listen (const char *listen_host, uint16_t port, PortBoundCallback callback, const void *callback_baton)
 {
     //DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s called", (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
     // Disconnect without saving errno
diff --git a/lldb/tools/debugserver/source/RNBSocket.h b/lldb/tools/debugserver/source/RNBSocket.h
index 2467bb7..32f4ebe 100644
--- a/lldb/tools/debugserver/source/RNBSocket.h
+++ b/lldb/tools/debugserver/source/RNBSocket.h
@@ -27,7 +27,7 @@
 class RNBSocket
 {
 public:
-    typedef void (*PortBoundCallback) (const void *baton, in_port_t port);
+    typedef void (*PortBoundCallback) (const void *baton, uint16_t port);
 
     RNBSocket () :
         m_fd (-1),
@@ -44,7 +44,7 @@
     }
 
     rnb_err_t Listen (const char *listen_host,
-                      in_port_t port,
+                      uint16_t port,
                       PortBoundCallback callback,
                       const void *callback_baton);
     rnb_err_t Connect (const char *host, uint16_t port);
diff --git a/lldb/tools/debugserver/source/debugserver.cpp b/lldb/tools/debugserver/source/debugserver.cpp
index 42469ce..1b516e6 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -626,7 +626,7 @@
 }
 
 static void
-PortWasBoundCallbackNamedPipe (const void *baton, in_port_t port)
+PortWasBoundCallbackNamedPipe (const void *baton, uint16_t port)
 {
     const char *named_pipe = (const char *)baton;
     if (named_pipe && named_pipe[0])