summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h2
-rw-r--r--src/channels.cpp2
-rw-r--r--src/configreader.cpp8
-rw-r--r--src/mode.cpp2
-rw-r--r--src/modules/m_blockcaps.cpp2
-rw-r--r--src/modules/m_chghost.cpp2
-rw-r--r--src/modules/m_conn_umodes.cpp3
-rw-r--r--src/modules/m_dnsbl.cpp2
-rw-r--r--src/modules/m_ripemd160.cpp4
-rw-r--r--src/modules/m_sethost.cpp2
-rw-r--r--src/modules/m_spanningtree/override_map.cpp4
-rw-r--r--src/socketengines/socketengine_epoll.cpp8
12 files changed, 22 insertions, 19 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 002c4899a..fc0f2a04e 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -38,6 +38,8 @@
#include <cmath>
#include <cstring>
#include <climits>
+
+#include <sstream>
#include <string>
#include <vector>
#include <deque>
diff --git a/src/channels.cpp b/src/channels.cpp
index 878fdc1a2..8628148cf 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -31,7 +31,7 @@ Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : Serv
maxbans = topicset = limit = 0;
- memset(&modes, 0, 64);
+ modes.reset();
}
void Channel::SetMode(char mode,bool mode_on)
diff --git a/src/configreader.cpp b/src/configreader.cpp
index a302dd6ea..117546f09 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -301,7 +301,7 @@ bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance)
bool ValidateDisabledUModes(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
- memset(conf->DisabledUModes, 0, 64);
+ memset(conf->DisabledUModes, 0, sizeof(conf->DisabledUModes));
for (const unsigned char* p = (const unsigned char*)data.GetString(); *p; ++p)
{
if (*p < 'A' || *p > ('A' + 64)) throw CoreException(std::string("Invalid usermode ")+(char)*p+" was found.");
@@ -312,7 +312,7 @@ bool ValidateDisabledUModes(ServerConfig* conf, const char*, const char*, ValueI
bool ValidateDisabledCModes(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
- memset(conf->DisabledCModes, 0, 64);
+ memset(conf->DisabledCModes, 0, sizeof(conf->DisabledCModes));
for (const unsigned char* p = (const unsigned char*)data.GetString(); *p; ++p)
{
if (*p < 'A' || *p > ('A' + 64)) throw CoreException(std::string("Invalid chanmode ")+(char)*p+" was found.");
@@ -414,7 +414,7 @@ bool ValidateRules(ServerConfig* conf, const char*, const char*, ValueItem &data
bool ValidateModeLists(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
- memset(conf->HideModeLists, 0, 256);
+ memset(conf->HideModeLists, 0, sizeof(conf->HideModeLists));
for (const unsigned char* x = (const unsigned char*)data.GetString(); *x; ++x)
conf->HideModeLists[*x] = true;
return true;
@@ -422,7 +422,7 @@ bool ValidateModeLists(ServerConfig* conf, const char*, const char*, ValueItem &
bool ValidateExemptChanOps(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
- memset(conf->ExemptChanOps, 0, 256);
+ memset(conf->ExemptChanOps, 0, sizeof(conf->ExemptChanOps));
for (const unsigned char* x = (const unsigned char*)data.GetString(); *x; ++x)
conf->ExemptChanOps[*x] = true;
return true;
diff --git a/src/mode.cpp b/src/mode.cpp
index bce2b2019..faa70a29f 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -1221,5 +1221,5 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance)
this->AddMode(modes[index]);
seq = 0;
- memset(&sent, 0, 256);
+ memset(&sent, 0, sizeof(sent));
}
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 23658a9fa..31542befd 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -107,7 +107,7 @@ public:
std::string hmap = Conf.ReadValue("blockcaps", "capsmap", 0);
if (hmap.empty())
hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- memset(&capsmap, 0, 255);
+ memset(capsmap, 0, sizeof(capsmap));
for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
capsmap[(unsigned char)*n] = 1;
if (percent < 1 || percent > 100)
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index b1d9ade7c..ad5a9b562 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -103,7 +103,7 @@ class ModuleChgHost : public Module
if (hmap.empty())
hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789";
- memset(&hostmap, 0, 255);
+ memset(hostmap, 0, sizeof(hostmap));
for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
hostmap[(unsigned char)*n] = 1;
}
diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp
index 42c0ec660..2489f2a1f 100644
--- a/src/modules/m_conn_umodes.cpp
+++ b/src/modules/m_conn_umodes.cpp
@@ -56,7 +56,8 @@ class ModuleModesOnConnect : public Module
// Backup and zero out the disabled usermodes, so that we can override them here.
char save[64];
- memcpy(save, ServerInstance->Config->DisabledUModes, 64);
+ memcpy(save, ServerInstance->Config->DisabledUModes,
+ sizeof(ServerInstance->Config->DisabledUModes));
memset(ServerInstance->Config->DisabledUModes, 0, 64);
for (int j = 0; j < Conf->Enumerate("connect"); j++)
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 3b68e1c94..c4ab5a7e4 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -247,7 +247,7 @@ class ModuleDNSBL : public Module
}
else
{
- memset(e->records, 0, 256);
+ memset(e->records, 0, sizeof(e->records));
e->type = DNSBLConfEntry::A_RECORD;
irc::portparser portrange(MyConf->ReadValue("dnsbl", "records", i), false);
long item = -1;
diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp
index 007a89f09..ab5b23ad1 100644
--- a/src/modules/m_ripemd160.cpp
+++ b/src/modules/m_ripemd160.cpp
@@ -379,7 +379,7 @@ class ModuleRIPEMD160 : public Module
unsigned int i; /* counter */
dword X[16]; /* message words */
- memset(X, 0, 16*sizeof(dword));
+ memset(X, 0, sizeof(X));
/* put bytes from strptr into X */
for (i=0; i<(lswlen&63); i++) {
@@ -393,7 +393,7 @@ class ModuleRIPEMD160 : public Module
if ((lswlen & 63) > 55) {
/* length goes to next block */
compress(MDbuf, X);
- memset(X, 0, 16*sizeof(dword));
+ memset(X, 0, sizeof(X));
}
/* append length in bits*/
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index b84f11acf..fbc71ff2f 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -86,7 +86,7 @@ class ModuleSetHost : public Module
if (hmap.empty())
hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789";
- memset(&hostmap, 0, 255);
+ memset(hostmap, 0, sizeof(hostmap));
for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
hostmap[(unsigned char)*n] = 1;
}
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index b17e266b2..fca32b85b 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -43,7 +43,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha
// For Aligning, we need to work out exactly how deep this thing is, and produce
// a 'Spacer' String to compensate.
char spacer[40];
- memset(spacer,' ',40);
+ memset(spacer,' ',sizeof(spacer));
if ((40 - Current->GetName().length() - depth) > 1) {
spacer[40 - Current->GetName().length() - depth] = '\0';
}
@@ -55,7 +55,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha
float percent;
char text[128];
/* Neat and tidy default values, as we're dealing with a matrix not a simple string */
- memset(text, 0, 128);
+ memset(text, 0, sizeof(text));
if (ServerInstance->Users->clientlist->size() == 0)
{
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp
index 5552cccf6..6b8954412 100644
--- a/src/socketengines/socketengine_epoll.cpp
+++ b/src/socketengines/socketengine_epoll.cpp
@@ -68,7 +68,7 @@ bool EPollEngine::AddFd(EventHandler* eh)
}
struct epoll_event ev;
- memset(&ev,0,sizeof(struct epoll_event));
+ memset(&ev,0,sizeof(ev));
eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
ev.data.fd = fd;
int i = epoll_ctl(EngineHandle, EPOLL_CTL_ADD, fd, &ev);
@@ -91,7 +91,7 @@ void EPollEngine::WantWrite(EventHandler* eh)
* status for us and saves us a call.
*/
struct epoll_event ev;
- memset(&ev,0,sizeof(struct epoll_event));
+ memset(&ev,0,sizeof(ev));
ev.events = EPOLLOUT;
ev.data.fd = eh->GetFd();
epoll_ctl(EngineHandle, EPOLL_CTL_MOD, eh->GetFd(), &ev);
@@ -107,7 +107,7 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force)
}
struct epoll_event ev;
- memset(&ev,0,sizeof(struct epoll_event));
+ memset(&ev,0,sizeof(ev));
eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
ev.data.fd = fd;
int i = epoll_ctl(EngineHandle, EPOLL_CTL_DEL, fd, &ev);
@@ -181,7 +181,7 @@ int EPollEngine::DispatchEvents()
{
WriteEvents++;
struct epoll_event ev;
- memset(&ev,0,sizeof(struct epoll_event));
+ memset(&ev,0,sizeof(ev));
ev.events = EPOLLIN;
ev.data.fd = events[j].data.fd;
epoll_ctl(EngineHandle, EPOLL_CTL_MOD, events[j].data.fd, &ev);