From: Mikko Rasa Date: Sat, 13 Apr 2013 16:09:52 +0000 (+0300) Subject: Fix seeking of Slice X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=acbe2ee4cea637450389bb86a3892160bb724192;p=libs%2Fcore.git Fix seeking of Slice --- diff --git a/source/io/slice.cpp b/source/io/slice.cpp index 423c1a6..904f748 100644 --- a/source/io/slice.cpp +++ b/source/io/slice.cpp @@ -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(offstart_offset+length) throw bad_seek(off, type);