Pārlūkot izejas kodu

* convert unicode/widestring constants to ansistring in resourcestring
declarations (mantis #25198)

git-svn-id: trunk@25807 -

Jonas Maebe 11 gadi atpakaļ
vecāks
revīzija
8dd956cbde
3 mainītis faili ar 26 papildinājumiem un 0 dzēšanām
  1. 1 0
      .gitattributes
  2. 3 0
      compiler/pdecl.pas
  3. 22 0
      tests/webtbs/tw25198.pp

+ 1 - 0
.gitattributes

@@ -13621,6 +13621,7 @@ tests/webtbs/tw25077.pp svneol=native#text/pascal
 tests/webtbs/tw25081.pp svneol=native#text/pascal
 tests/webtbs/tw25101.pp svneol=native#text/pascal
 tests/webtbs/tw2514.pp svneol=native#text/plain
+tests/webtbs/tw25198.pp svneol=native#text/plain
 tests/webtbs/tw2525.pp svneol=native#text/plain
 tests/webtbs/tw2536.pp svneol=native#text/plain
 tests/webtbs/tw2540.pp svneol=native#text/plain

+ 3 - 0
compiler/pdecl.pas

@@ -956,6 +956,9 @@ implementation
                       stringconstn:
                         with Tstringconstnode(p) do
                           begin
+                             { resourcestrings are currently always single byte }
+                             if cst_type in [cst_widestring,cst_unicodestring] then
+                               changestringtype(getansistringdef);
                              getmem(sp,len+1);
                              move(value_str^,sp^,len+1);
                              sym:=tconstsym.create_string(orgname,constresourcestring,sp,len,nil);

+ 22 - 0
tests/webtbs/tw25198.pp

@@ -0,0 +1,22 @@
+program concatenate_resourestrings_delphiunicode;
+
+{$mode delphiunicode}
+{$codepage cp1250}
+
+{$ifdef unix}
+uses
+  cwstring;
+{$endif}
+
+resourcestring
+  res2 = 'žlu�ouèký ' + 'koníèek';
+
+type
+  tstr1250 = type ansistring(1250);
+var
+  str1250: tstr1250;
+begin
+  str1250 := 'žlu�ouèký ' + 'koníèek';
+  if res2<>str1250 then
+    halt(1);
+end.