]> git.tdb.fi Git - libs/core.git/commitdiff
Some fixes for eof handling in Memory
authorMikko Rasa <tdb@tdb.fi>
Sun, 4 Nov 2012 20:35:27 +0000 (22:35 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 4 Nov 2012 20:35:27 +0000 (22:35 +0200)
source/io/memory.cpp

index bc14ff1fd4e832967b93f346a7fd4de29c74f552..f64b4be9e52edcb6fcae3bb94c99d69595fd4e80 100644 (file)
@@ -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;
 }