瀏覽代碼

* Create proper unicode string for single char if in unicode rtl

Michaël Van Canneyt 4 月之前
父節點
當前提交
b5e2003392
共有 1 個文件被更改,包括 14 次插入4 次删除
  1. 14 4
      compiler/pdecl.pas

+ 14 - 4
compiler/pdecl.pas

@@ -1339,10 +1339,20 @@ implementation
                         begin
                            if is_constcharnode(p) then
                              begin
-                                getmem(sp,2);
-                                sp[0]:=chr(tordconstnode(p).value.svalue);
-                                sp[1]:=#0;
-                                sym:=cconstsym.create_string(orgname,constresourcestring,sp,1,nil);
+                                if not is_systemunit_unicode then
+                                  begin
+                                  getmem(sp,2);
+                                  sp[0]:=chr(tordconstnode(p).value.svalue);
+                                  sp[1]:=#0;
+                                  sym:=cconstsym.create_string(orgname,constresourcestring,sp,1,nil);
+                                  end
+                                else
+                                  begin
+                                  initwidestring(pw);
+                                  setlengthwidestring(pw,1);
+                                  pw^.data^:=tordconstnode(p).value.svalue;
+                                  sym:=cconstsym.create_wstring(orgname,constwresourcestring,pw);
+                                  end;
                              end
                            else
                              Message(parser_e_illegal_expression);