Fix various warnings, including one reported by Adam: possible crash in aliases (introduced 1-2wks ago)

This commit is contained in:
Bram Matthys 2015-06-07 22:07:00 +02:00
parent 0a1ce10e2f
commit e1b7c34c96
4 changed files with 8 additions and 5 deletions

View file

@ -763,3 +763,4 @@ extern void unreal_delete_masks(ConfigItem_mask *m);
extern void unreal_add_masks(ConfigItem_mask **head, ConfigEntry *ce);
extern int unreal_mask_match(aClient *acptr, ConfigItem_mask *m);
extern char *our_strcasestr(char *haystack, char *needle);
extern void update_conf(void);

View file

@ -481,7 +481,7 @@ aMatch *unreal_create_match(MatchType type, char *str, char **error)
if (error)
{
if (erroroffset > 0)
snprintf(errorbuf, sizeof(errorbuf), "%s (at character #%d)", buf2, erroroffset);
snprintf(errorbuf, sizeof(errorbuf), "%s (at character #%d)", buf2, (int)erroroffset);
else
strlcpy(errorbuf, buf2, sizeof(errorbuf));
*error = errorbuf;
@ -553,6 +553,8 @@ int unreal_match(aMatch *m, char *str)
return 0;
}
#endif
return 0;
}
int unreal_match_method_strtoval(char *str)

View file

@ -313,7 +313,7 @@ int ret;
ptr = parv[1];
for (format = alias->format; format; format = (ConfigItem_alias_format *)format->next)
{
if (regexec(&format->expr, ptr, 0, NULL, 0) == 0)
if (unreal_match(format->expr, ptr))
{
/* Parse the parameters */
int i = 0, j = 0, k = 1;

View file

@ -752,7 +752,7 @@ int upgrade_allow(ConfigEntry *ce)
return 1;
}
int update_conf_file()
int update_conf_file(void)
{
ConfigFile *cf = NULL;
ConfigEntry *ce = NULL, *cep, *cepp;
@ -914,7 +914,7 @@ ConfigFile *build_include_list(char *fname)
return cf_list;
}
void update_conf()
void update_conf(void)
{
ConfigFile *cf;
ConfigEntry *ce, *cep, *cepp;
@ -937,7 +937,7 @@ void update_conf()
config_error("Could not create temp file for processing!");
die();
}
if (update_conf_file(cf->cf_filename))
if (update_conf_file())
{
char buf[512];
snprintf(buf, sizeof(buf), "%s.old", configfile);