Browse Source

--- Merging r31480 into '.':
U rtl/inc/ustrings.inc
A tests/webtbs/tw28593.pp
--- Recording mergeinfo for merge of r31480 into '.':
U .

# revisions: 31480

git-svn-id: branches/fixes_3_0@32261 -

joost 9 years ago
parent
commit
aef7142f34
3 changed files with 29 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      rtl/inc/ustrings.inc
  3. 27 0
      tests/webtbs/tw28593.pp

+ 1 - 0
.gitattributes

@@ -14284,6 +14284,7 @@ tests/webtbs/tw2853c.pp svneol=native#text/plain
 tests/webtbs/tw2853d.pp svneol=native#text/plain
 tests/webtbs/tw2853d.pp svneol=native#text/plain
 tests/webtbs/tw2853e.pp svneol=native#text/plain
 tests/webtbs/tw2853e.pp svneol=native#text/plain
 tests/webtbs/tw2859.pp svneol=native#text/plain
 tests/webtbs/tw2859.pp svneol=native#text/plain
+tests/webtbs/tw28593.pp svneol=native#text/plain
 tests/webtbs/tw2865.pp svneol=native#text/plain
 tests/webtbs/tw2865.pp svneol=native#text/plain
 tests/webtbs/tw28674.pp svneol=native#text/pascal
 tests/webtbs/tw28674.pp svneol=native#text/pascal
 tests/webtbs/tw28718a.pp svneol=native#text/plain
 tests/webtbs/tw28718a.pp svneol=native#text/plain

+ 1 - 1
rtl/inc/ustrings.inc

@@ -2195,7 +2195,7 @@ begin
   for i:=0 to length(s)-2 do  { -2 because s contains explicit terminating #0 }
   for i:=0 to length(s)-2 do  { -2 because s contains explicit terminating #0 }
     begin
     begin
       nc:=s[i];
       nc:=s[i];
-      if (nc<$ffff) then
+      if (nc<=$ffff) then
         dest^:=widechar(nc)
         dest^:=widechar(nc)
       else if (dword(nc)<=$10ffff) then
       else if (dword(nc)<=$10ffff) then
         begin
         begin

+ 27 - 0
tests/webtbs/tw28593.pp

@@ -0,0 +1,27 @@
+program tucs4toutf16FFFF;
+{$H+}
+uses
+  sysutils;
+
+procedure halt_error(const AErrorCode : Integer; const AMsg : string);
+begin
+  Write(AMsg);
+  Halt(AErrorCode);
+end;
+
+var
+  s4 : UCS4String;
+  us : UnicodeString;
+begin
+  SetLength(s4,2);
+  s4[0] := $FFFF;
+  s4[1] := 0;
+  us := UCS4StringToUnicodeString(s4);
+  if (Length(us) <> 1) then
+    halt_error(1, 'A single code point UTF6 string expected.');
+  if (Ord(us[1]) <> $FFFF) then
+    halt_error(2, 'code point U+FFFF expected, got U+'+IntToHex(Ord(us[1]),4));
+  WriteLn('OK');
+end.
+
+