Pārlūkot izejas kodu

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

Michaël Van Canneyt 4 mēneši atpakaļ
vecāks
revīzija
b5e2003392
1 mainītis faili ar 14 papildinājumiem un 4 dzēšanām
  1. 14 4
      compiler/pdecl.pas

+ 14 - 4
compiler/pdecl.pas

@@ -1339,10 +1339,20 @@ implementation
                         begin
                         begin
                            if is_constcharnode(p) then
                            if is_constcharnode(p) then
                              begin
                              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
                              end
                            else
                            else
                              Message(parser_e_illegal_expression);
                              Message(parser_e_illegal_expression);