From bff25a255af05f1ddd6c956a97fa6b8c50c9b22d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 15 Jun 2011 11:20:13 +0300 Subject: [PATCH] Fix Memory::getline --- source/io/memory.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/io/memory.cpp b/source/io/memory.cpp index fa8f905..274f6ba 100644 --- a/source/io/memory.cpp +++ b/source/io/memory.cpp @@ -70,11 +70,16 @@ unsigned Memory::put(char c) bool Memory::getline(string &line) { + if(pos==end) + { + set_eof(); + return false; + } + char *nl = find(pos, end, '\n'); line.assign(pos, nl); - bool result = (nl!=pos); - pos = nl; - return result; + pos = (nl==end ? end : nl+1); + return true; } int Memory::get() -- 2.45.2