From acbe2ee4cea637450389bb86a3892160bb724192 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 13 Apr 2013 19:09:52 +0300 Subject: [PATCH] Fix seeking of Slice --- source/io/slice.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); -- 2.45.2