View Issue Details

IDProjectCategoryView StatusLast Update
0035330FPCRTLpublic2019-05-13 14:29
Reporterrd0x Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSWindows/Linux 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0035330: TFileStream.ReadBuffer fails with TBytes while Delphi works
DescriptionfResultBytes: TBytes;

In Delphi
TFileStream.ReadBuffer(fResultBytes, fBytesToEnd);
works fine without issues while in FPC it crashes the program or throws an exception (Stream read error)

In FPC and Delphi
TFileStream.ReadBuffer(fResultBytes[0], fBytesToEnd);
works fine
Steps To Reproducerun the attached program and change the lines for ReadBuffer
Additional Informationhappens also on trunk
TagsNo tags attached.
Fixed in Revision42042
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

rd0x

2019-04-06 09:13

reporter  

filestream.pas (1,667 bytes)

rd0x

2019-04-06 09:14

reporter  

x.txt (251 bytes)   
The quick brown fox jumps over the lazy dog
asdf
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
lskfsgh
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
fsgdhfhfh
x.txt (251 bytes)   

Michael Van Canneyt

2019-04-06 09:25

administrator   ~0115262

This is a known issue.

Delphi has a special overload for TBytes. FPC does not have this.
I will add it, but for the time being, you must use the fResultBytes[0] variant.

Marco van de Voort

2019-04-18 12:54

manager   ~0115648

TFilestream or TStream?

Michael Van Canneyt

2019-05-12 10:10

administrator   ~0116146

Added Read/Write for TBytes.

Also Added ReadData/WriteData ReadBufferData/WriteBufferDate methods found in newer delphis.

Issue History

Date Modified Username Field Change
2019-04-06 09:13 rd0x New Issue
2019-04-06 09:13 rd0x File Added: filestream.pas
2019-04-06 09:14 rd0x File Added: x.txt
2019-04-06 09:24 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-04-06 09:24 Michael Van Canneyt Status new => assigned
2019-04-06 09:25 Michael Van Canneyt Note Added: 0115262
2019-04-18 12:54 Marco van de Voort Note Added: 0115648
2019-05-12 10:10 Michael Van Canneyt Status assigned => resolved
2019-05-12 10:10 Michael Van Canneyt Resolution open => fixed
2019-05-12 10:10 Michael Van Canneyt Fixed in Version => 3.3.1
2019-05-12 10:10 Michael Van Canneyt Fixed in Revision => 42042
2019-05-12 10:10 Michael Van Canneyt FPCTarget => 3.2.0
2019-05-12 10:10 Michael Van Canneyt Note Added: 0116146
2019-05-13 14:29 rd0x Status resolved => closed