* support constant array of char to array of widechar

git-svn-id: trunk@1475 -
This commit is contained in:
peter 2005-10-18 12:31:30 +00:00
parent 79f096e6c8
commit 8b60dbe4cb

View File

@ -716,15 +716,21 @@ implementation
if (left.nodetype = stringconstn) and
(tstringdef(left.resulttype.def).string_typ=st_conststring) then
begin
{ if the array is large enough we can use the string
{ if the array of char is large enough we can use the string
constant directly. This is handled in ncgcnv }
if arrsize>=tstringconstnode(left).len then
if (arrsize>=tstringconstnode(left).len) and
is_char(tarraydef(resulttype.def).elementtype.def) then
exit;
{ Convert to shortstring/ansistring and call helper }
if tstringconstnode(left).len>255 then
inserttypeconv(left,cansistringtype)
{ Convert to wide/short/ansistring and call default helper }
if is_widechar(tarraydef(resulttype.def).elementtype.def) then
inserttypeconv(left,cwidestringtype)
else
inserttypeconv(left,cshortstringtype);
begin
if tstringconstnode(left).len>255 then
inserttypeconv(left,cansistringtype)
else
inserttypeconv(left,cshortstringtype);
end;
end;
if is_widechar(tarraydef(resulttype.def).elementtype.def) then
chartype:='widechar'