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
pull/1/head
Tatsuhiro Tsujikawa 2008-09-30 15:16:37 +00:00
parent c1dd780b95
commit b513331407
5 changed files with 43 additions and 19 deletions

View File

@ -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> 2008-09-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made a socket of incoming peer non-blocking. Made a socket of incoming peer non-blocking.

View File

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

View File

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

View File

@ -33,15 +33,20 @@
*/ */
/* copyright --> */ /* copyright --> */
#include "SocketCore.h" #include "SocketCore.h"
#include <unistd.h>
#include <cerrno>
#include <cstring>
#include "message.h" #include "message.h"
#include "a2netcompat.h" #include "a2netcompat.h"
#include "DlRetryEx.h" #include "DlRetryEx.h"
#include "DlAbortEx.h" #include "DlAbortEx.h"
#include "StringFormat.h" #include "StringFormat.h"
#include "Util.h" #include "Util.h"
#include <unistd.h> #include "LogFactory.h"
#include <cerrno>
#include <cstring>
#ifndef __MINGW32__ #ifndef __MINGW32__
# define SOCKET_ERRNO (errno) # define SOCKET_ERRNO (errno)
#else #else
@ -59,7 +64,7 @@
#else #else
# define CLOSE(X) while(close(X) == -1 && errno == EINTR) # define CLOSE(X) while(close(X) == -1 && errno == EINTR)
#endif // __MINGW32__ #endif // __MINGW32__
#include "LogFactory.h"
namespace aria2 { namespace aria2 {
SocketCore::SocketCore(int sockType):_sockType(sockType), sockfd(-1) { 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 std::string SocketCore::getSocketError() const
{ {
int error; SOCKOPT_T error;
SOCKOPT_T optlen = sizeof(error); socklen_t optlen = sizeof(error);
if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &optlen) == -1) { if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &optlen) == -1) {
throw DlAbortEx(StringFormat("Failed to get socket error: %s", throw DlAbortEx(StringFormat("Failed to get socket error: %s",
errorMsg()).str()); errorMsg()).str());
} }
if(error != 0) { if(error != 0) {
return strerror(error); return errorMsg(error);
} else { } else {
return ""; return "";
} }

View File

@ -36,11 +36,13 @@
#define _D_SOCKET_CORE_H_ #define _D_SOCKET_CORE_H_
#include "common.h" #include "common.h"
#include "a2io.h"
#include "a2netcompat.h" #ifdef HAVE_EPOLL_CREATE
#include "a2time.h" # include <sys/epoll.h>
#include <cstdlib> #endif // HAVE_EPOLL_CREATE
#include <string> #include <string>
#include <cstdlib>
#include <utility> #include <utility>
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
@ -51,9 +53,10 @@
#ifdef HAVE_LIBGNUTLS #ifdef HAVE_LIBGNUTLS
# include <gnutls/gnutls.h> # include <gnutls/gnutls.h>
#endif // HAVE_LIBGNUTLS #endif // HAVE_LIBGNUTLS
#ifdef HAVE_EPOLL
# include <sys/epoll.h> #include "a2io.h"
#endif // HAVE_EPOLL #include "a2netcompat.h"
#include "a2time.h"
namespace aria2 { namespace aria2 {