Dňa 14.5.2015 o 14:15 Michael Van Canneyt napísal(a):
On Thu, 14 May 2015, LacaK wrote:
Hi,
When I run this simple program in Delphi:
============================================
program bug_StrPLCopy;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
Buf: array[0..10] of Char;
begin
Buf[0] := 'A';
writeln(ord(Buf[0]));
StrPLCopy(Buf, '', 0);
writeln(ord(Buf[0]));
readln;
end.
============================================
Delphi Output is:
65
0
In FPC Output is:
65
65
So for MaxLen = 0 nothing happens.
In function StrPLCopy there is:
if (Result <> Nil) and (MaxLen <> 0) then
...
Is it bug?
From the delphi docs:
StrPLCopy copies up to a maximum of MaxLen characters from Source to
the null-terminated string Dest. StrPLCopy returns a pointer to Dest.
Note: Dest should point to a location with room for MaxLen + 1
characters, including the null terminator.
So: yes, it is a bug, please report it.
Thanks
http://bugs.freepascal.org/view.php?id=28089
-Laco.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel