]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/memory.cpp
Rewrite BufferedFile as a standalone class
[libs/core.git] / source / io / memory.cpp
index bc14ff1fd4e832967b93f346a7fd4de29c74f552..37954cca5bea6bb95a62a5afdfc094009584ba83 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;
 }
@@ -112,9 +116,10 @@ SeekOffset Memory::seek(SeekOffset off, SeekType type)
                throw invalid_argument("Memory::seek");
 
        if(new_pos<begin || new_pos>end)
-               throw out_of_range("Memory::seek");
+               throw bad_seek(off, type);
 
        pos = new_pos;
+       eof_flag = false;
        return pos-begin;
 }