From bad67799229b94ea2ba0174319949766ad1c2fc6 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 15 Apr 2015 09:58:01 +0200 Subject: old-arch cleanup: Drop CRAY support (i.e., drop code related to CRAY, _CRAY, WORD64, WORD64ALIGN, MUSTCOPY, UNSIGNEDBITFIELDS definitions). --- nx-X11/lib/X11/ChWindow.c | 9 -- nx-X11/lib/X11/ConfWind.c | 13 --- nx-X11/lib/X11/CrWindow.c | 9 -- nx-X11/lib/X11/DrArc.c | 13 --- nx-X11/lib/X11/DrLine.c | 16 --- nx-X11/lib/X11/DrPoint.c | 15 --- nx-X11/lib/X11/DrRect.c | 16 --- nx-X11/lib/X11/FillArc.c | 16 --- nx-X11/lib/X11/FillRct.c | 15 --- nx-X11/lib/X11/Font.c | 45 +------- nx-X11/lib/X11/FontInfo.c | 24 +---- nx-X11/lib/X11/ImUtil.c | 8 -- nx-X11/lib/X11/LiHosts.c | 7 -- nx-X11/lib/X11/Macros.c | 5 - nx-X11/lib/X11/MoveWin.c | 9 -- nx-X11/lib/X11/PolyTxt16.c | 26 +---- nx-X11/lib/X11/Quarks.c | 4 - nx-X11/lib/X11/RestackWs.c | 11 +- nx-X11/lib/X11/SendEvent.c | 5 - nx-X11/lib/X11/StColor.c | 13 --- nx-X11/lib/X11/Text16.c | 23 ----- nx-X11/lib/X11/XKBNames.c | 56 ---------- nx-X11/lib/X11/XKBRdBuf.c | 27 +---- nx-X11/lib/X11/XKBlibint.h | 2 +- nx-X11/lib/X11/Xlib.h | 4 - nx-X11/lib/X11/XlibAsync.c | 5 - nx-X11/lib/X11/XlibInt.c | 252 --------------------------------------------- nx-X11/lib/X11/Xlibint.h | 63 +----------- nx-X11/lib/X11/cmsTrig.c | 4 - nx-X11/lib/X11/omXChar.c | 71 ------------- 30 files changed, 7 insertions(+), 779 deletions(-) (limited to 'nx-X11/lib/X11') diff --git a/nx-X11/lib/X11/ChWindow.c b/nx-X11/lib/X11/ChWindow.c index a403d76d8..615b6d27c 100644 --- a/nx-X11/lib/X11/ChWindow.c +++ b/nx-X11/lib/X11/ChWindow.c @@ -44,20 +44,11 @@ unsigned int width, height; 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; diff --git a/nx-X11/lib/X11/ConfWind.c b/nx-X11/lib/X11/ConfWind.c index fddd28319..adcc7b667 100644 --- a/nx-X11/lib/X11/ConfWind.c +++ b/nx-X11/lib/X11/ConfWind.c @@ -44,18 +44,6 @@ unsigned int width, height; 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 @@ unsigned int width, height; *valuePtr++ = width; *valuePtr = height; } -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); return 1; diff --git a/nx-X11/lib/X11/CrWindow.c b/nx-X11/lib/X11/CrWindow.c index 9a15f2ec1..f64ca9f64 100644 --- a/nx-X11/lib/X11/CrWindow.c +++ b/nx-X11/lib/X11/CrWindow.c @@ -56,20 +56,11 @@ Window XCreateSimpleWindow(dpy, parent, x, y, width, height, 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(); diff --git a/nx-X11/lib/X11/DrArc.c b/nx-X11/lib/X11/DrArc.c index 311167647..58e55771e 100644 --- a/nx-X11/lib/X11/DrArc.c +++ b/nx-X11/lib/X11/DrArc.c @@ -48,12 +48,6 @@ XDrawArc(dpy, d, gc, x, y, width, height, angle1, angle2) { register xPolyArcReq *req; register xArc *arc; -#ifdef MUSTCOPY - xArc arcdata; - long len = SIZEOF(xArc); - - arc = &arcdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -62,9 +56,7 @@ XDrawArc(dpy, d, gc, x, y, width, height, angle1, angle2) req->drawable = d; req->gc = gc->gid; -#ifndef MUSTCOPY arc = (xArc *) NEXTPTR(req,xPolyArcReq); -#endif /* MUSTCOPY */ arc->x = x; arc->y = y; @@ -73,11 +65,6 @@ XDrawArc(dpy, d, gc, x, y, width, height, angle1, angle2) arc->angle1 = angle1; arc->angle2 = angle2; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xArc); - Data (dpy, (char *) arc, len); -#endif /* MUSTCOPY */ - UnlockDisplay(dpy); SyncHandle(); return 1; diff --git a/nx-X11/lib/X11/DrLine.c b/nx-X11/lib/X11/DrLine.c index 59095069b..4a7c620b5 100644 --- a/nx-X11/lib/X11/DrLine.c +++ b/nx-X11/lib/X11/DrLine.c @@ -44,12 +44,6 @@ XDrawLine (dpy, d, gc, x1, y1, x2, y2) int x1, y1, x2, y2; { register xSegment *segment; -#ifdef MUSTCOPY - xSegment segmentdata; - long len = SIZEOF(xSegment); - - segment = &segmentdata; -#endif /* not MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -66,21 +60,15 @@ XDrawLine (dpy, d, gc, x1, y1, x2, y2) && (((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; @@ -88,10 +76,6 @@ XDrawLine (dpy, d, gc, x1, y1, x2, y2) segment->x2 = x2; segment->y2 = y2; -#ifdef MUSTCOPY - Data (dpy, (char *) &segmentdata, len); -#endif /* MUSTCOPY */ - UnlockDisplay(dpy); SyncHandle(); } diff --git a/nx-X11/lib/X11/DrPoint.c b/nx-X11/lib/X11/DrPoint.c index 3cd6b7f57..26d17ef88 100644 --- a/nx-X11/lib/X11/DrPoint.c +++ b/nx-X11/lib/X11/DrPoint.c @@ -43,12 +43,6 @@ XDrawPoint(dpy, d, gc, x, y) int x, y; /* INT16 */ { xPoint *point; -#ifdef MUSTCOPY - xPoint pointdata; - long len = SIZEOF(xPoint); - - point = &pointdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -66,10 +60,8 @@ XDrawPoint(dpy, d, gc, x, y) && ((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 { @@ -77,19 +69,12 @@ XDrawPoint(dpy, d, gc, x, y) 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(); diff --git a/nx-X11/lib/X11/DrRect.c b/nx-X11/lib/X11/DrRect.c index 984e291c6..affbc982d 100644 --- a/nx-X11/lib/X11/DrRect.c +++ b/nx-X11/lib/X11/DrRect.c @@ -45,12 +45,6 @@ XDrawRectangle(dpy, d, gc, x, y, width, height) unsigned int width, 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(dpy, d, gc, x, y, width, height) && (((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(dpy, d, gc, x, y, width, height) rect->width = width; rect->height = height; -#ifdef MUSTCOPY - Data (dpy, (char *) rect, len); /* subtracted bufptr up above */ -#endif /* MUSTCOPY */ - } UnlockDisplay(dpy); SyncHandle(); diff --git a/nx-X11/lib/X11/FillArc.c b/nx-X11/lib/X11/FillArc.c index 2aa88d8fd..12d17dba1 100644 --- a/nx-X11/lib/X11/FillArc.c +++ b/nx-X11/lib/X11/FillArc.c @@ -45,12 +45,6 @@ XFillArc(dpy, d, gc, x, y, width, height, angle1, angle2) int angle1, angle2; /* INT16 */ { xArc *arc; -#ifdef MUSTCOPY - xArc arcdata; - long len = SIZEOF(xArc); - - arc = &arcdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -66,10 +60,8 @@ XFillArc(dpy, d, gc, x, y, width, height, angle1, angle2) && ((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 { @@ -77,11 +69,7 @@ XFillArc(dpy, d, gc, x, y, width, height, angle1, angle2) 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; @@ -90,10 +78,6 @@ XFillArc(dpy, d, gc, x, y, width, height, angle1, angle2) arc->angle1 = angle1; arc->angle2 = angle2; -#ifdef MUSTCOPY - Data (dpy, (char *) arc, len); -#endif /* MUSTCOPY */ - } UnlockDisplay(dpy); SyncHandle(); diff --git a/nx-X11/lib/X11/FillRct.c b/nx-X11/lib/X11/FillRct.c index d4a362af7..e1b7ad091 100644 --- a/nx-X11/lib/X11/FillRct.c +++ b/nx-X11/lib/X11/FillRct.c @@ -44,12 +44,6 @@ XFillRectangle(dpy, d, gc, x, y, width, height) unsigned int width, 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, d, gc, x, y, width, height) && ((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(); diff --git a/nx-X11/lib/X11/Font.c b/nx-X11/lib/X11/Font.c index c37617cf9..92a6a8f4a 100644 --- a/nx-X11/lib/X11/Font.c +++ b/nx-X11/lib/X11/Font.c @@ -35,7 +35,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 @@ -231,31 +231,9 @@ _XQueryFont (dpy, fid, seq) 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; /* @@ -279,7 +257,6 @@ _XQueryFont (dpy, fid, seq) * 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); @@ -290,28 +267,8 @@ _XQueryFont (dpy, fid, seq) (reply.nCharInfos * SIZEOF(xCharInfo))); 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 */ diff --git a/nx-X11/lib/X11/FontInfo.c b/nx-X11/lib/X11/FontInfo.c index f92375853..bc096fef7 100644 --- a/nx-X11/lib/X11/FontInfo.c +++ b/nx-X11/lib/X11/FontInfo.c @@ -32,7 +32,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 @@ -135,31 +135,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) { diff --git a/nx-X11/lib/X11/ImUtil.c b/nx-X11/lib/X11/ImUtil.c index 9e667bb9c..85f4183f4 100644 --- a/nx-X11/lib/X11/ImUtil.c +++ b/nx-X11/lib/X11/ImUtil.c @@ -533,9 +533,7 @@ static unsigned long _XGetPixel (ximage, x, y) return (pixel & low_bits_table[ximage->depth]); } -#ifndef WORD64 static CARD32 const byteorderpixel = MSBFirst << 24; -#endif static unsigned long _XGetPixel32 (ximage, x, y) register XImage *ximage; @@ -548,11 +546,9 @@ static unsigned long _XGetPixel32 (ximage, x, y) if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 2)]; -#ifndef WORD64 if (*((const char *)&byteorderpixel) == ximage->byte_order) pixel = *((CARD32 *)addr); else -#endif if (ximage->byte_order == MSBFirst) pixel = ((unsigned long)addr[0] << 24 | (unsigned long)addr[1] << 16 | @@ -739,11 +735,9 @@ static int _XPutPixel32 (ximage, x, y, pixel) if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 2)]; -#ifndef WORD64 if (*((const char *)&byteorderpixel) == ximage->byte_order) *((CARD32 *)addr) = pixel; else -#endif if (ximage->byte_order == MSBFirst) { addr[0] = pixel >> 24; addr[1] = pixel >> 16; @@ -1002,7 +996,6 @@ _XAddPixel (ximage, value) x = ximage->bytes_per_line * ximage->height; while (--x >= 0) *dp++ += value; -#ifndef WORD64 } else if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16) && (*((const char *)&byteorderpixel) == ximage->byte_order)) { @@ -1017,7 +1010,6 @@ _XAddPixel (ximage, value) x = (ximage->bytes_per_line >> 2) * ximage->height; while (--x >= 0) *dp++ += value; -#endif } else { for (y = ximage->height; --y >= 0; ) { for (x = ximage->width; --x >= 0; ) { diff --git a/nx-X11/lib/X11/LiHosts.c b/nx-X11/lib/X11/LiHosts.c index 01cfadb13..bd0864448 100644 --- a/nx-X11/lib/X11/LiHosts.c +++ b/nx-X11/lib/X11/LiHosts.c @@ -95,15 +95,8 @@ XHostAddress *XListHosts ( _XRead (dpy, (char *) buf, nbytes); for (i = 0; i < reply.nHosts; i++) { -#ifdef WORD64 - xHostEntry xhe; - memcpy((char *)&xhe, bp, SIZEOF(xHostEntry)); - op->family = xhe.family; - op->length = xhe.length; -#else op->family = ((xHostEntry *) bp)->family; op->length =((xHostEntry *) bp)->length; -#endif if (op->family == FamilyServerInterpreted) { char *tp = (char *) (bp + SIZEOF(xHostEntry)); char *vp = memchr(tp, 0, op->length); diff --git a/nx-X11/lib/X11/Macros.c b/nx-X11/lib/X11/Macros.c index 34d11feaf..ebb513226 100644 --- a/nx-X11/lib/X11/Macros.c +++ b/nx-X11/lib/X11/Macros.c @@ -126,12 +126,7 @@ int XImageByteOrder(dpy) Display *dpy; { return (ImageByteOrder(dpy)); } unsigned long XNextRequest(dpy) Display *dpy; { -#ifdef WORD64 - WORD64ALIGN - return dpy->request + 1; -#else return (NextRequest(dpy)); -#endif } unsigned long XLastKnownRequestProcessed(dpy) diff --git a/nx-X11/lib/X11/MoveWin.c b/nx-X11/lib/X11/MoveWin.c index d3c4f8821..44097fea5 100644 --- a/nx-X11/lib/X11/MoveWin.c +++ b/nx-X11/lib/X11/MoveWin.c @@ -45,20 +45,11 @@ XMoveWindow (dpy, w, x, y) 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; diff --git a/nx-X11/lib/X11/PolyTxt16.c b/nx-X11/lib/X11/PolyTxt16.c index ddaa62d08..ded535dc3 100644 --- a/nx-X11/lib/X11/PolyTxt16.c +++ b/nx-X11/lib/X11/PolyTxt16.c @@ -169,18 +169,7 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) } 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; @@ -214,21 +203,8 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) } 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 + PartialNChars * 2); } } item++; diff --git a/nx-X11/lib/X11/Quarks.c b/nx-X11/lib/X11/Quarks.c index a5ffa8ac1..d47bce314 100644 --- a/nx-X11/lib/X11/Quarks.c +++ b/nx-X11/lib/X11/Quarks.c @@ -133,10 +133,8 @@ static char *permalloc(unsigned int length) return(ret); } -#ifndef WORD64 typedef struct {char a; double b;} TestType1; typedef struct {char a; unsigned long b;} TestType2; -#endif #ifdef XTHREADS static char *_Xpermalloc(unsigned int length); @@ -159,7 +157,6 @@ char *Xpermalloc(unsigned int length) int i; if (neverFreeTableSize && length < NEVERFREETABLESIZE) { -#ifndef WORD64 if ((sizeof(TestType1) != (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && !(length & (DALIGN-1)) && @@ -167,7 +164,6 @@ char *Xpermalloc(unsigned int length) neverFreeTableSize -= DALIGN - i; neverFreeTable += DALIGN - i; } else -#endif if ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1))) { neverFreeTableSize -= WALIGN - i; neverFreeTable += WALIGN - i; diff --git a/nx-X11/lib/X11/RestackWs.c b/nx-X11/lib/X11/RestackWs.c index 1887e7c73..ab5386251 100644 --- a/nx-X11/lib/X11/RestackWs.c +++ b/nx-X11/lib/X11/RestackWs.c @@ -38,9 +38,6 @@ XRestackWindows (dpy, windows, n) int n; { int i = 0; -#ifdef MUSTCOPY - unsigned long val = Below; /* needed for macro below */ -#endif LockDisplay(dpy); while (windows++, ++i < n) { @@ -49,19 +46,13 @@ XRestackWindows (dpy, windows, n) 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(); return 1; diff --git a/nx-X11/lib/X11/SendEvent.c b/nx-X11/lib/X11/SendEvent.c index 06e23a5c9..a1b8d6620 100644 --- a/nx-X11/lib/X11/SendEvent.c +++ b/nx-X11/lib/X11/SendEvent.c @@ -65,12 +65,7 @@ XSendEvent(dpy, w, propagate, event_mask, event) req->destination = w; req->propagate = propagate; req->eventMask = event_mask; -#ifdef WORD64 - /* avoid quad-alignment problems */ - memcpy ((char *) req->eventdata, (char *) &ev, SIZEOF(xEvent)); -#else req->event = ev; -#endif /* WORD64 */ } UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/StColor.c b/nx-X11/lib/X11/StColor.c index b2b197a99..b6784b5e2 100644 --- a/nx-X11/lib/X11/StColor.c +++ b/nx-X11/lib/X11/StColor.c @@ -39,21 +39,13 @@ XColor *def; { 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; @@ -61,11 +53,6 @@ XColor *def; 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(); return 1; diff --git a/nx-X11/lib/X11/Text16.c b/nx-X11/lib/X11/Text16.c index 96d5911d6..dbf876326 100644 --- a/nx-X11/lib/X11/Text16.c +++ b/nx-X11/lib/X11/Text16.c @@ -84,18 +84,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; } @@ -106,19 +95,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 } } diff --git a/nx-X11/lib/X11/XKBNames.c b/nx-X11/lib/X11/XKBNames.c index a8eeb2adf..8483187c3 100644 --- a/nx-X11/lib/X11/XKBNames.c +++ b/nx-X11/lib/X11/XKBNames.c @@ -498,38 +498,10 @@ XkbSetNames( Display * dpy, if (which&XkbGroupNamesMask) _XkbCopyAtoms(dpy,names->groups,groups,XkbNumKbdGroups); if (which&XkbKeyNamesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKeys*XkbKeyNameLength); - for (i=0;ikeys[firstKey+i].name[0]; - tmp[1]= names->keys[firstKey+i].name[1]; - tmp[2]= names->keys[firstKey+i].name[2]; - tmp[3]= names->keys[firstKey+i].name[3]; - } -#else Data(dpy,(char *)&names->keys[firstKey],nKeys*XkbKeyNameLength); -#endif } if (which&XkbKeyAliasesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKA*XkbKeyNameLength*2); - for (i=0;ikey_aliases[i].real[0]; - tmp[1]= names->key_aliases[i].real[1]; - tmp[2]= names->key_aliases[i].real[2]; - tmp[3]= names->key_aliases[i].real[3]; - tmp[4]= names->key_aliases[i].alias[0]; - tmp[5]= names->key_aliases[i].alias[1]; - tmp[6]= names->key_aliases[i].alias[2]; - tmp[7]= names->key_aliases[i].alias[3]; - } -#else Data(dpy,(char *)names->key_aliases,nKA*XkbKeyNameLength*2); -#endif } if (which&XkbRGNamesMask) { Data32(dpy,(long *)names->radio_groups,nRG*4); @@ -754,38 +726,10 @@ XkbChangeNames(Display *dpy,XkbDescPtr xkb,XkbNameChangesPtr changes) if (which&XkbGroupNamesMask) _XkbCopyAtoms(dpy,names->groups,groups,XkbNumKbdGroups); if (which&XkbKeyNamesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKeys*4); - for (i=0;ikeys[firstKey+i].name[0]; - tmp[1]= names->keys[firstKey+i].name[1]; - tmp[2]= names->keys[firstKey+i].name[2]; - tmp[3]= names->keys[firstKey+i].name[3]; - } -#else Data(dpy,(char *)&names->keys[firstKey],nKeys*XkbKeyNameLength); -#endif } if (which&XkbKeyAliasesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKA*XkbKeyNameLength*2); - for (i=0;ikey_aliases[i].real[0]; - tmp[1]= names->key_aliases[i].real[1]; - tmp[2]= names->key_aliases[i].real[2]; - tmp[3]= names->key_aliases[i].real[3]; - tmp[4]= names->key_aliases[i].alias[0]; - tmp[5]= names->key_aliases[i].alias[1]; - tmp[6]= names->key_aliases[i].alias[2]; - tmp[7]= names->key_aliases[i].alias[3]; - } -#else Data(dpy,(char *)names->key_aliases,nKA*XkbKeyNameLength*2); -#endif } if (which&XkbRGNamesMask) { Data32(dpy,(long *)names->radio_groups,nRG*4); diff --git a/nx-X11/lib/X11/XKBRdBuf.c b/nx-X11/lib/X11/XKBRdBuf.c index a68a80a33..d0b7045d6 100644 --- a/nx-X11/lib/X11/XKBRdBuf.c +++ b/nx-X11/lib/X11/XKBRdBuf.c @@ -121,29 +121,8 @@ _XkbReadCopyData32(int *wire,long *to,int num_words) return 1; } #endif -#ifdef WORD64 -int -_XkbReadCopyData32(int *from,long *lp,int num_words) -{ -long *lpack; -long mask32 = 0x00000000ffffffff; -long maskw, i, bits; - - lpack = (long *)from; - bits = 32; - - for (i=0;i> bits; - bits = bits ^ 32; - if (bits) - lpack++; - } - return 1; -} -#endif -#if defined(LONG64) || defined(WORD64) +#if defined(LONG64) int _XkbReadBufferCopy32(XkbReadBufferPtr from,long *to,int num_words) { @@ -167,10 +146,6 @@ _XkbWriteCopyData32 (register unsigned long *from,CARD32 *to,int len) } #endif /* LONG64 */ -#ifdef WORD64 -_XkbWriteCopyData32 Not Implemented Yet for sizeof(int)==8 -#endif - char * _XkbPeekAtReadBuffer(XkbReadBufferPtr from,int size) { diff --git a/nx-X11/lib/X11/XKBlibint.h b/nx-X11/lib/X11/XKBlibint.h index a154d1bce..0244e2ef3 100644 --- a/nx-X11/lib/X11/XKBlibint.h +++ b/nx-X11/lib/X11/XKBlibint.h @@ -215,7 +215,7 @@ extern int _XkbCopyFromReadBuffer( ); -#if defined(WORD64) || defined(LONG64) +#if defined(LONG64) extern int _XkbReadCopyData32( int * /* from */, long * /* to */, diff --git a/nx-X11/lib/X11/Xlib.h b/nx-X11/lib/X11/Xlib.h index e21d9ffac..8ce7fb577 100644 --- a/nx-X11/lib/X11/Xlib.h +++ b/nx-X11/lib/X11/Xlib.h @@ -144,11 +144,7 @@ typedef char *XPointer; #define BitmapBitOrder(dpy) (((_XPrivDisplay)dpy)->bitmap_bit_order) #define BitmapPad(dpy) (((_XPrivDisplay)dpy)->bitmap_pad) #define ImageByteOrder(dpy) (((_XPrivDisplay)dpy)->byte_order) -#ifdef CRAY /* unable to get WORD64 without pulling in other symbols */ -#define NextRequest(dpy) XNextRequest(dpy) -#else #define NextRequest(dpy) (((_XPrivDisplay)dpy)->request + 1) -#endif #define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)dpy)->last_request_read) /* macros for screen oriented applications (toolkit) */ diff --git a/nx-X11/lib/X11/XlibAsync.c b/nx-X11/lib/X11/XlibAsync.c index 70bd82bad..81403ebc9 100644 --- a/nx-X11/lib/X11/XlibAsync.c +++ b/nx-X11/lib/X11/XlibAsync.c @@ -119,11 +119,6 @@ _XGetAsyncReply(dpy, replbuf, rep, buf, len, extra, discard) _XRead(dpy, replbuf + len, size - len); buf = replbuf; len = size; -#ifdef MUSTCOPY - } else { - memcpy(replbuf, buf, size); - buf = replbuf; -#endif } if (discard && rep->generic.length > extra && diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c index 47e2ea139..0514470dd 100644 --- a/nx-X11/lib/X11/XlibInt.c +++ b/nx-X11/lib/X11/XlibInt.c @@ -202,20 +202,6 @@ extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); #define MAX_PATH _POSIX_PATH_MAX #endif -#ifdef MUSTCOPY - -#define STARTITERATE(tpvar,type,start,endcond) \ - { register char *cpvar; \ - for (cpvar = (char *) (start); endcond; ) { \ - type dummy; memcpy ((char *) &dummy, cpvar, SIZEOF(type)); \ - tpvar = &dummy; -#define ITERPTR(tpvar) cpvar -#define RESETITERPTR(tpvar,type,start) cpvar = start -#define INCITERPTR(tpvar,type) cpvar += SIZEOF(type) -#define ENDITERATE }} - -#else - #define STARTITERATE(tpvar,type,start,endcond) \ for (tpvar = (type *) (start); endcond; ) #define ITERPTR(tpvar) (char *)tpvar @@ -223,8 +209,6 @@ extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); #define INCITERPTR(tpvar,type) tpvar++ #define ENDITERATE -#endif /* MUSTCOPY */ - typedef union { xReply rep; char buf[BUFSIZE]; @@ -1611,125 +1595,6 @@ void _XRead32( } #endif /* LONG64 */ -#ifdef WORD64 - -/* - * XXX This is a *really* stupid way of doing this.... - * PACKBUFFERSIZE must be a multiple of 4. - */ - -#define PACKBUFFERSIZE 4096 - - -/* - * _XRead32 - Read bytes from the socket unpacking each 32 bits - * into a long (64 bits on a CRAY computer). - * - */ -static void _doXRead32( - register Display *dpy, - register long *data - register long size, - register char *packbuffer) -{ - long *lpack,*lp; - long mask32 = 0x00000000ffffffff; - long maskw, nwords, i, bits; - - _XReadPad (dpy, packbuffer, size); - - lp = data; - lpack = (long *) packbuffer; - nwords = size >> 2; - bits = 32; - - for(i=0;i> bits; - bits = bits ^32; - if(bits){ - lpack++; - } - } -} - -void _XRead32( - Display *dpy, - long *data, - long len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 2; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - _doXRead32 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) _doXRead32 (dpy, data, len, packbuffer); -} - - - -/* - * _XRead16 - Read bytes from the socket unpacking each 16 bits - * into a long (64 bits on a CRAY computer). - * - */ -static _doXRead16( - register Display *dpy, - register short *data, - register long size, - char *packbuffer) -{ - long *lpack,*lp; - long mask16 = 0x000000000000ffff; - long maskw, nwords, i, bits; - - (void) _XRead(dpy,packbuffer,size); /* don't do a padded read... */ - - lp = (long *) data; - lpack = (long *) packbuffer; - nwords = size >> 1; /* number of 16 bit words to be unpacked */ - bits = 48; - for(i=0;i> bits; - bits -= 16; - if(bits < 0){ - lpack++; - bits = 48; - } - } -} - -void _XRead16( - Display *dpy, - short *data, - long len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 1; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - _doXRead16 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) _doXRead16 (dpy, data, len, packbuffer); -} - -void _XRead16Pad( - Display *dpy, - short *data, - long size) -{ - int slop = (size & 3); - short slopbuf[3]; - - _XRead16 (dpy, data, size); - if (slop > 0) { - _XRead16 (dpy, slopbuf, 4 - slop); - } -} -#endif /* WORD64 */ - /* * _XReadPad - Read bytes from the socket taking into account incomplete @@ -3795,123 +3660,6 @@ _XData32( } #endif /* LONG64 */ -#ifdef WORD64 - -/* - * XXX This is a *really* stupid way of doing this. It should just use - * dpy->bufptr directly, taking into account where in the word it is. - */ - -/* - * Data16 - Place 16 bit data in the buffer. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to the data. - * "len" is the length in bytes of the data. - */ - -static doData16( - register Display *dpy, - short *data, - unsigned len, - char *packbuffer) -{ - long *lp,*lpack; - long i, nwords,bits; - long mask16 = 0x000000000000ffff; - - lp = (long *)data; - lpack = (long *)packbuffer; - -/* nwords is the number of 16 bit values to be packed, - * the low order 16 bits of each word will be packed - * into 64 bit words - */ - nwords = len >> 1; - bits = 48; - - for(i=0;i> 1; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - doData16 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) doData16 (dpy, data, len, packbuffer); -} - -/* - * Data32 - Place 32 bit data in the buffer. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to the data. - * "len" is the length in bytes of the data. - */ - -static doData32( - register Display *dpy - long *data, - unsigned len, - char *packbuffer) -{ - long *lp,*lpack; - long i,bits,nwords; - long mask32 = 0x00000000ffffffff; - - lpack = (long *) packbuffer; - lp = data; - -/* nwords is the number of 32 bit values to be packed - * the low order 32 bits of each word will be packed - * into 64 bit words - */ - nwords = len >> 2; - bits = 32; - - for(i=0;i> 2; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - doData32 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) doData32 (dpy, data, len, packbuffer); -} - -#endif /* WORD64 */ - /* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. * Otherwise, Xau will not be able to find your cookies in the Xauthority file. diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h index 56da2349b..b9a39b25e 100644 --- a/nx-X11/lib/X11/Xlibint.h +++ b/nx-X11/lib/X11/Xlibint.h @@ -215,13 +215,6 @@ struct _XDisplay #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) -/* - * define the following if you want the Data macro to be a procedure instead - */ -#ifdef CRAY -#define DataRoutineIsProcedure -#endif /* CRAY */ - #ifndef _XEVENT_ /* * _QEvent datatype for use in input queueing. @@ -426,26 +419,8 @@ extern LockInfoPtr _Xglobal_lock; * X Protocol packetizing macros. */ -/* Need to start requests on 64 bit word boundaries - * on a CRAY computer so add a NoOp (127) if needed. - * A character pointer on a CRAY computer will be non-zero - * after shifting right 61 bits of it is not pointing to - * a word boundary. - */ -#ifdef WORD64 -#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\ - dpy->last_req = dpy->bufptr;\ - *(dpy->bufptr) = X_NoOperation;\ - *(dpy->bufptr+1) = 0;\ - *(dpy->bufptr+2) = 0;\ - *(dpy->bufptr+3) = 1;\ - dpy->request++;\ - dpy->bufptr += 4;\ - } -#else /* else does not require alignment on 64-bit boundaries */ +/* Leftover from CRAY support - was defined empty on all non-Cray systems */ #define WORD64ALIGN -#endif /* WORD64 */ - /* * GetReq - Get the next available X request packet in the buffer and @@ -458,7 +433,6 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ _XFlush(dpy);\ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ @@ -469,7 +443,6 @@ extern LockInfoPtr _Xglobal_lock; #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ #define GetReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ _XFlush(dpy);\ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ @@ -484,7 +457,6 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetReqExtra(name, n, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\ _XFlush(dpy);\ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ @@ -494,7 +466,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #else #define GetReqExtra(name, n, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\ _XFlush(dpy);\ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ @@ -513,7 +484,6 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetResReq(name, rid, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ @@ -524,7 +494,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #else #define GetResReq(name, rid, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ @@ -541,7 +510,6 @@ extern LockInfoPtr _Xglobal_lock; */ #if !defined(UNIXCPP) || defined(ANSICPP) #define GetEmptyReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xReq *) (dpy->last_req = dpy->bufptr);\ @@ -551,7 +519,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #else #define GetEmptyReq(name, req) \ - WORD64ALIGN\ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ _XFlush(dpy);\ req = (xReq *) (dpy->last_req = dpy->bufptr);\ @@ -561,18 +528,6 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #endif -#ifdef WORD64 -#define MakeBigReq(req,n) \ - { \ - char _BRdat[4]; \ - unsigned long _BRlen = req->length - 1; \ - req->length = 0; \ - memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ - memcpy(((char *)req) + 4, _BRdat, 4); \ - Data32(dpy, (long *)&_BRdat, 4); \ - } -#else #ifdef LONG64 #define MakeBigReq(req,n) \ { \ @@ -596,7 +551,6 @@ extern LockInfoPtr _Xglobal_lock; Data32(dpy, &_BRdat, 4); \ } #endif -#endif #define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ @@ -655,10 +609,6 @@ extern void _XFlushGCCache(Display *dpy, GC gc); (void)ptr; \ dpy->bufptr += (n); -#ifdef WORD64 -#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len) -#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len) -#else #define Data16(dpy, data, len) Data((dpy), (char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) @@ -678,7 +628,6 @@ extern void _XRead32( #define Data32(dpy, data, len) Data((dpy), (char *)(data), (len)) #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #endif -#endif /* not WORD64 */ #define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len) @@ -747,20 +696,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; /* diff --git a/nx-X11/lib/X11/cmsTrig.c b/nx-X11/lib/X11/cmsTrig.c index 1859fa93e..a2d100c04 100644 --- a/nx-X11/lib/X11/cmsTrig.c +++ b/nx-X11/lib/X11/cmsTrig.c @@ -82,12 +82,8 @@ _XcmsModuloF( #define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) /* XCMS_DMAXPOWTWO - largest power of two exactly representable as a double */ -#ifdef _CRAY -#define XCMS_DMAXPOWTWO ((double)(1 < 47)) -#else #define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \ (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1))) -#endif /* * LOCAL VARIABLES diff --git a/nx-X11/lib/X11/omXChar.c b/nx-X11/lib/X11/omXChar.c index 4afafd40f..5ddd03584 100644 --- a/nx-X11/lib/X11/omXChar.c +++ b/nx-X11/lib/X11/omXChar.c @@ -264,47 +264,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, @@ -360,10 +319,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; @@ -382,32 +337,6 @@ _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); - 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) -- cgit v1.2.3 From ac9fbaabd6bdbca6dd1d94fa385aea41fdebf2c1 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Wed, 15 Apr 2015 10:16:18 +0200 Subject: MakeBigReq: don't move the last word, already handled by Data32 (X.Org CVE-2013-7439). MakeBigReq inserts a length field after the first 4 bytes of the request (after req->length), pushing everything else back by 4 bytes. The current memmove moves everything but the first 4 bytes back. If a request aligns to the end of the buffer pointer when MakeBigReq is invoked for that request, this runs over the buffer. Instead, we need to memmove minus the first 4 bytes (which aren't moved), minus the last 4 bytes (so we still align to the previous tail). The 4 bytes that fell out are already handled with Data32, which will handle the buffermax correctly. The case where req->length = 1 was already not functional. Reported by Abhishek Arya (against X.Org BTS). https://bugzilla.mozilla.org/show_bug.cgi?id=803762 Reviewed-by: Jeff Muizelaar Reviewed-by: Peter Hutterer Signed-off-by: Alan Coopersmith Rebased-for-NX: Mike Gabriel --- nx-X11/lib/X11/Xlibint.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'nx-X11/lib/X11') diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h index b9a39b25e..bcd42b52b 100644 --- a/nx-X11/lib/X11/Xlibint.h +++ b/nx-X11/lib/X11/Xlibint.h @@ -528,6 +528,14 @@ extern LockInfoPtr _Xglobal_lock; dpy->request++ #endif +/* + * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 + * length, after req->length, before the data in the request. The new length + * includes the "n" extra 32-bit words. + * + * Do not use MakeBigReq if there is no data already in the request. + * req->length must already be >= 2. + */ #ifdef LONG64 #define MakeBigReq(req,n) \ { \ @@ -535,7 +543,7 @@ extern LockInfoPtr _Xglobal_lock; CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } @@ -546,12 +554,19 @@ extern LockInfoPtr _Xglobal_lock; CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } #endif +/* + * SetReqLen increases the count of 32-bit words in the request by "n", + * or by "badlen" if "n" is too large. + * + * Do not use SetReqLen if "req" does not already have data after the + * xReq header. req->length must already be >= 2. + */ #define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ if (dpy->bigreq_size) { \ -- cgit v1.2.3