summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-04-16 09:25:59 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-04-16 09:25:59 +0000
commit5b5a3be7e2a5b8dd769c700c3faeba4de4c1e000 (patch)
treeac11dc1978e027c488f21776f944fc3f2ed17085
parent2302c623e66bdfadd0cdad3be6f4ba70a1885f0a (diff)
2010-04-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed compile error with openssl 1.1.0 and mingw32. * src/AsyncNameResolver.cc * src/LogFactory.cc * src/Logger.cc * src/Logger.h * src/SocketCore.cc * src/SocketCore.h * src/a2netcompat.h
-rw-r--r--ChangeLog11
-rw-r--r--src/AsyncNameResolver.cc3
-rw-r--r--src/LogFactory.cc18
-rw-r--r--src/Logger.cc2
-rw-r--r--src/Logger.h34
-rw-r--r--src/SocketCore.cc1
-rw-r--r--src/SocketCore.h2
-rw-r--r--src/a2netcompat.h10
8 files changed, 46 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 826ab144..8d1a3991 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-04-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+
+ Fixed compile error with openssl 1.1.0 and mingw32.
+ * src/AsyncNameResolver.cc
+ * src/LogFactory.cc
+ * src/Logger.cc
+ * src/Logger.h
+ * src/SocketCore.cc
+ * src/SocketCore.h
+ * src/a2netcompat.h
+
2010-04-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Release 1.9.1
diff --git a/src/AsyncNameResolver.cc b/src/AsyncNameResolver.cc
index 31f6977d..6d8fdf99 100644
--- a/src/AsyncNameResolver.cc
+++ b/src/AsyncNameResolver.cc
@@ -93,8 +93,7 @@ void AsyncNameResolver::process(fd_set* rfdsPtr, fd_set* wfdsPtr)
int AsyncNameResolver::getsock(sock_t* sockets) const
{
- // TODO cast to int* might cause problem with Windows SOCKET?
- return ares_getsock(channel, reinterpret_cast<int*>(sockets),
+ return ares_getsock(channel, reinterpret_cast<ares_socket_t*>(sockets),
ARES_GETSOCK_MAXNUM);
}
diff --git a/src/LogFactory.cc b/src/LogFactory.cc
index d6e829b6..692c0678 100644
--- a/src/LogFactory.cc
+++ b/src/LogFactory.cc
@@ -42,7 +42,7 @@ namespace aria2 {
std::string LogFactory::filename = DEV_NULL;
Logger* LogFactory::logger = 0;
bool LogFactory::_consoleOutput = true;
-Logger::LEVEL LogFactory::_logLevel = Logger::DEBUG;
+Logger::LEVEL LogFactory::_logLevel = Logger::A2_DEBUG;
Logger* LogFactory::getInstance() {
if(!logger) {
@@ -54,9 +54,9 @@ Logger* LogFactory::getInstance() {
}
slogger->setLogLevel(_logLevel);
if(_consoleOutput) {
- slogger->setStdoutLogLevel(Logger::NOTICE, true);
- slogger->setStdoutLogLevel(Logger::WARN, true);
- slogger->setStdoutLogLevel(Logger::ERROR, true);
+ slogger->setStdoutLogLevel(Logger::A2_NOTICE, true);
+ slogger->setStdoutLogLevel(Logger::A2_WARN, true);
+ slogger->setStdoutLogLevel(Logger::A2_ERROR, true);
}
logger = slogger;
}
@@ -71,15 +71,15 @@ void LogFactory::setLogLevel(Logger::LEVEL level)
void LogFactory::setLogLevel(const std::string& level)
{
if(level == V_DEBUG) {
- _logLevel = Logger::DEBUG;
+ _logLevel = Logger::A2_DEBUG;
} else if(level == V_INFO) {
- _logLevel = Logger::INFO;
+ _logLevel = Logger::A2_INFO;
} else if(level == V_NOTICE) {
- _logLevel = Logger::NOTICE;
+ _logLevel = Logger::A2_NOTICE;
} else if(level == V_WARN) {
- _logLevel = Logger::WARN;
+ _logLevel = Logger::A2_WARN;
} else if(level == V_ERROR) {
- _logLevel = Logger::ERROR;
+ _logLevel = Logger::A2_ERROR;
}
}
diff --git a/src/Logger.cc b/src/Logger.cc
index 75c1f914..04abbea4 100644
--- a/src/Logger.cc
+++ b/src/Logger.cc
@@ -53,7 +53,7 @@ const std::string Logger::ERROR_LABEL("ERROR");
const std::string Logger::INFO_LABEL("INFO");
-Logger::Logger():_logLevel(Logger::DEBUG), _stdoutField(0) {}
+Logger::Logger():_logLevel(Logger::A2_DEBUG), _stdoutField(0) {}
Logger::~Logger()
{
diff --git a/src/Logger.h b/src/Logger.h
index 216a29cf..d5cbe4eb 100644
--- a/src/Logger.h
+++ b/src/Logger.h
@@ -49,11 +49,11 @@ class Exception;
class Logger {
public:
enum LEVEL {
- DEBUG = 1 << 0,
- INFO = 1 << 1,
- NOTICE = 1 << 2,
- WARN = 1 << 3,
- ERROR = 1 << 4,
+ A2_DEBUG = 1 << 0,
+ A2_INFO = 1 << 1,
+ A2_NOTICE = 1 << 2,
+ A2_WARN = 1 << 3,
+ A2_ERROR = 1 << 4,
};
static const std::string DEBUG_LABEL;
@@ -127,52 +127,52 @@ public:
void debug(const char* msg, ...)
{
- WRITE_LOG(DEBUG, DEBUG_LABEL, msg);
+ WRITE_LOG(A2_DEBUG, DEBUG_LABEL, msg);
}
void debug(const char* msg, const Exception& ex, ...)
{
- WRITE_LOG_EX(DEBUG, DEBUG_LABEL, msg, ex);
+ WRITE_LOG_EX(A2_DEBUG, DEBUG_LABEL, msg, ex);
}
void info(const char* msg, ...)
{
- WRITE_LOG(INFO, INFO_LABEL, msg);
+ WRITE_LOG(A2_INFO, INFO_LABEL, msg);
}
void info(const char* msg, const Exception& ex, ...)
{
- WRITE_LOG_EX(INFO, INFO_LABEL, msg, ex);
+ WRITE_LOG_EX(A2_INFO, INFO_LABEL, msg, ex);
}
void notice(const char* msg, ...)
{
- WRITE_LOG(NOTICE, NOTICE_LABEL, msg);
+ WRITE_LOG(A2_NOTICE, NOTICE_LABEL, msg);
}
void notice(const char* msg, const Exception& ex, ...)
{
- WRITE_LOG_EX(NOTICE, NOTICE_LABEL, msg, ex);
+ WRITE_LOG_EX(A2_NOTICE, NOTICE_LABEL, msg, ex);
}
void warn(const char* msg, ...)
{
- WRITE_LOG(WARN, WARN_LABEL, msg);
+ WRITE_LOG(A2_WARN, WARN_LABEL, msg);
}
void warn(const char* msg, const Exception& ex, ...)
{
- WRITE_LOG_EX(WARN, WARN_LABEL, msg, ex);
+ WRITE_LOG_EX(A2_WARN, WARN_LABEL, msg, ex);
}
void error(const char* msg, ...)
{
- WRITE_LOG(ERROR, ERROR_LABEL, msg);
+ WRITE_LOG(A2_ERROR, ERROR_LABEL, msg);
}
void error(const char* msg, const Exception& ex, ...)
{
- WRITE_LOG_EX(ERROR, ERROR_LABEL, msg, ex);
+ WRITE_LOG_EX(A2_ERROR, ERROR_LABEL, msg, ex);
}
void openFile(const std::string& filename);
@@ -197,12 +197,12 @@ public:
// either file or stdout.
bool debug()
{
- return levelEnabled(DEBUG);
+ return levelEnabled(A2_DEBUG);
}
bool info()
{
- return levelEnabled(INFO);
+ return levelEnabled(A2_INFO);
}
};
diff --git a/src/SocketCore.cc b/src/SocketCore.cc
index fb4d33f9..0347c39d 100644
--- a/src/SocketCore.cc
+++ b/src/SocketCore.cc
@@ -47,7 +47,6 @@
#endif // HAVE_LIBGNUTLS
#include "message.h"
-#include "a2netcompat.h"
#include "DlRetryEx.h"
#include "DlAbortEx.h"
#include "StringFormat.h"
diff --git a/src/SocketCore.h b/src/SocketCore.h
index e306a43d..dc183e8c 100644
--- a/src/SocketCore.h
+++ b/src/SocketCore.h
@@ -46,6 +46,8 @@
#include <utility>
#include <vector>
+#include "a2netcompat.h"
+
#ifdef HAVE_LIBSSL
// for SSL
# include <openssl/ssl.h>
diff --git a/src/a2netcompat.h b/src/a2netcompat.h
index 11938fb7..c24e74ee 100644
--- a/src/a2netcompat.h
+++ b/src/a2netcompat.h
@@ -36,18 +36,18 @@
#include "a2io.h"
-#ifndef __CYGWIN__
+#ifdef __MINGW32__
+# ifndef WINVER
+# define WINVER 0x501
+# endif // !WINVER
# ifdef HAVE_WINSOCK2_H
-# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x501
-# endif // _WIN32_WINNT
# include <winsock2.h>
# undef ERROR
# endif // HAVE_WINSOCK2_H
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
# endif // HAVE_WS2TCPIP_H
-#endif // !__CYGWIN__
+#endif // __MINGW32__
#ifdef __MINGW32__
# define a2_sockopt_t char *