- removed commented out implementation of Upper/LowerWideString which

takes into account surrogate pairs (not needed, since upper/lower
    case characters never need surrogate pairs)

git-svn-id: trunk@9394 -
This commit is contained in:
Jonas Maebe 2007-12-05 17:44:34 +00:00
parent 68595c8b72
commit a180fdcc74

View File

@ -265,92 +265,6 @@ procedure Ansi2WideMove(source:pchar;var dest:widestring;len:SizeInt);
end;
(*
function LowerWideString(const s : WideString) : WideString;
var
i, slen : SizeInt;
{$if sizeof(wchar_t) = 4}
nc : wint_t;
resindex : SizeInt;
len : longint;
valid : boolean;
{$elseif sizeof(wchar_t) = 2}
p : PWideChar;
{$endif sizeof(wchar_t)}
begin
slen:=length(s);
SetLength(result,slen);
{$if sizeof(wint_t) = 4}
i:=1;
resindex:=1;
while (i<=slen) do
begin
nc:=utf16toutf32(s,i,len,valid);
inc(i,len);
if (valid) then
ConcatUTF32ToWideStr(towlower(nc),result,resindex)
else
{ do nothing }
pwidechar(@result[i])^:=s[i];
end;
{ adjust length }
setlength(result,resindex-1);
{$elseif sizeof(wchar_t) = 2}
{ avoid unique calls for each character }
p:=@result[1];
{ this will fail for surrogate pairs, but that's inherent }
{ to choosing sizeof(wint_t)=2, and nothing we can help }
for i:=1 to length(s) do
p[i]:=WideChar(towlower(wint_t(s[i])));
{$else}
{$error Unsupported wchar_t size}
{$endif}
end;
function UpperWideString(const s : WideString) : WideString;
var
i, slen : SizeInt;
{$if sizeof(wint_t) = 4}
nc : wint_t;
resindex : SizeInt;
len : longint;
valid : boolean;
{$elseif sizeof(wchar_t) = 2}
p : PWideChar;
{$endif sizeof(wchar_t)}
begin
slen:=length(s);
SetLength(result,slen);
{$if sizeof(wchar_t) = 4}
i:=1;
resindex:=1;
while (i<=slen) do
begin
nc:=utf16toutf32(s,i,len,valid);
inc(i,len);
if (valid) then
ConcatUTF32ToWideStr (towupper(nc),result,resindex)
else
{ do nothing }
pwidechar(@result[i])^:=s[i];
end;
{ adjust length }
setlength(result,resindex-1);
{$elseif sizeof(wchar_t) = 2}
{ avoid unique calls for each character }
p:=@result[1];
{ this will fail for surrogate pairs, but that's inherent }
{ to choosing sizeof(wint_t)=2, and nothing we can help }
for i:=1 to length(s) do
p[i]:=WideChar(towupper(wint_t(s[i])));
{$else}
{$error Unsupported wchar_t size}
{$endif}
end;
*)
function LowerWideString(const s : WideString) : WideString;
var
i : SizeInt;