diff options
author | Johannes Schickel | 2014-03-30 21:41:53 +0200 |
---|---|---|
committer | Johannes Schickel | 2014-03-30 21:41:53 +0200 |
commit | 2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6 (patch) | |
tree | 85673931abb4151cfd912f9e30ea69024e127fc5 | |
parent | 6d51c401be9498d2f36dec0220fe441c54a6b3ee (diff) | |
parent | 8638b29b8933e1cee30c5bac8641278ba039a1f8 (diff) | |
download | scummvm-rg350-2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6.tar.gz scummvm-rg350-2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6.tar.bz2 scummvm-rg350-2eed6daf72468fdcf5ef0a0ab54871e7d3943ff6.zip |
Merge pull request #457 from fingolfin/clang-fixes
SCUMM: Avoid potential issues casting invalid values to enum
-rw-r--r-- | engines/scumm/saveload.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index fc3c193e74..0aaff4c094 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1242,7 +1242,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { } s->saveUint16(0xFFFF); // End marker } else { - while ((int)(type = (ResType)s->loadUint16()) != 0xFFFF) { + uint16 tmp; + while ((tmp = s->loadUint16()) != 0xFFFF) { + type = (ResType)tmp; while ((idx = s->loadUint16()) != 0xFFFF) { assert(idx < _res->_types[type].size()); loadResource(s, type, idx); @@ -1430,7 +1432,9 @@ void ScummEngine::saveOrLoad(Serializer *s) { } s->saveByte(0xFF); } else { - while ((int)(type = (ResType)s->loadByte()) != 0xFF) { + uint8 tmp; + while ((tmp = s->loadByte()) != 0xFF) { + type = (ResType)tmp; idx = s->loadUint16(); _res->lock(type, idx); } |