浏览代码

UPD: Allocate space using an independent property

Alexander Koblov 1 年之前
父节点
当前提交
fa9bf4e35b

+ 4 - 3
components/doublecmd/dcclassesutf8.pas

@@ -42,7 +42,7 @@ type
   protected
   protected
     FFileName: String;
     FFileName: String;
     procedure Sync(AWritten: Int64);
     procedure Sync(AWritten: Int64);
-    procedure SetSize64(const NewSize: Int64); override;
+    procedure SetCapacity(const NewCapacity: Int64);
   public
   public
     constructor Create(const AFileName: String; Mode: LongWord); virtual; overload;
     constructor Create(const AFileName: String; Mode: LongWord); virtual; overload;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -51,6 +51,7 @@ type
     function Write(const Buffer; Count: LongInt): LongInt; override;
     function Write(const Buffer; Count: LongInt): LongInt; override;
     property DirtyLimit: Int64 read FDirtyLimit write FDirtyLimit;
     property DirtyLimit: Int64 read FDirtyLimit write FDirtyLimit;
     property AutoSync: Boolean read FAutoSync write SetAutoSync;
     property AutoSync: Boolean read FAutoSync write SetAutoSync;
+    property Capacity: Int64 write SetCapacity;
     property FileName: String read FFileName;
     property FileName: String read FFileName;
   end; 
   end; 
 
 
@@ -156,9 +157,9 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TFileStreamEx.SetSize64(const NewSize: Int64);
+procedure TFileStreamEx.SetCapacity(const NewCapacity: Int64);
 begin
 begin
-  FileAllocate(Handle, NewSize);
+  FileAllocate(Handle, NewCapacity);
 end;
 end;
 
 
 constructor TFileStreamEx.Create(const AFileName: String; Mode: LongWord);
 constructor TFileStreamEx.Create(const AFileName: String; Mode: LongWord);

+ 1 - 1
components/doublecmd/doublecmd_common.lpk

@@ -36,7 +36,7 @@ end"/>
     </CompilerOptions>
     </CompilerOptions>
     <Description Value="Common units for Double Commander"/>
     <Description Value="Common units for Double Commander"/>
     <License Value="GNU GPL 2"/>
     <License Value="GNU GPL 2"/>
-    <Version Minor="4" Release="1"/>
+    <Version Minor="4" Release="2"/>
     <Files Count="12">
     <Files Count="12">
       <Item1>
       <Item1>
         <Filename Value="dcclassesutf8.pas"/>
         <Filename Value="dcclassesutf8.pas"/>

+ 2 - 2
src/filesources/filesystem/ufilesystemutil.pas

@@ -615,7 +615,7 @@ var
             TotalBytesToRead := SourceFileStream.Size;
             TotalBytesToRead := SourceFileStream.Size;
             if FReserveSpace then
             if FReserveSpace then
             begin
             begin
-              TargetFileStream.Size:= SourceFileStream.Size;
+              TargetFileStream.Capacity:= SourceFileStream.Size;
               TargetFileStream.Seek(0, fsFromBeginning);
               TargetFileStream.Seek(0, fsFromBeginning);
             end;
             end;
           end;
           end;
@@ -759,7 +759,7 @@ begin
 
 
         if FReserveSpace then
         if FReserveSpace then
         begin
         begin
-          TargetFileStream.Size:= SourceFileStream.Size;
+          TargetFileStream.Capacity:= SourceFileStream.Size;
           TargetFileStream.Seek(0, fsFromBeginning);
           TargetFileStream.Seek(0, fsFromBeginning);
         end;
         end;
       end else
       end else