[Scummvm-git-logs] scummvm master -> b7831c7755a7eea5f653c2b6f61f5207a882d02d
digitall
noreply at scummvm.org
Tue Feb 14 23:48:38 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b7831c7755 DRAGONS: Fix Format Truncation GCC Compiler Warnings
Commit: b7831c7755a7eea5f653c2b6f61f5207a882d02d
https://github.com/scummvm/scummvm/commit/b7831c7755a7eea5f653c2b6f61f5207a882d02d
Author: D G Turner (digitall at scummvm.org)
Date: 2023-02-14T23:48:06Z
Commit Message:
DRAGONS: Fix Format Truncation GCC Compiler Warnings
Changed paths:
engines/dragons/sound.cpp
diff --git a/engines/dragons/sound.cpp b/engines/dragons/sound.cpp
index 8b1f1cff2e6..1dc10a10fe9 100644
--- a/engines/dragons/sound.cpp
+++ b/engines/dragons/sound.cpp
@@ -510,26 +510,24 @@ void SoundManager::stopAllVoices() {
}
void SoundManager::playMusic(int16 song) {
- char sceneName[5] = "nnnn";
- char filename[12] = "xxxxznn.msq";
-
if (_currentSong == song) {
return;
}
_currentSong = song;
- memcpy(sceneName, _vm->_dragonRMS->getSceneName(_vm->getCurrentSceneId()), 4);
- snprintf(filename, 12, "%sz%02d.msq", sceneName, song);
- debug(1, "Load music file %s", filename);
+ // Music filenames have format "xxxxznn.msq" where xxxx is the four character scene name and nn is the two digit song number
+ Common::String filename = Common::String(_vm->_dragonRMS->getSceneName(_vm->getCurrentSceneId()), 4);
+ filename += Common::String::format("z%02d.msq", song);
+ debug(1, "Load music file %s", filename.c_str());
- if (!_bigFileArchive->doesFileExist(filename)) {
- warning("Could not find music file %s", filename);
+ if (!_bigFileArchive->doesFileExist(filename.c_str())) {
+ warning("Could not find music file %s", filename.c_str());
return;
}
uint32 dataSize;
- byte *seqData = _bigFileArchive->load(filename, dataSize);
+ byte *seqData = _bigFileArchive->load(filename.c_str(), dataSize);
Common::MemoryReadStream *seq = new Common::MemoryReadStream(seqData, dataSize, DisposeAfterUse::YES);
_midiPlayer->playSong(seq);
delete seq;
More information about the Scummvm-git-logs
mailing list