MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / Seek

Method Seek

Libraries/unrar/qopen.cpp:169–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168
169bool QuickOpen::Seek(int64 Offset,int Method)
170{
171 if (!Loaded)
172 return false;
173
174 // Normally we process an archive sequentially from beginning to end,
175 // so we read quick open data sequentially. But some operations like
176 // archive updating involve several passes. So if we detect that file
177 // pointer is moved back, we reload quick open data from beginning.
178 if (Method==SEEK_SET && (uint64)Offset<SeekPos && (uint64)Offset<LastReadHeaderPos)
179 Load(QOHeaderPos);
180
181 if (Method==SEEK_SET)
182 SeekPos=Offset;
183 if (Method==SEEK_CUR)
184 SeekPos+=Offset;
185 UnsyncSeekPos=true;
186
187 if (Method==SEEK_END)
188 {
189 Arc->File::Seek(Offset,SEEK_END);
190 SeekPos=Arc->File::Tell();
191 UnsyncSeekPos=false;
192 }
193 return true;
194}
195
196
197bool QuickOpen::Tell(int64 *Pos)

Callers 2

LoadMethod · 0.45
ReadBufferMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected