From: Jacek S. <arn...@us...> - 2006-02-18 23:32:21
|
Update of /cvsroot/dcplusplus/dcplusplus/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15474/client Modified Files: stdinc.h Util.cpp BufferedSocket.cpp ClientManager.cpp Log Message: vs2k fix, bufferedsocket fix Index: ClientManager.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/ClientManager.cpp,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** ClientManager.cpp 13 Feb 2006 21:13:27 -0000 1.95 --- ClientManager.cpp 18 Feb 2006 23:32:17 -0000 1.96 *************** *** 114,117 **** --- 114,119 ---- if(i != users.end()) lst.push_back(i->second->getFirstNick()); + else + lst.push_back('{' + cid.toBase32() + '}'); } return lst; Index: Util.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/Util.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** Util.cpp 5 Feb 2006 13:38:44 -0000 1.94 --- Util.cpp 18 Feb 2006 23:32:17 -0000 1.95 *************** *** 65,68 **** --- 65,74 ---- } + #if defined(_WIN32) && _MSC_VER == 1400 + void WINAPI invalidParameterHandler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t) { + //do nothing, this exist because vs2k5 crt needs it not to crash on errors. + } + #endif + void Util::initialize() { setlocale(LC_ALL, ""); *************** *** 77,80 **** --- 83,91 ---- appPath = Text::fromT(buf); appPath.erase(appPath.rfind('\\') + 1); + + #if _MSC_VER == 1400 + _set_invalid_parameter_handler(reinterpret_cast<_invalid_parameter_handler>(invalidParameterHandler)); + #endif + #else // _WIN32 char* home = getenv("HOME"); Index: BufferedSocket.cpp =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/BufferedSocket.cpp,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** BufferedSocket.cpp 12 Feb 2006 18:16:12 -0000 1.100 --- BufferedSocket.cpp 18 Feb 2006 23:32:17 -0000 1.101 *************** *** 198,202 **** dcassert(file != NULL); size_t sockSize = (size_t)sock->getSocketOptInt(SO_SNDBUF); ! size_t bufSize = sockSize * 16; // Perhaps make this a setting? dcdebug("threadSendFile buffer size: %lu\n", bufSize); AutoArray<u_int8_t> buf(bufSize); --- 198,202 ---- dcassert(file != NULL); size_t sockSize = (size_t)sock->getSocketOptInt(SO_SNDBUF); ! size_t bufSize = max(sockSize, (size_t)64*1024); dcdebug("threadSendFile buffer size: %lu\n", bufSize); AutoArray<u_int8_t> buf(bufSize); *************** *** 216,232 **** return; ! int w = sock->wait(POLL_TIMEOUT, Socket::WAIT_WRITE | Socket::WAIT_READ); ! if(w & Socket::WAIT_READ) { ! threadRead(); ! } ! if(w & Socket::WAIT_WRITE) { ! int written = sock->write(buf + done, min(sockSize, actual - done)); ! if(written > 0) { ! done += written; ! size_t doneReadNow = static_cast<size_t>((static_cast<double>(done)/actual) * bytesRead); ! fire(BufferedSocketListener::BytesSent(), doneReadNow - doneRead, written); ! doneRead = doneReadNow; } } --- 216,231 ---- return; ! int written = sock->write(buf + done, min(sockSize, actual - done)); ! if(written > 0) { ! done += written; ! size_t doneReadNow = static_cast<size_t>((static_cast<double>(done)/actual) * bytesRead); ! fire(BufferedSocketListener::BytesSent(), doneReadNow - doneRead, written); ! doneRead = doneReadNow; ! } else if(written == -1) { ! int w = sock->wait(POLL_TIMEOUT, Socket::WAIT_WRITE | Socket::WAIT_READ); ! if(w & Socket::WAIT_READ) { ! threadRead(); } } Index: stdinc.h =================================================================== RCS file: /cvsroot/dcplusplus/dcplusplus/client/stdinc.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** stdinc.h 15 Jan 2006 18:40:37 -0000 1.21 --- stdinc.h 18 Feb 2006 23:32:17 -0000 1.22 *************** *** 33,36 **** --- 33,43 ---- #define _ATL_NO_OLD_NAMES + #if _MSC_VER == 1400 + //disable the deperecated warnings for the crt functions. + #define _CRT_SECURE_NO_DEPRECATE 1 + #define _ATL_SECURE_NO_DEPRECATE 1 + #define _CRT_NON_CONFORMING_SWPRINTFS 1 + #endif + #include <Winsock2.h> |