From b513331407f6b805bb8752648ab1568b86287975 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 30 Sep 2008 15:16:37 +0000 Subject: [PATCH] 2008-09-30 Tatsuhiro Tsujikawa Fixed compile error with debian mingw32 cross compiler(4.2.1). The configuration is minimum: no torrent, no metalink, so there may be other compile error on their code. * src/a2netcompat.h * src/File.cc * src/File.h * src/SocketCore.cc * src/SocketCore.h --- ChangeLog | 11 +++++++++++ src/File.cc | 11 +++++++---- src/File.h | 4 +++- src/SocketCore.cc | 19 ++++++++++++------- src/SocketCore.h | 17 ++++++++++------- 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7cd34e46..07d7c088 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-09-30 Tatsuhiro Tsujikawa + + Fixed compile error with debian mingw32 cross compiler(4.2.1). + The configuration is minimum: no torrent, no metalink, so there may be + other compile error on their code. + * src/a2netcompat.h + * src/File.cc + * src/File.h + * src/SocketCore.cc + * src/SocketCore.h + 2008-09-28 Tatsuhiro Tsujikawa Made a socket of incoming peer non-blocking. diff --git a/src/File.cc b/src/File.cc index e4ca5b69..ebe02002 100644 --- a/src/File.cc +++ b/src/File.cc @@ -33,14 +33,17 @@ */ /* copyright --> */ #include "File.h" -#include "Util.h" -#include "A2STR.h" -#include + #include -#include #include #include +#include +#include + +#include "Util.h" +#include "A2STR.h" + namespace aria2 { #ifdef __MINGW32__ diff --git a/src/File.h b/src/File.h index ab75f123..31bd90a0 100644 --- a/src/File.h +++ b/src/File.h @@ -36,9 +36,11 @@ #define _D_FILE_H_ #include "common.h" + +#include + #include "a2io.h" #include "TimeA2.h" -#include namespace aria2 { diff --git a/src/SocketCore.cc b/src/SocketCore.cc index cbdd4c35..c7025fd9 100644 --- a/src/SocketCore.cc +++ b/src/SocketCore.cc @@ -33,15 +33,20 @@ */ /* copyright --> */ #include "SocketCore.h" + +#include + +#include +#include + #include "message.h" #include "a2netcompat.h" #include "DlRetryEx.h" #include "DlAbortEx.h" #include "StringFormat.h" #include "Util.h" -#include -#include -#include +#include "LogFactory.h" + #ifndef __MINGW32__ # define SOCKET_ERRNO (errno) #else @@ -59,7 +64,7 @@ #else # define CLOSE(X) while(close(X) == -1 && errno == EINTR) #endif // __MINGW32__ -#include "LogFactory.h" + namespace aria2 { SocketCore::SocketCore(int sockType):_sockType(sockType), sockfd(-1) { @@ -883,14 +888,14 @@ ssize_t SocketCore::readDataFrom(char* data, size_t len, std::string SocketCore::getSocketError() const { - int error; - SOCKOPT_T optlen = sizeof(error); + SOCKOPT_T error; + socklen_t optlen = sizeof(error); if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &optlen) == -1) { throw DlAbortEx(StringFormat("Failed to get socket error: %s", errorMsg()).str()); } if(error != 0) { - return strerror(error); + return errorMsg(error); } else { return ""; } diff --git a/src/SocketCore.h b/src/SocketCore.h index 9f3411ca..1392e456 100644 --- a/src/SocketCore.h +++ b/src/SocketCore.h @@ -36,11 +36,13 @@ #define _D_SOCKET_CORE_H_ #include "common.h" -#include "a2io.h" -#include "a2netcompat.h" -#include "a2time.h" -#include + +#ifdef HAVE_EPOLL_CREATE +# include +#endif // HAVE_EPOLL_CREATE + #include +#include #include #ifdef HAVE_LIBSSL @@ -51,9 +53,10 @@ #ifdef HAVE_LIBGNUTLS # include #endif // HAVE_LIBGNUTLS -#ifdef HAVE_EPOLL -# include -#endif // HAVE_EPOLL + +#include "a2io.h" +#include "a2netcompat.h" +#include "a2time.h" namespace aria2 {