Browse Source

* set the code page of rawbytestring typed constants to the same value as
when assigning a string constant to a rawbytestring (system code page with
{$modeswitch systemcodepage}, CP_ACP without) (mantis #25332)

git-svn-id: trunk@26397 -

Jonas Maebe 11 years ago
parent
commit
ffd6a4ea47
4 changed files with 25 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 6 0
      compiler/ngtcon.pas
  3. 9 0
      tests/webtbs/tw25332.pp
  4. 8 0
      tests/webtbs/tw25332a.pp

+ 2 - 0
.gitattributes

@@ -13757,6 +13757,8 @@ tests/webtbs/tw2525.pp svneol=native#text/plain
 tests/webtbs/tw25269.pp svneol=native#text/pascal
 tests/webtbs/tw25269.pp svneol=native#text/pascal
 tests/webtbs/tw25289.pp svneol=native#text/plain
 tests/webtbs/tw25289.pp svneol=native#text/plain
 tests/webtbs/tw25318.pp svneol=native#text/pascal
 tests/webtbs/tw25318.pp svneol=native#text/pascal
+tests/webtbs/tw25332.pp svneol=native#text/plain
+tests/webtbs/tw25332a.pp svneol=native#text/plain
 tests/webtbs/tw25349.pp svneol=native#text/plain
 tests/webtbs/tw25349.pp svneol=native#text/plain
 tests/webtbs/tw2536.pp svneol=native#text/plain
 tests/webtbs/tw2536.pp svneol=native#text/plain
 tests/webtbs/tw25361.pp svneol=native#text/plain
 tests/webtbs/tw25361.pp svneol=native#text/plain

+ 6 - 0
compiler/ngtcon.pas

@@ -455,6 +455,12 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
               begin
               begin
                 strlength:=tstringconstnode(node).len;
                 strlength:=tstringconstnode(node).len;
                 strval:=tstringconstnode(node).value_str;
                 strval:=tstringconstnode(node).value_str;
+                { the def may have changed from e.g. RawByteString to
+                  AnsiString(CP_ACP) }
+                if node.resultdef.typ=stringdef then
+                  def:=tstringdef(node.resultdef)
+                else
+                  internalerror(2014010501);
               end
               end
             else
             else
               begin
               begin

+ 9 - 0
tests/webtbs/tw25332.pp

@@ -0,0 +1,9 @@
+
+{mode delphiunicode}
+
+const r: rawbytestring = 'abc';
+begin
+  if (stringcodepage(r) <> CP_ACP) and
+     (stringcodepage(r) <> DefaultSystemCodePage) then
+    halt(1);
+end.

+ 8 - 0
tests/webtbs/tw25332a.pp

@@ -0,0 +1,8 @@
+
+{$mode delphiunicode}
+
+const r: rawbytestring = 'abc';
+begin
+  if stringcodepage(r) = CP_NONE then
+    halt(1);
+end.