From 8dd956cbde7ccf5bf70816967e906a3a4eb89498 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 17 Oct 2013 12:43:39 +0000 Subject: [PATCH] * convert unicode/widestring constants to ansistring in resourcestring declarations (mantis #25198) git-svn-id: trunk@25807 - --- .gitattributes | 1 + compiler/pdecl.pas | 3 +++ tests/webtbs/tw25198.pp | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/webtbs/tw25198.pp diff --git a/.gitattributes b/.gitattributes index 9b2f3e5e7c..6a302ca01a 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index a26528fbe9..8e17243400 100644 --- a/compiler/pdecl.pas +++ b/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); diff --git a/tests/webtbs/tw25198.pp b/tests/webtbs/tw25198.pp new file mode 100644 index 0000000000..ab764b7b99 --- /dev/null +++ b/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.