diff options
author | Colin Snover | 2017-09-23 01:39:16 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-23 20:56:48 -0500 |
commit | d17ae077dd014d380e8091161fe1f584a8cc29ba (patch) | |
tree | 23e62600930bb08a825e1008d34175146d5c6d96 /engines/sci/engine | |
parent | b3c27c2159a1e6d5d775d76a98dd5f4ca4315616 (diff) | |
download | scummvm-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
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/file.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 15 | ||||
-rw-r--r-- | engines/sci/engine/savegame.h | 2 |
3 files changed, 9 insertions, 10 deletions
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 |