[Verse-dev] Weird address size bug

Emil Brink emil at obsession.se
Thu Jul 20 16:38:10 CEST 2006


Eskil,

while looking through the code and compiling with even more warnings
than usual, I found this function:

void v_cmd_buf_set_size(VCMDBufHead *head, unsigned int size)
{
	if(head->address_size > size);
		head->address_size = size;
	head->size = size;
}

At first glance, it looks simple and nice, but closer inspection
reveals the spurious semi colon right after the if. So, in effect
this function reads like this:

void v_cmd_buf_set_size(VCMDBufHead *head, unsigned int size)
{
	head->address_size = size;
	head->size = size;
}

Should I replace it with this? The more obvious fix, to just remove
the semi colon and assume that the if is correct, does not work. If
done that way, the communication becomes unreliable and data is lost.

Any ideas?

Regards,

/Emil


More information about the Verse-dev mailing list