Fixed a few compiler warnings on clang (#3263)

Mostly pointer-bool-conversion and autological-pointer-compare
This commit is contained in:
Lemongrass3110
2018-07-05 22:53:20 +02:00
committed by GitHub
parent 532e043490
commit 91169d7ebc
16 changed files with 55 additions and 79 deletions

View File

@@ -2354,8 +2354,8 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
}
if( (dnd=npc_name2id(nd->exname)) != NULL ) {// duplicate unique name, generate new one
char this_mapname[32];
char other_mapname[32];
char this_mapname[MAP_NAME_LENGTH_EXT];
char other_mapname[MAP_NAME_LENGTH_EXT];
int i = 0;
do {
@@ -3935,11 +3935,11 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
{
int16 m;
char mapname[32];
char mapname[MAP_NAME_LENGTH_EXT];
int state = 1;
// w1=<mapname>
if( sscanf(w1, "%31[^,]", mapname) != 1 )
if( sscanf(w1, "%15[^,]", mapname) != 1 )
{
ShowError("npc_parse_mapflag: Invalid mapflag definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return strchr(start,'\n');// skip and continue
@@ -4367,10 +4367,10 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit)
if( strcmp(w1,"-") !=0 && strcasecmp(w1,"function") != 0 )
{// w1 = <map name>,<x>,<y>,<facing>
char mapname[MAP_NAME_LENGTH*2]; // TODO: Check why this does not use MAP_NAME_LENGTH_EXT
char mapname[MAP_NAME_LENGTH_EXT];
int count2;
count2 = sscanf(w1,"%23[^,],%6hd,%6hd[^,]",mapname,&x,&y);
count2 = sscanf(w1,"%15[^,],%6hd,%6hd[^,]",mapname,&x,&y);
if ( count2 < 1 ) {
ShowError("npc_parsesrcfile: Invalid script definition in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,p-buffer), w1, w2, w3, w4);