Explorar o código

* fixed typo when converting tunicodestring to punicodechar

git-svn-id: branches/unicodestring@11717 -
florian %!s(int64=17) %!d(string=hai) anos
pai
achega
7e7658df8f
Modificáronse 3 ficheiros con 29 adicións e 1 borrados
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/defcmp.pas
  3. 27 0
      tests/test/tstring10.pp

+ 1 - 0
.gitattributes

@@ -7826,6 +7826,7 @@ tests/test/tsetsize.pp svneol=native#text/plain
 tests/test/tstack.pp svneol=native#text/plain
 tests/test/tstprocv.pp svneol=native#text/plain
 tests/test/tstring1.pp svneol=native#text/plain
+tests/test/tstring10.pp svneol=native#text/plain
 tests/test/tstring2.pp svneol=native#text/plain
 tests/test/tstring3.pp svneol=native#text/plain
 tests/test/tstring4.pp svneol=native#text/plain

+ 1 - 1
compiler/defcmp.pas

@@ -909,7 +909,7 @@ implementation
                          else
                           { pwidechar(widestring) }
                           if is_pwidechar(def_to) and
-                             (is_widestring(def_from) or is_unicodestring(def_to))  then
+                            is_wide_or_unicode_string(def_from) then
                            begin
                              doconv:=tc_ansistring_2_pchar;
                              eq:=te_convert_l1;

+ 27 - 0
tests/test/tstring10.pp

@@ -0,0 +1,27 @@
+program punicodechartest;
+{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
+{$ifdef mswindows}{$apptype console}{$endif}
+uses
+ {$ifdef FPC}{$ifdef linux}cthreads,{$endif}{$endif}
+ sysutils;
+var
+ astr: ansistring;
+ wstr: widestring;
+ ustr: unicodestring;
+begin
+ astr:= '';
+ wstr:= '';
+ ustr:= '';
+ writeln(ptrint(pansichar(astr)));
+ flush(output);
+ writeln(ptrint(pwidechar(wstr)));
+ flush(output);
+ writeln(ptrint(punicodechar(ustr)));
+ flush(output);
+ writeln(ord(pansichar(astr)^));
+ flush(output);
+ writeln(ord(pwidechar(wstr)^));
+ flush(output);
+ writeln(ord(punicodechar(ustr)^));
+ flush(output);
+end.