aboutsummaryrefslogtreecommitdiff
path: root/engines/tony
diff options
context:
space:
mode:
authorStrangerke2016-01-04 13:53:11 +0100
committerStrangerke2016-01-04 13:53:11 +0100
commit94809c4995ccd7a765ce86efdf24f2d3af175d4f (patch)
treeb9e902289c2d7a99009182aab98b7932e76ca22b /engines/tony
parente6d8655a9b37af313840cca05b0e3493624ca575 (diff)
downloadscummvm-rg350-94809c4995ccd7a765ce86efdf24f2d3af175d4f.tar.gz
scummvm-rg350-94809c4995ccd7a765ce86efdf24f2d3af175d4f.tar.bz2
scummvm-rg350-94809c4995ccd7a765ce86efdf24f2d3af175d4f.zip
TONY: Reduce variable scope, use MKTAG to check file signature
Diffstat (limited to 'engines/tony')
-rw-r--r--engines/tony/tony.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 6308cf6396..08e30cd409 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -573,9 +573,6 @@ void TonyEngine::loadState(CORO_PARAM, int n) {
}
bool TonyEngine::openVoiceDatabase() {
- char id[4];
- uint32 numfiles;
-
// Open the voices database
if (_vdbFP.open("voices.vdb"))
_vdbCodec = FPCODEC_ADPCM;
@@ -589,30 +586,29 @@ bool TonyEngine::openVoiceDatabase() {
return false;
_vdbFP.seek(-8, SEEK_END);
- numfiles = _vdbFP.readUint32LE();
- _vdbFP.read(id, 4);
+ uint32 numfiles = _vdbFP.readUint32LE();
switch (_vdbCodec) {
case FPCODEC_ADPCM:
- if (id[0] != 'V' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ if (_vdbFP.readUint32BE() != MKTAG('V', 'D', 'B', '1')) {
_vdbFP.close();
return false;
}
break;
case FPCODEC_MP3:
- if (id[0] != 'M' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ if (_vdbFP.readUint32BE() != MKTAG('M', 'D', 'B', '1')) {
_vdbFP.close();
return false;
}
break;
case FPCODEC_OGG:
- if (id[0] != 'O' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ if (_vdbFP.readUint32BE() != MKTAG('O', 'D', 'B', '1')) {
_vdbFP.close();
return false;
}
break;
case FPCODEC_FLAC:
- if (id[0] != 'F' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+ if (_vdbFP.readUint32BE() != MKTAG('F', 'D', 'B', '1')) {
_vdbFP.close();
return false;
}