mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 07:29:29 +02:00
* support constant array of char to array of widechar
git-svn-id: trunk@1475 -
This commit is contained in:
parent
79f096e6c8
commit
8b60dbe4cb
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user