Fix all -Wformat warnings

directional-lights
Lukas Werling 2016-10-31 23:39:27 +01:00
parent 02dffb8af1
commit 9c98227a03
3 changed files with 7 additions and 7 deletions

View File

@ -450,7 +450,7 @@ StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool
StdStrBuf buf; StdStrBuf buf;
auto name = KeycodeToString(wCode); auto name = KeycodeToString(wCode);
if (name) buf.Copy(name); if (name) buf.Copy(name);
if (!buf.getLength()) buf.Format("\\x%x", wCode); if (!buf.getLength()) buf.Format("\\x%lx", wCode);
return buf; return buf;
#endif #endif
return FormatString("$%x", static_cast<unsigned int>(wCode)); return FormatString("$%x", static_cast<unsigned int>(wCode));

View File

@ -1150,7 +1150,7 @@ void C4AulCompiler::CodegenAstVisitor::visit(const ::aul::ast::CallExpr *n)
} }
} }
int fn_argc = C4AUL_MAX_Par; size_t fn_argc = C4AUL_MAX_Par;
if (!n->context) if (!n->context)
{ {
// if this is a function without explicit context, we resolve it // if this is a function without explicit context, we resolve it
@ -1169,7 +1169,7 @@ void C4AulCompiler::CodegenAstVisitor::visit(const ::aul::ast::CallExpr *n)
{ {
// Pop off any args that are over the limit // Pop off any args that are over the limit
Warn(target_host, host, n->args[fn_argc].get(), Fn, Warn(target_host, host, n->args[fn_argc].get(), Fn,
"call to %s passes %d parameters, of which only %d are used", cname, n->args.size(), fn_argc); "call to %s passes %zu parameters, of which only %zu are used", cname, n->args.size(), fn_argc);
AddBCC(n->loc, AB_STACK, fn_argc - n->args.size()); AddBCC(n->loc, AB_STACK, fn_argc - n->args.size());
} }
else if (n->args.size() < fn_argc) else if (n->args.size() < fn_argc)
@ -1249,7 +1249,7 @@ void C4AulCompiler::CodegenAstVisitor::visit(const ::aul::ast::CallExpr *n)
C4V_Type to = expected_par_types[i]; C4V_Type to = expected_par_types[i];
if (C4Value::WarnAboutConversion(from, to)) if (C4Value::WarnAboutConversion(from, to))
{ {
Warn(target_host, host, n->args[i].get(), Fn, "parameter %d of %s is %s (%s expected)", i, cname, GetC4VName(from), GetC4VName(to)); Warn(target_host, host, n->args[i].get(), Fn, "parameter %zu of %s is %s (%s expected)", i, cname, GetC4VName(from), GetC4VName(to));
} }
} }

View File

@ -1103,7 +1103,7 @@ void C4AulParse::Parse_CallParams(::aul::ast::CallExpr *call)
case ATT_COMMA: case ATT_COMMA:
// got no parameter before a "," // got no parameter before a ","
if (Config.Developer.ExtraWarnings) if (Config.Developer.ExtraWarnings)
Warn(FormatString("parameter %d of call to %s is empty", call->args.size(), call->callee.c_str()).getData(), NULL); Warn(FormatString("parameter %zu of call to %s is empty", call->args.size(), call->callee.c_str()).getData(), NULL);
call->args.push_back(::aul::ast::NilLit::New(TokenSPos)); call->args.push_back(::aul::ast::NilLit::New(TokenSPos));
Shift(); Shift();
break; break;
@ -1137,7 +1137,7 @@ std::unique_ptr<::aul::ast::ArrayLit> C4AulParse::Parse_Array()
if (TokenType == ATT_COMMA) if (TokenType == ATT_COMMA)
{ {
if (Config.Developer.ExtraWarnings) if (Config.Developer.ExtraWarnings)
Warn(FormatString("array entry %d is empty", arr->values.size()).getData(), NULL); Warn(FormatString("array entry %zu is empty", arr->values.size()).getData(), NULL);
arr->values.emplace_back(::aul::ast::NilLit::New(TokenSPos)); arr->values.emplace_back(::aul::ast::NilLit::New(TokenSPos));
} }
else else
@ -1149,7 +1149,7 @@ std::unique_ptr<::aul::ast::ArrayLit> C4AulParse::Parse_Array()
if (TokenType == ATT_BCLOSE2) if (TokenType == ATT_BCLOSE2)
{ {
if (Config.Developer.ExtraWarnings) if (Config.Developer.ExtraWarnings)
Warn(FormatString("array entry %d is empty", arr->values.size()).getData(), NULL); Warn(FormatString("array entry %zu is empty", arr->values.size()).getData(), NULL);
arr->values.emplace_back(::aul::ast::NilLit::New(TokenSPos)); arr->values.emplace_back(::aul::ast::NilLit::New(TokenSPos));
} }
} }