aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorD G Turner2019-08-25 07:27:21 +0100
committerD G Turner2019-08-25 07:27:21 +0100
commit50c5177eb002da0d809f16941643a53677ec324c (patch)
treebb15f5cbe6d1fe5b870458cb3eca4c8ff826c884 /engines
parent482f835ad6c1260fb2fc2609ecca70f3ac618fc5 (diff)
downloadscummvm-rg350-50c5177eb002da0d809f16941643a53677ec324c.tar.gz
scummvm-rg350-50c5177eb002da0d809f16941643a53677ec324c.tar.bz2
scummvm-rg350-50c5177eb002da0d809f16941643a53677ec324c.zip
AGI: Fix Remaining GCC Compiler Warnings
These were the remaining memset on non-trivial structure warnings.
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.cpp16
-rw-r--r--engines/agi/agi.h10
-rw-r--r--engines/agi/logic.h11
-rw-r--r--engines/agi/picture.h7
-rw-r--r--engines/agi/preagi.cpp8
-rw-r--r--engines/agi/view.h4
6 files changed, 40 insertions, 16 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 227700561b..73d9e095ce 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -91,14 +91,14 @@ int AgiEngine::agiInit() {
// clear all resources and events
for (i = 0; i < MAX_DIRECTORY_ENTRIES; i++) {
- memset(&_game.views[i], 0, sizeof(struct AgiView));
- memset(&_game.pictures[i], 0, sizeof(struct AgiPicture));
- memset(&_game.logics[i], 0, sizeof(struct AgiLogic));
- memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now
- memset(&_game.dirView[i], 0, sizeof(struct AgiDir));
- memset(&_game.dirPic[i], 0, sizeof(struct AgiDir));
- memset(&_game.dirLogic[i], 0, sizeof(struct AgiDir));
- memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
+ _game.views[i].reset();
+ _game.pictures[i].reset();
+ _game.logics[i].reset();
+ _game.sounds[i] = nullptr; // _game.sounds contains pointers now
+ _game.dirView[i].reset();
+ _game.dirPic[i].reset();
+ _game.dirLogic[i].reset();
+ _game.dirSound[i].reset();
}
// clear view table
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 8627d2d8b1..6923b2e7cf 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -375,7 +375,15 @@ struct AgiDir {
// 0x40 = was compressed
uint8 flags;
- AgiDir() : volume(0), offset(0), len(0), clen(0), flags(0) {}
+ void reset() {
+ volume = 0;
+ offset = 0;
+ len = 0;
+ clen = 0;
+ flags = 0;
+ }
+
+ AgiDir() { reset(); }
};
struct AgiBlock {
diff --git a/engines/agi/logic.h b/engines/agi/logic.h
index 5e8700d9a8..992ebbf775 100644
--- a/engines/agi/logic.h
+++ b/engines/agi/logic.h
@@ -36,7 +36,16 @@ struct AgiLogic {
int numTexts; /**< number of messages */
const char **texts; /**< message list */
- AgiLogic() : data(nullptr), size(0), sIP(0), cIP(0), numTexts(0), texts(nullptr) {}
+ void reset() {
+ data = nullptr;
+ size = 0;
+ sIP = 0;
+ cIP = 0;
+ numTexts = 0;
+ texts = nullptr;
+ }
+
+ AgiLogic() { reset(); }
};
} // End of namespace Agi
diff --git a/engines/agi/picture.h b/engines/agi/picture.h
index 1380aae3fc..dc6e5822bf 100644
--- a/engines/agi/picture.h
+++ b/engines/agi/picture.h
@@ -35,7 +35,12 @@ struct AgiPicture {
uint32 flen; /**< size of raw data */
uint8 *rdata; /**< raw vector image data */
- AgiPicture() : flen(0), rdata(nullptr) {}
+ void reset() {
+ flen = 0;
+ rdata = nullptr;
+ }
+
+ AgiPicture() { reset(); }
};
// AGI picture version
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index e2751cd87b..aff00a75f7 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -82,10 +82,10 @@ void PreAgiEngine::initialize() {
// clear all resources and events
for (int i = 0; i < MAX_DIRECTORY_ENTRIES; i++) {
- memset(&_game.pictures[i], 0, sizeof(struct AgiPicture));
- memset(&_game.sounds[i], 0, sizeof(class AgiSound *)); // _game.sounds contains pointers now
- memset(&_game.dirPic[i], 0, sizeof(struct AgiDir));
- memset(&_game.dirSound[i], 0, sizeof(struct AgiDir));
+ _game.pictures[i].reset();
+ _game.sounds[i] = nullptr; // _game.sounds contains pointers now
+ _game.dirPic[i].reset();
+ _game.dirSound[i].reset();
}
}
diff --git a/engines/agi/view.h b/engines/agi/view.h
index e4adfdc014..88094d6833 100644
--- a/engines/agi/view.h
+++ b/engines/agi/view.h
@@ -48,13 +48,15 @@ struct AgiView {
int16 loopCount;
AgiViewLoop *loop;
- AgiView() {
+ void reset() {
headerStepSize = 0;
headerCycleTime = 0;
description = nullptr;
loopCount = 0;
loop = nullptr;
}
+
+ AgiView() { reset(); }
};
enum MotionType {