mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 11:49:30 +02:00
* 64-bit support
git-svn-id: trunk@27705 -
This commit is contained in:
parent
2fc9ad04e8
commit
1aba82b677
@ -54,7 +54,7 @@ type
|
||||
|
||||
Tcompressionstream=class(Tcustomzlibstream)
|
||||
protected
|
||||
raw_written,compressed_written:longint;
|
||||
raw_written,compressed_written: int64;
|
||||
public
|
||||
constructor create(level:Tcompressionlevel;
|
||||
dest:Tstream;
|
||||
@ -68,7 +68,7 @@ type
|
||||
|
||||
Tdecompressionstream=class(Tcustomzlibstream)
|
||||
protected
|
||||
raw_read,compressed_read:longint;
|
||||
raw_read,compressed_read:int64;
|
||||
skipheader:boolean;
|
||||
procedure reset;
|
||||
function GetPosition() : Int64; override;
|
||||
@ -76,7 +76,7 @@ type
|
||||
constructor create(Asource:Tstream;Askipheader:boolean=false);
|
||||
destructor destroy;override;
|
||||
function read(var buffer;count:longint):longint;override;
|
||||
function seek(offset:longint;origin:word):longint;override;
|
||||
function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;
|
||||
function get_compressionrate:single;
|
||||
property OnProgress;
|
||||
end;
|
||||
@ -329,33 +329,33 @@ begin
|
||||
GetPosition := raw_read;
|
||||
end;
|
||||
|
||||
function Tdecompressionstream.seek(offset:longint;origin:word):longint;
|
||||
function Tdecompressionstream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64;
|
||||
|
||||
var c:longint;
|
||||
var c,off: int64;
|
||||
|
||||
begin
|
||||
if (origin=sofrombeginning) or
|
||||
((origin=sofromcurrent) and (offset+raw_read>=0)) then
|
||||
off:=Offset;
|
||||
if (origin=soBeginning) or ((origin=soCurrent) and (off+raw_read>=0)) then
|
||||
begin
|
||||
if origin = sofromcurrent then
|
||||
seek := raw_read + offset
|
||||
if origin = soCurrent then
|
||||
seek := raw_read + off
|
||||
else
|
||||
seek := offset;
|
||||
seek := off;
|
||||
|
||||
if origin=sofrombeginning then
|
||||
dec(offset,raw_read);
|
||||
if origin=soBeginning then
|
||||
dec(off,raw_read);
|
||||
if offset<0 then
|
||||
begin
|
||||
inc(offset,raw_read);
|
||||
inc(off,raw_read);
|
||||
reset;
|
||||
end;
|
||||
while offset>0 do
|
||||
while off>0 do
|
||||
begin
|
||||
c:=offset;
|
||||
c:=off;
|
||||
if c>bufsize then
|
||||
c:=bufsize;
|
||||
c:=read(Fbuffer^,c);
|
||||
dec(offset,c);
|
||||
dec(off,c);
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user