瀏覽代碼

2008-09-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	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
Tatsuhiro Tsujikawa 17 年之前
父節點
當前提交
b513331407
共有 5 個文件被更改,包括 43 次插入19 次删除
  1. 11 0
      ChangeLog
  2. 7 4
      src/File.cc
  3. 3 1
      src/File.h
  4. 12 7
      src/SocketCore.cc
  5. 10 7
      src/SocketCore.h

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+2008-09-30  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	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  <tujikawa at rednoah dot com>
 
 	Made a socket of incoming peer non-blocking.

+ 7 - 4
src/File.cc

@@ -33,14 +33,17 @@
  */
 /* copyright --> */
 #include "File.h"
-#include "Util.h"
-#include "A2STR.h"
-#include <cstring>
+
 #include <stdlib.h>
-#include <deque>
 #include <sys/types.h>
 #include <utime.h>
 
+#include <deque>
+#include <cstring>
+
+#include "Util.h"
+#include "A2STR.h"
+
 namespace aria2 {
 
 #ifdef __MINGW32__

+ 3 - 1
src/File.h

@@ -36,9 +36,11 @@
 #define _D_FILE_H_
 
 #include "common.h"
+
+#include <string>
+
 #include "a2io.h"
 #include "TimeA2.h"
-#include <string>
 
 namespace aria2 {
 

+ 12 - 7
src/SocketCore.cc

@@ -33,15 +33,20 @@
  */
 /* copyright --> */
 #include "SocketCore.h"
+
+#include <unistd.h>
+
+#include <cerrno>
+#include <cstring>
+
 #include "message.h"
 #include "a2netcompat.h"
 #include "DlRetryEx.h"
 #include "DlAbortEx.h"
 #include "StringFormat.h"
 #include "Util.h"
-#include <unistd.h>
-#include <cerrno>
-#include <cstring>
+#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 "";
   }

+ 10 - 7
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 <cstdlib>
+
+#ifdef HAVE_EPOLL_CREATE
+# include <sys/epoll.h>
+#endif // HAVE_EPOLL_CREATE
+
 #include <string>
+#include <cstdlib>
 #include <utility>
 
 #ifdef HAVE_LIBSSL
@@ -51,9 +53,10 @@
 #ifdef HAVE_LIBGNUTLS
 # include <gnutls/gnutls.h>
 #endif // HAVE_LIBGNUTLS
-#ifdef HAVE_EPOLL
-# include <sys/epoll.h>
-#endif // HAVE_EPOLL
+
+#include "a2io.h"
+#include "a2netcompat.h"
+#include "a2time.h"
 
 namespace aria2 {