aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-11-27 21:52:31 +0100
committerWillem Jan Palenstijn2015-12-23 21:33:43 +0100
commitb76a624c9ae59aac7df11ad5df7d39879d3344c8 (patch)
treed4b32d514bd86330afc4bc5ef320b204c3b499f8
parent93e3ba9eddc7c50db7f6475305a24cd30f2893fa (diff)
downloadscummvm-rg350-b76a624c9ae59aac7df11ad5df7d39879d3344c8.tar.gz
scummvm-rg350-b76a624c9ae59aac7df11ad5df7d39879d3344c8.tar.bz2
scummvm-rg350-b76a624c9ae59aac7df11ad5df7d39879d3344c8.zip
LAB: Fix several cppcheck errors
-rw-r--r--engines/lab/allocroom.cpp17
-rw-r--r--engines/lab/detection.cpp2
-rw-r--r--engines/lab/engine.cpp7
-rw-r--r--engines/lab/interface.cpp4
-rw-r--r--engines/lab/processroom.cpp10
-rw-r--r--engines/lab/special.cpp3
-rw-r--r--engines/lab/vga.cpp15
7 files changed, 26 insertions, 32 deletions
diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp
index 2d7016d3ee..22dfae6181 100644
--- a/engines/lab/allocroom.cpp
+++ b/engines/lab/allocroom.cpp
@@ -99,7 +99,7 @@ static void freeRoom(uint16 RMarker) {
Rooms[RoomNum].WestView = NULL;
RuleList *rules = Rooms[RoomNum].rules;
- for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++)
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule)
delete *rule;
Rooms[RoomNum].rules->clear();
delete Rooms[RoomNum].rules;
@@ -119,28 +119,25 @@ static void freeRoom(uint16 RMarker) {
/* Gets a chunk of memory from the buffer. */
/*****************************************************************************/
static void *getCurMem(uint16 Size) {
- uint16 counter;
- void *Ptr, *Start0, *Start1, *End0, *End1;
-
if (((int32) Size) > MemLeftInBuffer) {
MemPlace = RoomBuffer;
MemLeftInBuffer = ROOMBUFFERSIZE;
NextMemPlace = NULL;
}
- Ptr = MemPlace;
+ void *Ptr = MemPlace;
MemPlace = (char *)MemPlace + Size;
MemLeftInBuffer -= Size;
if (MemPlace > NextMemPlace) {
NextMemPlace = NULL;
- for (counter = 0; counter < MAXMARKERS; counter++) {
+ for (uint16 counter = 0; counter < MAXMARKERS; counter++) {
if (RoomMarkers[counter].RoomNum != EMPTYROOM) {
- Start0 = RoomMarkers[counter].Start0;
- Start1 = RoomMarkers[counter].Start1;
- End0 = RoomMarkers[counter].End0;
- End1 = RoomMarkers[counter].End1;
+ void *Start0 = RoomMarkers[counter].Start0;
+ void *Start1 = RoomMarkers[counter].Start1;
+ void *End0 = RoomMarkers[counter].End0;
+ void *End1 = RoomMarkers[counter].End1;
if (((Start0 >= Ptr) && (Start0 < MemPlace)) ||
((End0 >= Ptr) && (End0 < MemPlace)) ||
diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp
index 1da269ecad..ddb6aa32a8 100644
--- a/engines/lab/detection.cpp
+++ b/engines/lab/detection.cpp
@@ -186,7 +186,7 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const {
SaveStateList saveList;
- for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 18178d3972..2c56f5fa72 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -1307,10 +1307,8 @@ from_crumbs:
void LabEngine::go() {
- bool mem, dointro = false;
uint16 counter;
-
- dointro = true;
+ bool dointro = true;
IsHiRes = ((getFeatures() & GF_LOWRES) == 0);
@@ -1320,6 +1318,8 @@ void LabEngine::go() {
else
warning("Running in LowRes mode");
#endif
+
+ bool mem = false;
if (initBuffer(BUFFERSIZE, true)) {
mem = true;
} else {
@@ -1345,7 +1345,6 @@ void LabEngine::go() {
if (dointro && mem) {
Intro intro;
-
intro.introSequence();
} else
DoBlack = true;
diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp
index 54a7e13499..36891d7fe8 100644
--- a/engines/lab/interface.cpp
+++ b/engines/lab/interface.cpp
@@ -64,10 +64,10 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image
void freeButtonList(Gadget *gptrlist) {
- Gadget *gptr, *next = gptrlist;
+ Gadget *next = gptrlist;
while (next) {
- gptr = next;
+ Gadget *gptr = next;
next = next->NextGadget;
free(gptr);
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index e6e9d9135d..fd5ec73670 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -619,7 +619,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
rules = Rooms[roomNum].rules;
}
- for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == ACTION) &&
(((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) {
if ((((*rule)->Param2 == LCPtr->CloseUpType) ||
@@ -676,7 +676,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C
rules = Rooms[roomNum].rules;
}
- for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == OPERATE) &&
(((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) &&
(((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) {
@@ -731,7 +731,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) {
bool doGoForward(CloseDataPtr *LCPtr) {
RuleList *rules = Rooms[RoomNum].rules;
- for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, LCPtr);
@@ -752,7 +752,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
RuleList *rules = Rooms[RoomNum].rules;
- for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == TURN) ||
(((*rule)->RuleType == TURNFROMTO) &&
((*rule)->Param1 == from) && ((*rule)->Param2 == to))) {
@@ -771,7 +771,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
/*****************************************************************************/
bool doMainView(CloseDataPtr *LCPtr) {
RuleList *rules = Rooms[RoomNum].rules;
- for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
+ for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if ((*rule)->RuleType == GOMAINVIEW) {
if (checkConditions((*rule)->Condition)) {
doActions((*rule)->ActionList, LCPtr);
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 16940e1cbc..1ee539f20b 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -373,7 +373,6 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
/* Changes the combination number of one of the slots */
/*****************************************************************************/
static void changeTile(uint16 col, uint16 row) {
- bool check;
int16 scrolltype = -1;
if (row > 0) {
@@ -417,7 +416,7 @@ static void changeTile(uint16 col, uint16 row) {
return;
}
- check = true;
+ bool check = true;
row = 0;
col = 0;
diff --git a/engines/lab/vga.cpp b/engines/lab/vga.cpp
index c1d526b53a..73d8cf3192 100644
--- a/engines/lab/vga.cpp
+++ b/engines/lab/vga.cpp
@@ -82,13 +82,10 @@ bool LabEngine::WSDL_HasNextChar() {
}
void LabEngine::WSDL_ProcessInput(bool can_delay) {
- int n;
- int lastMouseAtEdge;
- int flags = 0;
-
Common::Event event;
if (1 /*!g_IgnoreProcessInput*/) {
+ int flags = 0;
while (g_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_RBUTTONDOWN:
@@ -101,8 +98,8 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
mouseHandler(flags, _mouseX, _mouseY);
break;
- case Common::EVENT_MOUSEMOVE:
- lastMouseAtEdge = _mouseAtEdge;
+ case Common::EVENT_MOUSEMOVE: {
+ int lastMouseAtEdge = _mouseAtEdge;
_mouseAtEdge = false;
_mouseX = event.mouse.x;
if (event.mouse.x <= 0) {
@@ -127,6 +124,7 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
if (!lastMouseAtEdge || !_mouseAtEdge)
mouseHandler(1, _mouseX, _mouseY);
+ }
break;
case Common::EVENT_KEYDOWN:
@@ -143,14 +141,15 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
//saveSettings();
break;
- default:
- n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F)
+ default: {
+ int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F)
- ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26);
if (n != _nextKeyOut) {
_keyBuf[_nextKeyIn] = event.kbd.keycode;
_nextKeyIn = n;
}
}
+ }
break;
case Common::EVENT_QUIT: