* fixed string code page after setstring(rawbytestring,..) (mantis #29833)

git-svn-id: trunk@33268 -
This commit is contained in:
Jonas Maebe 2016-03-18 12:43:42 +00:00
parent 632de58a5e
commit 5919ca84bb
3 changed files with 17 additions and 1 deletions

1
.gitattributes vendored
View File

@ -12921,6 +12921,7 @@ tests/test/tutf8cpl.pp svneol=native#text/plain
tests/test/tvarpropsetter1.pp svneol=native#text/plain
tests/test/tvarpropsetter2.pp svneol=native#text/plain
tests/test/tvarset1.pp svneol=native#text/plain
tests/test/tw29833.pp svneol=native#text/plain
tests/test/twarn1.pp svneol=native#text/pascal
tests/test/tweaklib1.pp svneol=native#text/plain
tests/test/tweaklib2.pp svneol=native#text/plain

View File

@ -515,6 +515,7 @@ implementation
var
paras, strpara, pcharpara: tnode;
procname: string;
cp: tstringencoding;
begin
consume(_LKLAMMER);
paras:=parse_paras(false,false,_RKLAMMER);
@ -534,7 +535,12 @@ implementation
( = paras.right.right) is an ansistring, add a codepage
parameter }
if is_ansistring(strpara.resultdef) then
paras:=ccallparanode.create(genintconstnode(tstringdef(strpara.resultdef).encoding),paras);
begin
cp:=tstringdef(strpara.resultdef).encoding;
if (cp=globals.CP_NONE) then
cp:=0;
paras:=ccallparanode.create(genintconstnode(cp),paras);
end;
procname:='fpc_setstring_'+tstringdef(strpara.resultdef).stringtypname;
{ decide which version to call based on the second parameter }
if not is_shortstring(strpara.resultdef) then

9
tests/test/tw29833.pp Normal file
View File

@ -0,0 +1,9 @@
var
aURI,Server:rawbytestring;
begin
aURI:='abcdefg';
SetString(Server,@aURI[1],Length(aURI));
if stringcodepage(server)=CP_NONE then
halt(1);
end.