View Issue Details

IDProjectCategoryView StatusLast Update
0038963FPCRTLpublic2021-06-05 15:43
ReporterSebastian Hellwig Assigned ToMarco van de Voort  
Status resolvedResolutionfixed 
Summary0038963: [Patch] Fix TStringStream.WriteUnicodeString
DescriptionThis patch fixes an issue with the method TStringStream.WriteUnicodeString, which causes it to not work properly.

If the stream is empty the method doesn't write anything to the stream. If the stream has data, the written size is not determined by the size of the string to be written, but by the current size of the stream.
Steps To ReproduceCall the method TStringStream.WriteUnicodeString and verify the size afterwards:

StringStream := TStringStream.Create('', TEncoding.Unicode, False);
StringStream.WriteUnicodeString('Lorem Ipsum');
// StringStream.Size is 0
Additional InformationAs of Revision 49477 the problem still exists.
TagsNo tags attached.
Fixed in Revision49478
Attached Files


Sebastian Hellwig

2021-06-05 08:37


WriteUnicodeString-fix.patch (443 bytes)   
Index: rtl/objpas/classes/
--- rtl/objpas/classes/	(Revision 49477)
+++ rtl/objpas/classes/	(Arbeitskopie)
@@ -1643,7 +1643,7 @@
   if Length(B)>0 then
-    WriteBuffer(B[0],Length(Bytes));
+    WriteBuffer(B[0],Length(B));
 function TStringStream.ReadAnsiString(Count: Longint): AnsiString;

Marco van de Voort

2021-06-05 15:43

manager   ~0131159

committed, thanks!

Issue History

Date Modified Username Field Change
2021-06-05 08:37 Sebastian Hellwig New Issue
2021-06-05 08:37 Sebastian Hellwig File Added: WriteUnicodeString-fix.patch
2021-06-05 15:43 Marco van de Voort Assigned To => Marco van de Voort
2021-06-05 15:43 Marco van de Voort Status new => resolved
2021-06-05 15:43 Marco van de Voort Resolution open => fixed
2021-06-05 15:43 Marco van de Voort Fixed in Revision => 49478
2021-06-05 15:43 Marco van de Voort FPCTarget => -
2021-06-05 15:43 Marco van de Voort Note Added: 0131159