Procházet zdrojové kódy

2010-02-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Fixed compile error with mingw32 cross compiler. Defined
	a2_sockopt_t as void* for the target systems other than mingw32.
	* src/SocketCore.cc
	* src/a2netcompat.h
Tatsuhiro Tsujikawa před 15 roky
rodič
revize
aa2036a70d
3 změnil soubory, kde provedl 10 přidání a 3 odebrání
  1. 7 0
      ChangeLog
  2. 2 2
      src/SocketCore.cc
  3. 1 1
      src/a2netcompat.h

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2010-02-21  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Fixed compile error with mingw32 cross compiler. Defined
+	a2_sockopt_t as void* for the target systems other than mingw32.
+	* src/SocketCore.cc
+	* src/a2netcompat.h
+
 2010-02-20  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Removed 'always true' condition

+ 2 - 2
src/SocketCore.cc

@@ -418,14 +418,14 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port)
 void SocketCore::setSockOpt
 (int level, int optname, void* optval, socklen_t optlen)
 {
-  if(setsockopt(sockfd, level, optname, optval, optlen) < 0) {
+  if(setsockopt(sockfd, level, optname, (a2_sockopt_t)optval, optlen) < 0) {
     throw DL_ABORT_EX(StringFormat(EX_SOCKET_SET_OPT, errorMsg()).str());
   }
 }   
 
 void SocketCore::setMulticastTtl(unsigned char ttl)
 {
-  setSockOpt(IPPROTO_IP, IP_MULTICAST_TTL, (a2_sockopt_t)&ttl, sizeof(ttl));
+  setSockOpt(IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
 }
 
 void SocketCore::joinMulticastGroup(const std::string& ipaddr, uint16_t port)

+ 1 - 1
src/a2netcompat.h

@@ -55,7 +55,7 @@
 # undef HAVE_GAI_STRERROR
 # undef gai_strerror
 #else
-# define a2_sockopt_t int *
+# define a2_sockopt_t void *
 #endif // __MINGW32__
 
 #ifdef HAVE_NETDB_H