summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-18 18:25:56 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-18 18:25:56 +0000
commit955dfd805df45f63aba037bcb506e1071afd54ef (patch)
tree7c33a2f1e84f882ae4df513c4a7b6c85864b5d5b /src
parent2b51823f8d4ae1bd84a4e8d9d9d0ac0858f88bf1 (diff)
Apply patches to remove 200-odd dll limit on windows, made by GreenReaper, lots of thanks!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9533 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/command_parse.cpp3
-rw-r--r--src/dns.cpp2
-rw-r--r--src/inspircd.cpp13
-rw-r--r--src/modules.cpp2
-rw-r--r--src/socket.cpp4
-rw-r--r--src/socketengines/socketengine_iocp.cpp7
-rw-r--r--src/threadengines/threadengine_win32.cpp5
7 files changed, 25 insertions, 11 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index fff8653b3..dab770312 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -559,7 +559,7 @@ void CommandParser::SetupCommandTable(User* user)
if (library)
{
dirent* entry = NULL;
- while ((entry = readdir(library)))
+ while (0 != (entry = readdir(library)))
{
if (match(entry->d_name, "cmd_*.so"))
{
@@ -663,3 +663,4 @@ int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, st
return translations;
}
+
diff --git a/src/dns.cpp b/src/dns.cpp
index 4bb2da020..2e393de53 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -791,6 +791,7 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length, int result_we_w
rr.type = DNS_QUERY_NONE;
rr.rdlength = 0;
rr.ttl = 1; /* GCC is a whiney bastard -- see the XXX below. */
+ rr.rr_class = 0; /* Same for VC++ */
if (!(header.flags1 & FLAGS_MASK_QR))
return std::make_pair((unsigned char*)NULL,"Not a query result");
@@ -1175,3 +1176,4 @@ unsigned long DNS::PRNG()
return val;
}
+
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index ee5d0a2bc..d533a6e45 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -12,8 +12,6 @@
*/
/* $Install: src/inspircd $(BINPATH) */
-
-
#include "inspircd.h"
#include <signal.h>
@@ -28,6 +26,13 @@
#ifndef RUSAGE_SELF
#define RUSAGE_SELF 0
#endif
+
+ /* CRT memory debugging */
+ #ifdef DEBUG
+ #define _CRTDBG_MAP_ALLOC
+ #include <stdlib.h>
+ #include <crtdbg.h>
+ #endif
#endif
#include <fstream>
@@ -306,7 +311,9 @@ InspIRCd::InspIRCd(int argc, char** argv)
FloodQuitUser(&HandleFloodQuitUser)
{
-
+#ifdef WIN32
+ _CrtSetDbgFlag ( _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
+#endif
int found_ports = 0;
FailedPortList pl;
int do_version = 0, do_nofork = 0, do_debug = 0,
diff --git a/src/modules.cpp b/src/modules.cpp
index 41e4e2606..df6876b1a 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -356,7 +356,7 @@ bool ModuleManager::Load(const char* filename)
{
/* Try and locate and load all modules matching the pattern */
dirent* entry = NULL;
- while ((entry = readdir(library)))
+ while (0 != (entry = readdir(library)))
{
if (Instance->MatchText(entry->d_name, filename))
{
diff --git a/src/socket.cpp b/src/socket.cpp
index 17b98e28b..1341716f8 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -337,6 +337,7 @@ bool irc::sockets::MatchCIDR(const char* address, const char* cidr_mask, bool ma
*/
bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten)
{
+ _CrtCheckMemory();
/* We allocate 2 of these, because sockaddr_in6 is larger than sockaddr (ugh, hax) */
sockaddr* servaddr = new sockaddr[2];
memset(servaddr,0,sizeof(sockaddr)*2);
@@ -510,7 +511,7 @@ int InspIRCd::BindPorts(bool, int &ports_found, FailedPortList &failed_ports)
{
irc::portparser portrange(configToken, false);
int portno = -1;
- while ((portno = portrange.GetToken()))
+ while (0 != (portno = portrange.GetToken()))
{
if (*Addr == '*')
*Addr = 0;
@@ -583,3 +584,4 @@ int irc::sockets::insp_aton(const char* a, insp_inaddr* n)
return inet_pton(AF_FAMILY, a, n);
}
+
diff --git a/src/socketengines/socketengine_iocp.cpp b/src/socketengines/socketengine_iocp.cpp
index 9ae394e56..c1e97ce74 100644
--- a/src/socketengines/socketengine_iocp.cpp
+++ b/src/socketengines/socketengine_iocp.cpp
@@ -455,7 +455,7 @@ EventHandler * IOCPEngine::GetIntRef(int fd)
int IOCPEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen)
{
- SOCKET s = fd->GetFd();
+ //SOCKET s = fd->GetFd();
Overlapped* acceptevent = NULL;
if (!fd->GetExt("windows_acceptevent", acceptevent))
@@ -465,7 +465,7 @@ int IOCPEngine::Accept(EventHandler* fd, sockaddr *addr, socklen_t *addrlen)
Overlapped* ovl = acceptevent;
accept_overlap* ov = (accept_overlap*)ovl->m_params;
- sockaddr_in* server_address = (sockaddr_in*)&ov->buf[10];
+ //sockaddr_in* server_address = (sockaddr_in*)&ov->buf[10];
sockaddr_in* client_address = (sockaddr_in*)&ov->buf[38];
memcpy(addr, client_address, sizeof(sockaddr_in));
@@ -484,7 +484,7 @@ int IOCPEngine::GetSockName(EventHandler* fd, sockaddr *name, socklen_t* namelen
accept_overlap* ov = (accept_overlap*)ovl->m_params;
sockaddr_in* server_address = (sockaddr_in*)&ov->buf[10];
- sockaddr_in* client_address = (sockaddr_in*)&ov->buf[38];
+ //sockaddr_in* client_address = (sockaddr_in*)&ov->buf[38];
memcpy(name, server_address, sizeof(sockaddr_in));
*namelen = sizeof(sockaddr_in);
@@ -524,3 +524,4 @@ int IOCPEngine::Close(EventHandler* fd)
return this->Close(fd->GetFd());
}
+
diff --git a/src/threadengines/threadengine_win32.cpp b/src/threadengines/threadengine_win32.cpp
index 07d1b2373..566611367 100644
--- a/src/threadengines/threadengine_win32.cpp
+++ b/src/threadengines/threadengine_win32.cpp
@@ -27,11 +27,11 @@ void Win32ThreadEngine::Create(Thread* thread_to_init)
HANDLE* MyThread = new HANDLE;
DWORD ThreadId = 0;
- if (!(*MyThread = CreateThread(NULL,0,Win32ThreadEngine::Entry,this,0,&ThreadId)))
+ if (NULL == (*MyThread = CreateThread(NULL,0,Win32ThreadEngine::Entry,this,0,&ThreadId)))
{
delete MyThread;
Mutex(false);
- throw CoreException(std::string("Unable to reate new Win32ThreadEngine: ") + dlerror());
+ throw CoreException(std::string("Unable to create new Win32ThreadEngine: ") + dlerror());
}
NewThread = thread_to_init;
@@ -85,3 +85,4 @@ void Win32ThreadEngine::FreeThread(Thread* thread)
}
}
+