Parcourir la source

* return the correct size for files in ar archive. This is required by the REL
reader, which reads files until the end of file

git-svn-id: trunk@45558 -

nickysn il y a 5 ans
Parent
commit
d0beacc35f
2 fichiers modifiés avec 16 ajouts et 1 suppressions
  1. 7 0
      compiler/owar.pas
  2. 9 1
      compiler/owbase.pas

+ 7 - 0
compiler/owar.pas

@@ -75,6 +75,7 @@ type
     procedure ReadArchive;
   protected
     function getfilename:string;override;
+    function GetSize: longint;override;
     function GetPos: longint;override;
     function GetIsArchive: boolean; override;
   public
@@ -366,6 +367,12 @@ implementation
       end;
 
 
+    function tarobjectreader.GetSize: longint;
+      begin
+        result:=CurrMemberSize;
+      end;
+
+
     function tarobjectreader.GetPos: longint;
       begin
         result:=inherited GetPos-CurrMemberPos;

+ 9 - 1
compiler/owbase.pas

@@ -55,6 +55,8 @@ type
 
   tobjectwriterclass = class of tobjectwriter;
 
+  { tobjectreader }
+
   tobjectreader=class
   private
     f      : TCCustomFileStream;
@@ -66,6 +68,7 @@ type
     function readbuf:boolean;
   protected
     function getfilename : string;virtual;
+    function GetSize: longint;virtual;
     function GetPos: longint;virtual;
     function GetIsArchive: boolean;virtual;
   public
@@ -78,7 +81,7 @@ type
     function  read(out b;len:longint):boolean;virtual;
     function  readarray(a:TDynamicArray;len:longint):boolean;
     property filename : string read getfilename;
-    property size:longint read bufmax;
+    property size:longint read GetSize;
     property Pos:longint read GetPos;
     property IsArchive: boolean read GetIsArchive;
   end;
@@ -332,6 +335,11 @@ function tobjectreader.getfilename : string;
     result:=ffilename;
   end;
 
+function tobjectreader.GetSize: longint;
+  begin
+    result:=bufmax;
+  end;
+
 function tobjectreader.GetPos: longint;
   begin
     Result:=bufidx;