mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-11 20:59:29 +01:00
* don't stop at #0 characters for setstring with pchar either
git-svn-id: trunk@13828 -
This commit is contained in:
parent
3f5ce0d228
commit
be39c47d02
@ -1660,13 +1660,7 @@ var
|
||||
begin
|
||||
SetLength(S,Len);
|
||||
If (Buf<>Nil) and (Len>0) then
|
||||
begin
|
||||
BufLen := IndexByte(Buf^, Len+1, 0);
|
||||
If (BufLen>0) and (BufLen < Len) then
|
||||
Len := BufLen;
|
||||
widestringmanager.Ansi2UnicodeMoveProc(Buf,S,Len);
|
||||
//PUnicodeChar(Pointer(S)+Len*sizeof(UnicodeChar))^:=#0;
|
||||
end;
|
||||
widestringmanager.Ansi2UnicodeMoveProc(Buf,S,Len);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -1025,18 +1025,10 @@ end;
|
||||
|
||||
|
||||
Procedure SetString (Out S : WideString; Buf : PChar; Len : SizeInt);
|
||||
var
|
||||
BufLen: SizeInt;
|
||||
begin
|
||||
SetLength(S,Len);
|
||||
If (Buf<>Nil) and (Len>0) then
|
||||
begin
|
||||
BufLen := IndexByte(Buf^, Len+1, 0);
|
||||
If (BufLen>0) and (BufLen < Len) then
|
||||
Len := BufLen;
|
||||
widestringmanager.Ansi2WideMoveProc(Buf,S,Len);
|
||||
//PWideChar(Pointer(S)+Len*sizeof(WideChar))^:=#0;
|
||||
end;
|
||||
widestringmanager.Ansi2WideMoveProc(Buf,S,Len);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -3,14 +3,26 @@ var
|
||||
u: unicodestring;
|
||||
pw: pwidechar;
|
||||
pu: punicodechar;
|
||||
p: pchar;
|
||||
begin
|
||||
pw:='abc'#0'def';
|
||||
setstring(w,pw,7);
|
||||
if w<>'abc'#0'def' then
|
||||
halt(1);
|
||||
w:='';
|
||||
|
||||
pu:='abc'#0'def';
|
||||
setstring(u,pu,7);
|
||||
if u<>'abc'#0'def' then
|
||||
halt(2);
|
||||
u:='';
|
||||
|
||||
p:='abc'#0'def';
|
||||
setstring(w,p,7);
|
||||
if w<>'abc'#0'def' then
|
||||
halt(3);
|
||||
|
||||
setstring(u,p,7);
|
||||
if u<>'abc'#0'def' then
|
||||
halt(4);
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user