Skip to content
Snippets Groups Projects
Commit 6794d53a authored by Marcus Comstedt's avatar Marcus Comstedt
Browse files

Optimized seek in read mode.

Rev: src/modules/Gz/module.pmod.in:1.11
parent 425d50d0
No related branches found
No related tags found
No related merge requests found
// $Id: module.pmod.in,v 1.10 2003/04/15 13:39:31 marcus Exp $ // $Id: module.pmod.in,v 1.11 2003/04/15 13:42:34 marcus Exp $
#pike __REAL_VERSION__ #pike __REAL_VERSION__
inherit @module@; inherit @module@;
...@@ -201,11 +201,14 @@ class _file { ...@@ -201,11 +201,14 @@ class _file {
pos += file_pos; pos += file_pos;
if(pos < 0) if(pos < 0)
return -1; return -1;
if(pos < file_pos) {
if(!f->seek || f->seek(0)<0) if(!f->seek || f->seek(0)<0)
return -1; return -1;
file_pos = 0; file_pos = 0;
read_buf = ""; read_buf = "";
crc = crc32(""); crc = crc32("");
} else
pos -= file_pos;
while(pos > 0) { while(pos > 0) {
string r = read(pos>16384? 16384:pos); string r = read(pos>16384? 16384:pos);
if(!sizeof(r)) if(!sizeof(r))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment