aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-09-23 01:39:16 -0500
committerColin Snover2017-09-23 20:56:48 -0500
commitd17ae077dd014d380e8091161fe1f584a8cc29ba (patch)
tree23e62600930bb08a825e1008d34175146d5c6d96
parentb3c27c2159a1e6d5d775d76a98dd5f4ca4315616 (diff)
downloadscummvm-rg350-d17ae077dd014d380e8091161fe1f584a8cc29ba.tar.gz
scummvm-rg350-d17ae077dd014d380e8091161fe1f584a8cc29ba.tar.bz2
scummvm-rg350-d17ae077dd014d380e8091161fe1f584a8cc29ba.zip
SCI: Use reference instead of pointer for required out-data in metadata save function
-rw-r--r--engines/sci/detection.cpp4
-rw-r--r--engines/sci/engine/file.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp15
-rw-r--r--engines/sci/engine/savegame.h2
4 files changed, 11 insertions, 12 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 9ebdfa9e7c..aa7a63d224 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -812,7 +812,7 @@ SaveStateList SciMetaEngine::listSaves(const char *target) const {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
SavegameMetadata meta;
- if (!get_savegame_metadata(in, &meta)) {
+ if (!get_savegame_metadata(in, meta)) {
// invalid
delete in;
continue;
@@ -861,7 +861,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
if (in) {
SavegameMetadata meta;
- if (!get_savegame_metadata(in, &meta)) {
+ if (!get_savegame_metadata(in, meta)) {
// invalid
delete in;
diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index f3c04dd48c..d1015cc4be 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -307,7 +307,7 @@ bool fillSavegameDesc(const Common::String &filename, SavegameDesc &desc) {
}
SavegameMetadata meta;
- if (!get_savegame_metadata(in.get(), &meta) || meta.name.empty()) {
+ if (!get_savegame_metadata(in.get(), meta) || meta.name.empty()) {
return false;
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index fd07e0c126..8c89b90517 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -1395,22 +1395,21 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
s->gameIsRestarting = GAMEISRESTARTING_RESTORE;
}
-bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata *meta) {
+bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata &meta) {
assert(stream);
- assert(meta);
- Common::Serializer ser(stream, 0);
- sync_SavegameMetadata(ser, *meta);
+ Common::Serializer ser(stream, nullptr);
+ sync_SavegameMetadata(ser, meta);
if (stream->eos())
return false;
- if ((meta->version < MINIMUM_SAVEGAME_VERSION) ||
- (meta->version > CURRENT_SAVEGAME_VERSION)) {
- if (meta->version < MINIMUM_SAVEGAME_VERSION)
+ if ((meta.version < MINIMUM_SAVEGAME_VERSION) ||
+ (meta.version > CURRENT_SAVEGAME_VERSION)) {
+ if (meta.version < MINIMUM_SAVEGAME_VERSION)
warning("Old savegame version detected- can't load");
else
- warning("Savegame version is %d- maximum supported is %0d", meta->version, CURRENT_SAVEGAME_VERSION);
+ warning("Savegame version is %d- maximum supported is %0d", meta.version, CURRENT_SAVEGAME_VERSION);
return false;
}
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index 29930241b1..f862b961e0 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -118,7 +118,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *save);
/**
* Read the header from a savegame.
*/
-bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* meta);
+bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata &meta);
} // End of namespace Sci