Re: [AD] warnings when using VC 7 (.net)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> AL_INLINE(void, bmp_write24, (unsigned long addr, int c),
> {
> unsigned char *p = (unsigned char *)addr;
> p[0] = c & 0xFF;
> p[1] = (c>>8) & 0xFF;
> p[2] = (c>>16) & 0xFF;
> })
> 
> AL_INLINE(void, _putpixel, (BITMAP *bmp, int x, int y, int color),
> {
> unsigned long addr;
> bmp_select(bmp);
> addr = bmp_write_line(bmp, y);
> bmp_write8(addr+x, color);
> bmp_unwrite_line(bmp);
> })

Just out of curiosity: is there any compelling reason addr can't be a void* 
in either of those cases?
Regardless, I *think* using ptrdiff_t instead of unsigned long *should* fix 
the problem. (It must be large enough to hold the whole range of pointer 
differences, which would be of the order of 2**64 on 64 bit systems. IIRC, 
it is defined as (signed) long by DJGPP.)




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/