2
0
Эх сурвалжийг харах

* Implemented CompareWideString, based on CompareStr

git-svn-id: trunk@10501 -
joost 17 жил өмнө
parent
commit
b5454e0352
1 өөрчлөгдсөн 24 нэмэгдсэн , 1 устгасан
  1. 24 1
      rtl/inc/wustrings.inc

+ 24 - 1
rtl/inc/wustrings.inc

@@ -1971,10 +1971,33 @@ function GenericWideCase(const s : WideString) : WideString;
     unimplementedwidestring;
   end;
 
+function CompareWideMemRange(P1, P2: Pointer; Length: cardinal): integer;
+  var i: cardinal;
+  begin
+    i := 0;
+    result := 0;
+    while (result=0) and (I<length) do
+      begin
+      result:=Word(P1^)-Word(P2^);
+      P1:=PWideChar(P1)+1;            // VP compat.
+      P2:=PWideChar(P2)+1;
+      i := i + 1;
+      end;
+  end;
 
 function CompareWideString(const s1, s2 : WideString) : PtrInt;
+  var count, count1, count2: integer;
   begin
-    unimplementedwidestring;
+    result := 0;
+    Count1 := Length(S1);
+    Count2 := Length(S2);
+    if Count1>Count2 then
+      Count:=Count2
+    else
+      Count:=Count1;
+    result := CompareWideMemRange(Pointer(S1),Pointer(S2), Count);
+    if result=0 then
+      result:=Count1-Count2;
   end;