From eb93429cf032e93dc5a0a275d7b2745b6a3577e3 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 27 Jun 2013 21:38:02 +0000 Subject: [PATCH] * prefer "constant string" -> pwidechar for {$modeswitch unicodestrings} * prefer "constant char" -> pchar to "constant char" -> pwidechar, and "constant widechar" -> pwidechar to "constant widechar" -> pchar git-svn-id: branches/cpstrrtl@24997 - --- compiler/defcmp.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index e86f613691..050e04021b 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -1140,7 +1140,10 @@ implementation (is_pchar(def_to) or is_pwidechar(def_to)) then begin doconv:=tc_cstring_2_pchar; - eq:=te_convert_l2; + if is_pwidechar(def_to)=(m_default_unicodestring in current_settings.modeswitches) then + eq:=te_convert_l2 + else + eq:=te_convert_l3 end else if (cdo_explicit in cdoptions) or (fromtreetype = arrayconstructorn) then @@ -1171,7 +1174,10 @@ implementation (is_pchar(def_to) or is_pwidechar(def_to)) then begin doconv:=tc_cchar_2_pchar; - eq:=te_convert_l1; + if is_char(def_from)=is_pchar(def_to) then + eq:=te_convert_l1 + else + eq:=te_convert_l2 end else if (m_delphi in current_settings.modeswitches) and is_integer(def_from) then