Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-01

[FPC1.1] SetString(AnsiString,...) and #0

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dimitry Sibiryakov

Hi, All!

I think current behavior of SetString is incorrect. AnsiString may contain #0's so SetString shouldn't care about Buf's content. BTW, what if Len=0?

astrings.inc.diff:

805,806d804
< var
<   BufLen: longint;
810,815c808
<     begin
<       BufLen := StrLen(Buf);
<       If (BufLen < Len) then
<         Len := BufLen;
<       Move (Buf[0],S[1],Len);
<     end;
---
Move (Buf[0],S[1],Len);

SY, Dimitry Sibiryakov.

Reply by email

Jonas Maebe
to Dimitry Sibiryakov
Dimitry Sibiryakov wrote
I think current behavior of SetString is incorrect. AnsiString may contain #0's so SetString shouldn't care about Buf's content.

Thanks, it's fixed.

BTW, what if Len=0?

No problem, setlength() will make the ansistring nil in len = 0.

Jonas

Reply by email