aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-12-03 22:55:30 +0000
committerMax Horn2008-12-03 22:55:30 +0000
commitabae99d6451e89c62f7037cc3372876d036af781 (patch)
tree3af7153f31fc86fe35e220f2fc56c077b8400a7d
parent9ad879af48a5079b2c2b79dd65135d7f468085ea (diff)
downloadscummvm-rg350-abae99d6451e89c62f7037cc3372876d036af781.tar.gz
scummvm-rg350-abae99d6451e89c62f7037cc3372876d036af781.tar.bz2
scummvm-rg350-abae99d6451e89c62f7037cc3372876d036af781.zip
Get rid of readLine_OLD for good
svn-id: r35229
-rw-r--r--common/stream.cpp68
-rw-r--r--common/stream.h5
2 files changed, 4 insertions, 69 deletions
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
@@ -368,11 +368,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
* stops when the end of a line is reached (CR, CR/LF or LF), and