summaryrefslogtreecommitdiff
path: root/lib/libX11/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2018-08-23 19:38:13 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2018-08-23 19:38:13 +0000
commit8dbe9430b9721465765da50ffa679b63c2e1824a (patch)
treecadf51609c036c96b7aa802891eae907873bc2c7 /lib/libX11/src
parent311459c7ca47421c292ff114aa2104e1f36c4dae (diff)
Udate to libX11 1.6.6. bug fixes release - no API/ABI changes.
Diffstat (limited to 'lib/libX11/src')
-rw-r--r--lib/libX11/src/DisName.c2
-rw-r--r--lib/libX11/src/FSWrap.c2
-rw-r--r--lib/libX11/src/FontNames.c16
-rw-r--r--lib/libX11/src/GetFPath.c13
-rw-r--r--lib/libX11/src/GetIFocus.c2
-rw-r--r--lib/libX11/src/GetImage.c16
-rw-r--r--lib/libX11/src/GetKCnt.c2
-rw-r--r--lib/libX11/src/GetPCnt.c2
-rw-r--r--lib/libX11/src/GetPntMap.c2
-rw-r--r--lib/libX11/src/GetSSaver.c2
-rw-r--r--lib/libX11/src/GrServer.c2
-rw-r--r--lib/libX11/src/LiHosts.c21
-rw-r--r--lib/libX11/src/ListExt.c21
-rw-r--r--lib/libX11/src/Macros.c2
-rw-r--r--lib/libX11/src/ModMap.c4
-rw-r--r--lib/libX11/src/QuKeybd.c2
-rw-r--r--lib/libX11/src/ReconfWM.c2
-rw-r--r--lib/libX11/src/SetHints.c4
-rw-r--r--lib/libX11/src/StColor.c1
-rw-r--r--lib/libX11/src/StColors.c1
-rw-r--r--lib/libX11/src/StrKeysym.c10
-rw-r--r--lib/libX11/src/Sync.c2
-rw-r--r--lib/libX11/src/UngrabSvr.c2
-rw-r--r--lib/libX11/src/XlibInt.c14
-rw-r--r--lib/libX11/src/xcb_io.c3
-rw-r--r--lib/libX11/src/xcms/cmsCmap.c2
-rw-r--r--lib/libX11/src/xcms/cmsProp.c1
-rw-r--r--lib/libX11/src/xkb/XKBAlloc.c8
-rw-r--r--lib/libX11/src/xkb/XKBExtDev.c2
-rw-r--r--lib/libX11/src/xlibi18n/lcCT.c10
-rw-r--r--lib/libX11/src/xlibi18n/lcDB.c2
-rw-r--r--lib/libX11/src/xlibi18n/lcGeneric.c75
-rw-r--r--lib/libX11/src/xlibi18n/lcPublic.c1
33 files changed, 130 insertions, 121 deletions
diff --git a/lib/libX11/src/DisName.c b/lib/libX11/src/DisName.c
index 87a1e2f0e..5a90ab34f 100644
--- a/lib/libX11/src/DisName.c
+++ b/lib/libX11/src/DisName.c
@@ -60,5 +60,5 @@ XDisplayName(
return( (char *)display );
if ( (d = getenv( "DISPLAY" )) != (char *)NULL )
return( d );
- return( "" );
+ return( (char *) "" );
}
diff --git a/lib/libX11/src/FSWrap.c b/lib/libX11/src/FSWrap.c
index 12d0406ba..92caea07c 100644
--- a/lib/libX11/src/FSWrap.c
+++ b/lib/libX11/src/FSWrap.c
@@ -195,7 +195,7 @@ XCreateFontSet (
if (oc && def_string) {
*def_string = oc->core.default_string;
if (!*def_string)
- *def_string = "";
+ *def_string = (char *)"";
}
if (oc == NULL)
diff --git a/lib/libX11/src/FontNames.c b/lib/libX11/src/FontNames.c
index 9ffdfd299..ec7d90fa2 100644
--- a/lib/libX11/src/FontNames.c
+++ b/lib/libX11/src/FontNames.c
@@ -88,24 +88,16 @@ int *actualCount) /* RETURN */
* unpack into null terminated strings.
*/
chstart = ch;
- chend = ch + (rlen + 1);
+ chend = ch + rlen;
length = *(unsigned char *)ch;
*ch = 1; /* make sure it is non-zero for XFreeFontNames */
for (i = 0; i < rep.nFonts; i++) {
if (ch + length < chend) {
flist[i] = ch + 1; /* skip over length */
ch += length + 1; /* find next length ... */
- if (ch <= chend) {
- length = *(unsigned char *)ch;
- *ch = '\0'; /* and replace with null-termination */
- count++;
- } else {
- Xfree(chstart);
- Xfree(flist);
- flist = NULL;
- count = 0;
- break;
- }
+ length = *(unsigned char *)ch;
+ *ch = '\0'; /* and replace with null-termination */
+ count++;
} else {
Xfree(chstart);
Xfree(flist);
diff --git a/lib/libX11/src/GetFPath.c b/lib/libX11/src/GetFPath.c
index 8c3f49c95..87d257615 100644
--- a/lib/libX11/src/GetFPath.c
+++ b/lib/libX11/src/GetFPath.c
@@ -42,7 +42,7 @@ char **XGetFontPath(
int count = 0;
register unsigned i;
register int length;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq (GetFontPath, req);
@@ -69,15 +69,20 @@ char **XGetFontPath(
/*
* unpack into null terminated strings.
*/
- chend = ch + (nbytes + 1);
- length = *ch;
+ chend = ch + nbytes;
+ length = *(unsigned char *)ch;
for (i = 0; i < rep.nPaths; i++) {
if (ch + length < chend) {
flist[i] = ch+1; /* skip over length */
ch += length + 1; /* find next length ... */
- length = *ch;
+ length = *(unsigned char *)ch;
*ch = '\0'; /* and replace with null-termination */
count++;
+ } else if (i == 0) {
+ Xfree(flist);
+ Xfree(ch);
+ flist = NULL;
+ break;
} else
flist[i] = NULL;
}
diff --git a/lib/libX11/src/GetIFocus.c b/lib/libX11/src/GetIFocus.c
index 5d43ead4f..0a7f36e8d 100644
--- a/lib/libX11/src/GetIFocus.c
+++ b/lib/libX11/src/GetIFocus.c
@@ -36,7 +36,7 @@ XGetInputFocus(
int *revert_to)
{
xGetInputFocusReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(GetInputFocus, req);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
diff --git a/lib/libX11/src/GetImage.c b/lib/libX11/src/GetImage.c
index ff32d5891..44a576a1b 100644
--- a/lib/libX11/src/GetImage.c
+++ b/lib/libX11/src/GetImage.c
@@ -105,14 +105,16 @@ XImage *XGetImage (
planes = 1;
}
- if (!image)
+ if (!image) {
Xfree(data);
- if (planes < 1 || image->height < 1 || image->bytes_per_line < 1 ||
- INT_MAX / image->height <= image->bytes_per_line ||
- INT_MAX / planes <= image->height * image->bytes_per_line ||
- nbytes < planes * image->height * image->bytes_per_line) {
- XDestroyImage(image);
- image = NULL;
+ } else {
+ if (planes < 1 || image->height < 1 || image->bytes_per_line < 1 ||
+ INT_MAX / image->height <= image->bytes_per_line ||
+ INT_MAX / planes <= image->height * image->bytes_per_line ||
+ nbytes < planes * image->height * image->bytes_per_line) {
+ XDestroyImage(image);
+ image = NULL;
+ }
}
UnlockDisplay(dpy);
SyncHandle();
diff --git a/lib/libX11/src/GetKCnt.c b/lib/libX11/src/GetKCnt.c
index 17f487fbe..5829fbeaa 100644
--- a/lib/libX11/src/GetKCnt.c
+++ b/lib/libX11/src/GetKCnt.c
@@ -35,7 +35,7 @@ XGetKeyboardControl (
register XKeyboardState *state)
{
xGetKeyboardControlReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq (GetKeyboardControl, req);
(void) _XReply (dpy, (xReply *) &rep,
diff --git a/lib/libX11/src/GetPCnt.c b/lib/libX11/src/GetPCnt.c
index 2c35d210c..72d9495b5 100644
--- a/lib/libX11/src/GetPCnt.c
+++ b/lib/libX11/src/GetPCnt.c
@@ -38,7 +38,7 @@ XGetPointerControl(
int *threshold)
{
xGetPointerControlReply rep;
- xReq *req;
+ _X_UNUSED xReq *req;
LockDisplay(dpy);
GetEmptyReq(GetPointerControl, req);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
diff --git a/lib/libX11/src/GetPntMap.c b/lib/libX11/src/GetPntMap.c
index 29fdf21f0..07625f8a0 100644
--- a/lib/libX11/src/GetPntMap.c
+++ b/lib/libX11/src/GetPntMap.c
@@ -45,7 +45,7 @@ int XGetPointerMapping (
unsigned char mapping[256]; /* known fixed size */
unsigned long nbytes, remainder = 0;
xGetPointerMappingReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(GetPointerMapping, req);
diff --git a/lib/libX11/src/GetSSaver.c b/lib/libX11/src/GetSSaver.c
index 1aba3bb74..7c2a3061a 100644
--- a/lib/libX11/src/GetSSaver.c
+++ b/lib/libX11/src/GetSSaver.c
@@ -40,7 +40,7 @@ XGetScreenSaver(
{
xGetScreenSaverReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(GetScreenSaver, req);
diff --git a/lib/libX11/src/GrServer.c b/lib/libX11/src/GrServer.c
index 11d21e491..c4c62bef3 100644
--- a/lib/libX11/src/GrServer.c
+++ b/lib/libX11/src/GrServer.c
@@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group.
int
XGrabServer (register Display *dpy)
{
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(GrabServer, req);
UnlockDisplay(dpy);
diff --git a/lib/libX11/src/LiHosts.c b/lib/libX11/src/LiHosts.c
index 83cf3c791..315e4dbb4 100644
--- a/lib/libX11/src/LiHosts.c
+++ b/lib/libX11/src/LiHosts.c
@@ -77,7 +77,7 @@ XHostAddress *XListHosts (
xListHostsReply reply;
unsigned char *buf, *bp;
register unsigned i;
- register xListHostsReq *req;
+ _X_UNUSED register xListHostsReq *req;
XServerInterpretedAddress *sip;
*nhosts = 0;
@@ -119,11 +119,16 @@ XHostAddress *XListHosts (
_XRead (dpy, (char *) buf, nbytes);
for (i = 0; i < reply.nHosts; i++) {
+ if (bp > buf + nbytes - SIZEOF(xHostEntry))
+ goto fail;
op->family = ((xHostEntry *) bp)->family;
op->length =((xHostEntry *) bp)->length;
if (op->family == FamilyServerInterpreted) {
char *tp = (char *) (bp + SIZEOF(xHostEntry));
- char *vp = memchr(tp, 0, op->length);
+ char *vp;
+ if (tp > (char *) (buf + nbytes - op->length))
+ goto fail;
+ vp = memchr(tp, 0, op->length);
if (vp != NULL) {
sip->type = tp;
@@ -138,6 +143,8 @@ XHostAddress *XListHosts (
sip++;
} else {
op->address = (char *) (bp + SIZEOF(xHostEntry));
+ if (op->address > (char *) (buf + nbytes - op->length))
+ goto fail;
}
bp += SIZEOF(xHostEntry) + (((op->length + 3) >> 2) << 2);
op++;
@@ -149,9 +156,9 @@ XHostAddress *XListHosts (
UnlockDisplay(dpy);
SyncHandle();
return (outbuf);
+fail:
+ *enabled = reply.enabled;
+ *nhosts = 0;
+ Xfree(outbuf);
+ return (NULL);
}
-
-
-
-
-
diff --git a/lib/libX11/src/ListExt.c b/lib/libX11/src/ListExt.c
index 0516e4596..a795041d0 100644
--- a/lib/libX11/src/ListExt.c
+++ b/lib/libX11/src/ListExt.c
@@ -41,7 +41,7 @@ char **XListExtensions(
int count = 0;
register unsigned i;
register int length;
- register xReq *req;
+ _X_UNUSED register xReq *req;
unsigned long rlen = 0;
LockDisplay(dpy);
@@ -74,19 +74,20 @@ char **XListExtensions(
/*
* unpack into null terminated strings.
*/
- chend = ch + (rlen + 1);
- length = *ch;
+ chend = ch + rlen;
+ length = *(unsigned char *)ch;
for (i = 0; i < rep.nExtensions; i++) {
if (ch + length < chend) {
list[i] = ch+1; /* skip over length */
ch += length + 1; /* find next length ... */
- if (ch <= chend) {
- length = *ch;
- *ch = '\0'; /* and replace with null-termination */
- count++;
- } else {
- list[i] = NULL;
- }
+ length = *(unsigned char *)ch;
+ *ch = '\0'; /* and replace with null-termination */
+ count++;
+ } else if (i == 0) {
+ Xfree(list);
+ Xfree(ch);
+ list = NULL;
+ break;
} else
list[i] = NULL;
}
diff --git a/lib/libX11/src/Macros.c b/lib/libX11/src/Macros.c
index 394a7641f..dcd038026 100644
--- a/lib/libX11/src/Macros.c
+++ b/lib/libX11/src/Macros.c
@@ -283,7 +283,7 @@ int XAddPixel(
int
XNoOp (register Display *dpy)
{
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(NoOperation, req);
diff --git a/lib/libX11/src/ModMap.c b/lib/libX11/src/ModMap.c
index 49a5d08e8..ca15dde25 100644
--- a/lib/libX11/src/ModMap.c
+++ b/lib/libX11/src/ModMap.c
@@ -34,7 +34,7 @@ XModifierKeymap *
XGetModifierMapping(register Display *dpy)
{
xGetModifierMappingReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
unsigned long nbytes;
XModifierKeymap *res;
@@ -84,7 +84,7 @@ XSetModifierMapping(
req->length += mapSize >> 2;
req->numKeyPerModifier = modifier_map->max_keypermod;
- Data(dpy, modifier_map->modifiermap, mapSize);
+ Data(dpy, (const char *)modifier_map->modifiermap, mapSize);
(void) _XReply(dpy, (xReply *) & rep,
(SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue);
diff --git a/lib/libX11/src/QuKeybd.c b/lib/libX11/src/QuKeybd.c
index 4b8431d50..0a2d4d0fc 100644
--- a/lib/libX11/src/QuKeybd.c
+++ b/lib/libX11/src/QuKeybd.c
@@ -39,7 +39,7 @@ XQueryKeymap(
char keys[32])
{
xQueryKeymapReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(QueryKeymap, req);
diff --git a/lib/libX11/src/ReconfWM.c b/lib/libX11/src/ReconfWM.c
index 8dc3534e0..b3d8624cf 100644
--- a/lib/libX11/src/ReconfWM.c
+++ b/lib/libX11/src/ReconfWM.c
@@ -105,7 +105,7 @@ Status XReconfigureWMWindow (
*/
{
xGetInputFocusReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
GetEmptyReq(GetInputFocus, req);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
diff --git a/lib/libX11/src/SetHints.c b/lib/libX11/src/SetHints.c
index 5f0a4d4c8..626a2b3ab 100644
--- a/lib/libX11/src/SetHints.c
+++ b/lib/libX11/src/SetHints.c
@@ -211,7 +211,7 @@ XSetCommand (
int argc)
{
register int i;
- register int nbytes;
+ size_t nbytes;
register char *buf, *bp;
for (i = 0, nbytes = 0; i < argc; i++) {
nbytes += safestrlen(argv[i]) + 1;
@@ -295,7 +295,7 @@ XSetClassHint(
{
char *class_string;
char *s;
- int len_nm, len_cl;
+ size_t len_nm, len_cl;
len_nm = safestrlen(classhint->res_name);
len_cl = safestrlen(classhint->res_class);
diff --git a/lib/libX11/src/StColor.c b/lib/libX11/src/StColor.c
index d5a217fb0..221fae136 100644
--- a/lib/libX11/src/StColor.c
+++ b/lib/libX11/src/StColor.c
@@ -50,6 +50,7 @@ XStoreColor(
citem->green = def->green;
citem->blue = def->blue;
citem->flags = def->flags; /* do_red, do_green, do_blue */
+ citem->pad = 0;
UnlockDisplay(dpy);
diff --git a/lib/libX11/src/StColors.c b/lib/libX11/src/StColors.c
index 17a215cc0..fa1814c8e 100644
--- a/lib/libX11/src/StColors.c
+++ b/lib/libX11/src/StColors.c
@@ -53,6 +53,7 @@ XStoreColors(
citem.green = defs[i].green;
citem.blue = defs[i].blue;
citem.flags = defs[i].flags;
+ citem.pad = 0;
/* note that xColorItem doesn't contain all 16-bit quantities, so
we can't use Data16 */
diff --git a/lib/libX11/src/StrKeysym.c b/lib/libX11/src/StrKeysym.c
index 12fce6872..be77a93cd 100644
--- a/lib/libX11/src/StrKeysym.c
+++ b/lib/libX11/src/StrKeysym.c
@@ -115,7 +115,7 @@ XStringToKeysym(_Xconst char *s)
{
XrmValue result;
XrmRepresentation from_type;
- char c;
+ char d;
XrmQuark names[2];
names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False);
@@ -126,10 +126,10 @@ XStringToKeysym(_Xconst char *s)
val = 0;
for (i = 0; i < result.size - 1; i++)
{
- c = ((char *)result.addr)[i];
- if ('0' <= c && c <= '9') val = (val<<4)+c-'0';
- else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10;
- else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10;
+ d = ((char *)result.addr)[i];
+ if ('0' <= d && d <= '9') val = (val<<4)+d-'0';
+ else if ('a' <= d && d <= 'f') val = (val<<4)+d-'a'+10;
+ else if ('A' <= d && d <= 'F') val = (val<<4)+d-'A'+10;
else return NoSymbol;
}
return val;
diff --git a/lib/libX11/src/Sync.c b/lib/libX11/src/Sync.c
index 6326de768..bc768d4f6 100644
--- a/lib/libX11/src/Sync.c
+++ b/lib/libX11/src/Sync.c
@@ -37,7 +37,7 @@ XSync (
Bool discard)
{
xGetInputFocusReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(GetInputFocus, req);
diff --git a/lib/libX11/src/UngrabSvr.c b/lib/libX11/src/UngrabSvr.c
index ea0084879..20ad9aa35 100644
--- a/lib/libX11/src/UngrabSvr.c
+++ b/lib/libX11/src/UngrabSvr.c
@@ -33,7 +33,7 @@ int
XUngrabServer (
register Display *dpy)
{
- register xReq *req;
+ _X_UNUSED register xReq *req;
LockDisplay(dpy);
GetEmptyReq(UngrabServer, req);
diff --git a/lib/libX11/src/XlibInt.c b/lib/libX11/src/XlibInt.c
index 729694885..903ca88fe 100644
--- a/lib/libX11/src/XlibInt.c
+++ b/lib/libX11/src/XlibInt.c
@@ -196,7 +196,7 @@ void _XSeqSyncFunction(
register Display *dpy)
{
xGetInputFocusReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
if ((X_DPY_GET_REQUEST(dpy) - X_DPY_GET_LAST_REQUEST_READ(dpy)) >= (65535 - BUFSIZE/SIZEOF(xReq))) {
GetEmptyReq(GetInputFocus, req);
@@ -1238,7 +1238,7 @@ _XWireToEvent(
* _XDefaultIOError - Default fatal system error reporting routine. Called
* when an X internal system error is encountered.
*/
-int _XDefaultIOError(
+_X_NORETURN int _XDefaultIOError(
Display *dpy)
{
if (ECHECK(EPIPE)) {
@@ -1382,6 +1382,16 @@ int _XDefaultError(
XErrorEvent *event)
{
if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0;
+
+ /*
+ * Store in dpy flags that the client is exiting on an unhandled XError
+ * (pretend it is an IOError, since the application is dying anyway it
+ * does not make a difference).
+ * This is useful for _XReply not to hang if the application makes Xlib
+ * calls in _fini as part of process termination.
+ */
+ dpy->flags |= XlibDisplayIOError;
+
exit(1);
/*NOTREACHED*/
}
diff --git a/lib/libX11/src/xcb_io.c b/lib/libX11/src/xcb_io.c
index bd26a62ae..649c82008 100644
--- a/lib/libX11/src/xcb_io.c
+++ b/lib/libX11/src/xcb_io.c
@@ -700,10 +700,7 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard)
/* it's not an error, but we don't have a reply, so it's an I/O
* error. */
if(!reply)
- {
_XIOError(dpy);
- return 0;
- }
/* there's no error and we have a reply. */
dpy->xcb->reply_data = reply;
diff --git a/lib/libX11/src/xcms/cmsCmap.c b/lib/libX11/src/xcms/cmsCmap.c
index c5401c05d..c7087ecb1 100644
--- a/lib/libX11/src/xcms/cmsCmap.c
+++ b/lib/libX11/src/xcms/cmsCmap.c
@@ -181,7 +181,7 @@ CmapRecForColormap(
}
{
xGetInputFocusReply rep;
- register xReq *req;
+ _X_UNUSED register xReq *req;
GetEmptyReq(GetInputFocus, req);
(void) _XReply (dpy, (xReply *)&rep, 0, xTrue);
diff --git a/lib/libX11/src/xcms/cmsProp.c b/lib/libX11/src/xcms/cmsProp.c
index 2826ee7be..77c072f22 100644
--- a/lib/libX11/src/xcms/cmsProp.c
+++ b/lib/libX11/src/xcms/cmsProp.c
@@ -138,6 +138,7 @@ _XcmsGetProperty(
if (xgwp_ret != Success || format_ret == 0 || nitems_ret == 0) {
/* the property does not exist or is of an unexpected type or
getting window property failed */
+ XFree (prop_ret);
return(XcmsFailure);
}
diff --git a/lib/libX11/src/xkb/XKBAlloc.c b/lib/libX11/src/xkb/XKBAlloc.c
index 50a5764d6..f824bca8c 100644
--- a/lib/libX11/src/xkb/XKBAlloc.c
+++ b/lib/libX11/src/xkb/XKBAlloc.c
@@ -216,24 +216,22 @@ XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap)
type = map->types;
for (i = 0; i < map->num_types; i++, type++) {
- if (type->level_names != NULL) {
_XkbFree(type->level_names);
type->level_names = NULL;
- }
}
}
}
- if ((which & XkbKeyNamesMask) && (names->keys != NULL)) {
+ if (which & XkbKeyNamesMask) {
_XkbFree(names->keys);
names->keys = NULL;
names->num_keys = 0;
}
- if ((which & XkbKeyAliasesMask) && (names->key_aliases)) {
+ if (which & XkbKeyAliasesMask) {
_XkbFree(names->key_aliases);
names->key_aliases = NULL;
names->num_key_aliases = 0;
}
- if ((which & XkbRGNamesMask) && (names->radio_groups)) {
+ if (which & XkbRGNamesMask) {
_XkbFree(names->radio_groups);
names->radio_groups = NULL;
names->num_rg = 0;
diff --git a/lib/libX11/src/xkb/XKBExtDev.c b/lib/libX11/src/xkb/XKBExtDev.c
index b9710f86b..d45460e99 100644
--- a/lib/libX11/src/xkb/XKBExtDev.c
+++ b/lib/libX11/src/xkb/XKBExtDev.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
-extern void
+void
XkbNoteDeviceChanges(XkbDeviceChangesPtr old,
XkbExtensionDeviceNotifyEvent *new,
unsigned int wanted)
diff --git a/lib/libX11/src/xlibi18n/lcCT.c b/lib/libX11/src/xlibi18n/lcCT.c
index b1613007d..1f413e97c 100644
--- a/lib/libX11/src/xlibi18n/lcCT.c
+++ b/lib/libX11/src/xlibi18n/lcCT.c
@@ -1021,19 +1021,19 @@ cstoct(
) {
while (csstr_len > 0 && ct_len > 0) {
unsigned char ch = * (const unsigned char *) csptr;
- int char_size = (ch < 0xc0 ? 1 :
+ int ch_size = (ch < 0xc0 ? 1 :
ch < 0xe0 ? 2 :
ch < 0xf0 ? 3 :
ch < 0xf8 ? 4 :
ch < 0xfc ? 5 :
6);
int i;
- if (!(csstr_len >= char_size && ct_len >= char_size))
+ if (!(csstr_len >= ch_size && ct_len >= ch_size))
break;
- for (i = char_size; i > 0; i--)
+ for (i = ch_size; i > 0; i--)
*ctptr++ = *csptr++;
- csstr_len -= char_size;
- ct_len -= char_size;
+ csstr_len -= ch_size;
+ ct_len -= ch_size;
}
} else {
while (csstr_len > 0 && ct_len > 0) {
diff --git a/lib/libX11/src/xlibi18n/lcDB.c b/lib/libX11/src/xlibi18n/lcDB.c
index fda3ae7e3..19e80aa2f 100644
--- a/lib/libX11/src/xlibi18n/lcDB.c
+++ b/lib/libX11/src/xlibi18n/lcDB.c
@@ -790,7 +790,7 @@ f_right_brace(
case S_VALUE:
if (! store_to_database(db))
return 0;
- /* fall into next case */
+ /* fall through - to next case */
case S_CATEGORY:
if (parse_info.name[parse_info.nest_depth] != NULL) {
Xfree(parse_info.name[parse_info.nest_depth]);
diff --git a/lib/libX11/src/xlibi18n/lcGeneric.c b/lib/libX11/src/xlibi18n/lcGeneric.c
index 1c78a95c6..f816fee77 100644
--- a/lib/libX11/src/xlibi18n/lcGeneric.c
+++ b/lib/libX11/src/xlibi18n/lcGeneric.c
@@ -77,6 +77,7 @@ create(
return lcd;
err:
+ Xfree(lcd->core);
Xfree(lcd);
return (XLCd) NULL;
}
@@ -1027,10 +1028,8 @@ freeByteM(
}
blst = codeset->byteM;
for (i = 0; i < codeset->length; i++) {
- if (blst[i].byteinfo) {
Xfree(blst[i].byteinfo);
blst[i].byteinfo = NULL;
- }
}
Xfree(codeset->byteM);
codeset->byteM = NULL;
@@ -1044,20 +1043,18 @@ freeConversion(
if (codeset->mbconv) {
mbconv = codeset->mbconv;
/* ... */
- if (mbconv->convlist) {
- Xfree(mbconv->convlist);
- mbconv->convlist = NULL;
- }
+ Xfree(mbconv->convlist);
+ mbconv->convlist = NULL;
+
Xfree(mbconv);
codeset->mbconv = NULL;
}
if (codeset->ctconv) {
ctconv = codeset->ctconv;
/* ... */
- if (ctconv->convlist) {
- Xfree(ctconv->convlist);
- ctconv->convlist = NULL;
- }
+ Xfree(ctconv->convlist);
+ ctconv->convlist = NULL;
+
Xfree(ctconv);
codeset->ctconv = NULL;
}
@@ -1072,14 +1069,12 @@ freeExtdSegment(
return;
}
ctextseg = codeset->ctextseg;
- if (ctextseg->name) {
- Xfree(ctextseg->name);
- ctextseg->name = NULL;
- }
- if (ctextseg->area) {
- Xfree(ctextseg->area);
- ctextseg->area = NULL;
- }
+ Xfree(ctextseg->name);
+ ctextseg->name = NULL;
+
+ Xfree(ctextseg->area);
+ ctextseg->area = NULL;
+
Xfree(codeset->ctextseg);
codeset->ctextseg = NULL;
}
@@ -1093,10 +1088,10 @@ freeParseInfo(
return;
}
parse_info = codeset->parse_info;
- if (parse_info->encoding) {
- Xfree(parse_info->encoding);
- parse_info->encoding = NULL;
- }
+
+ Xfree(parse_info->encoding);
+ parse_info->encoding = NULL;
+
Xfree(codeset->parse_info);
codeset->parse_info = NULL;
}
@@ -1115,10 +1110,10 @@ destroy_CodeSetList(
freeConversion(codeset[i]);
freeExtdSegment(codeset[i]);
freeParseInfo(codeset[i]);
- if (codeset[i]->charset_list) {
- Xfree(codeset[i]->charset_list);
- codeset[i]->charset_list = NULL;
- }
+
+ Xfree(codeset[i]->charset_list);
+ codeset[i]->charset_list = NULL;
+
Xfree(codeset[i]); codeset[i]=NULL;
}
Xfree(codeset); gen->codeset_list = NULL;
@@ -1130,21 +1125,20 @@ destroy_SegConv(
{
SegConv seg = gen->segment_conv;
int i;
+
if (gen->segment_conv_num == 0) {
return;
}
for (i=0;i<gen->segment_conv_num;i++) {
- if (seg[i].source_encoding) {
+
Xfree(seg[i].source_encoding);
seg[i].source_encoding = NULL;
- }
- if (seg[i].destination_encoding) {
+
Xfree(seg[i].destination_encoding);
seg[i].destination_encoding = NULL;
- }
- if (seg[i].conv) {
- Xfree(seg[i].conv); seg[i].conv = NULL;
- }
+
+ Xfree(seg[i].conv);
+ seg[i].conv = NULL;
}
Xfree(seg); gen->segment_conv = NULL;
}
@@ -1156,14 +1150,13 @@ destroy_gen(
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
destroy_SegConv(gen);
destroy_CodeSetList(gen);
- if (gen->mb_parse_table) {
- Xfree(gen->mb_parse_table);
- gen->mb_parse_table = NULL;
- }
- if (gen->mb_parse_list) {
- Xfree(gen->mb_parse_list);
- gen->mb_parse_list = NULL;
- }
+
+ Xfree(gen->mb_parse_table);
+ gen->mb_parse_table = NULL;
+
+ Xfree(gen->mb_parse_list);
+ gen->mb_parse_list = NULL;
+
}
/* VW/UDC end 95.01.08 */
diff --git a/lib/libX11/src/xlibi18n/lcPublic.c b/lib/libX11/src/xlibi18n/lcPublic.c
index 98a7435fd..f35f17a63 100644
--- a/lib/libX11/src/xlibi18n/lcPublic.c
+++ b/lib/libX11/src/xlibi18n/lcPublic.c
@@ -97,6 +97,7 @@ create(
return lcd;
err:
+ Xfree(lcd->core);
Xfree(lcd);
return (XLCd) NULL;
}