]> git.tdb.fi Git - libs/core.git/commitdiff
Fix seeking of Slice
authorMikko Rasa <tdb@tdb.fi>
Sat, 13 Apr 2013 16:09:52 +0000 (19:09 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 13 Apr 2013 16:09:52 +0000 (19:09 +0300)
source/io/slice.cpp

index 423c1a6c8cae85e73c2f6e15e9733786b31d700e..904f748668e472257ae383dd93330cc8fc3d4299 100644 (file)
@@ -90,12 +90,13 @@ int Slice::get()
 
 SeekOffset Slice::seek(SeekOffset off, SeekType type)
 {
-       if(type==S_BEG)
-               off += start_offset;
-       else if(type==S_CUR)
+       off += start_offset;
+       if(type==S_CUR)
                off += position;
        else if(type==S_END)
-               off += start_offset+length;
+               off += length;
+       else if(type!=S_BEG)
+               throw invalid_argument("Slice::seek");
 
        if(off<start_offset || off>start_offset+length)
                throw bad_seek(off, type);