[asterisk-dev] [asterisk-commits] file: trunk r89582 - /trunk/main/utils.c

Simon Perreault simon.perreault at viagenie.ca
Tue Nov 27 09:48:19 CST 2007

On Tuesday 27 November 2007 06:30:40 Joshua Colp wrote:
> Well, the issue that cropped up is that it broke compiling on 32-bit
> platforms :D. So if you can test on there that could be useful, but I'll
> look at it in depth today.

Ah you're right, the compiler will complain about the overflow. Hrmph.

Maybe this would make the compiler happy:

if (res <= RAND_MAX)
	return res;
long rm = RAND_MAX;
++rm;  /* Can't overflow because if res > RAND_MAX then we're on 64-bit */
return res % rm;

Can't test right now, sorry.

More information about the asterisk-dev mailing list