|
@@ -752,7 +752,8 @@ begin
|
|
DefCpRec.OS2CP := CPArr [0];
|
|
DefCpRec.OS2CP := CPArr [0];
|
|
(* Find out WinCP _without_ considering RtlUsesWinCP *)
|
|
(* Find out WinCP _without_ considering RtlUsesWinCP *)
|
|
I := 1;
|
|
I := 1;
|
|
- while (I <= MaxNonEqualCPMapping) and (CpXList [I].OS2CP <> OS2CP) do
|
|
|
|
|
|
+ while (I <= MaxNonEqualCPMapping) and (CpXList [I].OS2CP <> DefCpRec.OS2CP)
|
|
|
|
+ do
|
|
Inc (I);
|
|
Inc (I);
|
|
if CpXList [I].OS2CP = CPArr [0] then
|
|
if CpXList [I].OS2CP = CPArr [0] then
|
|
DefCpRec.WinCP := CpXList [I].WinCP
|
|
DefCpRec.WinCP := CpXList [I].WinCP
|
|
@@ -1260,11 +1261,21 @@ begin
|
|
{ UniStrColl interprets null chars as end-of-string -> filter out }
|
|
{ UniStrColl interprets null chars as end-of-string -> filter out }
|
|
HS1 := NoNullsUnicodeString (S1);
|
|
HS1 := NoNullsUnicodeString (S1);
|
|
HS2 := NoNullsUnicodeString (S2);
|
|
HS2 := NoNullsUnicodeString (S2);
|
|
|
|
+(*
|
|
|
|
+ if coLingIgnoreCase in Options then
|
|
|
|
+ begin
|
|
|
|
+ HS1:=OS2UpperUnicodeString(HS1);
|
|
|
|
+ HS2:=OS2UpperUnicodeString(HS2);
|
|
|
|
+{$WARNING TODO: Exclude null characters and convert to uppercase in one-pass}
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+*)
|
|
if coIgnoreCase in Options then
|
|
if coIgnoreCase in Options then
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
HS1:=OS2UpperUnicodeString(HS1);
|
|
HS1:=OS2UpperUnicodeString(HS1);
|
|
HS2:=OS2UpperUnicodeString(HS2);
|
|
HS2:=OS2UpperUnicodeString(HS2);
|
|
- end;
|
|
|
|
|
|
+{$WARNING TODO: Exclude null characters and convert to uppercase in one-pass}
|
|
|
|
+ end;
|
|
Result := Sys_UniStrColl (DefLocObj, PWideChar (HS1), PWideChar (HS2));
|
|
Result := Sys_UniStrColl (DefLocObj, PWideChar (HS1), PWideChar (HS2));
|
|
if Result < -1 then
|
|
if Result < -1 then
|
|
Result := -1
|
|
Result := -1
|
|
@@ -1273,12 +1284,14 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+(*
|
|
function OS2CompareTextUnicodeString (const S1, S2: UnicodeString): PtrInt;
|
|
function OS2CompareTextUnicodeString (const S1, S2: UnicodeString): PtrInt;
|
|
begin
|
|
begin
|
|
Result := OS2CompareUnicodeString (OS2UpperUnicodeString (S1),
|
|
Result := OS2CompareUnicodeString (OS2UpperUnicodeString (S1),
|
|
OS2UpperUnicodeString (S2));
|
|
OS2UpperUnicodeString (S2));
|
|
{$WARNING Language independent uppercase routine may not be appropriate for language dependent case insensitive comparison!}
|
|
{$WARNING Language independent uppercase routine may not be appropriate for language dependent case insensitive comparison!}
|
|
end;
|
|
end;
|
|
|
|
+*)
|
|
|
|
|
|
|
|
|
|
function OS2UpperAnsiString (const S: AnsiString): AnsiString;
|
|
function OS2UpperAnsiString (const S: AnsiString): AnsiString;
|
|
@@ -1327,8 +1340,7 @@ begin
|
|
character.
|
|
character.
|
|
*)
|
|
*)
|
|
if UniAPI then
|
|
if UniAPI then
|
|
- Result := OS2LowerUnicodeString (S)
|
|
|
|
-{ Two implicit conversions... ;-) }
|
|
|
|
|
|
+ Result := AnsiString (OS2LowerUnicodeString (UnicodeString (S)))
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
Result := S;
|
|
Result := S;
|
|
@@ -1362,7 +1374,8 @@ var
|
|
I, MaxLen: PtrUInt;
|
|
I, MaxLen: PtrUInt;
|
|
begin
|
|
begin
|
|
if UniAPI then
|
|
if UniAPI then
|
|
- Result := OS2CompareUnicodeString (S1, S2) (* implicit conversions *)
|
|
|
|
|
|
+ Result := OS2CompareUnicodeString (UnicodeString (S1), UnicodeString (S2),
|
|
|
|
+ [])
|
|
else
|
|
else
|
|
(* Older OS/2 versions without Unicode support do not provide direct means *)
|
|
(* Older OS/2 versions without Unicode support do not provide direct means *)
|
|
(* for case sensitive and codepage and language-aware string comparison. *)
|
|
(* for case sensitive and codepage and language-aware string comparison. *)
|
|
@@ -1431,8 +1444,8 @@ begin
|
|
HSA2 := AnsiString (S2);
|
|
HSA2 := AnsiString (S2);
|
|
if UniApi then
|
|
if UniApi then
|
|
begin
|
|
begin
|
|
- HSU1 := HSA1; (* implicit conversion *)
|
|
|
|
- HSU2 := HSA2; (* implicit conversion *)
|
|
|
|
|
|
+ HSU1 := UnicodeString (HSA1);
|
|
|
|
+ HSU2 := UnicodeString (HSA2);
|
|
Result := Sys_UniStrColl (DefLocObj, PWideChar (HSU1), PWideChar (HSU2));
|
|
Result := Sys_UniStrColl (DefLocObj, PWideChar (HSU1), PWideChar (HSU2));
|
|
if Result < -1 then
|
|
if Result < -1 then
|
|
Result := -1
|
|
Result := -1
|
|
@@ -1450,7 +1463,8 @@ var
|
|
I: PtrUInt;
|
|
I: PtrUInt;
|
|
begin
|
|
begin
|
|
if UniAPI then
|
|
if UniAPI then
|
|
- Result := OS2CompareTextUnicodeString (S1, S2) (* implicit conversions *)
|
|
|
|
|
|
+ Result := OS2CompareUnicodeString (UnicodeString (S1), UnicodeString (S2),
|
|
|
|
+ [coIgnoreCase])
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
(* Let's use collation strings here as a fallback *)
|
|
(* Let's use collation strings here as a fallback *)
|