compiler: don't return te_eual when we convert from RawByteString to another codepage

git-svn-id: trunk@19283 -
This commit is contained in:
paul 2011-09-29 12:03:11 +00:00
parent d766e671a9
commit a769ef0ad2
5 changed files with 28 additions and 3 deletions

1
.gitattributes vendored
View File

@ -9956,6 +9956,7 @@ tests/test/tcpstr1.pp svneol=native#text/plain
tests/test/tcpstr10.pp svneol=native#text/pascal
tests/test/tcpstr11.pp svneol=native#text/pascal
tests/test/tcpstr12.pp svneol=native#text/pascal
tests/test/tcpstr13.pp svneol=native#text/pascal
tests/test/tcpstr2.pp svneol=native#text/plain
tests/test/tcpstr2a.pp svneol=native#text/plain
tests/test/tcpstr3.pp svneol=native#text/plain

View File

@ -355,7 +355,6 @@ implementation
(tstringdef(def_from).stringtype=st_ansistring) then
begin
if (tstringdef(def_from).encoding=tstringdef(def_to).encoding) or
(tstringdef(def_from).encoding=globals.CP_NONE) or
(tstringdef(def_to).encoding=globals.CP_NONE) then
begin
//doconv := tc_string_2_string;

View File

@ -931,7 +931,7 @@ begin
move(S[1],(pointer(S)+ofs)^,strlength+1)
end;
Function Fpc_Ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt) : AnsiString;compilerproc;
Function Fpc_Ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt) : RawByteString;compilerproc;
var
ResultAddress : Pointer;
begin

View File

@ -290,7 +290,7 @@ Procedure fpc_AnsiStr_CheckRange(p : Pointer; index : SizeInt); compilerproc;
{$endif VER2_4}
Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;
Function fpc_ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt) : AnsiString;compilerproc;
Function fpc_ansistr_Copy (Const S : RawByteString; Index,Size : SizeInt) : RawByteString;compilerproc;
{$ifdef EXTRAANSISHORT}
Function fpc_AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): SizeInt; compilerproc;
{$endif EXTRAANSISHORT}

25
tests/test/tcpstr13.pp Normal file
View File

@ -0,0 +1,25 @@
program tcpstr13;
// check that copy operation converts from 866 to DefaultSystemCodePage encoding
{$mode delphi}
{$ifdef unix}
uses
cwstring;
{$endif}
type
ts866 = type ansistring(866);
var
s: ts866;
a: ansistring;
begin
s:='abc'#$00A9#$00AE'123';
// if s[4] <> 'c' then
// halt(1);
a:=copy(s,1,4);
if stringcodepage(a)<>DefaultSystemCodePage then
halt(2);
end.