mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:26:24 +02:00
rtl: code refactoring by Inoussa (mantis #0024898)
git-svn-id: trunk@25320 -
This commit is contained in:
parent
936bd3c902
commit
4ee7b4e7e2
@ -88,6 +88,21 @@ begin
|
|||||||
current_Map:=nil;
|
current_Map:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FindMap(const cp: TSystemCodePage): punicodemap;inline;
|
||||||
|
begin
|
||||||
|
if (cp=DefaultSystemCodePage) then
|
||||||
|
begin
|
||||||
|
{ update current_Map in case the DefaultSystemCodePage has been changed }
|
||||||
|
if (current_DefaultSystemCodePage<>DefaultSystemCodePage) or not Assigned(current_Map) then
|
||||||
|
begin
|
||||||
|
FiniThread;
|
||||||
|
InitThread;
|
||||||
|
end;
|
||||||
|
Result:=current_Map;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result:=getmap(cp);
|
||||||
|
end;
|
||||||
|
|
||||||
{ return value:
|
{ return value:
|
||||||
-1 if incomplete or invalid code point
|
-1 if incomplete or invalid code point
|
||||||
@ -245,18 +260,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (cp=DefaultSystemCodePage) then
|
locMap:=FindMap(cp);
|
||||||
begin
|
|
||||||
{ update current_Map in case the DefaultSystemCodePage has been changed }
|
|
||||||
if (current_DefaultSystemCodePage<>DefaultSystemCodePage) or not Assigned(current_Map) then
|
|
||||||
begin
|
|
||||||
FiniThread;
|
|
||||||
InitThread;
|
|
||||||
end;
|
|
||||||
locMap:=current_Map;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
locMap:=getmap(cp);
|
|
||||||
if (locMap=nil) then
|
if (locMap=nil) then
|
||||||
begin
|
begin
|
||||||
DefaultUnicode2AnsiMove(source,dest,DefaultSystemCodePage,len);
|
DefaultUnicode2AnsiMove(source,dest,DefaultSystemCodePage,len);
|
||||||
@ -318,18 +322,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (cp=DefaultSystemCodePage) then
|
locMap:=FindMap(cp);
|
||||||
begin
|
|
||||||
{ update current_Map in case the DefaultSystemCodePage has been changed }
|
|
||||||
if (current_DefaultSystemCodePage<>DefaultSystemCodePage) or not Assigned(current_Map) then
|
|
||||||
begin
|
|
||||||
FiniThread;
|
|
||||||
InitThread;
|
|
||||||
end;
|
|
||||||
locMap:=current_Map;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
locMap:=getmap(cp);
|
|
||||||
if (locMap=nil) then
|
if (locMap=nil) then
|
||||||
begin
|
begin
|
||||||
DefaultAnsi2UnicodeMove(source,DefaultSystemCodePage,dest,len);
|
DefaultAnsi2UnicodeMove(source,DefaultSystemCodePage,dest,len);
|
||||||
@ -353,18 +346,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (cp=DefaultSystemCodePage) then
|
locMap:=FindMap(cp);
|
||||||
begin
|
|
||||||
{ update current_Map in case the DefaultSystemCodePage has been changed }
|
|
||||||
if (current_DefaultSystemCodePage<>DefaultSystemCodePage) or not Assigned(current_Map) then
|
|
||||||
begin
|
|
||||||
FiniThread;
|
|
||||||
InitThread;
|
|
||||||
end;
|
|
||||||
locMap:=current_Map;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
locMap:=getmap(cp);
|
|
||||||
if (locMap=nil) then
|
if (locMap=nil) then
|
||||||
begin
|
begin
|
||||||
DefaultAnsi2WideMove(source,DefaultSystemCodePage,dest,len);
|
DefaultAnsi2WideMove(source,DefaultSystemCodePage,dest,len);
|
||||||
@ -499,13 +481,8 @@ begin
|
|||||||
UnicodeToUtf8(@Result[1],slen,@us[1],ulen);
|
UnicodeToUtf8(@Result[1],slen,@us[1],ulen);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (current_DefaultSystemCodePage<>DefaultSystemCodePage) or not Assigned(current_Map) then
|
locMap:=FindMap(DefaultSystemCodePage);
|
||||||
begin
|
|
||||||
FiniThread;
|
|
||||||
InitThread;
|
|
||||||
end;
|
|
||||||
locMap:=current_Map;
|
|
||||||
if (locMap=nil) then
|
if (locMap=nil) then
|
||||||
exit(System.UpCase(s));
|
exit(System.UpCase(s));
|
||||||
|
|
||||||
@ -571,12 +548,7 @@ begin
|
|||||||
UnicodeToUtf8(@Result[1],slen,@us[1],ulen);
|
UnicodeToUtf8(@Result[1],slen,@us[1],ulen);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if (current_DefaultSystemCodePage<>DefaultSystemCodePage) or not Assigned(current_Map) then
|
locMap:=FindMap(DefaultSystemCodePage);
|
||||||
begin
|
|
||||||
FiniThread;
|
|
||||||
InitThread;
|
|
||||||
end;
|
|
||||||
locMap:=current_Map;
|
|
||||||
if (locMap=nil) then
|
if (locMap=nil) then
|
||||||
exit(System.LowerCase(s));
|
exit(System.LowerCase(s));
|
||||||
|
|
||||||
@ -714,7 +686,7 @@ end;
|
|||||||
|
|
||||||
function StrCompAnsiString(S1, S2: PChar): PtrInt;
|
function StrCompAnsiString(S1, S2: PChar): PtrInt;
|
||||||
var
|
var
|
||||||
l1,l2,l : PtrInt;
|
l1,l2 : PtrInt;
|
||||||
begin
|
begin
|
||||||
l1:=strlen(S1);
|
l1:=strlen(S1);
|
||||||
l2:=strlen(S2);
|
l2:=strlen(S2);
|
||||||
|
Loading…
Reference in New Issue
Block a user