瀏覽代碼

* 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 -

Jonas Maebe 12 年之前
父節點
當前提交
eb93429cf0
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      compiler/defcmp.pas

+ 8 - 2
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