mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-20 19:09:39 +01:00
o update by Michael Denisenko for case <string> of
* memory management fixed * idention fixed git-svn-id: trunk@13712 -
This commit is contained in:
parent
da7fdf76d5
commit
02eeb3dad6
@ -277,7 +277,11 @@ implementation
|
||||
if is_wide then
|
||||
begin
|
||||
if (tstringconstnode(p).cst_type in [cst_widestring, cst_unicodestring]) then
|
||||
get_string_value := tstringconstnode(p).value_str
|
||||
begin
|
||||
initwidestring(pWideStringVal);
|
||||
copywidestring(pcompilerwidestring(tstringconstnode(p).value_str), pWideStringVal);
|
||||
get_string_value := TConstString(pWideStringVal);
|
||||
end
|
||||
else
|
||||
{ if string must be wide, but actually was parsed as usual }
|
||||
begin
|
||||
@ -297,7 +301,12 @@ implementation
|
||||
get_string_value := pCharVal;
|
||||
end
|
||||
else
|
||||
get_string_value := tstringconstnode(p).value_str;
|
||||
begin
|
||||
getmem(pCharVal, tstringconstnode(p).len + 1);
|
||||
strcopy(pCharVal, tstringconstnode(p).value_str);
|
||||
pCharVal[tstringconstnode(p).len] := #0;
|
||||
get_string_value := pCharVal;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
|
||||
@ -231,11 +231,13 @@ implementation
|
||||
((not caseofstring) and (not is_subequal(casedef, p.resultdef))) then
|
||||
CGMessage(parser_e_case_mismatch);
|
||||
|
||||
if caseofstring then begin
|
||||
if caseofstring then
|
||||
begin
|
||||
sl1:=get_string_value(p, is_wide_or_unicode_string(casedef));
|
||||
casenode.addlabel(blockid,sl1,sl1,st2cst[tstringdef(casedef).stringtype]);
|
||||
end
|
||||
else begin
|
||||
else
|
||||
begin
|
||||
hl1:=get_ordinal_value(p);
|
||||
if not casedeferror then
|
||||
testrange(casedef,hl1,false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user