mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-30 07:02:33 +02:00
merge r13486 from cpstrnew branch by florian:
+ fpc_ansistr_to_ansistr implemented, rtl compiles again git-svn-id: trunk@19084 -
This commit is contained in:
parent
ae0d732c8f
commit
06af8f3e44
@ -2878,7 +2878,13 @@ implementation
|
||||
end
|
||||
{ encoding parameter required? }
|
||||
else if (tstringdef(resultdef).stringtype=st_ansistring) and
|
||||
(tstringdef(left.resultdef).stringtype in [st_widestring,st_unicodestring]) then
|
||||
((tstringdef(left.resultdef).stringtype in [st_widestring,st_unicodestring]) or
|
||||
{ ansistring to ansistring and no RawByteString envolved? }
|
||||
((tstringdef(resultdef).encoding<>65535) and
|
||||
(tstringdef(left.resultdef).stringtype=st_ansistring) and
|
||||
(tstringdef(left.resultdef).encoding<>65535)
|
||||
)
|
||||
) then
|
||||
result:=ccallnode.createinternres(procname,
|
||||
ccallparanode.create(cordconstnode.create(tstringdef(resultdef).encoding,u16inttype,true),
|
||||
ccallparanode.create(left,nil)),resultdef)
|
||||
|
@ -336,6 +336,22 @@ end;
|
||||
{$endif EXTRAANSISHORT}
|
||||
|
||||
|
||||
Function fpc_AnsiStr_To_AnsiStr (const S : AnsiString;cp : TSystemCodePage): AnsiString; compilerproc;
|
||||
{
|
||||
Converts an AnsiString to an AnsiString taking code pages into care
|
||||
}
|
||||
Var
|
||||
Size : SizeInt;
|
||||
temp : UnicodeString;
|
||||
begin
|
||||
temp:=S;
|
||||
result:='';
|
||||
Size:=Length(temp);
|
||||
if Size>0 then
|
||||
widestringmanager.Unicode2AnsiMoveProc(PUnicodeChar(Pointer(temp)),result,cp,Size);
|
||||
end;
|
||||
|
||||
|
||||
{$ifndef FPC_STRTOSHORTSTRINGPROC}
|
||||
|
||||
{ the following declaration has exactly the same effect as }
|
||||
|
@ -266,6 +266,7 @@ function fpc_AnsiStr_To_ShortStr (high_of_res: SizeInt;const S2 : Ansistring): s
|
||||
{$else FPC_STRTOSHORTSTRINGPROC}
|
||||
procedure fpc_AnsiStr_To_ShortStr (out res : shortstring;const S2 : Ansistring); compilerproc;
|
||||
{$endif FPC_STRTOSHORTSTRINGPROC}
|
||||
Function fpc_AnsiStr_To_AnsiStr (const S : AnsiString;cp : TSystemCodePage): AnsiString; compilerproc;
|
||||
Function fpc_ShortStr_To_AnsiStr (Const S2 : ShortString): ansistring; compilerproc;
|
||||
Function fpc_Char_To_AnsiStr(const c : Char): AnsiString; compilerproc;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user