mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
DRASCULA: Don't use unsafe strcat and strcpy
This commit is contained in:
parent
667ea2f88e
commit
b25335bd33
@ -763,7 +763,7 @@ void DrasculaEngine::animation_16_2() {
|
||||
if (i < 4)
|
||||
sprintf(curPic, "his%i.alg", i);
|
||||
else
|
||||
strcpy(curPic, "his4_2.alg");
|
||||
Common::strcpy_s(curPic, "his4_2.alg");
|
||||
|
||||
loadPic(curPic, screenSurface, HALF_PAL);
|
||||
centerText(_texthis[i], 180, 180);
|
||||
@ -2079,7 +2079,7 @@ void DrasculaEngine::animation_1_4() {
|
||||
debug(4, "animation_1_4()");
|
||||
|
||||
if (flags[21] == 0) {
|
||||
strcpy(objName[2], _textmisc[5]); // "igor"
|
||||
Common::strcpy_s(objName[2], _textmisc[5]); // "igor"
|
||||
talk(275);
|
||||
|
||||
updateRefresh_pre();
|
||||
|
@ -168,19 +168,19 @@ void DrasculaEngine::converse(int index) {
|
||||
|
||||
if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) {
|
||||
Common::strlcpy(phrase3, _text[405], 128);
|
||||
strcpy(sound3, "405.als");
|
||||
Common::strcpy_s(sound3, "405.als");
|
||||
answer3 = 31;
|
||||
}
|
||||
|
||||
if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[7] == 1) {
|
||||
Common::strlcpy(phrase3, _text[273], 128);
|
||||
strcpy(sound3, "273.als");
|
||||
Common::strcpy_s(sound3, "273.als");
|
||||
answer3 = 14;
|
||||
}
|
||||
|
||||
if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[10] == 1) {
|
||||
Common::strlcpy(phrase3, _text[274], 128);
|
||||
strcpy(sound3, "274.als");
|
||||
Common::strcpy_s(sound3, "274.als");
|
||||
answer3 = 15;
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) {
|
||||
Common::strlcat(tmpMessageCurLine, curWord, 50);
|
||||
if (textFitsCentered(tmpMessageCurLine, textX)) {
|
||||
// Line fits, so add the word to the current message line
|
||||
strcpy(messageCurLine, tmpMessageCurLine);
|
||||
Common::strcpy_s(messageCurLine, tmpMessageCurLine);
|
||||
} else {
|
||||
// Line does't fit. Store the current line and start a new line.
|
||||
Common::strlcpy(messageLines[curLine++], messageCurLine, 41);
|
||||
@ -424,7 +424,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) {
|
||||
if (!textFitsCentered(messageCurLine, textX)) {
|
||||
messageCurLine[strlen(messageCurLine) - 1] = '\0';
|
||||
Common::strlcpy(messageLines[curLine++], messageCurLine, 41);
|
||||
strcpy(messageLines[curLine++], " ");
|
||||
Common::strcpy_s(messageLines[curLine++], " ");
|
||||
} else
|
||||
Common::strlcpy(messageLines[curLine++], messageCurLine, 41);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void DrasculaEngine::showMap() {
|
||||
|
||||
for (int l = 0; l < numRoomObjs; l++) {
|
||||
if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && visible[l] == 1) {
|
||||
strcpy(textName, objName[l]);
|
||||
Common::strcpy_s(textName, objName[l]);
|
||||
_hasName = true;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ void DrasculaEngine::checkObjects() {
|
||||
|
||||
for (l = 0; l < numRoomObjs; l++) {
|
||||
if (_objectRect[l].contains(Common::Point(_mouseX, _mouseY)) && visible[l] == 1 && isDoor[l] == 0) {
|
||||
strcpy(textName, objName[l]);
|
||||
Common::strcpy_s(textName, objName[l]);
|
||||
_hasName = true;
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ void DrasculaEngine::checkObjects() {
|
||||
if (_mouseX > curX + 2 && _mouseY > curY + 2
|
||||
&& _mouseX < curX + curWidth - 2 && _mouseY < curY + curHeight - 2) {
|
||||
if (currentChapter == 2 || !_hasName) {
|
||||
strcpy(textName, _textmisc[3]); // "hacker"
|
||||
Common::strcpy_s(textName, _textmisc[3]); // "hacker"
|
||||
_hasName = true;
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ bool DrasculaEngine::room_13(int fl) {
|
||||
talk(411);
|
||||
trackProtagonist = 3;
|
||||
talk(412);
|
||||
strcpy(objName[1], _textmisc[4]); // "yoda"
|
||||
Common::strcpy_s(objName[1], _textmisc[4]); // "yoda"
|
||||
} else if (pickedObject == kVerbTalk && fl == 51) {
|
||||
converse(7);
|
||||
} else if (pickedObject == 19 && fl == 51) {
|
||||
@ -1671,7 +1671,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
|
||||
|
||||
_hasName = false;
|
||||
|
||||
strcpy(currentData, fileName);
|
||||
Common::strcpy_s(currentData, fileName);
|
||||
|
||||
Common::SeekableReadStream *stream = _archives.open(fileName);
|
||||
if (!stream)
|
||||
@ -1706,7 +1706,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
|
||||
p.parseString(surfaceName);
|
||||
loadPic(surfaceName, backSurface);
|
||||
|
||||
strcpy(menuBackground, surfaceName);
|
||||
Common::strcpy_s(menuBackground, surfaceName);
|
||||
} else {
|
||||
curWidth = CHARACTER_WIDTH;
|
||||
curHeight = CHARACTER_HEIGHT;
|
||||
@ -1718,7 +1718,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
|
||||
loadPic(96, frontSurface);
|
||||
loadPic(99, backSurface);
|
||||
|
||||
strcpy(menuBackground, "99.alg");
|
||||
Common::strcpy_s(menuBackground, "99.alg");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user