[Scummvm-cvs-logs] CVS: scummvm/queen resource.cpp,1.11,1.12
Joost Peters
joostp at users.sourceforge.net
Sun Oct 12 12:18:04 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.14,1.15 cutaway.h,1.7,1.8 talk.cpp,1.6,1.7 talk.h,1.4,1.5
- Next message: [Scummvm-cvs-logs] CVS: web styles.css,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv2689/queen
Modified Files:
resource.cpp
Log Message:
don't use strstr(), as there is no terminating '\0' at the end of the file
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- resource.cpp 12 Oct 2003 18:44:44 -0000 1.11
+++ resource.cpp 12 Oct 2003 19:17:26 -0000 1.12
@@ -122,16 +122,13 @@
}
char *Resource::getJAS2Line() {
- char *startOfLine = _JAS2Ptr + _JAS2Pos;
- char *pos = strstr(startOfLine, "\r\n");
- if (pos) {
- *pos = '\0';
- pos += 2;
- } else {
- error("Couldn't find newline");
- }
- _JAS2Pos = (pos - _JAS2Ptr);
- return startOfLine;
+ char *startOfLine = _JAS2Ptr + _JAS2Pos;
+ char *curPos = startOfLine;
+ while (*curPos++ != 0xd) ;
+ *(curPos-1) = '\0'; // '\r'
+ *curPos = '\0'; // '\n'
+ _JAS2Pos = (curPos - _JAS2Ptr) + 1;
+ return startOfLine;
}
uint32 Resource::fileSize(const char *filename) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.14,1.15 cutaway.h,1.7,1.8 talk.cpp,1.6,1.7 talk.h,1.4,1.5
- Next message: [Scummvm-cvs-logs] CVS: web styles.css,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list