Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change in behavior for TStringStream.ReadString in D2009?

Tags:

delphi

I noticed today that in D2009 (with update 1), TStringStream.ReadString does not move the Position in the Stream anymore like it used to do up to D2007.
So, looping on MyStringStream.ReadString(10) would always read the 1st 10 chars of the stream instead of moving along and getting all the stream 10 chars by 10 chars. I checked the doc, it still says that ReadString should move the Position...
Can anyone confirm if it is a bug in the D2009 code or if there has been a design change (and why) and the doc is obsolete?
Thanks...

Update: Reported issue in QC #68582

like image 690
Francesca Avatar asked Nov 04 '08 07:11

Francesca


1 Answers

Definitely a bug and an ugly compatibility breakage. If you check the Classes.pas, you'll see Unicode and non-Unicode version of the ReadString. Non-Unicode version is incrementing the FPosition while Unicode is not. Both original D2009 and Update 1 are behaving the same.

Please report it in QC.

like image 90
gabr Avatar answered Oct 04 '22 01:10

gabr