Browse Source

* 64-bit support

git-svn-id: trunk@27705 -
michael 11 years ago
parent
commit
1aba82b677
1 changed files with 16 additions and 16 deletions
  1. 16 16
      packages/paszlib/src/zstream.pp

+ 16 - 16
packages/paszlib/src/zstream.pp

@@ -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