[FFmpeg-devel] [PATCH] Make the inet_aton replacement endian independent

Martin Storsjö martin
Thu Jan 7 17:21:42 CET 2010


On Thu, 7 Jan 2010, Ronald S. Bultje wrote:

> On Fri, Jan 1, 2010 at 11:04 AM, Martin Storsj? <martin at martin.st> wrote:
> > Currently, the replacement which is used if inet_aton isn't available,
> > only works correctly on little-endian. The attached patch makes it endian
> > independent.
> 
> -    add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
> +    add->s_addr = htonl((add1<<24) + (add2<<16) + (add3<<8) + add4);
> 
> I'd add spaces: add3_<<_8 (around all) while you're at it. Otherwise
> patch OK, if tested.

Yes, tested on both big- and little-endian.

> Do you have a SVN account or do I need to apply for you?

I don't have any SVN account, so feel free to apply with any formatting 
changes you like.

// Martin



More information about the ffmpeg-devel mailing list