Page 1 of 1

issue-#81+ CopyOfAdrString does not copy the string contents

Posted: Fri May 20, 2016 10:19 am
by Josef Templ
There is another trivial bug in CommTCP.

CopyOfAdrString does not copy the string contents but does a pointer assignment.

Code: Select all

	PROCEDURE CopyOfAdrString (a: CommStreams.Adr): CommStreams.Adr;
		VAR b: CommStreams.Adr;
	BEGIN
		NEW(b, LEN(a)); b := a; <<< "b := a;" needs to be changed to: "b^ := a$"
		RETURN b
	END CopyOfAdrString;
It seems that Redmine is delivering only up to 100 issues in the xml output.
We are close to that limit.
So instead of creating a new issue I would rather fix it under #81.

- Josef

Re: issue-#81 supporting empty localAdr in CommTCP

Posted: Fri May 20, 2016 1:15 pm
by Ivan Denisov
It is very simple bug fix, so we can vote without big discussion.
When you prepare the demo blackbox, I will create voting.

Re: issue-#81 supporting empty localAdr in CommTCP

Posted: Sat May 21, 2016 6:04 am
by Josef Templ
The change is in the issue branch.

For the diff see http://redmine.blackboxframework.org/pr ... 80743c8d8a.

- Josef

Re: issue-#81 supporting empty localAdr in CommTCP

Posted: Sun May 22, 2016 11:53 am
by Ivan Denisov
Josef, do we need to add information to the issue description?
http://redmine.blackboxframework.org/issues/81

Re: issue-#81 supporting empty localAdr in CommTCP

Posted: Sun May 22, 2016 6:19 pm
by Josef Templ
I added a little paragraph.

Re: issue-#81+ CopyOfAdrString does not copy the string cont

Posted: Mon May 23, 2016 8:24 am
by cfbsoftware
I don't believe this fix is correct. The original looks OK to me. The name of the function indicates that it is making a copy of an address, it is not supposed to be copying the contents of that address.

Re: issue-#81+ CopyOfAdrString does not copy the string cont

Posted: Mon May 23, 2016 8:40 am
by Josef Templ
cfbsoftware wrote:I don't believe this fix is correct. The original looks OK to me. The name of the function indicates that it is making a copy of an address, it is not supposed to be copying the contents of that address.
The original allocates a new string and then forgets about it and returns the input pointer.
It does a pointer assignment, not a string copy. Note that TYPE Adr = POINTER TO ARRAY OF CHAR.

- Josef

Re: issue-#81+ CopyOfAdrString does not copy the string cont

Posted: Mon May 23, 2016 11:44 am
by cfbsoftware
OK - I get it now! I've corrected my vote.

Thanks,
Chris