[comp.windows.x] #define bugs in maskbits.h

dale@amiga.UUCP (Dale Luck) (05/31/88)

This bug already sent to xbugs but I thought server implementors would
be interested.


VERSION:
	X11 release 2

CLIENT MACHINE:
	amiga 2000

CLIENT OPERATING SYSTEM:
	amigados

DISPLAY:
	amiga 640x400 monochrome

SYNOPSIS:
	bad #define in maskbits.h for GETLEFTBITS_ALIGNMENT == 1

DESCRIPTION:
	If you set GETLEFTBITS_ALIGNMENT = 1 in servermd.h it will fail
	to cast the pointer (normally a char *) to the needed
	unsigned int ptr in maskbits.h. By using GETLEFTBITS_ALIGNMENT = 1
	we can save some code and increase execution speed since there is
	no longer a check for glyph alignment when the glyphs may, by
	defination, already be aligned. See the comments in servermd.h
	regarding GLYPHPADBYTES and GETLEFTBITS_ALIGNMENT.

REPEAT-BY:
	Defining GETLEFTBITS_ALIGNMENT = 1 in servermd.h and recompiling
	ddx/mfb/[mfbimggblt.c|mfbplygblt.c|mfbtegblt.c]
	Start up the X server and note there is no cursor anymore.

FIX:
	Add an (unsigned int *) cast to maskbits.h The diff follows.
	This fix has been tested with the recent PURDUE changes and it seems
	to work ok. It has also been tested with 68010 and 68020 systems.
	The problem also exists if GETLEFTBITS_ALIGNMENT == 2. Although
	I have not tested this I added the cast there also.

299c299,300
< #define getleftbits(psrc, w, dst)	getbits(psrc, 0, w, dst)
---
> #define getleftbits(psrc, w, dst) \
> 	getbits(((unsigned int *)(psrc)), 0, w, dst)
308c309
< 		getbits(psrc, 0, w, dst)
---
> 		getbits(((unsigned int *)(psrc)), 0, w, dst)

Dale Luck
amiga!dale