Writing Blocks - Problem with I/O Count

I’m writing a (allegedly simple) block to frame incoming bytes with a
3-byte header, and append to them a one-byte CRC. One input port, one
output port. Problem is, my sent message will look something like
“testtesttesttest”, and, after packetizing, it looks like
“HEYtest1HEYtest1HEYHEYHEYtest1”, where HEY is my header, and 1 is my
crc (for now). I suspect that the block variable “noutput_items” is not
correct - but I have no way to prove this theory. I saw some source for
a similar block which did some modification on this variable inside the
general_work function.

I am confused most about this variable being passed in to the general
work function, yet also being returned from the same function. Who
passes it to my function, and how is it determined before I actually do
the general_work?

Thanks,
Stephen A.