cvs commit: src/sys/netinet sctp_asconf.c

Ruslan Ermilov ru at freebsd.org
Fri Nov 3 22:30:51 UTC 2006


On Fri, Nov 03, 2006 at 05:03:28PM -0500, John Baldwin wrote:
> On Friday 03 November 2006 16:34, Randall Stewart wrote:
> > /src/sys/netinet/sctp_usrreq.c: In function `sctp_optsset':
> > /src/sys/netinet/sctp_usrreq.c:3136: warning: cast from pointer to 
> > integer of different size
> > 
> > 
> > The above one I will have to ask if any one of you can give
> > me a hand.. I am not a sparcy person ;-) and the line is:
> > 			on_off = (mtod(m, int));
> > 
> > (on_off is declared as a int on_off; a few lines above it).
> 
> mtod() returns a pointer.  If you want to get an int out of the
> mbuf data, then maybe something like:
> 
> 	on_off = ntohl(*mtod(m, int *)));
> 
> is what you want.  As it is, you are casting m->m_data (char *) to an int and 
> returning the raw value of the data pointer into your int. :)
> 
This is the setsockopt()/getsockopt() backend, so it looks like
no ntohl() is actually necessary.


Cheers,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20061103/9d682aaf/attachment.pgp


More information about the cvs-src mailing list