View Issue Details

IDProjectCategoryView StatusLast Update
0037118FPCRTLpublic2020-05-20 09:34
ReporterMarcelo Campos Rocha Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.2.0 
Summary0037118: THandleStream.SetSize doesn't change position property
DescriptionThe current implementation only call FileTruncate. Delphi's documentation(http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Classes_THandleStream_SetSize@Int64.html) describes that before truncate, seek is called to position the file at the new end.
Steps To Reproduceprogram Project1;

{$mode delphi}

uses
  SysUtils, Classes;

var
  f: TFileStream;
  content: AnsiString;

begin
  f := TFileStream.Create('file.txt', fmCreate);
  content := 'file content';

  f.Write(PAnsiChar(content)^, Length(content));
  f.Size := 4;
  Writeln('File position should be 4 but it''s ', f.Position);
  f.free;
end.
TagsNo tags attached.
Fixed in Revision45444
FPCOldBugId
FPCTarget4.0.0
Attached Files

Activities

Michael Van Canneyt

2020-05-20 09:34

administrator   ~0122947

Fixed, thanks for reporting!

Issue History

Date Modified Username Field Change
2020-05-20 00:58 Marcelo Campos Rocha New Issue
2020-05-20 09:34 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-05-20 09:34 Michael Van Canneyt Status new => resolved
2020-05-20 09:34 Michael Van Canneyt Resolution open => fixed
2020-05-20 09:34 Michael Van Canneyt Fixed in Version => 3.2.0
2020-05-20 09:34 Michael Van Canneyt Fixed in Revision => 45444
2020-05-20 09:34 Michael Van Canneyt FPCTarget => 4.0.0
2020-05-20 09:34 Michael Van Canneyt Note Added: 0122947