[Scummvm-git-logs] scummvm master -> 2629bfa0ee898caa009bdce376ff373a789cc84f
digitall
noreply at scummvm.org
Fri May 5 23:27:10 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2629bfa0ee WATCHMAKER: Fix for Memset on Non-Trivial Structure GCC Warning
Commit: 2629bfa0ee898caa009bdce376ff373a789cc84f
https://github.com/scummvm/scummvm/commit/2629bfa0ee898caa009bdce376ff373a789cc84f
Author: D G Turner (digitall at scummvm.org)
Date: 2023-05-06T00:26:42+01:00
Commit Message:
WATCHMAKER: Fix for Memset on Non-Trivial Structure GCC Warning
Changed paths:
engines/watchmaker/schedule.cpp
engines/watchmaker/struct.h
diff --git a/engines/watchmaker/schedule.cpp b/engines/watchmaker/schedule.cpp
index 8e16142f781..965a5e42127 100644
--- a/engines/watchmaker/schedule.cpp
+++ b/engines/watchmaker/schedule.cpp
@@ -49,7 +49,7 @@ void MessageSystem::addWaitingMsgs(uint16 flags) {
_vm->_messageSystem.doEvent(_waitingMsg[a].classe, _waitingMsg[a].event, _waitingMsg[a].flags,
_waitingMsg[a].wparam1, _waitingMsg[a].wparam2,
_waitingMsg[a].bparam, &_waitingMsg[a].lparam[0], &_waitingMsg[a].lparam[1], &_waitingMsg[a].lparam[2]);
- memset(&_waitingMsg[a], 0, sizeof(_waitingMsg[a]));
+ _waitingMsg[a].reset();
}
}
}
@@ -63,7 +63,7 @@ void MessageSystem::deleteWaitingMsgs(uint16 flags) {
for (int a = 0; a < MAXWAITINGMSGS; a++)
if (_waitingMsg[a].classe != EventClass::MC_IDLE && (_waitingMsg[a].flags < MP_WAITA))
- memset(&_waitingMsg[a], 0, sizeof(_waitingMsg[a]));
+ _waitingMsg[a].reset();
}
/* -----------------08/02/99 10.09-------------------
@@ -96,7 +96,7 @@ void MessageSystem::init() {
}
for (int i = 0; i < MAXWAITINGMSGS; i++) {
- memset(&_waitingMsg[i], 0, sizeof(_waitingMsg[i]));
+ _waitingMsg[i].reset();
}
}
@@ -309,7 +309,7 @@ void MessageSystem::removeEvent(EventClass classe, uint8 event) {
for (b = 0; b < MAXWAITINGMSGS; b++)
if ((_waitingMsg[b].classe == classe) && ((event == ME_ALL) || (_waitingMsg[b].event == event)))
- memset(&_waitingMsg[b], 0, sizeof(_waitingMsg[b]));
+ _waitingMsg[b].reset();
}
/* -----------------18/12/00 16.32-------------------
@@ -335,7 +335,7 @@ void MessageSystem::removeEvent_bparam(EventClass classe, uint8 event, uint8 bpa
for (b = 0; b < MAXWAITINGMSGS; b++)
if ((_waitingMsg[b].classe == classe) && ((event == ME_ALL) || (_waitingMsg[b].event == event)) && (_waitingMsg[b].bparam == bparam))
- memset(&_waitingMsg[b], 0, sizeof(_waitingMsg[b]));
+ _waitingMsg[b].reset();
}
/* -----------------08/02/99 10.11-------------------
diff --git a/engines/watchmaker/struct.h b/engines/watchmaker/struct.h
index 613fb45c8c1..a21e4cc114a 100644
--- a/engines/watchmaker/struct.h
+++ b/engines/watchmaker/struct.h
@@ -487,8 +487,20 @@ struct message {
int32 lparam[3] = {}; // long parameter
t3dF32 fparam[3]; // float parameter
};
+
message() = default;
message(EventClass _classe, uint8 _event, uint16 _flags) : classe(_classe), event(_event), flags(_flags) {}
+
+ void reset() {
+ classe = MC_IDLE;
+ event = 0;
+ flags = 0;
+ bparam = 0;
+ wparam1 = 0;
+ wparam2 = 0;
+ for (uint i = 0; i < ARRAYSIZE(lparam); i++) lparam[i] = 0;
+ // fparam cleared as union with lparam i.e. shared memory
+ }
};
struct pqueue {
More information about the Scummvm-git-logs
mailing list