Commit 9399caf2 authored by Alan Coopersmith's avatar Alan Coopersmith

unifdef MUSTCOPY

MUSTCOPY seems to have only been defined in <X11/Xmd.h> when building for
CRAY, to handle missing some sizes of integer type.

(mostly performed with unifdef, followed by some manual cleanup of
 spacing/indenting in the remaining code)
Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent b687440c
......@@ -701,19 +701,10 @@ extern void _XRead32(
}
#ifdef MUSTCOPY
/* for when 32-bit alignment is not good enough */
#define OneDataCard32(dpy,dstaddr,srcvar) \
{ dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
#else
/* srcvar must be a variable for large architecture version */
#define OneDataCard32(dpy,dstaddr,srcvar) \
{ *(CARD32 *)(dstaddr) = (srcvar); }
#endif /* MUSTCOPY */
typedef struct _XInternalAsync {
struct _XInternalAsync *next;
......
......@@ -262,47 +262,6 @@ _XomGetFontSetFromCharSet(
return (FontSet) NULL;
}
#ifdef MUSTCOPY
static void
cs_to_xchar2b(
register char *from,
register XChar2b *to,
register length)
{
while (length-- > 0) {
to->byte1 = *from++;
to->byte2 = *from++;
to++;
}
}
static void
cs_to_xchar2b_gl(
register char *from,
register XChar2b *to,
register length)
{
while (length-- > 0) {
to->byte1 = *from++ & 0x7f;
to->byte2 = *from++ & 0x7f;
to++;
}
}
static void
cs_to_xchar2b_gr(
register char *from,
register XChar2b *to,
register length)
{
while (length-- > 0) {
to->byte1 = *from++ | 0x80;
to->byte2 = *from++ | 0x80;
to++;
}
}
#endif
static void
shift_to_gl(
register char *text,
......@@ -358,10 +317,6 @@ _XomConvert(
XlcCharSet charset;
int length, cs_left, ret;
FontSet font_set;
#ifdef MUSTCOPY
XChar2b *xchar2b;
char *buf, buf_local[BUFSIZ];
#endif
cs = *to;
cs_left = *to_left;
......@@ -380,46 +335,18 @@ _XomConvert(
length = *to_left - cs_left;
#ifdef MUSTCOPY
if (font_set->is_xchar2b) {
buf = (length > BUFSIZ) ? Xmalloc(length) : buf_local;
if (buf == NULL)
return -1;
memcpy(buf, (char *) *to, length);
xchar2b = (XChar2b *) *to;
length >>= 1;
if (font_set->side == charset->side)
cs_to_xchar2b(buf, xchar2b, length);
else if (font_set->side == XlcGL)
cs_to_xchar2b_gl(buf, xchar2b, length);
if (font_set->side != charset->side) {
if (font_set->side == XlcGL)
shift_to_gl(*to, length);
else if (font_set->side == XlcGR)
cs_to_xchar2b_gr(buf, xchar2b, length);
else
cs_to_xchar2b(buf, xchar2b, length);
if (buf != buf_local)
Xfree(buf);
*to = (XPointer) (xchar2b + length);
*to_left -= length;
} else
#endif
{
if (font_set->side != charset->side) {
if (font_set->side == XlcGL)
shift_to_gl(*to, length);
else if (font_set->side == XlcGR)
shift_to_gr(*to, length);
}
if (font_set->is_xchar2b)
length >>= 1;
*to = cs;
*to_left -= length;
shift_to_gr(*to, length);
}
if (font_set->is_xchar2b)
length >>= 1;
*to = cs;
*to_left -= length;
*((XFontStruct **) args[0]) = font_set->font;
*((Bool *) args[1]) = font_set->is_xchar2b;
if(num_args >= 3){
......
......@@ -43,20 +43,11 @@ XResizeWindow(
req->window = w;
req->mask = CWWidth | CWHeight;
#ifdef MUSTCOPY
{
unsigned long lwidth = width, lheight = height;
dpy->bufptr -= 8;
Data32 (dpy, (long *) &lwidth, 4); /* order dictated by values of */
Data32 (dpy, (long *) &lheight, 4); /* CWWidth and CWHeight */
}
#else
{
CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq);
*valuePtr++ = width;
*valuePtr = height;
}
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
return 1;
......
......@@ -44,18 +44,6 @@ XMoveResizeWindow(
GetReqExtra(ConfigureWindow, 16, req);
req->window = w;
req->mask = CWX | CWY | CWWidth | CWHeight;
#ifdef MUSTCOPY
{
long lx = x, ly = y;
unsigned long lwidth = width, lheight = height;
dpy->bufptr -= 16;
Data32 (dpy, (long *) &lx, 4); /* order must match values of */
Data32 (dpy, (long *) &ly, 4); /* CWX, CWY, CWWidth, and CWHeight */
Data32 (dpy, (long *) &lwidth, 4);
Data32 (dpy, (long *) &lheight, 4);
}
#else
{
register CARD32 *valuePtr =
(CARD32 *) NEXTPTR(req,xConfigureWindowReq);
......@@ -64,7 +52,6 @@ XMoveResizeWindow(
*valuePtr++ = width;
*valuePtr = height;
}
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
return 1;
......
......@@ -57,20 +57,11 @@ Window XCreateSimpleWindow(
wid = req->wid = XAllocID(dpy);
req->mask = CWBackPixel | CWBorderPixel;
#ifdef MUSTCOPY
{
unsigned long lbackground = background, lborder = border;
dpy->bufptr -= 8;
Data32 (dpy, (long *) &lbackground, 4);
Data32 (dpy, (long *) &lborder, 4);
}
#else
{
register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xCreateWindowReq);
*valuePtr++ = background;
*valuePtr = border;
}
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -49,12 +49,6 @@ XDrawArc(
{
register xPolyArcReq *req;
register xArc *arc;
#ifdef MUSTCOPY
xArc arcdata;
long len = SIZEOF(xArc);
arc = &arcdata;
#endif /* MUSTCOPY */
LockDisplay(dpy);
FlushGC(dpy, gc);
......@@ -63,9 +57,7 @@ XDrawArc(
req->drawable = d;
req->gc = gc->gid;
#ifndef MUSTCOPY
arc = (xArc *) NEXTPTR(req,xPolyArcReq);
#endif /* MUSTCOPY */
arc->x = x;
arc->y = y;
......@@ -74,10 +66,6 @@ XDrawArc(
arc->angle1 = angle1;
arc->angle2 = angle2;
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xArc);
Data (dpy, (char *) arc, len);
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -45,12 +45,6 @@ XDrawLine (
int y2)
{
register xSegment *segment;
#ifdef MUSTCOPY
xSegment segmentdata;
long len = SIZEOF(xSegment);
segment = &segmentdata;
#endif /* not MUSTCOPY */
LockDisplay(dpy);
FlushGC(dpy, gc);
......@@ -67,21 +61,15 @@ XDrawLine (
&& (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ?
wsize : zsize)) ) {
req->length += SIZEOF(xSegment) >> 2;
#ifndef MUSTCOPY
segment = (xSegment *) dpy->bufptr;
dpy->bufptr += SIZEOF(xSegment);
#endif /* not MUSTCOPY */
}
else {
GetReqExtra (PolySegment, SIZEOF(xSegment), req);
req->drawable = d;
req->gc = gc->gid;
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xSegment);
#else
segment = (xSegment *) NEXTPTR(req,xPolySegmentReq);
#endif /* MUSTCOPY */
}
segment->x1 = x1;
......@@ -89,10 +77,6 @@ XDrawLine (
segment->x2 = x2;
segment->y2 = y2;
#ifdef MUSTCOPY
Data (dpy, (char *) &segmentdata, len);
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
}
......
......@@ -42,12 +42,6 @@ XDrawPoint(
int y) /* INT16 */
{
xPoint *point;
#ifdef MUSTCOPY
xPoint pointdata;
long len = SIZEOF(xPoint);
point = &pointdata;
#endif /* MUSTCOPY */
LockDisplay(dpy);
FlushGC(dpy, gc);
......@@ -65,10 +59,8 @@ XDrawPoint(
&& ((dpy->bufptr + SIZEOF(xPoint)) <= dpy->bufmax)
&& (((char *)dpy->bufptr - (char *)req) < size) ) {
req->length += SIZEOF(xPoint) >> 2;
#ifndef MUSTCOPY
point = (xPoint *) dpy->bufptr;
dpy->bufptr += SIZEOF(xPoint);
#endif /* not MUSTCOPY */
}
else {
......@@ -76,19 +68,12 @@ XDrawPoint(
req->drawable = d;
req->gc = gc->gid;
req->coordMode = CoordModeOrigin;
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xPoint);
#else
point = (xPoint *) NEXTPTR(req,xPolyPointReq);
#endif /* MUSTCOPY */
}
point->x = x;
point->y = y;
#ifdef MUSTCOPY
Data (dpy, (char *) point, len);
#endif /* MUSTCOPY */
}
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -45,12 +45,6 @@ XDrawRectangle(
unsigned int height) /* CARD16 */
{
xRectangle *rect;
#ifdef MUSTCOPY
xRectangle rectdata;
long len = SIZEOF(xRectangle);
rect = &rectdata;
#endif /* MUSTCOPY */
LockDisplay(dpy);
FlushGC(dpy, gc);
......@@ -67,21 +61,15 @@ XDrawRectangle(
&& (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ?
wsize : zsize)) ) {
req->length += SIZEOF(xRectangle) >> 2;
#ifndef MUSTCOPY
rect = (xRectangle *) dpy->bufptr;
dpy->bufptr += SIZEOF(xRectangle);
#endif /* not MUSTCOPY */
}
else {
GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req);
req->drawable = d;
req->gc = gc->gid;
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xRectangle);
#else
rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq);
#endif /* MUSTCOPY */
}
rect->x = x;
......@@ -89,10 +77,6 @@ XDrawRectangle(
rect->width = width;
rect->height = height;
#ifdef MUSTCOPY
Data (dpy, (char *) rect, len); /* subtracted bufptr up above */
#endif /* MUSTCOPY */
}
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -46,12 +46,6 @@ XFillArc(
int angle2) /* INT16 */
{
xArc *arc;
#ifdef MUSTCOPY
xArc arcdata;
long len = SIZEOF(xArc);
arc = &arcdata;
#endif /* MUSTCOPY */
LockDisplay(dpy);
FlushGC(dpy, gc);
......@@ -67,10 +61,8 @@ XFillArc(
&& ((dpy->bufptr + SIZEOF(xArc)) <= dpy->bufmax)
&& (((char *)dpy->bufptr - (char *)req) < size) ) {
req->length += SIZEOF(xArc) >> 2;
#ifndef MUSTCOPY
arc = (xArc *) dpy->bufptr;
dpy->bufptr += SIZEOF(xArc);
#endif /* not MUSTCOPY */
}
else {
......@@ -78,11 +70,7 @@ XFillArc(
req->drawable = d;
req->gc = gc->gid;
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xArc);
#else
arc = (xArc *) NEXTPTR(req,xPolyFillArcReq);
#endif /* MUSTCOPY */
}
arc->x = x;
arc->y = y;
......@@ -91,10 +79,6 @@ XFillArc(
arc->angle1 = angle1;
arc->angle2 = angle2;
#ifdef MUSTCOPY
Data (dpy, (char *) arc, len);
#endif /* MUSTCOPY */
}
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -44,12 +44,6 @@ XFillRectangle(
unsigned int height) /* CARD16 */
{
xRectangle *rect;
#ifdef MUSTCOPY
xRectangle rectdata;
long len = SIZEOF(xRectangle);
rect = &rectdata;
#endif /* MUSTCOPY */
LockDisplay(dpy);
FlushGC(dpy, gc);
......@@ -66,30 +60,21 @@ XFillRectangle(
&& ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax)
&& (((char *)dpy->bufptr - (char *)req) < size) ) {
req->length += SIZEOF(xRectangle) >> 2;
#ifndef MUSTCOPY
rect = (xRectangle *) dpy->bufptr;
dpy->bufptr += SIZEOF(xRectangle);
#endif /* not MUSTCOPY */
}
else {
GetReqExtra(PolyFillRectangle, SIZEOF(xRectangle), req);
req->drawable = d;
req->gc = gc->gid;
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xRectangle);
#else
rect = (xRectangle *) NEXTPTR(req,xPolyFillRectangleReq);
#endif /* MUSTCOPY */
}
rect->x = x;
rect->y = y;
rect->width = width;
rect->height = height;
#ifdef MUSTCOPY
Data (dpy, (char *) rect, len);
#endif /* MUSTCOPY */
}
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -32,7 +32,7 @@ authorization from the X Consortium and the XFree86 Project.
#endif
#include "Xlibint.h"
#if defined(XF86BIGFONT) && !defined(MUSTCOPY)
#if defined(XF86BIGFONT)
#define USE_XF86BIGFONT
#endif
#ifdef USE_XF86BIGFONT
......@@ -228,31 +228,9 @@ _XQueryFont (
fs->ascent = cvtINT16toInt (reply.fontAscent);
fs->descent = cvtINT16toInt (reply.fontDescent);
#ifdef MUSTCOPY
{
xCharInfo *xcip;
xcip = (xCharInfo *) &reply.minBounds;
fs->min_bounds.lbearing = cvtINT16toShort(xcip->leftSideBearing);
fs->min_bounds.rbearing = cvtINT16toShort(xcip->rightSideBearing);
fs->min_bounds.width = cvtINT16toShort(xcip->characterWidth);
fs->min_bounds.ascent = cvtINT16toShort(xcip->ascent);
fs->min_bounds.descent = cvtINT16toShort(xcip->descent);
fs->min_bounds.attributes = xcip->attributes;
xcip = (xCharInfo *) &reply.maxBounds;
fs->max_bounds.lbearing = cvtINT16toShort(xcip->leftSideBearing);
fs->max_bounds.rbearing = cvtINT16toShort(xcip->rightSideBearing);
fs->max_bounds.width = cvtINT16toShort(xcip->characterWidth);
fs->max_bounds.ascent = cvtINT16toShort(xcip->ascent);
fs->max_bounds.descent = cvtINT16toShort(xcip->descent);
fs->max_bounds.attributes = xcip->attributes;
}
#else
/* XXX the next two statements won't work if short isn't 16 bits */
fs->min_bounds = * (XCharStruct *) &reply.minBounds;
fs->max_bounds = * (XCharStruct *) &reply.maxBounds;
#endif /* MUSTCOPY */
fs->n_properties = reply.nFontProps;
/*
......@@ -276,7 +254,6 @@ _XQueryFont (
* If no characters in font, then it is a bad font, but
* shouldn't try to read nothing.
*/
/* have to unpack charinfos on some machines (CRAY) */
fs->per_char = NULL;
if (reply.nCharInfos > 0){
nbytes = reply.nCharInfos * sizeof(XCharStruct);
......@@ -288,27 +265,8 @@ _XQueryFont (
return (XFontStruct *)NULL;
}
#ifdef MUSTCOPY
{
register XCharStruct *cs = fs->per_char;
register int i;
for (i = 0; i < reply.nCharInfos; i++, cs++) {
xCharInfo xcip;
_XRead(dpy, (char *)&xcip, SIZEOF(xCharInfo));
cs->lbearing = cvtINT16toShort(xcip.leftSideBearing);
cs->rbearing = cvtINT16toShort(xcip.rightSideBearing);
cs->width = cvtINT16toShort(xcip.characterWidth);
cs->ascent = cvtINT16toShort(xcip.ascent);
cs->descent = cvtINT16toShort(xcip.descent);
cs->attributes = xcip.attributes;
}
}
#else
nbytes = reply.nCharInfos * SIZEOF(xCharInfo);
_XRead16 (dpy, (char *)fs->per_char, nbytes);
#endif
}
/* call out to any extensions interested */
......
......@@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group.
#endif
#include "Xlibint.h"
#if defined(XF86BIGFONT) && !defined(MUSTCOPY)
#if defined(XF86BIGFONT)
#define USE_XF86BIGFONT
#endif
#ifdef USE_XF86BIGFONT
......@@ -133,31 +133,9 @@ XFontStruct **info) /* RETURN */
fs->ascent = cvtINT16toInt (reply.fontAscent);
fs->descent = cvtINT16toInt (reply.fontDescent);
#ifdef MUSTCOPY
{
xCharInfo *xcip;
xcip = (xCharInfo *) &reply.minBounds;
fs->min_bounds.lbearing = xcip->leftSideBearing;
fs->min_bounds.rbearing = xcip->rightSideBearing;
fs->min_bounds.width = xcip->characterWidth;
fs->min_bounds.ascent = xcip->ascent;
fs->min_bounds.descent = xcip->descent;
fs->min_bounds.attributes = xcip->attributes;
xcip = (xCharInfo *) &reply.maxBounds;
fs->max_bounds.lbearing = xcip->leftSideBearing;
fs->max_bounds.rbearing = xcip->rightSideBearing;
fs->max_bounds.width = xcip->characterWidth;
fs->max_bounds.ascent = xcip->ascent;
fs->max_bounds.descent = xcip->descent;
fs->max_bounds.attributes = xcip->attributes;
}
#else
/* XXX the next two statements won't work if short isn't 16 bits */
fs->min_bounds = * (XCharStruct *) &reply.minBounds;
fs->max_bounds = * (XCharStruct *) &reply.maxBounds;
#endif /* MUSTCOPY */
fs->n_properties = reply.nFontProps;
if (fs->n_properties > 0) {
......
......@@ -44,20 +44,11 @@ XMoveWindow (
req->window = w;
req->mask = CWX | CWY;
#ifdef MUSTCOPY
{
long lx = (long) x, ly = (long) y;
dpy->bufptr -= 8;
Data32 (dpy, (long *) &lx, 4); /* order dictated by CWX and CWY */
Data32 (dpy, (long *) &ly, 4);
}
#else
{
CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq);
*valuePtr++ = x;
*valuePtr = y;
}
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
return 1;
......
......@@ -168,18 +168,7 @@ XDrawText16(
}
elt->len = 254;
#if defined(MUSTCOPY) || defined(MUSTCOPY2B)
{
register int i;
register unsigned char *cp;
for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) {
*cp++ = CharacterOffset[i].byte1;
*cp++ = CharacterOffset[i].byte2;
}
}
#else
memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2);
#endif
PartialNChars = PartialNChars - 254;
CharacterOffset += 254;
......@@ -213,21 +202,9 @@ XDrawText16(
}
elt->len = PartialNChars;
#if defined(MUSTCOPY) || defined(MUSTCOPY2B)
{
register int i;
register unsigned char *cp;
for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars;
i++) {
*cp++ = CharacterOffset[i].byte1;
*cp++ = CharacterOffset[i].byte2;
}
}
#else
memcpy ((char *) (elt + 1), (char *)CharacterOffset,
PartialNChars *
2);
#endif
}
}
item++;
......
......@@ -36,9 +36,6 @@ XRestackWindows (
int n)
{
int i = 0;
#ifdef MUSTCOPY
unsigned long val = Below; /* needed for macro below */
#endif
LockDisplay(dpy);
while (windows++, ++i < n) {
......@@ -47,18 +44,12 @@ XRestackWindows (
GetReqExtra (ConfigureWindow, 8, req);
req->window = *windows;
req->mask = CWSibling | CWStackMode;
#ifdef MUSTCOPY
dpy->bufptr -= 8;
Data32 (dpy, (long *)(windows-1), 4);
Data32 (dpy, (long *)&val, 4);
#else
{
register CARD32 *values = (CARD32 *)
NEXTPTR(req,xConfigureWindowReq);
*values++ = *(windows-1);
*values = Below;
}
#endif /* MUSTCOPY */
}
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -37,21 +37,13 @@ XStoreColor(
{
xColorItem *citem;
register xStoreColorsReq *req;
#ifdef MUSTCOPY
xColorItem citemdata;
long len = SIZEOF(xColorItem);
citem = &citemdata;
#endif /* MUSTCOPY */
LockDisplay(dpy);
GetReqExtra(StoreColors, SIZEOF(xColorItem), req); /* assume size is 4*n */
req->cmap = cmap;
#ifndef MUSTCOPY
citem = (xColorItem *) NEXTPTR(req,xStoreColorsReq);
#endif /* not MUSTCOPY */
citem->pixel = def->pixel;
citem->red = def->red;
......@@ -59,10 +51,6 @@ XStoreColor(
citem->blue = def->blue;
citem->flags = def->flags; /* do_red, do_green, do_blue */
#ifdef MUSTCOPY
dpy->bufptr -= SIZEOF(xColorItem); /* adjust for GetReqExtra */
Data (dpy, (char *) citem, len);
#endif /* MUSTCOPY */
UnlockDisplay(dpy);
SyncHandle();
......
......@@ -82,18 +82,7 @@ XDrawString16(
BufAlloc (xTextElt *, elt, nbytes);
elt->delta = 0;
elt->len = 254;
#if defined(MUSTCOPY) || defined(MUSTCOPY2B)
{
register int i;
register unsigned char *cp;
for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) {
*cp++ = CharacterOffset[i].byte1;
*cp++ = CharacterOffset[i].byte2;
}
}
#else
memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2);
#endif
PartialNChars = PartialNChars - 254;
CharacterOffset += 254;
}
......@@ -104,19 +93,7 @@ XDrawString16(
BufAlloc (xTextElt *, elt, nbytes);
elt->delta = 0;
elt->len = PartialNChars;
#if defined(MUSTCOPY) || defined(MUSTCOPY2B)
{
register int i;
register unsigned char *cp;
for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars;
i++) {
*cp++ = CharacterOffset[i].byte1;
*cp++ = CharacterOffset[i].byte2;
}
}
#else
memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2);
#endif
}
}
......
......@@ -100,11 +100,6 @@ _XGetAsyncReply(
_XRead(dpy, replbuf + len, size - len);