[Orxonox-commit 2686] r7391 - in code/branches/ipv6/src/external/enet: . include/enet

rgrieder at orxonox.net rgrieder at orxonox.net
Thu Sep 9 17:02:16 CEST 2010


Author: rgrieder
Date: 2010-09-09 17:02:16 +0200 (Thu, 09 Sep 2010)
New Revision: 7391

Modified:
   code/branches/ipv6/src/external/enet/CMakeLists.txt
   code/branches/ipv6/src/external/enet/host.c
   code/branches/ipv6/src/external/enet/include/enet/enet.h
   code/branches/ipv6/src/external/enet/protocol.c
   code/branches/ipv6/src/external/enet/win32.c
Log:
Compile ENet as C library.

Modified: code/branches/ipv6/src/external/enet/CMakeLists.txt
===================================================================
--- code/branches/ipv6/src/external/enet/CMakeLists.txt	2010-09-09 14:30:50 UTC (rev 7390)
+++ code/branches/ipv6/src/external/enet/CMakeLists.txt	2010-09-09 15:02:16 UTC (rev 7391)
@@ -28,7 +28,7 @@
     include/enet/utility.h
     include/enet/win32.h
 
-COMPILATION_BEGIN ENetCompilation.cpp
+COMPILATION_BEGIN ENetCompilation.c
     callbacks.c
     compress.c
     host.c

Modified: code/branches/ipv6/src/external/enet/host.c
===================================================================
--- code/branches/ipv6/src/external/enet/host.c	2010-09-09 14:30:50 UTC (rev 7390)
+++ code/branches/ipv6/src/external/enet/host.c	2010-09-09 15:02:16 UTC (rev 7391)
@@ -52,6 +52,7 @@
 {
     ENetHost * host;
     ENetPeer * currentPeer;
+    int family;
 
     if (peerCount > ENET_PROTOCOL_MAXIMUM_PEER_ID)
       return NULL;
@@ -69,7 +70,7 @@
     }
     memset (host -> peers, 0, peerCount * sizeof (ENetPeer));
 
-    int family = (address == NULL || !memcmp (& address -> host, & ENET_HOST_ANY, sizeof (ENetHostAddress))) ?
+    family = (address == NULL || !memcmp (& address -> host, & ENET_HOST_ANY, sizeof (ENetHostAddress))) ?
         ENET_IPV4 | ENET_IPV6 :
         enet_get_address_family (address);
 

Modified: code/branches/ipv6/src/external/enet/include/enet/enet.h
===================================================================
--- code/branches/ipv6/src/external/enet/include/enet/enet.h	2010-09-09 14:30:50 UTC (rev 7390)
+++ code/branches/ipv6/src/external/enet/include/enet/enet.h	2010-09-09 15:02:16 UTC (rev 7391)
@@ -58,9 +58,9 @@
    enet_uint8 addr[16];
 } ENetHostAddress;
 
-extern const ENetHostAddress ENET_HOST_ANY;          /**< specifies the default server host */
-extern const ENetHostAddress ENET_IPV4MAPPED_PREFIX; /**< specifies the IPv4-mapped IPv6 prefix */
-extern const ENetHostAddress ENET_HOST_BROADCAST;    /**< specifies a IPv4 subnet-wide broadcast */
+extern ENET_API const ENetHostAddress ENET_HOST_ANY;          /**< specifies the default server host */
+extern ENET_API const ENetHostAddress ENET_IPV4MAPPED_PREFIX; /**< specifies the IPv4-mapped IPv6 prefix */
+extern ENET_API const ENetHostAddress ENET_HOST_BROADCAST;    /**< specifies a IPv4 subnet-wide broadcast */
 #define ENET_IPV4MAPPED_PREFIX_LEN 12                /**< specifies the length of the IPv4-mapped IPv6 prefix */
 #define ENET_PORT_ANY 0                              /**< specifies that a port should be automatically chosen */
 

Modified: code/branches/ipv6/src/external/enet/protocol.c
===================================================================
--- code/branches/ipv6/src/external/enet/protocol.c	2010-09-09 14:30:50 UTC (rev 7390)
+++ code/branches/ipv6/src/external/enet/protocol.c	2010-09-09 15:02:16 UTC (rev 7391)
@@ -1397,6 +1397,9 @@
          currentPeer < & host -> peers [host -> peerCount];
          ++ currentPeer)
     {
+        ENetAddressFamily family;
+        ENetSocket socket;
+
         if (currentPeer -> state == ENET_PEER_STATE_DISCONNECTED ||
             currentPeer -> state == ENET_PEER_STATE_ZOMBIE)
           continue;
@@ -1521,8 +1524,8 @@
 
         currentPeer -> lastSendTime = host -> serviceTime;
 
-        ENetAddressFamily family = enet_get_address_family (& currentPeer -> address);
-        ENetSocket socket = family == ENET_IPV4 ? host -> socket4 : host -> socket6;
+        family = enet_get_address_family (& currentPeer -> address);
+        socket = family == ENET_IPV4 ? host -> socket4 : host -> socket6;
         if (socket == ENET_SOCKET_NULL)
           return -1;
         sentLength = enet_socket_send (socket,

Modified: code/branches/ipv6/src/external/enet/win32.c
===================================================================
--- code/branches/ipv6/src/external/enet/win32.c	2010-09-09 14:30:50 UTC (rev 7390)
+++ code/branches/ipv6/src/external/enet/win32.c	2010-09-09 15:02:16 UTC (rev 7391)
@@ -180,7 +180,10 @@
     }
     else
     {
-        ENetAddress address_ = { ENET_HOST_ANY, 0, 0 };
+        ENetAddress address_;
+        address_.host = ENET_HOST_ANY;
+        address_.scopeID = 0;
+        address_.port = 0;
         enet_address_set_sin((SOCKADDR *) & sin, & address_, family);
     }
 
@@ -365,6 +368,7 @@
     fd_set readSet, writeSet;
     struct timeval timeVal;
     int selectCount;
+    ENetSocket maxSocket;
 
     timeVal.tv_sec = timeout / 1000;
     timeVal.tv_usec = (timeout % 1000) * 1000;
@@ -388,7 +392,7 @@
             FD_SET (socket6, & readSet);
     }
 
-    ENetSocket maxSocket = 0;
+    maxSocket = 0;
     if (socket4 != ENET_SOCKET_NULL)
         maxSocket = socket4;
     if (socket6 != ENET_SOCKET_NULL && socket6 > maxSocket)




More information about the Orxonox-commit mailing list