From abae99d6451e89c62f7037cc3372876d036af781 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Dec 2008 22:55:30 +0000 Subject: Get rid of readLine_OLD for good svn-id: r35229 --- common/stream.cpp | 68 ++++--------------------------------------------------- common/stream.h | 5 ---- 2 files changed, 4 insertions(+), 69 deletions(-) (limited to 'common') diff --git a/common/stream.cpp b/common/stream.cpp index 9bcc29550f..e17a745ef1 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -89,70 +89,10 @@ bool MemoryReadStream::seek(int32 offs, int whence) { return true; // FIXME: STREAM REWRITE } -#define LF 0x0A -#define 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; -} +enum { + LF = 0x0A, + CR = 0x0D +}; char *SeekableReadStream::readLine_NEW(char *buf, size_t bufSize) { assert(buf != 0 && bufSize > 1); diff --git a/common/stream.h b/common/stream.h index 02677e0dbb..7dd1b8283e 100644 --- a/common/stream.h +++ b/common/stream.h @@ -367,11 +367,6 @@ public: */ 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 -- cgit v1.2.3