[asterisk-dev] Question about zt_read() in chan_zap
Kevin P. Fleming
kpfleming at digium.com
Wed Jan 17 11:48:08 MST 2007
Tony Mountifield wrote:
> readbuf = ((unsigned char *)p->subs[index].buffer) + AST_FRIENDLY_OFFSET;
p->subs[index].buffer is an array of 'short's, so here is has been cast
to (unsigned char) and AST_FRIENDLY_OFFSET is interpreted as count of
'char' size.
> p->subs[index].f.data = p->subs[index].buffer + AST_FRIENDLY_OFFSET/2;
Here p->subs[index].buffer has NOT been cast to char, so the offset
would be interpreted as a count of 'short' size. Thus, it needs to be
halved to end up with the same number of bytes.
More information about the asterisk-dev
mailing list