[Scummvm-cvs-logs] CVS: scummvm/kyra kyra.cpp,1.54,1.55 resource.cpp,1.21,1.22
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Fri Oct 14 23:28:25 CEST 2005
Update of /cvsroot/scummvm/scummvm/kyra
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22825
Modified Files:
kyra.cpp resource.cpp
Log Message:
Fixed a bug in the Kyra CD intro that caused ScummVM to crash when compiled
with GCC 4. (The string buffer for the file name was too short, which
caused a write to another variable's address to overwrite the terminating
zero at the end of the string.)
Index: kyra.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/kyra.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- kyra.cpp 14 Oct 2005 11:25:48 -0000 1.54
+++ kyra.cpp 15 Oct 2005 06:26:53 -0000 1.55
@@ -926,15 +926,9 @@
void KyraEngine::snd_playVoiceFile(int id) {
debug(9, "KyraEngine::snd_playVoiceFile(%d)", id);
- char vocFile[7];
- memset(vocFile, 0, sizeof(char)*7);
- if (id < 10) {
- sprintf(vocFile, "00%d.VOC", id);
- } else if (id < 100) {
- sprintf(vocFile, "0%d.VOC", id);
- } else {
- sprintf(vocFile, "%d.VOC", id);
- }
+ char vocFile[8];
+ assert(id >= 0 && id < 1000);
+ sprintf(vocFile, "%03d.VOC", id);
uint32 fileSize = 0;
byte *fileData = 0;
fileData = _res->fileData(vocFile, &fileSize);
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/resource.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- resource.cpp 14 Oct 2005 11:25:48 -0000 1.21
+++ resource.cpp 15 Oct 2005 06:26:53 -0000 1.22
@@ -159,8 +159,6 @@
buffer = new uint8[*size];
assert(buffer);
- // TODO: maybe remove this again, this is only
- // because I had problems when using gcc 4.0.1
const uint8 *from = start->_file->getFile(file);
assert(from);
More information about the Scummvm-git-logs
mailing list