cppcheck warning fixes, including a real fix for bad iterator code.

master
Per Inge Mathisen 2011-12-12 23:37:31 +01:00
parent 529e28530d
commit d35b8b4111
3 changed files with 10 additions and 11 deletions

View File

@ -1266,16 +1266,15 @@ void intDisplayPIEView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL
MESSAGE *psMessage = (MESSAGE *)Form->pUserData;
UDWORD x0,y0,x1,y1;
SWORD image = -1;
RESEARCH *psResearch;
RESEARCH *psResearch;
//shouldn't have any proximity messages here...
if (psMessage->type == MSG_PROXIMITY)
// Should not have any proximity messages here...
if (!psMessage || psMessage->type == MSG_PROXIMITY)
{
return;
}
if (psMessage && psMessage->pViewData)
if (psMessage->pViewData)
{
x0 = xOffset+Form->x;
y0 = yOffset+Form->y;
@ -1321,12 +1320,12 @@ void intDisplayFLICView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DEC
VIEW_RESEARCH *psViewResearch;
//shouldn't have any proximity messages here...
if (psMessage->type == MSG_PROXIMITY)
if (!psMessage || psMessage->type == MSG_PROXIMITY)
{
return;
}
if (psMessage && psMessage->pViewData)
if (psMessage->pViewData)
{
OpenButtonRender((UWORD)(xOffset+Form->x), (UWORD)(yOffset+Form->y),
Form->width, Form->height);
@ -1350,7 +1349,6 @@ void intDisplayFLICView(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DEC
seq_RenderVideoToBuffer(psViewResearch->sequenceName, SEQUENCE_HOLD);
CloseButtonRender();
}
}
#endif

View File

@ -650,7 +650,7 @@ bool recvStructureCheck(NETQUEUE queue)
buildStructure(&asStructureStats[j], pS->pos.x, pS->pos.y, pS->player, false);
// Check it is finished
if (pS && pS->status != SS_BUILT)
if (pS->status != SS_BUILT)
{
pS->id = ref;
pS->status = SS_BUILT;

View File

@ -176,7 +176,8 @@ static QScriptValue js_queue(QScriptContext *context, QScriptEngine *engine)
void scriptRemoveObject(const BASE_OBJECT *psObj)
{
for (QHash<int, bindNode>::iterator i = bindings.find(psObj->id); i != bindings.end(); i++)
QHash<int, bindNode>::iterator i = bindings.find(psObj->id);
while (i != bindings.end() && i.key() == psObj->id)
{
int id = i.key();
bindNode node = i.value();
@ -187,7 +188,7 @@ void scriptRemoveObject(const BASE_OBJECT *psObj)
args += convMax(psObj, node.engine);
callFunction(node.engine, node.funcName, args);
}
bindings.erase(i);
i = bindings.erase(i);
}
}