mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-03-10 11:11:51 +00:00
- fixed comparison checks.
This commit is contained in:
parent
3563c99ead
commit
ef0e9c025e
1 changed files with 6 additions and 6 deletions
|
@ -3358,15 +3358,15 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx)
|
||||||
auto val = static_cast<FxConstant*>(left)->GetValue().GetUInt();
|
auto val = static_cast<FxConstant*>(left)->GetValue().GetUInt();
|
||||||
if (val > INT_MAX)
|
if (val > INT_MAX)
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_WARNING, "Comparison with out of range unsigned constant");
|
ScriptPosition.Message(MSG_WARNING, "Comparison of signed value with out of range unsigned constant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (right->isConstant() && !left->isConstant())
|
else if (right->isConstant() && !left->isConstant())
|
||||||
{
|
{
|
||||||
auto val = static_cast<FxConstant*>(right)->GetValue().GetInt();
|
auto val = static_cast<FxConstant*>(right)->GetValue().GetInt();
|
||||||
if (val > INT_MAX)
|
if (val < 0)
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_WARNING, "Comparison with out of range signed constant");
|
ScriptPosition.Message(MSG_WARNING, "Comparison of unsigned value with negative constant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!left->isConstant() && !right->isConstant())
|
else if (!left->isConstant() && !right->isConstant())
|
||||||
|
@ -3379,9 +3379,9 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx)
|
||||||
if (left->isConstant() && !right->isConstant())
|
if (left->isConstant() && !right->isConstant())
|
||||||
{
|
{
|
||||||
auto val = static_cast<FxConstant*>(left)->GetValue().GetInt();
|
auto val = static_cast<FxConstant*>(left)->GetValue().GetInt();
|
||||||
if (val > INT_MAX)
|
if (val < 0)
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_WARNING, "Comparison with out of range signed constant");
|
ScriptPosition.Message(MSG_WARNING, "Comparison of unsigned value with negative constant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (right->isConstant() && !left->isConstant())
|
else if (right->isConstant() && !left->isConstant())
|
||||||
|
@ -3389,7 +3389,7 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx)
|
||||||
auto val = static_cast<FxConstant*>(right)->GetValue().GetUInt();
|
auto val = static_cast<FxConstant*>(right)->GetValue().GetUInt();
|
||||||
if (val > INT_MAX)
|
if (val > INT_MAX)
|
||||||
{
|
{
|
||||||
ScriptPosition.Message(MSG_WARNING, "Comparison with out of range unsigned constant");
|
ScriptPosition.Message(MSG_WARNING, "Comparison of signed value with out of range unsigned constant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!left->isConstant() && !right->isConstant())
|
else if (!left->isConstant() && !right->isConstant())
|
||||||
|
|
Loading…
Reference in a new issue