[Scummvm-cvs-logs] SF.net SVN: scummvm:[35229] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Dec 3 23:55:30 CET 2008


Revision: 35229
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35229&view=rev
Author:   fingolfin
Date:     2008-12-03 22:55:30 +0000 (Wed, 03 Dec 2008)

Log Message:
-----------
Get rid of readLine_OLD for good

Modified Paths:
--------------
    scummvm/trunk/common/stream.cpp
    scummvm/trunk/common/stream.h

Modified: scummvm/trunk/common/stream.cpp
===================================================================
--- scummvm/trunk/common/stream.cpp	2008-12-03 22:15:05 UTC (rev 35228)
+++ scummvm/trunk/common/stream.cpp	2008-12-03 22:55:30 UTC (rev 35229)
@@ -89,71 +89,11 @@
 	return true;	// FIXME: STREAM REWRITE
 }
 
-#define LF 0x0A
-#define CR 0x0D
+enum {
+	LF = 0x0A,
+	CR = 0x0D
+};
 
-char *SeekableReadStream::readLine_OLD(char *buf, size_t bufSize) {
-	assert(buf && bufSize > 0);
-	char *p = buf;
-	size_t len = 0;
-	char c;
-
-	if (buf == 0 || bufSize == 0 || eos()) {
-		return 0;
-	}
-
-	// We don't include the newline character(s) in the buffer, and we
-	// always terminate it - we never read more than len-1 characters.
-
-	// EOF is treated as a line break, unless it was the first character
-	// that was read.
-
-	// 0 is treated as a line break, even though it should never occur in
-	// a text file.
-
-	// DOS and Windows use CRLF line breaks
-	// Unix and OS X use LF line breaks
-	// Macintosh before OS X uses CR line breaks
-
-
-	c = readByte();
-	if (eos() || ioFailed()) {
-		return 0;
-	}
-
-	while (!eos() && len + 1 < bufSize) {
-
-		if (ioFailed())
-			return 0;
-
-		if (c == 0 || c == LF)
-			break;
-
-		if (c == CR) {
-			c = readByte();
-			if (c != LF && !eos())
-				seek(-1, SEEK_CUR);
-			break;
-		}
-
-		*p++ = c;
-		len++;
-
-		c = readByte();
-	}
-
-	// This should fix a bug while using readLine with Common::File
-	// it seems that it sets the eos flag after an invalid read
-	// and at the same time the ioFailed flag
-	// the config file parser fails out of that reason for the new themes
-	if (eos()) {
-		clearIOFailed();
-	}
-
-	*p = 0;
-	return buf;
-}
-
 char *SeekableReadStream::readLine_NEW(char *buf, size_t bufSize) {
 	assert(buf != 0 && bufSize > 1);
 	char *p = buf;

Modified: scummvm/trunk/common/stream.h
===================================================================
--- scummvm/trunk/common/stream.h	2008-12-03 22:15:05 UTC (rev 35228)
+++ scummvm/trunk/common/stream.h	2008-12-03 22:55:30 UTC (rev 35229)
@@ -368,11 +368,6 @@
 	virtual bool skip(uint32 offset) { return seek(offset, SEEK_CUR); }
 
 	/**
-	 * DEPRECATED: Do not use this method! Instead use readLine_NEW() or readline().
-	 */
-	virtual char *readLine_OLD(char *buf, size_t bufSize);
-
-	/**
 	 * Reads at most one less than the number of characters specified
 	 * by bufSize from the and stores them in the string buf. Reading
 	 * stops when the end of a line is reached (CR, CR/LF or LF), and


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