merge r17330 from cpstrnew branch by michael:

* Patch from Inoussa, fixing tunistr1.pp and twide1.pp

git-svn-id: trunk@19107 -
This commit is contained in:
paul 2011-09-17 13:12:07 +00:00
parent 29c6b034aa
commit 7fd7eee1c9
3 changed files with 21 additions and 5 deletions

View File

@ -2918,9 +2918,9 @@ implementation
else if (tstringdef(resultdef).stringtype=st_ansistring) and
((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)
(//(tstringdef(resultdef).encoding<>65535) and
(tstringdef(left.resultdef).stringtype=st_ansistring)
//(tstringdef(left.resultdef).encoding<>65535)
)
) then
result:=ccallnode.createinternres(procname,

View File

@ -340,11 +340,17 @@ Function fpc_AnsiStr_To_UnicodeStr (Const S2 : RawByteString): UnicodeString; co
}
Var
Size : SizeInt;
cp: TSystemCodePage;
begin
result:='';
Size:=Length(S2);
if Size>0 then
widestringmanager.Ansi2UnicodeMoveProc(PChar(S2),StringCodePage(S2),result,Size);
begin
cp:=StringCodePage(S2);
if cp=$ffff then
cp:=DefaultSystemCodePage;
widestringmanager.Ansi2UnicodeMoveProc(PChar(S2),cp,result,Size);
end;
end;

View File

@ -267,11 +267,21 @@ Function fpc_WideStr_To_AnsiStr (const S2 : WideString{$ifdef FPC_HAS_CPSTRING};
}
Var
Size : SizeInt;
{$ifndef FPC_HAS_CPSTRING}
cp : TSystemCodePage;
{$endif FPC_HAS_CPSTRING}
begin
{$ifndef FPC_HAS_CPSTRING}
cp:=$ffff;
{$endif FPC_HAS_CPSTRING}
result:='';
Size:=Length(S2);
if Size>0 then
widestringmanager.Wide2AnsiMoveProc(PWideChar(Pointer(S2)),result,{$ifdef FPC_HAS_CPSTRING}cp{$else}TSystemCodePage(0){$endif FPC_HAS_CPSTRING},Size);
begin
if cp=$ffff then
cp:=DefaultSystemCodePage;
widestringmanager.Wide2AnsiMoveProc(PWideChar(Pointer(S2)),result,cp,Size);
end;
end;