#include <cmath>
#include <cstring>
#include <climits>
+
+#include <sstream>
#include <string>
#include <vector>
#include <deque>
maxbans = topicset = limit = 0;
- memset(&modes, 0, 64);
+ modes.reset();
}
void Channel::SetMode(char mode,bool mode_on)
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.");
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.");
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;
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;
this->AddMode(modes[index]);
seq = 0;
- memset(&sent, 0, 256);
+ memset(&sent, 0, sizeof(sent));
}
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)
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;
}
// 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++)
}
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;
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++) {
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*/
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;
}
// 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';
}
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)
{
}
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);
* 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);
}
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);
{
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);