mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-02 20:18:32 +02:00
* when simplifying a constant string concatenation that gets assigned to a
rawbytestring, ensure the resulting constant string does not get CP_NONE as codepage, but the default system code page (mantis #30082) git-svn-id: trunk@33597 -
This commit is contained in:
parent
6d3b580f2f
commit
2bbab60c92
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15044,6 +15044,7 @@ tests/webtbs/tw30035.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30035a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3004.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3005.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30082.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3010.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3012.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3023.pp svneol=native#text/plain
|
||||
|
@ -824,7 +824,11 @@ implementation
|
||||
begin
|
||||
t:=cstringconstnode.createpchar(concatansistrings(s1,s2,l1,l2),l1+l2,nil);
|
||||
typecheckpass(t);
|
||||
tstringconstnode(t).changestringtype(resultdef);
|
||||
if not is_ansistring(resultdef) or
|
||||
(tstringdef(resultdef).encoding<>globals.CP_NONE) then
|
||||
tstringconstnode(t).changestringtype(resultdef)
|
||||
else
|
||||
tstringconstnode(t).changestringtype(getansistringdef)
|
||||
end;
|
||||
ltn :
|
||||
t:=cordconstnode.create(byte(compareansistrings(s1,s2,l1,l2)<0),pasbool8type,true);
|
||||
@ -1859,7 +1863,7 @@ implementation
|
||||
begin
|
||||
{ use same code page if possible (don't force same code
|
||||
page in case both are ansistrings with code page <>
|
||||
CP_NONE, since then data loss can occur (the ansistring
|
||||
CP_NONE, since then data loss can occur: the ansistring
|
||||
helpers will convert them at run time to an encoding
|
||||
that can represent both encodings) }
|
||||
if is_ansistring(ld) and
|
||||
|
15
tests/webtbs/tw30082.pp
Normal file
15
tests/webtbs/tw30082.pp
Normal file
@ -0,0 +1,15 @@
|
||||
{$mode objfpc}
|
||||
{$h+}
|
||||
|
||||
var
|
||||
s : rawByteString;
|
||||
begin
|
||||
s:='REGISTER'+'DATA';
|
||||
writeln(stringcodepage(s));
|
||||
if stringcodepage(s)<>0 then
|
||||
halt(1);
|
||||
s:=s+'NAME';
|
||||
writeln(stringcodepage(s));
|
||||
if stringcodepage(s)<>0 then
|
||||
halt(2);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user