Index: configure =================================================================== --- configure (revision 1834) +++ configure (working copy) @@ -3579,7 +3579,7 @@ case "$target" in *mingw*|*cygwin*) - WINSOCK_LIBS="-lws2_32 -lpthread" + WINSOCK_LIBS="-lws2_32" ;; esac Index: src/RequestGroupMan.cc =================================================================== --- src/RequestGroupMan.cc (revision 1834) +++ src/RequestGroupMan.cc (working copy) @@ -577,8 +577,13 @@ o << "\n" <<_("Download Results:") << "\n" << "gid|stat|avg speed |path/URI" << "\n" - << "===+====+===========+===========================================================" << "\n"; - + << "===+====+===========+"; +#ifdef __MINGW32__ + int pathRowSize = 58; +#else // !__MINGW32__ + int pathRowSize = 59; +#endif // !__MINGW32__ + o << std::setfill('=') << std::setw(pathRowSize) << '=' << "\n"; int ok = 0; int err = 0; int inpr = 0; Index: src/File.cc =================================================================== --- src/File.cc (revision 1834) +++ src/File.cc (working copy) @@ -59,7 +59,7 @@ File::~File() {} int File::fillStat(a2_struct_stat& fstat) { - return stat(name.c_str(), &fstat); + return a2stat(name.c_str(), &fstat); } bool File::exists() { Index: src/OptionHandlerFactory.cc =================================================================== --- src/OptionHandlerFactory.cc (revision 1834) +++ src/OptionHandlerFactory.cc (working copy) @@ -157,7 +157,7 @@ SharedHandle op(new BooleanOptionHandler (PREF_DISABLE_IPV6, TEXT_DISABLE_IPV6, - V_FALSE, + V_TRUE, OptionHandler::OPT_ARG)); op->addTag(TAG_ADVANCED); handlers.push_back(op); Index: src/DHTMessageReceiver.cc =================================================================== --- src/DHTMessageReceiver.cc (revision 1834) +++ src/DHTMessageReceiver.cc (working copy) @@ -66,13 +66,13 @@ std::string remoteAddr; uint16_t remotePort; unsigned char data[64*1024]; - ssize_t length = _connection->receiveMessage(data, sizeof(data), - remoteAddr, - remotePort); - if(length <= 0) { - return SharedHandle(); - } try { + ssize_t length = _connection->receiveMessage(data, sizeof(data), + remoteAddr, + remotePort); + if(length <= 0) { + return SharedHandle(); + } bool isReply = false; const BDE dict = bencode::decode(data, length); if(dict.isDict()) { Index: src/a2io.h =================================================================== --- src/a2io.h (revision 1834) +++ src/a2io.h (working copy) @@ -113,17 +113,17 @@ #endif // HAVE_WINSOCK2_H #ifdef __MINGW32__ -# define lseek(fd, offset, origin) _lseeki64(fd, offset, origin) -# define fseek(fd, offset, origin) _fseeki64(fd, offset, origin) -# define fstat(fd, buf) _fstati64(fd, buf) -# define ftell(fd) _ftelli64(fd) -# define wstat(path, buf) _wstati64(path, buf) +# define a2lseek(fd, offset, origin) _lseeki64(fd, offset, origin) +# define a2fseek(fd, offset, origin) _fseeki64(fd, offset, origin) +# define a2fstat(fd, buf) _fstati64(fd, buf) +# define a2ftell(fd) _ftelli64(fd) +# define a2wstat(path, buf) _wstati64(path, buf) # ifdef stat # undef stat # endif // stat # define a2_struct_stat struct _stati64 -# define stat(path, buf) _stati64(path, buf) -# define tell(handle) _telli64(handle) +# define a2stat(path, buf) _stati64(path, buf) +# define a2tell(handle) _telli64(handle) # define a2mkdir(path, openMode) mkdir(path) #else # define a2_struct_stat struct stat Index: src/AbstractDiskWriter.cc =================================================================== --- src/AbstractDiskWriter.cc (revision 1834) +++ src/AbstractDiskWriter.cc (working copy) @@ -139,7 +139,7 @@ void AbstractDiskWriter::seek(off_t offset) { - if(lseek(fd, offset, SEEK_SET) == (off_t)-1) { + if(a2lseek(fd, offset, SEEK_SET) == (off_t)-1) { throw DL_ABORT_EX (StringFormat(EX_FILE_SEEK, _filename.c_str(), strerror(errno)).str()); } Index: src/ConsoleStatCalc.cc =================================================================== --- src/ConsoleStatCalc.cc (revision 1834) +++ src/ConsoleStatCalc.cc (working copy) @@ -42,6 +42,7 @@ #endif // HAVE_SYS_IOCTL_H #include +#include #include #include #include @@ -218,25 +219,25 @@ } _cp.reset(); const SizeFormatter& sizeFormatter = *_sizeFormatter.get(); + +#ifdef __MINGW32__ + bool isTTY = true; + // Windows terminal cannot handle at the end of line properly. + unsigned short int cols = 79; +#else // !__MINGW32__ bool isTTY = isatty(STDOUT_FILENO) == 1; unsigned short int cols = 80; -#ifdef __MINGW32__ - // Windows terminal cannot handle at the end of line properly. - --cols; -#endif // __MINGW32__ +#endif // !__MINGW32__ + if(isTTY) { +#ifndef __MINGW32__ #ifdef HAVE_TERMIOS_H struct winsize size; if(ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) { cols = size.ws_col; -#ifdef __MINGW32__ - if(cols > 0) { - // Windows terminal cannot handle at the end of line properly. - --cols; - } -#endif // __MINGW32__ } #endif // HAVE_TERMIOS_H +#endif // !__MINGW32__ std::cout << '\r' << std::setfill(' ') << std::setw(cols) << ' ' << '\r'; } std::ostringstream o; Index: configure.ac =================================================================== --- configure.ac (revision 1834) +++ configure.ac (working copy) @@ -12,7 +12,7 @@ case "$target" in *mingw*|*cygwin*) - WINSOCK_LIBS="-lws2_32 -lpthread" + WINSOCK_LIBS="-lws2_32" AC_SUBST(WINSOCK_LIBS) ;; esac @@ -432,4 +432,4 @@ echo "Epoll: $have_epoll" echo "Bittorrent: $enable_bittorrent" echo "Metalink: $enable_metalink" -echo "XML-RPC: $enable_xml_rpc" \ No newline at end of file +echo "XML-RPC: $enable_xml_rpc" Index: test/FileTest.cc =================================================================== --- test/FileTest.cc (revision 1834) +++ test/FileTest.cc (working copy) @@ -222,7 +222,7 @@ CPPUNIT_ASSERT(f.utime(Time(atime), Time(mtime))); a2_struct_stat buf; - CPPUNIT_ASSERT(0 == stat(f.getPath().c_str(), &buf)); + CPPUNIT_ASSERT(0 == a2stat(f.getPath().c_str(), &buf)); CPPUNIT_ASSERT_EQUAL((time_t)atime, buf.st_atime); CPPUNIT_ASSERT_EQUAL((time_t)mtime, f.getModifiedTime().getTime());