From 3ca96dd897c5b3a9fbfc6e96c447fc8a03e7bfaf Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 6 Jun 2000 13:06:17 +0000 Subject: [PATCH] * ansistring constants now also get a trailing #0 (bug reported by Thomas Schatzl) --- compiler/ptconst.pas | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index 372132989d..9fe7627a47 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -496,10 +496,14 @@ unit ptconst; { third write use count (set to -1 for safety ) } consts^.concat(new(pai_const,init_32bit(-1))); consts^.concat(new(pai_label,init(ll))); - getmem(ca,strlength+1); + getmem(ca,strlength+2); move(strval^,ca^,strlength); + { The terminating #0 to be stored in the .data section (JM) } ca[strlength]:=#0; - consts^.concat(new(pai_string,init_length_pchar(ca,strlength))); + { End of the PChar. The memory has to be allocated because in } + { tai_string.done, there is a freemem(len+1) (JM) } + ca[strlength+1]:=#0; + consts^.concat(new(pai_string,init_length_pchar(ca,strlength+1))); end; end; end; @@ -790,7 +794,11 @@ unit ptconst; end. { $Log$ - Revision 1.67 2000-05-17 17:10:06 peter + Revision 1.68 2000-06-06 13:06:17 jonas + * ansistring constants now also get a trailing #0 (bug reported by + Thomas Schatzl) + + Revision 1.67 2000/05/17 17:10:06 peter * add support for loading of typed const strings with resourcestrings, made the loading also a bit more generic