From 1edc1789b1af4a3e5aaaa3e44d5e6683585db8db Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 3 Dec 2008 21:52:51 +0000 Subject: Changed readLine_OLD() to readLine_NEW(). I guess both this and the previous readLine() change could be more robust, but at least it should be no worse than it was before. svn-id: r35226 --- engines/sword2/resman.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'engines/sword2') diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp index a30c6301cc..e7ef62d672 100644 --- a/engines/sword2/resman.cpp +++ b/engines/sword2/resman.cpp @@ -113,7 +113,17 @@ bool ResourceManager::init() { // The resource.inf file is a simple text file containing the names of // all the resource files. - while (file.readLine_OLD(_resFiles[_totalClusters].fileName, sizeof(_resFiles[_totalClusters].fileName))) { + while (1) { + char *buf = _resFiles[_totalClusters].fileName; + uint len = sizeof(_resFiles[_totalClusters].fileName); + + if (!file.readLine_NEW(buf, len)) + break; + + int pos = strlen(buf); + if (buf[pos - 1] == 0x0A) + buf[pos - 1] = 0; + _resFiles[_totalClusters].numEntries = -1; _resFiles[_totalClusters].entryTab = NULL; if (++_totalClusters >= MAX_res_files) { -- cgit v1.2.3