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

Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#81 supporting empty localAdr in CommTCP

Post 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.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#81 supporting empty localAdr in CommTCP

Post by Josef Templ »

The change is in the issue branch.

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

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#81 supporting empty localAdr in CommTCP

Post by Ivan Denisov »

Josef, do we need to add information to the issue description?
http://redmine.blackboxframework.org/issues/81
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#81 supporting empty localAdr in CommTCP

Post by Josef Templ »

I added a little paragraph.
cfbsoftware
Posts: 204
Joined: Wed Sep 18, 2013 10:06 pm
Contact:

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

Post 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.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

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

Post 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
cfbsoftware
Posts: 204
Joined: Wed Sep 18, 2013 10:06 pm
Contact:

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

Post by cfbsoftware »

OK - I get it now! I've corrected my vote.

Thanks,
Chris
Post Reply