diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp index b6b66cc09a0..768339c0cce 100644 --- a/engines/queen/display.cpp +++ b/engines/queen/display.cpp @@ -101,10 +101,10 @@ void Display::dynalumInit(const char *roomName, uint16 roomNum) { if (!isPalFadingDisabled(roomNum)) { char filename[20]; - sprintf(filename, "%s.MSK", roomName); + Common::sprintf_s(filename, "%s.MSK", roomName); if (_vm->resource()->fileExists(filename)) { _dynalum.mskBuf = (uint8 *)_vm->resource()->loadFile(filename, 0, &_dynalum.mskSize); - sprintf(filename, "%s.LUM", roomName); + Common::sprintf_s(filename, "%s.LUM", roomName); if (_vm->resource()->fileExists(filename)) { _dynalum.lumBuf = (int8 *)_vm->resource()->loadFile(filename, 0, &_dynalum.lumSize); _dynalum.valid = true; @@ -702,7 +702,7 @@ void Display::setupPanel() { uint32 dataSize; char dataName[20]; - sprintf(dataName, "PANEL.%s", _imageExt); + Common::sprintf_s(dataName, "PANEL.%s", _imageExt); uint8 *data = _vm->resource()->loadFile(dataName, 0, &dataSize); if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { @@ -721,7 +721,7 @@ void Display::setupNewRoom(const char *name, uint16 room) { uint32 dataSize; char dataName[20]; - sprintf(dataName, "%s.%s", name, _imageExt); + Common::sprintf_s(dataName, "%s.%s", name, _imageExt); uint8 *data = _vm->resource()->loadFile(dataName, 0, &dataSize); if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp index 059cf5a4d1c..ff7352118f6 100644 --- a/engines/queen/graphics.cpp +++ b/engines/queen/graphics.cpp @@ -672,7 +672,7 @@ void Graphics::setupNewRoom(const char *room, uint16 roomNum, int16 *furniture, // load/setup objects associated to this room char filename[20]; - sprintf(filename, "%s.BBK", room); + Common::sprintf_s(filename, "%s.BBK", room); _vm->bankMan()->load(filename, 15); _numFrames = FRAMES_JOE + 1; diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp index 189c0df3446..a462729f8de 100644 --- a/engines/queen/journal.cpp +++ b/engines/queen/journal.cpp @@ -182,7 +182,7 @@ void Journal::drawSaveDescriptions() { for (int i = 0; i < NUM_SAVES_PER_PAGE; ++i) { int n = _currentSavePage * 10 + i; char nb[4]; - sprintf(nb, "%d", n + 1); + Common::sprintf_s(nb, "%d", n + 1); int y = _textField.y + i * _textField.h; _vm->display()->setText(_textField.x, y, _saveDescriptions[n], false); _vm->display()->setText(_textField.x - 27, y + 1, nb, false); @@ -537,7 +537,7 @@ void Journal::drawInfoPanel() { break; } char versionId[13]; - sprintf(versionId, "Version %c.%c%c", ver[2], ver[3], ver[4]); + Common::sprintf_s(versionId, "Version %c.%c%c", ver[2], ver[3], ver[4]); _vm->display()->setTextCentered(156, versionId, false); } diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp index c6af9ea35dd..1b43a20ea7a 100644 --- a/engines/queen/logic.cpp +++ b/engines/queen/logic.cpp @@ -853,7 +853,7 @@ void Logic::makeJoeSpeak(uint16 descNum, bool objectType) { descNum += JOE_RESPONSE_MAX; } char descFilePrefix[10]; - sprintf(descFilePrefix, "JOE%04i", descNum); + Common::sprintf_s(descFilePrefix, "JOE%04i", descNum); makePersonSpeak(text, nullptr, descFilePrefix); } diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp index 7459161b01f..54bbf31baf2 100644 --- a/engines/queen/resource.cpp +++ b/engines/queen/resource.cpp @@ -254,7 +254,7 @@ void Resource::seekResourceFile(int num, uint32 offset) { debug(7, "Opening resource file %d, current %d", num, _currentResourceFileNum); _resourceFile.close(); char name[20]; - sprintf(name, "queen.%d", num); + Common::sprintf_s(name, "queen.%d", num); if (!_resourceFile.open(name)) { error("Could not open resource file '%s'", name); } diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index a0874c34366..d1ee196bb6f 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -608,7 +608,7 @@ void AmigaSound::updateMusic() { void AmigaSound::playSound(const char *base) { debug(7, "AmigaSound::playSound(%s)", base); char soundName[20]; - sprintf(soundName, "%s.AMR", base); + Common::sprintf_s(soundName, "%s.AMR", base); uint32 soundSize; Common::File *f = _vm->resource()->findSound(soundName, &soundSize); @@ -629,13 +629,13 @@ Audio::AudioStream *AmigaSound::loadModule(const char *base, int num) { // load song/pattern data uint32 sngDataSize; - sprintf(name, "%s.SNG", base); + Common::sprintf_s(name, "%s.SNG", base); uint8 *sngData = _vm->resource()->loadFile(name, 0, &sngDataSize); Common::MemoryReadStream sngStr(sngData, sngDataSize); // load instruments/wave data uint32 insDataSize; - sprintf(name, "%s.INS", base); + Common::sprintf_s(name, "%s.INS", base); uint8 *insData = _vm->resource()->loadFile(name, 0, &insDataSize); Common::MemoryReadStream insStr(insData, insDataSize); diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp index 2c8148339d2..1484096e6a3 100644 --- a/engines/queen/talk.cpp +++ b/engines/queen/talk.cpp @@ -132,13 +132,13 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { findDialogueString(_person1PtrOff, head, _pMax, _talkString[0]); if (hasTalkedTo() && head == 1) - sprintf(otherVoiceFilePrefix, "%2dXXXXP", _talkKey); + Common::sprintf_s(otherVoiceFilePrefix, "%2dXXXXP", _talkKey); else - sprintf(otherVoiceFilePrefix, "%2d%4xP", _talkKey, head); + Common::sprintf_s(otherVoiceFilePrefix, "%2d%4xP", _talkKey, head); if (_talkString[0][0] == '\0' && retval > 1) { findDialogueString(_person1PtrOff, retval, _pMax, _talkString[0]); - sprintf(otherVoiceFilePrefix,"%2d%4xP", _talkKey, retval); + Common::sprintf_s(otherVoiceFilePrefix,"%2d%4xP", _talkKey, retval); } // Joe dialogue @@ -151,7 +151,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { if (index < 0 && _vm->logic()->gameState(ABS(index)) != _dialogueTree[level][i].gameStateValue) _talkString[i][0] = '\0'; - sprintf(_joeVoiceFilePrefix[i], "%2d%4xJ", _talkKey, _dialogueTree[level][i].head); + Common::sprintf_s(_joeVoiceFilePrefix[i], "%2d%4xJ", _talkKey, _dialogueTree[level][i].head); } // Check to see if (all the dialogue options have been selected. @@ -247,7 +247,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) { if (-1 == retval) { findDialogueString(_person1PtrOff, head, _pMax, _talkString[0]); if (_talkString[0][0] != '\0') { - sprintf(otherVoiceFilePrefix, "%2d%4xP", _talkKey, head); + Common::sprintf_s(otherVoiceFilePrefix, "%2d%4xP", _talkKey, head); speak(_talkString[0], &person, otherVoiceFilePrefix); } } @@ -435,14 +435,14 @@ void Talk::initialTalk() { // Not yet talked to this person if (joeString[0] != '0') { char voiceFilePrefix[MAX_STRING_SIZE]; - sprintf(voiceFilePrefix, "%2dSSSSJ", _talkKey); + Common::sprintf_s(voiceFilePrefix, "%2dSSSSJ", _talkKey); speak(joeString, nullptr, voiceFilePrefix); } } else { // Already spoken to them, choose second response if (joe2String[0] != '0') { char voiceFilePrefix[MAX_STRING_SIZE]; - sprintf(voiceFilePrefix, "%2dXXXXJ", _talkKey); + Common::sprintf_s(voiceFilePrefix, "%2dXXXXJ", _talkKey); speak(joe2String, nullptr, voiceFilePrefix); } } @@ -789,7 +789,7 @@ void Talk::speakSegment( segment[length] = '\0'; char voiceFileName[MAX_STRING_SIZE]; - sprintf(voiceFileName, "%s%1x", voiceFilePrefix, index + 1); + Common::sprintf_s(voiceFileName, "%s%1x", voiceFilePrefix, index + 1); // French talkie version has a useless voice file ; c30e_102 file is the same as c30e_101, // so there is no need to play it. This voice was used in room 30 (N8) when talking to Klunk.