[Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.293,1.294
Max Horn
fingolfin at users.sourceforge.net
Sat Jun 4 14:22:48 CEST 2005
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31211
Modified Files:
string.cpp
Log Message:
Updated comment; added code to deal with newline chars in COMI text (see bug #902415)
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- string.cpp 26 May 2005 14:16:43 -0000 1.293
+++ string.cpp 4 Jun 2005 21:21:18 -0000 1.294
@@ -886,6 +886,8 @@
// tags and offsets. I did consider using a balanced tree
// instead, but the extra overhead in the node structure would
// easily have doubled the memory consumption of the index.
+ // And anyway, using qsort + bsearch gives us the exact same
+ // O(log(n)) access time anyway ;-).
_languageIndex = (LangIndexNode *)calloc(_languageIndexSize, sizeof(LangIndexNode));
@@ -958,7 +960,7 @@
// After that follows a single space which we skip
assert(isspace(*ptr));
ptr++;
-
+
// Then comes the translated string: we record an offset to that.
_languageIndex[i].offset = ptr - _languageBuffer;
@@ -968,6 +970,19 @@
break;
while (*ptr == '\n' || *ptr == '\r')
*ptr++ = 0;
+
+ // Convert '\n' code to a newline. See also bug #902415.
+ char *src, *dst;
+ src = dst = _languageBuffer + _languageIndex[i].offset;
+ while (*src) {
+ if (src[0] == '\\' && src[1] == 'n') {
+ *dst++ = '\n';
+ src += 2;
+ } else {
+ *dst++ = *src++;
+ }
+ }
+ *dst = 0;
}
}
More information about the Scummvm-git-logs
mailing list