Sign in Join

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

Mailing lists / fpc-devel / 2005-06

TStringList.commatext

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Martin Pekar

Hi,

I found some errors in TSringList.CommaText and tryed to fix it. For variable sl:TStringList, command

sl.CommaText:=sl.CommaText;

sometimes changes strings in the list
- when list contained more then one string and last string was '', previous command removed last string from the list
- string in a list was not qouted in commatext, if it contained #0 before first '"' or ',' or ' '
- commatext for empty list was '""', just like for list containing one empty string, so previous command changed empty list into list with one empty string

I am sending changed rtl\objpas\classes\stringl.inc in attachment. I have
changed methods
Function TStrings.GetDelimitedText: string;
Procedure TStrings.SetDelimitedText(const AValue: string);
and removed
Function GetNextQuotedChar (var P : PChar; Var S : String; Delim,Quote :
Char): Boolean;

changed parts are stil there as coments

Martin

Reply by email

Michael Van Canneyt
to Martin Pekar
Martin Pekar wrote 12 lines
Hi, I found some errors in TSringList.CommaText and tryed to fix it. For variable sl:TStringList, command sl.CommaText:=sl.CommaText; sometimes changes strings in the list - when list contained more then one string and last string was '', previous command removed last string from the list - string in a list was not qouted in commatext, if it contained #0 before first '"' or ',' or ' '

I am not comfortable with your #0 patch; It's a potential memory leak, so I'm inclined to say that #0 characters are not allowed in a stringlist.

Please remove this change and send the patch to me in private.

Michael.

Reply by email