diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2024-07-10 08:20:46 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2024-07-10 08:20:46 +0000 |
commit | fffc071567eefd51f06263228219780861d816fa (patch) | |
tree | 4f03a5ce80e520fd862467c54c3be8afca580c82 /lib/libX11/src | |
parent | 7bcffafb77bb1452dc7483e66202707c81ebf58c (diff) |
Update to libX11 1.8.9 part 5: various bug fixes
Diffstat (limited to 'lib/libX11/src')
-rw-r--r-- | lib/libX11/src/ChProp.c | 12 | ||||
-rw-r--r-- | lib/libX11/src/DrArcs.c | 4 | ||||
-rw-r--r-- | lib/libX11/src/DrLines.c | 6 | ||||
-rw-r--r-- | lib/libX11/src/DrPoints.c | 8 | ||||
-rw-r--r-- | lib/libX11/src/DrRects.c | 6 | ||||
-rw-r--r-- | lib/libX11/src/DrSegs.c | 6 | ||||
-rw-r--r-- | lib/libX11/src/FillArcs.c | 6 | ||||
-rw-r--r-- | lib/libX11/src/FillPoly.c | 8 | ||||
-rw-r--r-- | lib/libX11/src/FillRcts.c | 6 | ||||
-rw-r--r-- | lib/libX11/src/QuColors.c | 12 | ||||
-rw-r--r-- | lib/libX11/src/SetCRects.c | 10 | ||||
-rw-r--r-- | lib/libX11/src/xkb/XKBBind.c | 63 | ||||
-rw-r--r-- | lib/libX11/src/xkb/XKBExtDev.c | 6 | ||||
-rw-r--r-- | lib/libX11/src/xkb/XKBNames.c | 1 |
14 files changed, 71 insertions, 83 deletions
diff --git a/lib/libX11/src/ChProp.c b/lib/libX11/src/ChProp.c index 190a224f8..1089a4c95 100644 --- a/lib/libX11/src/ChProp.c +++ b/lib/libX11/src/ChProp.c @@ -45,16 +45,16 @@ XChangeProperty ( LockDisplay(dpy); GetReq (ChangeProperty, req); - req->window = w; - req->property = property; - req->type = type; - req->mode = mode; + req->window = (CARD32) w; + req->property = (CARD32) property; + req->type = (CARD32) type; + req->mode = (CARD8) mode; if (nelements < 0) { req->nUnits = 0; req->format = 0; /* ask for garbage, get garbage */ } else { - req->nUnits = nelements; - req->format = format; + req->nUnits = (CARD32) nelements; + req->format = (CARD8) format; } switch (req->format) { diff --git a/lib/libX11/src/DrArcs.c b/lib/libX11/src/DrArcs.c index 14405aa3d..bd010050f 100644 --- a/lib/libX11/src/DrArcs.c +++ b/lib/libX11/src/DrArcs.c @@ -45,8 +45,8 @@ XDrawArcs( LockDisplay(dpy); FlushGC(dpy, gc); GetReq(PolyArc,req); - req->drawable = d; - req->gc = gc->gid; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; len = ((long)n_arcs) * arc_scale; SetReqLen(req, len, 1); len <<= 2; /* watch out for macros... */ diff --git a/lib/libX11/src/DrLines.c b/lib/libX11/src/DrLines.c index 68071b6b4..460aabaa2 100644 --- a/lib/libX11/src/DrLines.c +++ b/lib/libX11/src/DrLines.c @@ -43,9 +43,9 @@ XDrawLines ( LockDisplay(dpy); FlushGC(dpy, gc); GetReq (PolyLine, req); - req->drawable = d; - req->gc = gc->gid; - req->coordMode = mode; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; + req->coordMode = (BYTE) mode; SetReqLen(req, npoints, 65535 - req->length); /* each point is 2 16-bit integers */ length = npoints << 2; /* watch out for macros... */ diff --git a/lib/libX11/src/DrPoints.c b/lib/libX11/src/DrPoints.c index 287fa057d..e7f946b00 100644 --- a/lib/libX11/src/DrPoints.c +++ b/lib/libX11/src/DrPoints.c @@ -49,12 +49,12 @@ XDrawPoints( FlushGC(dpy, gc); while (n_points) { GetReq(PolyPoint, req); - req->drawable = d; - req->gc = gc->gid; - req->coordMode = mode; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; + req->coordMode = (BYTE) mode; n = n_points; if (!dpy->bigreq_size && n > (dpy->max_request_size - req->length)) - n = dpy->max_request_size - req->length; + n = (int) (dpy->max_request_size - req->length); SetReqLen(req, n, n); nbytes = ((long)n) << 2; /* watch out for macros... */ if (xoff || yoff) { diff --git a/lib/libX11/src/DrRects.c b/lib/libX11/src/DrRects.c index 7827bf18d..137575625 100644 --- a/lib/libX11/src/DrRects.c +++ b/lib/libX11/src/DrRects.c @@ -45,12 +45,12 @@ XDrawRectangles( FlushGC(dpy, gc); while (n_rects) { GetReq(PolyRectangle, req); - req->drawable = d; - req->gc = gc->gid; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; n = n_rects; len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; + n = (int) ((dpy->max_request_size - req->length) >> 1); len = ((long)n) << 1; } SetReqLen(req, len, len); diff --git a/lib/libX11/src/DrSegs.c b/lib/libX11/src/DrSegs.c index 93eab4d08..59bf463d6 100644 --- a/lib/libX11/src/DrSegs.c +++ b/lib/libX11/src/DrSegs.c @@ -45,12 +45,12 @@ XDrawSegments ( FlushGC(dpy, gc); while (nsegments) { GetReq (PolySegment, req); - req->drawable = d; - req->gc = gc->gid; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; n = nsegments; len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; + n = (int) ((dpy->max_request_size - req->length) >> 1); len = ((long)n) << 1; } SetReqLen(req, len, len); diff --git a/lib/libX11/src/FillArcs.c b/lib/libX11/src/FillArcs.c index 62cfabf8f..3d0b62f08 100644 --- a/lib/libX11/src/FillArcs.c +++ b/lib/libX11/src/FillArcs.c @@ -47,12 +47,12 @@ XFillArcs( FlushGC(dpy, gc); while (n_arcs) { GetReq(PolyFillArc, req); - req->drawable = d; - req->gc = gc->gid; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; n = n_arcs; len = ((long)n) * arc_scale; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) / arc_scale; + n = (int) ((dpy->max_request_size - req->length) / arc_scale); len = ((long)n) * arc_scale; } SetReqLen(req, len, len); diff --git a/lib/libX11/src/FillPoly.c b/lib/libX11/src/FillPoly.c index ea162a41e..8c3bfabf2 100644 --- a/lib/libX11/src/FillPoly.c +++ b/lib/libX11/src/FillPoly.c @@ -46,10 +46,10 @@ XFillPolygon( FlushGC(dpy, gc); GetReq(FillPoly, req); - req->drawable = d; - req->gc = gc->gid; - req->shape = shape; - req->coordMode = mode; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; + req->shape = (BYTE) shape; + req->coordMode = (BYTE) mode; SetReqLen(req, n_points, 65535 - req->length); diff --git a/lib/libX11/src/FillRcts.c b/lib/libX11/src/FillRcts.c index ad334244f..a14afcf19 100644 --- a/lib/libX11/src/FillRcts.c +++ b/lib/libX11/src/FillRcts.c @@ -45,12 +45,12 @@ XFillRectangles( FlushGC(dpy, gc); while (n_rects) { GetReq(PolyFillRectangle, req); - req->drawable = d; - req->gc = gc->gid; + req->drawable = (CARD32) d; + req->gc = (CARD32) gc->gid; n = n_rects; len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; + n = (int) ((dpy->max_request_size - req->length) >> 1); len = ((long)n) << 1; } SetReqLen(req, len, len); diff --git a/lib/libX11/src/QuColors.c b/lib/libX11/src/QuColors.c index 10cf18257..099f1a4eb 100644 --- a/lib/libX11/src/QuColors.c +++ b/lib/libX11/src/QuColors.c @@ -43,7 +43,7 @@ _XQueryColors( GetReq(QueryColors, req); - req->cmap = cmap; + req->cmap = (CARD32) cmap; SetReqLen(req, ncolors, ncolors); /* each pixel is a CARD32 */ for (i = 0; i < ncolors; i++) @@ -51,11 +51,11 @@ _XQueryColors( /* XXX this isn't very efficient */ if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { - xrgb *color = Xmallocarray(ncolors, sizeof(xrgb)); + xrgb *color = Xmallocarray((size_t) ncolors, sizeof(xrgb)); if (color != NULL) { - unsigned long nbytes = (long) ncolors * SIZEOF(xrgb); + unsigned long nbytes = (size_t) ncolors * SIZEOF(xrgb); - _XRead(dpy, (char *) color, nbytes); + _XRead(dpy, (char *) color, (long) nbytes); for (i = 0; i < ncolors; i++) { register XColor *def = &defs[i]; @@ -82,9 +82,9 @@ XQueryColors( int n; if (dpy->bigreq_size > 0) - n = dpy->bigreq_size - (sizeof (xQueryColorsReq) >> 2) - 1; + n = (int) (dpy->bigreq_size - (sizeof (xQueryColorsReq) >> 2) - 1); else - n = dpy->max_request_size - (sizeof (xQueryColorsReq) >> 2); + n = (int) (dpy->max_request_size - (sizeof (xQueryColorsReq) >> 2)); LockDisplay(dpy); while (ncolors >= n) { diff --git a/lib/libX11/src/SetCRects.c b/lib/libX11/src/SetCRects.c index b18c449a6..1de2e3f1b 100644 --- a/lib/libX11/src/SetCRects.c +++ b/lib/libX11/src/SetCRects.c @@ -44,16 +44,16 @@ void _XSetClipRectangles ( register _XExtension *ext; GetReq (SetClipRectangles, req); - req->gc = gc->gid; - req->xOrigin = gc->values.clip_x_origin = clip_x_origin; - req->yOrigin = gc->values.clip_y_origin = clip_y_origin; - req->ordering = ordering; + req->gc = (CARD32) gc->gid; + req->xOrigin = (INT16) (gc->values.clip_x_origin = clip_x_origin); + req->yOrigin = (INT16) (gc->values.clip_y_origin = clip_y_origin); + req->ordering = (BYTE) ordering; len = ((long)n) << 1; SetReqLen(req, len, 1); len <<= 2; Data16 (dpy, (short *) rectangles, len); gc->rects = 1; - dirty = gc->dirty & ~(GCClipMask | GCClipXOrigin | GCClipYOrigin); + dirty = (gc->dirty & (unsigned long) ~(GCClipMask | GCClipXOrigin | GCClipYOrigin)); gc->dirty = GCClipMask | GCClipXOrigin | GCClipYOrigin; /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) diff --git a/lib/libX11/src/xkb/XKBBind.c b/lib/libX11/src/xkb/XKBBind.c index 8da18a7f1..467e41983 100644 --- a/lib/libX11/src/xkb/XKBBind.c +++ b/lib/libX11/src/xkb/XKBBind.c @@ -113,36 +113,24 @@ XKeycodeToKeysym(Display *dpy, return NoSymbol; if (col > 3) { - int lastSym, tmp, nGrp; + int firstSym, nGrp, grp; - lastSym = 3; + firstSym = 4; nGrp = XkbKeyNumGroups(xkb, kc); - if ((nGrp > 0) && - ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup1Index)) > 2)) { - if (col <= (lastSym + tmp - 2)) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index, - col - lastSym + 2); - lastSym += tmp - 2; - } - if ((nGrp > 1) && - ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup2Index)) > 2)) { - if (col <= (lastSym + tmp - 2)) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup2Index, - col - lastSym + 2); - lastSym += tmp - 2; - } - if (nGrp > 2) { - tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup3Index); - if (col <= lastSym + tmp) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup3Index, - col - lastSym); - lastSym += tmp; - } - if (nGrp > 3) { - tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup4Index); - if (col <= lastSym + tmp) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup4Index, - col - lastSym); + for (grp = 0; grp < nGrp; grp++) { + int width = XkbKeyGroupWidth(xkb, kc, grp); + int skip = 0; + if (grp < 2) { + /* Skip the first two symbols in the first two groups, since we + * return them below for indexes 0-3. */ + skip = 2; + width -= skip; + if (width < 0) + width = 0; + } + if (col < firstSym + width) + return XkbKeycodeToKeysym(dpy, kc, grp, col - firstSym + skip); + firstSym += width; } return NoSymbol; } @@ -214,6 +202,14 @@ XkbKeysymToModifiers(Display *dpy, KeySym ks) return mods; } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + KeySym XLookupKeysym(register XKeyEvent * event, int col) { @@ -223,22 +219,15 @@ XLookupKeysym(register XKeyEvent * event, int col) return _XLookupKeysym(event, col); _XkbCheckPendingRefresh(dpy, dpy->xkb_info); -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#elif defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif return XKeycodeToKeysym(dpy, event->keycode, col); +} + #ifdef __clang__ #pragma clang diagnostic pop #elif defined(__GNUC__) #pragma GCC diagnostic pop #endif -} - /* * Not a public entry point -- XkbTranslateKey is an obsolete name * that is preserved here so that functions linked against the old diff --git a/lib/libX11/src/xkb/XKBExtDev.c b/lib/libX11/src/xkb/XKBExtDev.c index a3e671dfe..162cc3561 100644 --- a/lib/libX11/src/xkb/XKBExtDev.c +++ b/lib/libX11/src/xkb/XKBExtDev.c @@ -188,8 +188,7 @@ _XkbReadGetDeviceInfoReply(Display *dpy, return tmp; } if (rep->nBtnsWanted > 0) { - if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted) - >= devi->num_btns) + if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted) > devi->num_btns) goto BAILOUT; act = &devi->btn_acts[rep->firstBtnWanted]; bzero((char *) act, (rep->nBtnsWanted * sizeof(XkbAction))); @@ -201,8 +200,7 @@ _XkbReadGetDeviceInfoReply(Display *dpy, if (rep->nBtnsRtrn > 0) { int size; - if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn) - >= devi->num_btns) + if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn) > devi->num_btns) goto BAILOUT; act = &devi->btn_acts[rep->firstBtnRtrn]; size = rep->nBtnsRtrn * SIZEOF(xkbActionWireDesc); diff --git a/lib/libX11/src/xkb/XKBNames.c b/lib/libX11/src/xkb/XKBNames.c index 1f6115b5f..0ea1c8273 100644 --- a/lib/libX11/src/xkb/XKBNames.c +++ b/lib/libX11/src/xkb/XKBNames.c @@ -189,6 +189,7 @@ _XkbReadGetNamesReply(Display *dpy, (char *) &names->keys[rep->firstKey], rep->nKeys * XkbKeyNameLength)) goto BAILOUT; + names->num_keys = rep->nKeys; } else _XkbSkipReadBufferData(&buf, rep->nKeys * XkbKeyNameLength); |