From: Mikko Rasa Date: Sun, 4 Nov 2012 20:35:27 +0000 (+0200) Subject: Some fixes for eof handling in Memory X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=3f7aa81d9212811b323d89949adcccda212cbed3;p=libs%2Fcore.git Some fixes for eof handling in Memory --- diff --git a/source/io/memory.cpp b/source/io/memory.cpp index bc14ff1..f64b4be 100644 --- a/source/io/memory.cpp +++ b/source/io/memory.cpp @@ -66,6 +66,10 @@ unsigned Memory::do_read(char *buf, unsigned size) unsigned Memory::put(char c) { check_access(M_WRITE); + + if(pos==end) + return 0; + *pos++ = c; return 1; } @@ -115,6 +119,7 @@ SeekOffset Memory::seek(SeekOffset off, SeekType type) throw out_of_range("Memory::seek"); pos = new_pos; + eof_flag = false; return pos-begin; }