Module Name:    xsrc
Committed By:   mrg
Date:           Sun Mar 16 22:48:35 UTC 2014

Modified Files:
        xsrc/external/mit/libX11/dist/modules/lc/gen: lcGenConv.c
        xsrc/external/mit/libX11/dist/src: Font.c FontNames.c GetFPath.c
            ListExt.c ModMap.c XlibInt.c
        xsrc/external/mit/libX11/dist/src/xlibi18n: XlcDL.c
Removed Files:
        xsrc/external/mit/libX11/dist/src: udcInf.c

Log Message:
merge libX11 1.6.2.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
    xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/libX11/dist/src/Font.c \
    xsrc/external/mit/libX11/dist/src/FontNames.c \
    xsrc/external/mit/libX11/dist/src/GetFPath.c \
    xsrc/external/mit/libX11/dist/src/ListExt.c \
    xsrc/external/mit/libX11/dist/src/ModMap.c
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/libX11/dist/src/XlibInt.c
cvs rdiff -u -r1.1.1.4 -r0 xsrc/external/mit/libX11/dist/src/udcInf.c
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/libX11/dist/src/xlibi18n/XlcDL.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c
diff -u xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c:1.5 xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c:1.6
--- xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c:1.5	Thu May 30 23:09:16 2013
+++ xsrc/external/mit/libX11/dist/modules/lc/gen/lcGenConv.c	Sun Mar 16 22:48:34 2014
@@ -342,7 +342,7 @@ byteM_parse_codeset(
 	    continue;
 
         for (j = 0; j < codeset->length; j++) {
-	    ch = *((unsigned char *)(inbufptr + j));
+	    ch = *((const unsigned char *)(inbufptr + j));
 	    byteM_rec = byteM[j];
 	    byteinfo = byteM_rec.byteinfo;
 
@@ -764,11 +764,6 @@ mbstowcs_org(
         return( 0 );
     }
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
 	ch = *inbufptr++;
@@ -923,11 +918,6 @@ wcstombs_org(
     int defstr_len = strlen(default_string);
 
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -1084,11 +1074,6 @@ wcstocts(
     int from_size = *from_left;
     char *ext_seg_len = NULL;
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -1239,7 +1224,7 @@ stdc_wcstocts(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -1278,11 +1263,6 @@ ctstowcs(
         return( 0 );
     }
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
 	ch = *inbufptr++;
@@ -1564,7 +1544,7 @@ stdc_ctstowcs(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -1600,7 +1580,7 @@ stdc_cstowcs(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -1636,7 +1616,7 @@ mbstocts(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -1674,11 +1654,6 @@ mbstostr(
         return( 0 );
     }
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
 	ch = *inbufptr++;
@@ -1966,12 +1941,6 @@ wcstostr(
     const char *default_string = XLC_PUBLIC(lcd, default_string);
     int defstr_len = strlen(default_string);
 
-
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -2094,7 +2063,7 @@ stdc_wcstostr(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -2126,11 +2095,6 @@ wctocs(
     char *outbufptr = *to;
     int from_size = *from_left;
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     if (*from_left && *to_left) {
 
         wc = *inbufptr++;
@@ -2374,7 +2338,7 @@ ctstombs(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -2410,7 +2374,7 @@ cstombs(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -2441,11 +2405,6 @@ strtombs(
     char *outbufptr = *to;
     int from_size = *from_left;
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
         ch = *inbufptr++;
@@ -2553,11 +2512,6 @@ strtowcs(
     wchar_t *outbufptr = (wchar_t *)*to;
     int from_size = *from_left;
 
-#ifdef notdef
-    if (*from_left > *to_left)
-        *from_left = *to_left;
-#endif
-
     while (*from_left && *to_left) {
 
         ch = *inbufptr++;
@@ -2629,7 +2583,7 @@ stdc_strtowcs(
 
 ret:
     if (buf)
-	Xfree((char *)buf);
+	Xfree(buf);
 
     return (unconv_num1 + unconv_num2);
 }
@@ -2643,14 +2597,14 @@ close_converter(
     XlcConv conv)
 {
     if (conv->state) {
-	Xfree((char *) conv->state);
+	Xfree(conv->state);
     }
 
     if (conv->methods) {
-	Xfree((char *) conv->methods);
+	Xfree(conv->methods);
     }
 
-    Xfree((char *) conv);
+    Xfree(conv);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -2665,11 +2619,11 @@ create_conv(
     XlcConv conv;
     State state;
 
-    conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec));
+    conv = Xcalloc(1, sizeof(XlcConvRec));
     if (conv == NULL)
 	return (XlcConv) NULL;
 
-    conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec));
+    conv->methods = Xmalloc(sizeof(XlcConvMethodsRec));
     if (conv->methods == NULL)
 	goto err;
     *conv->methods = *methods;

Index: xsrc/external/mit/libX11/dist/src/Font.c
diff -u xsrc/external/mit/libX11/dist/src/Font.c:1.2 xsrc/external/mit/libX11/dist/src/Font.c:1.3
--- xsrc/external/mit/libX11/dist/src/Font.c:1.2	Tue Jun 25 16:15:16 2013
+++ xsrc/external/mit/libX11/dist/src/Font.c	Sun Mar 16 22:48:34 2014
@@ -166,13 +166,13 @@ XFreeFont(
 #ifdef USE_XF86BIGFONT
 	_XF86BigfontFreeFontMetrics(fs);
 #else
-	Xfree ((char *) fs->per_char);
+	Xfree (fs->per_char);
 #endif
     }
     _XFreeExtData(fs->ext_data);
     if (fs->properties)
-	Xfree ((char *) fs->properties);
-    Xfree ((char *) fs);
+	Xfree (fs->properties);
+    Xfree (fs);
     return 1;
 }
 
@@ -249,7 +249,7 @@ _XQueryFont (
 		fs->properties = Xmalloc (pbytes);
 	    }
 	    if (! fs->properties) {
-		Xfree((char *) fs);
+		Xfree(fs);
 		_XEatDataWords(dpy, reply_left);
 		return (XFontStruct *)NULL;
 	    }
@@ -271,8 +271,8 @@ _XQueryFont (
 	    }
 	}
 	if (! fs->per_char) {
-	    if (fs->properties) Xfree((char *) fs->properties);
-	    Xfree((char *) fs);
+	    if (fs->properties) Xfree(fs->properties);
+	    Xfree(fs);
 	    _XEatDataWords(dpy, reply_left);
 	    return (XFontStruct *)NULL;
 	}
@@ -493,7 +493,7 @@ _XF86BigfontQueryFont (
 	    fs->properties = Xmalloc (pbytes);
 	}
 	if (! fs->properties) {
-	    Xfree((char *) fs);
+	    Xfree(fs);
 	    _XEatDataWords(dpy, reply_left);
 	    return (XFontStruct *)NULL;
 	}
@@ -507,8 +507,8 @@ _XF86BigfontQueryFont (
        any real font needs, so the combined total doesn't overflow either */
     if (reply.nUniqCharInfos > ((ULONG_MAX / 2) / SIZEOF(xCharInfo)) ||
 	reply.nCharInfos > ((ULONG_MAX / 2) / sizeof(CARD16))) {
-	Xfree((char *) fs->properties);
-	Xfree((char *) fs);
+	Xfree(fs->properties);
+	Xfree(fs);
 	_XEatDataWords(dpy, reply_left);
 	return (XFontStruct *)NULL;
     }
@@ -524,15 +524,15 @@ _XF86BigfontQueryFont (
 	             + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16);
 	    pUniqCI = Xmalloc (nbytes);
 	    if (!pUniqCI) {
-		if (fs->properties) Xfree((char *) fs->properties);
-		Xfree((char *) fs);
+		if (fs->properties) Xfree(fs->properties);
+		Xfree(fs);
 		_XEatDataWords(dpy, reply_left);
 		return (XFontStruct *)NULL;
 	    }
 	    if (! (fs->per_char = Xmalloc (reply.nCharInfos * sizeof(XCharStruct)))) {
-		Xfree((char *) pUniqCI);
-		if (fs->properties) Xfree((char *) fs->properties);
-		Xfree((char *) fs);
+		Xfree(pUniqCI);
+		if (fs->properties) Xfree(fs->properties);
+		Xfree(fs);
 		_XEatDataWords(dpy, reply_left);
 		return (XFontStruct *)NULL;
 	    }
@@ -541,15 +541,15 @@ _XF86BigfontQueryFont (
 	    for (i = 0; i < reply.nCharInfos; i++) {
 		if (pIndex2UniqIndex[i] >= reply.nUniqCharInfos) {
 		    fprintf(stderr, "_XF86BigfontQueryFont: server returned wrong data\n");
-		    Xfree((char *) pUniqCI);
-		    if (fs->properties) Xfree((char *) fs->properties);
-		    Xfree((char *) fs);
+		    Xfree(pUniqCI);
+		    if (fs->properties) Xfree(fs->properties);
+		    Xfree(fs);
 		    return (XFontStruct *)NULL;
 		}
 		/* XXX the next statement won't work if short isn't 16 bits */
 		fs->per_char[i] = * (XCharStruct *) &pUniqCI[pIndex2UniqIndex[i]];
 	    }
-	    Xfree((char *) pUniqCI);
+	    Xfree(pUniqCI);
 	} else {
 #ifdef HAS_SHM
 	    XExtData *pData;
@@ -558,8 +558,8 @@ _XF86BigfontQueryFont (
 
 	    pData = Xmalloc(sizeof(XExtData));
 	    if (!pData) {
-		if (fs->properties) Xfree((char *) fs->properties);
-		Xfree((char *) fs);
+		if (fs->properties) Xfree(fs->properties);
+		Xfree(fs);
 		return (XFontStruct *)NULL;
 	    }
 
@@ -577,9 +577,9 @@ _XF86BigfontQueryFont (
 	    if ((addr = shmat(reply.shmid, NULL, SHM_RDONLY)) == (char *)-1) {
 		if (extcodes->serverCapabilities & CAP_VerifiedLocal)
 		    fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n");
-	        Xfree((char *) pData);
-	        if (fs->properties) Xfree((char *) fs->properties);
-	        Xfree((char *) fs);
+	        Xfree(pData);
+	        if (fs->properties) Xfree(fs->properties);
+	        Xfree(fs);
 		/* Stop requesting shared memory transport from now on. */
 		extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
 	        return (XFontStruct *)NULL;
@@ -592,9 +592,9 @@ _XF86BigfontQueryFont (
 		      && buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32)
 		      && *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) {
 		    shmdt(addr);
-		    Xfree((char *) pData);
-		    if (fs->properties) Xfree((char *) fs->properties);
-		    Xfree((char *) fs);
+		    Xfree(pData);
+		    if (fs->properties) Xfree(fs->properties);
+		    Xfree(fs);
 		    /* Stop requesting shared memory transport from now on. */
 		    extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
 		    return (XFontStruct *)NULL;
@@ -611,8 +611,8 @@ _XF86BigfontQueryFont (
 	    fs->per_char = (XCharStruct *) (addr + reply.shmsegoffset);
 #else
 	    fprintf(stderr, "_XF86BigfontQueryFont: try recompiling libX11 with HasShm, Xserver has shm support\n");
-	    if (fs->properties) Xfree((char *) fs->properties);
-	    Xfree((char *) fs);
+	    if (fs->properties) Xfree(fs->properties);
+	    Xfree(fs);
 	    /* Stop requesting shared memory transport from now on. */
 	    extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
 	    return (XFontStruct *)NULL;
@@ -638,9 +638,9 @@ _XF86BigfontFreeFontMetrics (XFontStruct
 				      XF86BigfontNumber)))
 	shmdt ((char *) pData->private_data);
     else
-	Xfree ((char *) fs->per_char);
+	Xfree (fs->per_char);
 #else
-    Xfree ((char *) fs->per_char);
+    Xfree (fs->per_char);
 #endif
 }
 
@@ -693,14 +693,14 @@ int _XF86LoadQueryLocaleFont(
 #ifdef USE_XF86BIGFONT
 	    _XF86BigfontFreeFontMetrics(fs);
 #else
-	    Xfree ((char *) fs->per_char);
+	    Xfree (fs->per_char);
 #endif
 	}
 	_XFreeExtData(fs->ext_data);
 	if (fs->properties)
-	    Xfree ((char *) fs->properties);
+	    Xfree (fs->properties);
 	*fidp = fs->fid;
-	Xfree ((char *) fs);
+	Xfree (fs);
     } else {
 	XFreeFont(dpy, fs);
     }
Index: xsrc/external/mit/libX11/dist/src/FontNames.c
diff -u xsrc/external/mit/libX11/dist/src/FontNames.c:1.2 xsrc/external/mit/libX11/dist/src/FontNames.c:1.3
--- xsrc/external/mit/libX11/dist/src/FontNames.c:1.2	Tue Jun 25 20:34:20 2013
+++ xsrc/external/mit/libX11/dist/src/FontNames.c	Sun Mar 16 22:48:34 2014
@@ -73,7 +73,7 @@ int *actualCount)	/* RETURN */
 	}
 
 	if ((! flist) || (! ch)) {
-	    if (flist) Xfree((char *) flist);
+	    if (flist) Xfree(flist);
 	    if (ch) Xfree(ch);
 	    _XEatDataWords(dpy, rep.length);
 	    *actualCount = 0;
@@ -116,7 +116,7 @@ XFreeFontNames(char **list)
 				Xfree (*names);
 		}
 		Xfree (list[0]-1);
-		Xfree ((char *)list);
+		Xfree (list);
 	}
 	return 1;
 }
Index: xsrc/external/mit/libX11/dist/src/GetFPath.c
diff -u xsrc/external/mit/libX11/dist/src/GetFPath.c:1.2 xsrc/external/mit/libX11/dist/src/GetFPath.c:1.3
--- xsrc/external/mit/libX11/dist/src/GetFPath.c:1.2	Tue Jun 25 20:34:20 2013
+++ xsrc/external/mit/libX11/dist/src/GetFPath.c	Sun Mar 16 22:48:34 2014
@@ -57,7 +57,7 @@ char **XGetFontPath(
 	    }
 
 	    if ((! flist) || (! ch)) {
-		if (flist) Xfree((char *) flist);
+		if (flist) Xfree(flist);
 		if (ch) Xfree(ch);
 		_XEatDataWords(dpy, rep.length);
 		UnlockDisplay(dpy);
@@ -93,7 +93,7 @@ XFreeFontPath (char **list)
 {
 	if (list != NULL) {
 		Xfree (list[0]-1);
-		Xfree ((char *)list);
+		Xfree (list);
 	}
 	return 1;
 }
Index: xsrc/external/mit/libX11/dist/src/ListExt.c
diff -u xsrc/external/mit/libX11/dist/src/ListExt.c:1.2 xsrc/external/mit/libX11/dist/src/ListExt.c:1.3
--- xsrc/external/mit/libX11/dist/src/ListExt.c:1.2	Tue Jun 25 20:34:20 2013
+++ xsrc/external/mit/libX11/dist/src/ListExt.c	Sun Mar 16 22:48:34 2014
@@ -62,8 +62,8 @@ char **XListExtensions(
 	    }
 
 	    if ((!list) || (!ch)) {
-		if (list) Xfree((char *) list);
-		if (ch)   Xfree((char *) ch);
+		if (list) Xfree(list);
+		if (ch)   Xfree(ch);
 		_XEatDataWords(dpy, rep.length);
 		UnlockDisplay(dpy);
 		SyncHandle();
@@ -99,7 +99,7 @@ XFreeExtensionList (char **list)
 {
 	if (list != NULL) {
 	    Xfree (list[0]-1);
-	    Xfree ((char *)list);
+	    Xfree (list);
 	}
 	return 1;
 }
Index: xsrc/external/mit/libX11/dist/src/ModMap.c
diff -u xsrc/external/mit/libX11/dist/src/ModMap.c:1.2 xsrc/external/mit/libX11/dist/src/ModMap.c:1.3
--- xsrc/external/mit/libX11/dist/src/ModMap.c:1.2	Tue Jun 25 20:34:20 2013
+++ xsrc/external/mit/libX11/dist/src/ModMap.c	Sun Mar 16 22:48:34 2014
@@ -50,7 +50,7 @@ XGetModifierMapping(register Display *dp
     } else
 	res = NULL;
     if ((! res) || (! res->modifiermap)) {
-	if (res) Xfree((char *) res);
+	if (res) Xfree(res);
 	res = (XModifierKeymap *) NULL;
 	_XEatDataWords(dpy, rep.length);
     } else {
@@ -65,9 +65,9 @@ XGetModifierMapping(register Display *dp
 
 /*
  *	Returns:
- *	0	Success
- *	1	Busy - one or more old or new modifiers are down
- *	2	Failed - one or more new modifiers unacceptable
+ *	MappingSuccess (0)	Success
+ *	MappingBusy (1) 	Busy - one or more old or new modifiers are down
+ *	MappingFailed (2)	Failed - one or more new modifiers unacceptable
  */
 int
 XSetModifierMapping(
@@ -79,13 +79,11 @@ XSetModifierMapping(
     int         mapSize = modifier_map->max_keypermod << 3;	/* 8 modifiers */
 
     LockDisplay(dpy);
-    GetReqExtra(SetModifierMapping, mapSize, req);
-
+    GetReq(SetModifierMapping, req);
+    req->length += mapSize >> 2;
     req->numKeyPerModifier = modifier_map->max_keypermod;
 
-    memcpy((char *) NEXTPTR(req,xSetModifierMappingReq),
-	   (char *) modifier_map->modifiermap,
-	   mapSize);
+    Data(dpy, modifier_map->modifiermap, mapSize);
 
     (void) _XReply(dpy, (xReply *) & rep,
 	(SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue);
@@ -104,7 +102,7 @@ XNewModifiermap(int keyspermodifier)
 			    Xmalloc(8 * keyspermodifier)
 			    : (KeyCode *) NULL);
 	if (keyspermodifier && (res->modifiermap == NULL)) {
-	    Xfree((char *) res);
+	    Xfree(res);
 	    return (XModifierKeymap *) NULL;
 	}
     }
@@ -117,8 +115,8 @@ XFreeModifiermap(XModifierKeymap *map)
 {
     if (map) {
 	if (map->modifiermap)
-	    Xfree((char *) map->modifiermap);
-	Xfree((char *) map);
+	    Xfree(map->modifiermap);
+	Xfree(map);
     }
     return 1;
 }

Index: xsrc/external/mit/libX11/dist/src/XlibInt.c
diff -u xsrc/external/mit/libX11/dist/src/XlibInt.c:1.5 xsrc/external/mit/libX11/dist/src/XlibInt.c:1.6
--- xsrc/external/mit/libX11/dist/src/XlibInt.c:1.5	Thu May 30 23:09:16 2013
+++ xsrc/external/mit/libX11/dist/src/XlibInt.c	Sun Mar 16 22:48:34 2014
@@ -1733,6 +1733,14 @@ void *_XGetRequest(Display *dpy, CARD8 t
 
     if (dpy->bufptr + len > dpy->bufmax)
 	_XFlush(dpy);
+    /* Request still too large, so do not allow it to overflow. */
+    if (dpy->bufptr + len > dpy->bufmax) {
+	fprintf(stderr,
+		"Xlib: request %d length %zd would exceed buffer size.\n",
+		type, len);
+	/* Changes failure condition from overflow to NULL dereference. */
+	return NULL;
+    }
 
     if (len % 4)
 	fprintf(stderr,

Index: xsrc/external/mit/libX11/dist/src/xlibi18n/XlcDL.c
diff -u xsrc/external/mit/libX11/dist/src/xlibi18n/XlcDL.c:1.6 xsrc/external/mit/libX11/dist/src/xlibi18n/XlcDL.c:1.7
--- xsrc/external/mit/libX11/dist/src/xlibi18n/XlcDL.c:1.6	Wed Aug  3 03:06:00 2011
+++ xsrc/external/mit/libX11/dist/src/xlibi18n/XlcDL.c	Sun Mar 16 22:48:35 2014
@@ -185,16 +185,10 @@ resolve_object(char *path, const char *l
 
     if (lc_len == 0) { /* True only for the 1st time */
       lc_len = OBJECT_INIT_LEN;
-      xi18n_objects_list = (XI18NObjectsList)
-	  Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
+      xi18n_objects_list = Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
       if (!xi18n_objects_list) return;
     }
-/*
-1266793
-Limit the length of path to prevent stack buffer corruption.
-    sprintf(filename, "%s/%s", path, "XI18N_OBJS");
-*/
-    sprintf(filename, "%.*s/%s", BUFSIZ - 12, path, "XI18N_OBJS");
+    snprintf(filename, sizeof(filename), "%s/%s", path, "XI18N_OBJS");
     fp = fopen(filename, "r");
     if (fp == (FILE *)NULL){
 	return;
@@ -212,11 +206,13 @@ Limit the length of path to prevent stac
 	}
 
 	if (lc_count == lc_len) {
-	  lc_len += OBJECT_INC_LEN;
-	  xi18n_objects_list = (XI18NObjectsList)
-	    Xrealloc(xi18n_objects_list,
-		     sizeof(XI18NObjectsListRec) * lc_len);
-	  if (!xi18n_objects_list) return;
+	  int new_len = lc_len + OBJECT_INC_LEN;
+	  XI18NObjectsListRec *tmp = Xrealloc(xi18n_objects_list,
+	      sizeof(XI18NObjectsListRec) * new_len);
+	  if (tmp == NULL)
+	      goto done;
+	  xi18n_objects_list = tmp;
+	  lc_len = new_len;
 	}
 	n = parse_line(p, args, 6);
 
@@ -244,6 +240,7 @@ Limit the length of path to prevent stac
 	  lc_count++;
 	}
     }
+  done:
     fclose(fp);
 }
 
@@ -383,9 +380,9 @@ _XlcDynamicLoad(const char *lc_name)
 
     if (lc_name == NULL) return (XLCd)NULL;
 
-    if (_XlcLocaleDirName(lc_dir, BUFSIZE, (char *)lc_name) == (char *)NULL)
+    if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL)
         return (XLCd)NULL;
-    if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, (char *)lc_name) == (char*)NULL)
+    if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, lc_name) == NULL)
 	return (XLCd)NULL;
 
     resolve_object(lc_dir, lc_name);
@@ -512,7 +509,7 @@ _XDynamicUnRegisterIMInstantiateCallback
     XPointer	 client_data)
 {
   char lc_dir[BUFSIZE];
-  char *lc_name;
+  const char *lc_name;
   dynamicUnregisterProcp im_unregisterIM = (dynamicUnregisterProcp)NULL;
   Bool ret_flag = False;
   int count;

Reply via email to