Fixed most of warnings reported by Clang

src/scripting/zscript/zcc_compile.cpp: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
src/p_acs.cpp: warning: format specifies type 'char *' but the argument has type 'PClass *' [-Wformat]
This commit is contained in:
alexey.lysiuk 2017-03-04 12:17:53 +02:00
parent 8a1e0ee4b5
commit d8cee4d3a5
2 changed files with 10 additions and 10 deletions

View File

@ -4765,24 +4765,24 @@ static int ScriptCall(unsigned argc, int32_t *args)
auto cls = PClass::FindClass(clsname);
if (!cls)
{
I_Error("ACS call to unknown class in script function %s.%s", cls, funcname);
I_Error("ACS call to unknown class in script function %s.%s", clsname, funcname);
}
auto funcsym = dyn_cast<PFunction>(cls->Symbols.FindSymbol(funcname, true));
if (funcsym == nullptr)
{
I_Error("ACS call to unknown script function %s.%s", cls, funcname);
I_Error("ACS call to unknown script function %s.%s", clsname, funcname);
}
auto func = funcsym->Variants[0].Implementation;
if (func->ImplicitArgs > 0)
{
I_Error("ACS call to non-static script function %s.%s", cls, funcname);
I_Error("ACS call to non-static script function %s.%s", clsname, funcname);
}
TArray<VMValue> params;
for (unsigned i = 2; i < argc; i++)
{
if (func->Proto->ArgumentTypes.Size() < i - 1)
{
I_Error("Too many parameters in call to %s.%s", cls, funcname);
I_Error("Too many parameters in call to %s.%s", clsname, funcname);
}
auto argtype = func->Proto->ArgumentTypes[i - 2];
// The only types allowed are int, bool, double, Name, Sound, Color and String
@ -4812,7 +4812,7 @@ static int ScriptCall(unsigned argc, int32_t *args)
}
else
{
I_Error("Invalid type %s in call to %s.%s", argtype->DescriptiveName(), cls, funcname);
I_Error("Invalid type %s in call to %s.%s", argtype->DescriptiveName(), clsname, funcname);
}
}
if (func->Proto->ArgumentTypes.Size() > params.Size())
@ -4820,7 +4820,7 @@ static int ScriptCall(unsigned argc, int32_t *args)
// Check if we got enough parameters. That means we either cover the full argument list of the function or the next argument is optional.
if (!(funcsym->Variants[0].ArgFlags[params.Size()] & VARF_Optional))
{
I_Error("Insufficient parameters in call to %s.%s", cls, funcname);
I_Error("Insufficient parameters in call to %s.%s", clsname, funcname);
}
}
// The return value can be the same types as the parameter types, plus void

View File

@ -613,7 +613,7 @@ void ZCCCompiler::CreateClassTypes()
//
static int incompatible[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope };
int incompatiblecnt = 0;
for (int k = 0; k < countof(incompatible); k++)
for (size_t k = 0; k < countof(incompatible); k++)
if (incompatible[k] & c->cls->Flags) incompatiblecnt++;
if (incompatiblecnt > 1)
@ -1117,7 +1117,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope };
int excludeflags = 0;
int fc = 0;
for (int i = 0; i < countof(excludescope); i++)
for (size_t i = 0; i < countof(excludescope); i++)
{
if (field->Flags & excludescope[i])
{
@ -2176,7 +2176,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
static int exclude[] = { ZCC_Virtual, ZCC_Override, ZCC_Action, ZCC_Static };
int excludeflags = 0;
int fc = 0;
for (int i = 0; i < countof(exclude); i++)
for (size_t i = 0; i < countof(exclude); i++)
{
if (f->Flags & exclude[i])
{
@ -2213,7 +2213,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
static int excludescope[] = { ZCC_UIFlag, ZCC_Play, ZCC_ClearScope, ZCC_VirtualScope };
excludeflags = 0;
fc = 0;
for (int i = 0; i < countof(excludescope); i++)
for (size_t i = 0; i < countof(excludescope); i++)
{
if (f->Flags & excludescope[i])
{