[Scummvm-cvs-logs] SF.net SVN: scummvm: [21562] scummvm/trunk/engines/kyra/text.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sun Apr 2 11:59:01 CEST 2006
Revision: 21562
Author: eriktorbjorn
Date: 2006-04-02 11:58:07 -0700 (Sun, 02 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21562&view=rev
Log Message:
-----------
Don't try to copy str to _talkBuffer if str is pointing to _talkBuffer. Apart
from being unnecessary, the result of strcpy() on overlapping memory areas is
unpredictable.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/text.cpp
Modified: scummvm/trunk/engines/kyra/text.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text.cpp 2006-04-02 18:02:16 UTC (rev 21561)
+++ scummvm/trunk/engines/kyra/text.cpp 2006-04-02 18:58:07 UTC (rev 21562)
@@ -420,8 +420,10 @@
char *TextDisplayer::preprocessString(const char *str) {
debugC(9, kDebugLevelMain, "TextDisplayer::preprocessString('%s')", str);
- assert(strlen(str) < sizeof(_talkBuffer) - 1);
- strcpy(_talkBuffer, str);
+ if (str != _talkBuffer) {
+ assert(strlen(str) < sizeof(_talkBuffer) - 1);
+ strcpy(_talkBuffer, str);
+ }
char *p = _talkBuffer;
while (*p) {
if (*p == '\r') {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list