summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/configreader.h20
-rw-r--r--include/services.h20
-rw-r--r--lang/langcomp.c192
-rw-r--r--src/datafiles.c2
-rw-r--r--src/init.c2
-rw-r--r--src/misc.c3
-rw-r--r--src/modulemanager.cpp2
-rw-r--r--src/modules.c3
-rw-r--r--src/modules/cs_enforce.c6
-rw-r--r--src/operserv.c3
-rw-r--r--src/protocol/inspircd11.c20
-rw-r--r--src/protocol/inspircd12.cpp18
-rw-r--r--src/sessions.c2
-rw-r--r--src/sockutil.c4
14 files changed, 136 insertions, 161 deletions
diff --git a/include/configreader.h b/include/configreader.h
index d7786e11d..0cd1bf362 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -282,9 +282,6 @@ class ServerConfig
* recursively included.
*/
std::vector<std::string> include_stack;
- /** Process an include directive
- */
- bool DoInclude(ConfigDataHash &, const std::string &, std::ostringstream &);
/** Check that there is only one of each configuration item
*/
bool CheckOnce(const char *);
@@ -381,31 +378,20 @@ class ServerConfig
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/
-class ConfigException : public std::exception
+class ConfigException : public CoreException
{
- protected:
- /** Holds the error message to be displayed
- */
- const std::string err;
public:
/** Default constructor, just uses the error mesage 'Config threw an exception'.
*/
- ConfigException() : err("Config threw an exception") { }
+ ConfigException() : CoreException("Config threw an exception", "Config Parser") {}
/** This constructor can be used to specify an error message before throwing.
*/
- ConfigException(const std::string &message) : err(message) {}
+ ConfigException(const std::string &message) : CoreException(message, "Config Parser") {}
/** This destructor solves world hunger, cancels the world debt, and causes the world to end.
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
virtual ~ConfigException() throw() { };
- /** Returns the reason for the exception.
- * The module should probably put something informative here as the user will see this upon failure.
- */
- virtual const char *GetReason()
- {
- return err.c_str();
- }
};
#define CONF_NO_ERROR 0x000000
diff --git a/include/services.h b/include/services.h
index 7d504e3a2..d27fc5f52 100644
--- a/include/services.h
+++ b/include/services.h
@@ -198,11 +198,11 @@ extern int strncasecmp(const char *, const char *, size_t);
#ifdef _WIN32
#define MODULE_INIT(x, y) \
extern "C" DllExport Module *init_module(const std::string &, const std::string &); \
- extern "C" Module *init_module(const std::string &modname, const std::string &creator) \
+ extern "C" Module *init_module(const std::string &, const std::string &creator) \
{ \
return new y(x, creator); \
} \
- BOOLEAN WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved) \
+ BOOLEAN WINAPI DllMain(HINSTANCE, DWORD nReason, LPVOID) \
{ \
switch ( nReason ) \
{ \
@@ -220,7 +220,7 @@ extern int strncasecmp(const char *, const char *, size_t);
#else
#define MODULE_INIT(x, y) \
- extern "C" DllExport Module *init_module(const std::string &modname, const std::string &creator) \
+ extern "C" DllExport Module *init_module(const std::string &, const std::string &creator) \
{ \
return new y(x, creator); \
} \
@@ -253,10 +253,10 @@ class CoreExport CoreException : public std::exception
protected:
/** Holds the error message to be displayed
*/
- const std::string err;
+ std::string err;
/** Source of the exception
*/
- const std::string source;
+ std::string source;
public:
/** Default constructor, just uses the error mesage 'Core threw an exception'.
*/
@@ -272,16 +272,16 @@ class CoreExport CoreException : public std::exception
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
- virtual ~CoreException() throw() {};
+ virtual ~CoreException() throw() {}
/** Returns the reason for the exception.
* The module should probably put something informative here as the user will see this upon failure.
*/
- virtual const char* GetReason()
+ virtual const char* GetReason() const
{
return err.c_str();
}
- virtual const char* GetSource()
+ virtual const char* GetSource() const
{
return source.c_str();
}
@@ -301,7 +301,7 @@ class CoreExport ModuleException : public CoreException
* Actually no, it does nothing. Never mind.
* @throws Nothing!
*/
- virtual ~ModuleException() throw() {};
+ virtual ~ModuleException() throw() {}
};
/** Class with the ability to be extended with key:value pairs.
@@ -1405,7 +1405,7 @@ private:
* Thanks.
* -- w00t
*/
- virtual void SendQuit(const char *nick, const char *buf) MARK_DEPRECATED
+ virtual void SendQuit(const char *nick, const char *) MARK_DEPRECATED
{
send_cmd(nick, "QUIT");
}
diff --git a/lang/langcomp.c b/lang/langcomp.c
index 773702ba7..f32a1b2e5 100644
--- a/lang/langcomp.c
+++ b/lang/langcomp.c
@@ -71,28 +71,28 @@ int read_index_file()
int i;
if (!(f = fopen("index", "rb"))) {
- perror("fopen(index)");
- return -1;
+ perror("fopen(index)");
+ return -1;
}
while (fgets(buf, sizeof(buf), f))
- numstrings++;
- if (!(stringnames = (char **)calloc(sizeof(char *), numstrings))) {
- perror("calloc(stringnames)");
- return -1;
+ numstrings++;
+ if (!(stringnames = static_cast<char **>(calloc(sizeof(char *), numstrings)))) {
+ perror("calloc(stringnames)");
+ return -1;
}
- if (!(strings = (char **)calloc(sizeof(char *), numstrings))) {
- perror("calloc(strings)");
- return -1;
+ if (!(strings = static_cast<char **>(calloc(sizeof(char *), numstrings)))) {
+ perror("calloc(strings)");
+ return -1;
}
fseek(f, 0, SEEK_SET);
i = 0;
while (fgets(buf, sizeof(buf), f)) {
- if (buf[strlen(buf)-1] == '\n')
- buf[strlen(buf)-1] = '\0';
- if (!(stringnames[i++] = anopeStrDup(buf))) {
- perror("strdup()");
- return -1;
- }
+ if (buf[strlen(buf) - 1] == '\n')
+ buf[strlen(buf) -1] = '\0';
+ if (!(stringnames[i++] = anopeStrDup(buf))) {
+ perror("strdup()");
+ return -1;
+ }
}
fclose(f);
return 0;
@@ -107,8 +107,8 @@ int stringnum(const char *name)
int i;
for (i = 0; i < numstrings; i++) {
- if (strcmp(stringnames[i], name) == 0)
- return i;
+ if (strcmp(stringnames[i], name) == 0)
+ return i;
}
return -1;
}
@@ -124,13 +124,13 @@ char *ano_getline(FILE *f)
char *s;
do {
- if (!(fgets(buf, sizeof(buf), f)))
- return NULL;
- linenum++;
+ if (!(fgets(buf, sizeof(buf), f)))
+ return NULL;
+ linenum++;
} while (*buf == '#' || *buf == '\n');
- s = buf + strlen(buf)-1;
+ s = buf + strlen(buf) - 1;
if (*s == '\n')
- *s = '\0';
+ *s = '\0';
return buf;
}
@@ -140,22 +140,24 @@ char *ano_getline(FILE *f)
int fput32(int val, FILE *f)
{
- if (fputc(val>>24, f) < 0 ||
- fputc(val>>16, f) < 0 ||
- fputc(val>> 8, f) < 0 ||
- fputc(val , f) < 0
+ if (fputc(val >> 24, f) < 0 ||
+ fputc(val >> 16, f) < 0 ||
+ fputc(val >> 8, f) < 0 ||
+ fputc(val, f) < 0
) {
- return -1;
+ return -1;
} else {
- return 0;
+ return 0;
}
}
/*************************************************************************/
-char *anopeStrDup(const char *src) {
+
+char *anopeStrDup(const char *src)
+{
char *ret=NULL;
- if(src) {
- if( (ret = (char *)malloc(strlen(src)+1)) ) {;
+ if (src) {
+ if ((ret = static_cast<char *>(malloc(strlen(src) + 1)))) {
strcpy(ret,src);
}
}
@@ -163,10 +165,10 @@ char *anopeStrDup(const char *src) {
}
/*************************************************************************/
+
int main(int ac, char **av)
{
- char *filename = NULL, *s, *outfile;
- //char langname[254], outfile[256];
+ char *filename = NULL, *outfile;
FILE *in, *out;
int warn = 0;
int retval = 0;
@@ -175,97 +177,83 @@ int main(int ac, char **av)
int pos;
int maxerr = 50; /* Max errors before we bail out */
- if (ac >= 3 && strcmp(av[2], "-w") == 0) {
- warn = 1;
- av[2] = av[3];
- ac--;
+ if (ac >= 3 && strcmp(av[1], "-w") == 0) {
+ warn = 1;
+ av[1] = av[2];
+ av[2] = av[3];
+ ac--;
}
if (ac != 3) {
- fprintf(stderr, "Usage: %s [-w] <lang-file> <out-file>\n", av[0]);
- return 1;
+ fprintf(stderr, "Usage: %s [-w] <lang-file> <out-file>\n", av[0]);
+ return 1;
}
filename = av[1];
- /*s = strrchr(filename, '.');
- if (!s)
- s = filename + strlen(filename);
- if (s-filename > (int)sizeof(langname)-3)
- s = filename + sizeof(langname)-1;
- strncpy(langname, filename, s-filename);
- langname[s-filename] = '\0';
- snprintf(outfile, sizeof(outfile), "%s", langname);*/
outfile = av[2];
if (read_index_file() < 0)
- return 1;
+ return 1;
if (!(in = fopen(filename, "rb"))) {
- perror(filename);
- return 1;
+ perror(filename);
+ return 1;
}
if (!(out = fopen(outfile, "wb"))) {
- perror(outfile);
- return 1;
+ perror(outfile);
+ return 1;
}
while (maxerr > 0 && (line = ano_getline(in)) != NULL) {
- if (*line == '\t') {
- if (curstring == -2) {
- fprintf(stderr, "%s:%d: Junk at beginning of file\n",
- filename, linenum);
- retval = 1;
- } else if (curstring >= 0) {
- line++;
- i = strings[curstring] ? strlen(strings[curstring]) : 0;
- if (!(strings[curstring] =
- (char *)realloc(strings[curstring], i+strlen(line)+2))) {
- fprintf(stderr, "%s:%d: Out of memory!\n",filename,linenum);
- return 2;
- }
- sprintf(strings[curstring]+i, "%s\n", line);
- }
- } else {
-
- if ((curstring = stringnum(line)) < 0) {
- fprintf(stderr, "%s:%d: Unknown string name `%s'\n",
- filename, linenum, line);
- retval = 1;
- maxerr--;
- } else if (strings[curstring]) {
- fprintf(stderr, "%s:%d: Duplicate occurrence of string `%s'\n",
- filename, linenum, line);
- retval = 1;
- maxerr--;
+ if (*line == '\t') {
+ if (curstring == -2) {
+ fprintf(stderr, "%s:%d: Junk at beginning of file\n", filename, linenum);
+ retval = 1;
+ } else if (curstring >= 0) {
+ line++;
+ i = strings[curstring] ? strlen(strings[curstring]) : 0;
+ if (!(strings[curstring] = static_cast<char *>(realloc(strings[curstring], i + strlen(line) + 2)))) {
+ fprintf(stderr, "%s:%d: Out of memory!\n", filename, linenum);
+ return 2;
+ }
+ sprintf(strings[curstring] + i, "%s\n", line);
+ }
} else {
- if (!(strings[curstring] = (char *)malloc(1))) {
- fprintf(stderr, "%s:%d: Out of memory!\n",filename,linenum);
- return 2;
+ if ((curstring = stringnum(line)) < 0) {
+ fprintf(stderr, "%s:%d: Unknown string name `%s'\n", filename, linenum, line);
+ retval = 1;
+ maxerr--;
+ } else if (strings[curstring]) {
+ fprintf(stderr, "%s:%d: Duplicate occurrence of string `%s'\n", filename, linenum, line);
+ retval = 1;
+ maxerr--;
+ } else {
+ if (!(strings[curstring] = static_cast<char *>(malloc(1)))) {
+ fprintf(stderr, "%s:%d: Out of memory!\n", filename, linenum);
+ return 2;
+ }
+ *strings[curstring] = '\0';
+ }
+
+ if (maxerr == 0)
+ fprintf(stderr, "%s:%d: Too many errors!\n", filename, linenum);
}
- *strings[curstring] = '\0';
- }
-
- if (maxerr == 0)
- fprintf(stderr, "%s:%d: Too many errors!\n", filename, linenum);
-
- }
}
fput32(numstrings, out);
pos = numstrings * 8 + 4;
for (i = 0; i < numstrings; i++) {
- int len = strings[i] && *strings[i] ? strlen(strings[i])-1 : 0;
- fput32(pos, out);
- fput32(len, out);
- pos += len;
+ int len = strings[i] && *strings[i] ? strlen(strings[i]) - 1 : 0;
+ fput32(pos, out);
+ fput32(len, out);
+ pos += len;
}
for (i = 0; i < numstrings; i++) {
- if (strings[i]) {
- if (*strings[i])
- strings[i][strlen(strings[i])-1] = '\0'; /* kill last \n */
- if (*strings[i])
- fputs(strings[i], out);
- } else if (warn) {
- fprintf(stderr, "%s: String `%s' missing\n", filename,
- stringnames[i]);
- }
+ if (strings[i]) {
+ if (*strings[i])
+ strings[i][strlen(strings[i])-1] = '\0'; /* kill last \n */
+ if (*strings[i])
+ fputs(strings[i], out);
+ } else if (warn) {
+ fprintf(stderr, "%s: String `%s' missing\n", filename, stringnames[i]);
+ }
}
fclose(in);
diff --git a/src/datafiles.c b/src/datafiles.c
index 5c6d3f606..d7aaef736 100644
--- a/src/datafiles.c
+++ b/src/datafiles.c
@@ -186,7 +186,7 @@ static dbFILE *open_db_write(const char *service, const char *filename,
#ifdef _WIN32
if (debug) {
if (errno == ENOENT) {
- alog("debug: Error %d (ENOENT) : the file or directory does not exist", errno, filename);
+ alog("debug: Error %d (ENOENT) : the file or directory does not exist", errno);
} else if (errno == EACCES) {
alog("debug: Error %d (EACCES) : error while attempting to access file", errno);
} else {
diff --git a/src/init.c b/src/init.c
index 28e2dade3..499bede64 100644
--- a/src/init.c
+++ b/src/init.c
@@ -387,8 +387,10 @@ int init_primary(int ac, char **av)
int init_secondary(int ac, char **av)
{
+#ifndef _WIN32
int i;
int started_from_term = isatty(0) && isatty(1) && isatty(2);
+#endif
/* Add Core MSG handles */
moduleAddMsgs();
diff --git a/src/misc.c b/src/misc.c
index 5e6f4a4b8..75ed59a30 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -951,9 +951,8 @@ static void arc4_addrandom(void *dat, int datlen)
*/
void rand_init()
{
- int n;
#ifndef _WIN32
- int fd;
+ int n, fd;
#endif
struct {
#ifdef USE_MYSQL
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index cfbcc9794..672af7bbc 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -38,7 +38,9 @@ static int moduleCopyFile(const char *name, const char *output)
{
int ch;
FILE *source, *target;
+#ifndef _WIN32
int srcfp;
+#endif
char input[4096];
int len;
diff --git a/src/modules.c b/src/modules.c
index 0d7bd199b..48a01c43a 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -1233,7 +1233,6 @@ void ModuleRunTimeDirCleanUp()
BOOL fFinished;
HANDLE hList;
TCHAR szDir[MAX_PATH + 1];
- TCHAR szSubDir[MAX_PATH + 1];
WIN32_FIND_DATA FileData;
char buffer[_MAX_PATH];
#endif
@@ -1294,7 +1293,7 @@ void ModuleRunTimeDirCleanUp()
}
} else {
if (debug) {
- alog("debug: Invalid File Handle. GetLastError reports %d\n", GetLastError());
+ alog("debug: Invalid File Handle. GetLastError reports %d\n", static_cast<int>(GetLastError()));
}
}
FindClose(hList);
diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c
index aa5b6be42..e20f3ee91 100644
--- a/src/modules/cs_enforce.c
+++ b/src/modules/cs_enforce.c
@@ -363,7 +363,7 @@ void do_enforce_cmode_R(Channel * c)
if (!nick_identified(u)) {
get_idealban(ci, u, mask, sizeof(mask));
reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN);
- if (((cbm = &cbmodes['R'])->flag == 0)
+ if (((cbm = &cbmodes[static_cast<int>('R')])->flag == 0)
|| !(c->mode & cbm->flag))
ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask,
time(NULL));
@@ -395,7 +395,7 @@ void do_enforce_modes(Channel * c)
{
CBMode *cbm;
- if (((cbm = &cbmodes['R'])->flag != 0) && (c->mode & cbm->flag))
+ if (((cbm = &cbmodes[static_cast<int>('R')])->flag != 0) && (c->mode & cbm->flag))
do_enforce_cmode_R(c);
}
@@ -462,7 +462,7 @@ int my_cs_help_enforce(User * u)
ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " ");
me->NoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE);
ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " ");
- if (cbmodes['R'].flag != 0)
+ if (cbmodes[static_cast<int>('R')].flag != 0)
me->NoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_ENABLED);
else
me->NoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_DISABLED);
diff --git a/src/operserv.c b/src/operserv.c
index 2fcf4b139..54f0988a6 100644
--- a/src/operserv.c
+++ b/src/operserv.c
@@ -153,9 +153,8 @@ void load_os_dbase()
{
dbFILE *f;
int16 i, ver;
- uint16 tmp16, n;
+ uint16 tmp16;
uint32 tmp32;
- char *s;
int failed = 0;
if (!(f = open_db(s_OperServ, OperDBName, "r", OPER_VERSION)))
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index 14c6254a8..1b38286d5 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -499,7 +499,7 @@ class InspIRCdProto : public IRCDProto
void SendVhostDel(User *u)
{
- inspircd_cmd_chghost(u->nick, (u->mode & umodes['x']) ? u->chost.c_str() : u->host);
+ inspircd_cmd_chghost(u->nick, (u->mode & umodes[static_cast<int>('x')]) ? u->chost.c_str() : u->host);
}
void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason)
@@ -629,7 +629,7 @@ class InspIRCdProto : public IRCDProto
/* SVSHOLD - set */
void SendSVSHold(const char *nick)
{
- send_cmd(s_OperServ, "SVSHOLD %s %ds :%s", nick, NSReleaseTimeout, "Being held for registered user");
+ send_cmd(s_OperServ, "SVSHOLD %s %ds :%s", nick, static_cast<int>(NSReleaseTimeout), "Being held for registered user");
}
/* SVSHOLD - release */
@@ -1231,10 +1231,10 @@ int anope_event_capab(const char *source, int ac, const char **av)
cbmi->getvalue = get_flood;
cbmi->csgetvalue = cs_get_flood;
- myCbmodes['f'].flag = CMODE_f;
- myCbmodes['f'].flags = 0;
- myCbmodes['f'].setvalue = set_flood;
- myCbmodes['f'].cssetvalue = cs_set_flood;
+ myCbmodes[static_cast<int>('f')].flag = CMODE_f;
+ myCbmodes[static_cast<int>('f')].flags = 0;
+ myCbmodes[static_cast<int>('f')].setvalue = set_flood;
+ myCbmodes[static_cast<int>('f')].cssetvalue = cs_set_flood;
pmodule_ircd_cbmodeinfos(myCbmodeinfos);
pmodule_ircd_cbmodes(myCbmodes);
@@ -1249,13 +1249,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
}
if (has_banexceptionmod) {
- myCmmodes['e'].addmask = add_exception;
- myCmmodes['e'].delmask = del_exception;
+ myCmmodes[static_cast<int>('e')].addmask = add_exception;
+ myCmmodes[static_cast<int>('e')].delmask = del_exception;
ircd->except = 1;
}
if (has_inviteexceptionmod) {
- myCmmodes['I'].addmask = add_invite;
- myCmmodes['I'].delmask = del_invite;
+ myCmmodes[static_cast<int>('I')].addmask = add_invite;
+ myCmmodes[static_cast<int>('I')].delmask = del_invite;
ircd->invitemode = 1;
}
ircd->svshold = has_svsholdmod;
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp
index d21b5691c..e02ece0f3 100644
--- a/src/protocol/inspircd12.cpp
+++ b/src/protocol/inspircd12.cpp
@@ -498,7 +498,7 @@ class InspIRCdProto : public IRCDProto
void SendVhostDel(User *u)
{
- inspircd_cmd_chghost(u->uid, (u->mode & umodes['x']) ? u->chost.c_str() : u->host);
+ inspircd_cmd_chghost(u->uid, (u->mode & umodes[static_cast<int>('x')]) ? u->chost.c_str() : u->host);
}
void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason)
@@ -1251,10 +1251,10 @@ int anope_event_capab(const char *source, int ac, const char **av)
cbmi->getvalue = get_flood;
cbmi->csgetvalue = cs_get_flood;
- myCbmodes['f'].flag = CMODE_f;
- myCbmodes['f'].flags = 0;
- myCbmodes['f'].setvalue = set_flood;
- myCbmodes['f'].cssetvalue = cs_set_flood;
+ myCbmodes[static_cast<int>('f')].flag = CMODE_f;
+ myCbmodes[static_cast<int>('f')].flags = 0;
+ myCbmodes[static_cast<int>('f')].setvalue = set_flood;
+ myCbmodes[static_cast<int>('f')].cssetvalue = cs_set_flood;
pmodule_ircd_cbmodeinfos(myCbmodeinfos);
pmodule_ircd_cbmodes(myCbmodes);
@@ -1269,13 +1269,13 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
}
if (has_banexceptionmod) {
- myCmmodes['e'].addmask = add_exception;
- myCmmodes['e'].delmask = del_exception;
+ myCmmodes[static_cast<int>('e')].addmask = add_exception;
+ myCmmodes[static_cast<int>('e')].delmask = del_exception;
ircd->except = 1;
}
if (has_inviteexceptionmod) {
- myCmmodes['I'].addmask = add_invite;
- myCmmodes['I'].delmask = del_invite;
+ myCmmodes[static_cast<int>('I')].addmask = add_invite;
+ myCmmodes[static_cast<int>('I')].delmask = del_invite;
ircd->invitemode = 1;
}
ircd->svshold = has_svsholdmod;
diff --git a/src/sessions.c b/src/sessions.c
index f598d616d..69863382a 100644
--- a/src/sessions.c
+++ b/src/sessions.c
@@ -465,7 +465,7 @@ void save_exceptions()
SAFE(write_int16(nexceptions, f));
for (i = 0; i < nexceptions; i++) {
SAFE(write_string(exceptions[i].mask, f));
- SAFE(write_int16(exceptions[i].limit, f));
+ SAFE(write_int16(static_cast<uint16>(exceptions[i].limit), f));
SAFE(write_buffer(exceptions[i].who, f));
SAFE(write_string(exceptions[i].reason, f));
SAFE(write_int32(exceptions[i].time, f));
diff --git a/src/sockutil.c b/src/sockutil.c
index 772b4aacc..683ffbef9 100644
--- a/src/sockutil.c
+++ b/src/sockutil.c
@@ -431,7 +431,7 @@ char *sgets(char *buf, int len, ano_socket_t s)
if (read_buffer_len() == 0 && c == 0)
return reinterpret_cast<char *>(-1);
c = sgetc(s);
- while (--len && (*ptr++ = c) != '\n' && (c = sgetc(s)) >= 0);
+ while (--len && (*ptr++ = static_cast<char>(c)) != '\n' && (c = sgetc(s)) >= 0);
if (c < 0)
return NULL;
*ptr = 0;
@@ -532,7 +532,7 @@ static char *pack_ip(const char *ipaddr)
for (i = 0; i < 4; i++) {
if (tmp[i] < 0 || tmp[i] > 255)
return NULL;
- ipbuf[i] = tmp[i];
+ ipbuf[i] = static_cast<char>(tmp[i]);
}
return ipbuf;
}