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
pull/1/head
Tatsuhiro Tsujikawa 2010-04-16 09:25:59 +00:00
parent 2302c623e6
commit 5b5a3be7e2
8 changed files with 46 additions and 35 deletions

View File

@ -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> 2010-04-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Release 1.9.1 Release 1.9.1

View File

@ -93,8 +93,7 @@ void AsyncNameResolver::process(fd_set* rfdsPtr, fd_set* wfdsPtr)
int AsyncNameResolver::getsock(sock_t* sockets) const int AsyncNameResolver::getsock(sock_t* sockets) const
{ {
// TODO cast to int* might cause problem with Windows SOCKET? return ares_getsock(channel, reinterpret_cast<ares_socket_t*>(sockets),
return ares_getsock(channel, reinterpret_cast<int*>(sockets),
ARES_GETSOCK_MAXNUM); ARES_GETSOCK_MAXNUM);
} }

View File

@ -42,7 +42,7 @@ namespace aria2 {
std::string LogFactory::filename = DEV_NULL; std::string LogFactory::filename = DEV_NULL;
Logger* LogFactory::logger = 0; Logger* LogFactory::logger = 0;
bool LogFactory::_consoleOutput = true; bool LogFactory::_consoleOutput = true;
Logger::LEVEL LogFactory::_logLevel = Logger::DEBUG; Logger::LEVEL LogFactory::_logLevel = Logger::A2_DEBUG;
Logger* LogFactory::getInstance() { Logger* LogFactory::getInstance() {
if(!logger) { if(!logger) {
@ -54,9 +54,9 @@ Logger* LogFactory::getInstance() {
} }
slogger->setLogLevel(_logLevel); slogger->setLogLevel(_logLevel);
if(_consoleOutput) { if(_consoleOutput) {
slogger->setStdoutLogLevel(Logger::NOTICE, true); slogger->setStdoutLogLevel(Logger::A2_NOTICE, true);
slogger->setStdoutLogLevel(Logger::WARN, true); slogger->setStdoutLogLevel(Logger::A2_WARN, true);
slogger->setStdoutLogLevel(Logger::ERROR, true); slogger->setStdoutLogLevel(Logger::A2_ERROR, true);
} }
logger = slogger; logger = slogger;
} }
@ -71,15 +71,15 @@ void LogFactory::setLogLevel(Logger::LEVEL level)
void LogFactory::setLogLevel(const std::string& level) void LogFactory::setLogLevel(const std::string& level)
{ {
if(level == V_DEBUG) { if(level == V_DEBUG) {
_logLevel = Logger::DEBUG; _logLevel = Logger::A2_DEBUG;
} else if(level == V_INFO) { } else if(level == V_INFO) {
_logLevel = Logger::INFO; _logLevel = Logger::A2_INFO;
} else if(level == V_NOTICE) { } else if(level == V_NOTICE) {
_logLevel = Logger::NOTICE; _logLevel = Logger::A2_NOTICE;
} else if(level == V_WARN) { } else if(level == V_WARN) {
_logLevel = Logger::WARN; _logLevel = Logger::A2_WARN;
} else if(level == V_ERROR) { } else if(level == V_ERROR) {
_logLevel = Logger::ERROR; _logLevel = Logger::A2_ERROR;
} }
} }

View File

@ -53,7 +53,7 @@ const std::string Logger::ERROR_LABEL("ERROR");
const std::string Logger::INFO_LABEL("INFO"); const std::string Logger::INFO_LABEL("INFO");
Logger::Logger():_logLevel(Logger::DEBUG), _stdoutField(0) {} Logger::Logger():_logLevel(Logger::A2_DEBUG), _stdoutField(0) {}
Logger::~Logger() Logger::~Logger()
{ {

View File

@ -49,11 +49,11 @@ class Exception;
class Logger { class Logger {
public: public:
enum LEVEL { enum LEVEL {
DEBUG = 1 << 0, A2_DEBUG = 1 << 0,
INFO = 1 << 1, A2_INFO = 1 << 1,
NOTICE = 1 << 2, A2_NOTICE = 1 << 2,
WARN = 1 << 3, A2_WARN = 1 << 3,
ERROR = 1 << 4, A2_ERROR = 1 << 4,
}; };
static const std::string DEBUG_LABEL; static const std::string DEBUG_LABEL;
@ -127,52 +127,52 @@ public:
void debug(const char* msg, ...) 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, ...) 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, ...) 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, ...) 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, ...) 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, ...) 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, ...) 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, ...) 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, ...) 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, ...) 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); void openFile(const std::string& filename);
@ -197,12 +197,12 @@ public:
// either file or stdout. // either file or stdout.
bool debug() bool debug()
{ {
return levelEnabled(DEBUG); return levelEnabled(A2_DEBUG);
} }
bool info() bool info()
{ {
return levelEnabled(INFO); return levelEnabled(A2_INFO);
} }
}; };

View File

@ -47,7 +47,6 @@
#endif // HAVE_LIBGNUTLS #endif // HAVE_LIBGNUTLS
#include "message.h" #include "message.h"
#include "a2netcompat.h"
#include "DlRetryEx.h" #include "DlRetryEx.h"
#include "DlAbortEx.h" #include "DlAbortEx.h"
#include "StringFormat.h" #include "StringFormat.h"

View File

@ -46,6 +46,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "a2netcompat.h"
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
// for SSL // for SSL
# include <openssl/ssl.h> # include <openssl/ssl.h>

View File

@ -36,18 +36,18 @@
#include "a2io.h" #include "a2io.h"
#ifndef __CYGWIN__ #ifdef __MINGW32__
# ifndef WINVER
# define WINVER 0x501
# endif // !WINVER
# ifdef HAVE_WINSOCK2_H # ifdef HAVE_WINSOCK2_H
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x501
# endif // _WIN32_WINNT
# include <winsock2.h> # include <winsock2.h>
# undef ERROR # undef ERROR
# endif // HAVE_WINSOCK2_H # endif // HAVE_WINSOCK2_H
# ifdef HAVE_WS2TCPIP_H # ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h> # include <ws2tcpip.h>
# endif // HAVE_WS2TCPIP_H # endif // HAVE_WS2TCPIP_H
#endif // !__CYGWIN__ #endif // __MINGW32__
#ifdef __MINGW32__ #ifdef __MINGW32__
# define a2_sockopt_t char * # define a2_sockopt_t char *