Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Felipe Monteiro de Carvalho
On Wed, Oct 19, 2011 at 10:11 AM, Mattias Gaertner wrote: > I never saw such code for ansistring. Only for shortstring. Indeed, I copied some code from the RTL and it seams that I inadvertedly copied code for shortstring instead of ansistring =o I fixed this in rev 32977 in the Pascal Widestring

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Mattias Gaertner
Felipe Monteiro de Carvalho hat am 19. Oktober 2011 um 09:13 geschrieben: > Hello, > > Usually when we work with PChars we do things like this to set the > final terminator: > > var >   ansistr: ansistring; > begin >   // Copy the originating string taking into account the specified length > 

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Felipe Monteiro de Carvalho
2011/10/19 Tomas Hajny : > Sorry for a silly question, but why the difference between the two > implementations (i.e. why not addressing the WideStr element directly > without the typecast)? Actually it should be a pointer operation in the ansistring version too, because setting chars in a string

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Tomas Hajny
On Wed, October 19, 2011 09:13, Felipe Monteiro de Carvalho wrote: Hi, > Usually when we work with PChars we do things like this to set the > final terminator: > > var > ansistr: ansistring; > begin > // Copy the originating string taking into account the specified length > SetLength(ansis

Re: [fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Sven Barth
Am 19.10.2011 09:13, schrieb Felipe Monteiro de Carvalho: Hello, Usually when we work with PChars we do things like this to set the final terminator: var ansistr: ansistring; begin // Copy the originating string taking into account the specified length SetLength(ansistr, len+1); Sys

[fpc-pascal] Stack corruption setting UnicodeString Char

2011-10-19 Thread Felipe Monteiro de Carvalho
Hello, Usually when we work with PChars we do things like this to set the final terminator: var ansistr: ansistring; begin // Copy the originating string taking into account the specified length SetLength(ansistr, len+1); System.Move(source^, ansistr[1], len); ansistr[len+1] := #0; Se