Commit c161df4f authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

Remove even more casts of return values from Xmalloc/Xrealloc

parent 5d6cda4f
...@@ -111,7 +111,7 @@ XcmsCreateCCC( ...@@ -111,7 +111,7 @@ XcmsCreateCCC(
XcmsPerScrnInfo *pNewScrnInfo; XcmsPerScrnInfo *pNewScrnInfo;
if (pDefaultCCC == NULL || if (pDefaultCCC == NULL ||
!(newccc = (XcmsCCC) Xcalloc(1, (unsigned) sizeof(XcmsCCCRec)))) { !(newccc = Xcalloc(1, (unsigned) sizeof(XcmsCCCRec)))) {
return(NULL); return(NULL);
} }
...@@ -144,7 +144,7 @@ XcmsCreateCCC( ...@@ -144,7 +144,7 @@ XcmsCreateCCC(
* If one exists replace the pPerScrnInfo. * If one exists replace the pPerScrnInfo.
*/ */
if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) { if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) {
if (!(pNewScrnInfo = (XcmsPerScrnInfo *) if (!(pNewScrnInfo =
Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) { Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) {
Xfree(newccc); Xfree(newccc);
return(NULL); return(NULL);
......
...@@ -796,7 +796,7 @@ XcmsConvertColors( ...@@ -796,7 +796,7 @@ XcmsConvertColors(
* Make copy of array of color specifications * Make copy of array of color specifications
*/ */
if (nColors > 1) { if (nColors > 1) {
pColors_tmp = (XcmsColor *) Xmalloc(nColors * sizeof(XcmsColor)); pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor));
} else { } else {
pColors_tmp = &Color1; pColors_tmp = &Color1;
} }
......
...@@ -128,7 +128,7 @@ _XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return) ...@@ -128,7 +128,7 @@ _XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return)
return; return;
} }
args = (XIMArg *)Xmalloc((unsigned)(max_count + 1) * sizeof(XIMArg)); args = Xmalloc((unsigned)(max_count + 1) * sizeof(XIMArg));
*args_return = args; *args_return = args;
if (!args) return; if (!args) return;
......
...@@ -67,7 +67,7 @@ XcmsFormatOfPrefix(char *prefix) ...@@ -67,7 +67,7 @@ XcmsFormatOfPrefix(char *prefix)
* While copying prefix to string_lowered, convert to lowercase * While copying prefix to string_lowered, convert to lowercase
*/ */
if ((len = strlen(prefix)) >= sizeof(string_buf)) { if ((len = strlen(prefix)) >= sizeof(string_buf)) {
string_lowered = (char *) Xmalloc(len+1); string_lowered = Xmalloc(len+1);
} else { } else {
string_lowered = string_buf; string_lowered = string_buf;
} }
......
...@@ -237,7 +237,7 @@ _XcmsSetGetColors( ...@@ -237,7 +237,7 @@ _XcmsSetGetColors(
/* /*
* Allocate space for XColors * Allocate space for XColors
*/ */
if ((pXColors_in_out = (XColor *)Xcalloc(nColors, sizeof(XColor))) == if ((pXColors_in_out = Xcalloc(nColors, sizeof(XColor))) ==
NULL) { NULL) {
return(XcmsFailure); return(XcmsFailure);
} }
......
...@@ -85,7 +85,7 @@ XcmsStoreColors( ...@@ -85,7 +85,7 @@ XcmsStoreColors(
* overwrite the contents. * overwrite the contents.
*/ */
if (nColors > 1) { if (nColors > 1) {
pColors_tmp = (XcmsColor *) Xmalloc(nColors * sizeof(XcmsColor)); pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor));
} else { } else {
pColors_tmp = &Color1; pColors_tmp = &Color1;
} }
......
...@@ -184,10 +184,10 @@ _XDefaultOpenIM( ...@@ -184,10 +184,10 @@ _XDefaultOpenIM(
return((XIM)NULL); return((XIM)NULL);
} }
if ((im = (StaticXIM)Xmalloc(sizeof(StaticXIMRec))) == (StaticXIM)NULL) { if ((im = Xmalloc(sizeof(StaticXIMRec))) == (StaticXIM)NULL) {
return((XIM)NULL); return((XIM)NULL);
} }
if ((local_impart = (XIMStaticXIMRec*)Xmalloc(sizeof(XIMStaticXIMRec))) if ((local_impart = Xmalloc(sizeof(XIMStaticXIMRec)))
== (XIMStaticXIMRec *)NULL) { == (XIMStaticXIMRec *)NULL) {
Xfree(im); Xfree(im);
return((XIM)NULL); return((XIM)NULL);
...@@ -273,11 +273,11 @@ _GetIMValues( ...@@ -273,11 +273,11 @@ _GetIMValues(
for (p = values; p->name != NULL; p++) { for (p = values; p->name != NULL; p++) {
if (strcmp(p->name, XNQueryInputStyle) == 0) { if (strcmp(p->name, XNQueryInputStyle) == 0) {
styles = (XIMStyles *)Xmalloc(sizeof(XIMStyles)); styles = Xmalloc(sizeof(XIMStyles));
*(XIMStyles **)p->value = styles; *(XIMStyles **)p->value = styles;
styles->count_styles = 1; styles->count_styles = 1;
styles->supported_styles = styles->supported_styles =
(XIMStyle*)Xmalloc(styles->count_styles * sizeof(XIMStyle)); Xmalloc(styles->count_styles * sizeof(XIMStyle));
styles->supported_styles[0] = (XIMPreeditNone | XIMStatusNone); styles->supported_styles[0] = (XIMPreeditNone | XIMStatusNone);
} else { } else {
break; break;
...@@ -344,7 +344,7 @@ _CreateIC(XIM im, XIMArg *arg) ...@@ -344,7 +344,7 @@ _CreateIC(XIM im, XIMArg *arg)
{ {
XIC ic; XIC ic;
if ((ic = (XIC)Xmalloc(sizeof(XICRec))) == (XIC)NULL) { if ((ic = Xmalloc(sizeof(XICRec))) == (XIC)NULL) {
return ((XIC)NULL); return ((XIC)NULL);
} }
memset(ic, 0, sizeof(XICRec)); memset(ic, 0, sizeof(XICRec));
...@@ -452,7 +452,7 @@ _WcLookupString( ...@@ -452,7 +452,7 @@ _WcLookupString(
XComposeStatus NotSupportedYet ; XComposeStatus NotSupportedYet ;
int length; int length;
/* In single-byte, mb_len = wc_len */ /* In single-byte, mb_len = wc_len */
char *mb_buf = (char *)Xmalloc(wlen); char *mb_buf = Xmalloc(wlen);
length = XLookupString(ev, mb_buf, wlen, keysym, &NotSupportedYet); length = XLookupString(ev, mb_buf, wlen, keysym, &NotSupportedYet);
......
...@@ -76,7 +76,7 @@ Sun Microsystems, Inc. or its licensors is granted. ...@@ -76,7 +76,7 @@ Sun Microsystems, Inc. or its licensors is granted.
#define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen) #define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen)
#define DefineLocalBuf char local_buf[BUFSIZ] #define DefineLocalBuf char local_buf[BUFSIZ]
#define AllocLocalBuf(length) (length > BUFSIZ ? (char *)Xmalloc(length) : local_buf) #define AllocLocalBuf(length) (length > BUFSIZ ? Xmalloc(length) : local_buf)
#define FreeLocalBuf(ptr) if (ptr != local_buf) Xfree(ptr) #define FreeLocalBuf(ptr) if (ptr != local_buf) Xfree(ptr)
typedef struct _FontDataRec { typedef struct _FontDataRec {
...@@ -332,15 +332,15 @@ init_core_part( ...@@ -332,15 +332,15 @@ init_core_part(
if (count == 0) if (count == 0)
return False; return False;
font_struct_list = (XFontStruct **) Xmalloc(sizeof(XFontStruct *)); font_struct_list = Xmalloc(sizeof(XFontStruct *));
if (font_struct_list == NULL) if (font_struct_list == NULL)
return False; return False;
font_name_list = (char **) Xmalloc(sizeof(char *)); font_name_list = Xmalloc(sizeof(char *));
if (font_name_list == NULL) if (font_name_list == NULL)
goto err; goto err;
font_name_buf = (char *) Xmalloc(length); font_name_buf = Xmalloc(length);
if (font_name_buf == NULL) if (font_name_buf == NULL)
goto err; goto err;
...@@ -578,11 +578,11 @@ set_missing_list( ...@@ -578,11 +578,11 @@ set_missing_list(
if (count == 0) if (count == 0)
return True; return True;
charset_list = (char **) Xmalloc(sizeof(char *)); charset_list = Xmalloc(sizeof(char *));
if (charset_list == NULL) if (charset_list == NULL)
return False; return False;
charset_buf = (char *) Xmalloc(length); charset_buf = Xmalloc(length);
if (charset_buf == NULL) { if (charset_buf == NULL) {
Xfree(charset_list); Xfree(charset_list);
return False; return False;
...@@ -1172,11 +1172,11 @@ init_om( ...@@ -1172,11 +1172,11 @@ init_om(
length += strlen(data->font_data->name) + 1; length += strlen(data->font_data->name) + 1;
/* required charset list */ /* required charset list */
required_list = (char **) Xmalloc(sizeof(char *)); required_list = Xmalloc(sizeof(char *));
if (required_list == NULL) if (required_list == NULL)
return False; return False;
bufptr = (char *) Xmalloc(length); bufptr = Xmalloc(length);
if (bufptr == NULL) { if (bufptr == NULL) {
Xfree(required_list); Xfree(required_list);
return False; return False;
...@@ -1192,7 +1192,7 @@ init_om( ...@@ -1192,7 +1192,7 @@ init_om(
bufptr += strlen(bufptr) + 1; bufptr += strlen(bufptr) + 1;
/* orientation list */ /* orientation list */
orientation = (XOrientation *) Xmalloc(sizeof(XOrientation)); orientation = Xmalloc(sizeof(XOrientation));
if (orientation == NULL) if (orientation == NULL)
return False; return False;
......
...@@ -185,8 +185,7 @@ resolve_object(char *path, const char *lc_name) ...@@ -185,8 +185,7 @@ resolve_object(char *path, const char *lc_name)
if (lc_len == 0) { /* True only for the 1st time */ if (lc_len == 0) { /* True only for the 1st time */
lc_len = OBJECT_INIT_LEN; lc_len = OBJECT_INIT_LEN;
xi18n_objects_list = (XI18NObjectsList) xi18n_objects_list = Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
Xmalloc(sizeof(XI18NObjectsListRec) * lc_len);
if (!xi18n_objects_list) return; if (!xi18n_objects_list) return;
} }
snprintf(filename, sizeof(filename), "%s/%s", path, "XI18N_OBJS"); snprintf(filename, sizeof(filename), "%s/%s", path, "XI18N_OBJS");
......
...@@ -250,7 +250,7 @@ _XcmsAddCmapRec( ...@@ -250,7 +250,7 @@ _XcmsAddCmapRec(
{ {
XcmsCmapRec *pNew; XcmsCmapRec *pNew;
if ((pNew = (XcmsCmapRec *) Xcalloc(1, (unsigned) sizeof(XcmsCmapRec))) if ((pNew = Xcalloc(1, (unsigned) sizeof(XcmsCmapRec)))
== NULL) { == NULL) {
return((XcmsCmapRec *)NULL); return((XcmsCmapRec *)NULL);
} }
...@@ -301,7 +301,7 @@ _XcmsCopyCmapRecAndFree( ...@@ -301,7 +301,7 @@ _XcmsCopyCmapRecAndFree(
pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID, pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID,
pRec_src->visual); pRec_src->visual);
if (pRec_copy != NULL && pRec_src->ccc) { if (pRec_copy != NULL && pRec_src->ccc) {
pRec_copy->ccc = (XcmsCCC)Xcalloc(1, (unsigned) sizeof(XcmsCCCRec)); pRec_copy->ccc = Xcalloc(1, (unsigned) sizeof(XcmsCCCRec));
memcpy((char *)pRec_copy->ccc, (char *)pRec_src->ccc, memcpy((char *)pRec_copy->ccc, (char *)pRec_src->ccc,
sizeof(XcmsCCCRec)); sizeof(XcmsCCCRec));
} }
......
...@@ -209,7 +209,7 @@ _XcmsParseColorString( ...@@ -209,7 +209,7 @@ _XcmsParseColorString(
* While copying color_string to string_lowered, convert to lowercase * While copying color_string to string_lowered, convert to lowercase
*/ */
if ((len = strlen(color_string)) >= sizeof(string_buf)) { if ((len = strlen(color_string)) >= sizeof(string_buf)) {
string_lowered = (char *) Xmalloc(len+1); string_lowered = Xmalloc(len+1);
} else { } else {
string_lowered = string_buf; string_lowered = string_buf;
} }
...@@ -418,7 +418,7 @@ _XcmsLookupColorName( ...@@ -418,7 +418,7 @@ _XcmsLookupColorName(
Retry: Retry:
if ((len = strlen(tmpName)) > 63) { if ((len = strlen(tmpName)) > 63) {
name_lowered = (char *) Xmalloc(len+1); name_lowered = Xmalloc(len+1);
} else { } else {
name_lowered = name_lowered_64; name_lowered = name_lowered_64;
} }
...@@ -760,8 +760,8 @@ LoadColornameDB(void) ...@@ -760,8 +760,8 @@ LoadColornameDB(void)
} }
rewind(stream); rewind(stream);
strings = (char *) Xmalloc(size); strings = Xmalloc(size);
pairs = (XcmsPair *)Xcalloc(nEntries, sizeof(XcmsPair)); pairs = Xcalloc(nEntries, sizeof(XcmsPair));
ReadColornameDB(stream, pairs, strings); ReadColornameDB(stream, pairs, strings);
(void) fclose(stream); (void) fclose(stream);
......
...@@ -82,7 +82,7 @@ _XcmsCopyPointerArray( ...@@ -82,7 +82,7 @@ _XcmsCopyPointerArray(
for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++);
n++; /* add 1 to include the NULL pointer */ n++; /* add 1 to include the NULL pointer */
if ((newArray = (XPointer *)Xmalloc(n * sizeof(XPointer)))) { if ((newArray = Xmalloc(n * sizeof(XPointer)))) {
memcpy((char *)newArray, (char *)pap, memcpy((char *)newArray, (char *)pap,
(unsigned)(n * sizeof(XPointer))); (unsigned)(n * sizeof(XPointer)));
} }
...@@ -141,7 +141,7 @@ _XcmsPushPointerArray( ...@@ -141,7 +141,7 @@ _XcmsPushPointerArray(
/* add 2: 1 for the new pointer and another for the NULL pointer */ /* add 2: 1 for the new pointer and another for the NULL pointer */
n += 2; n += 2;
if ((newArray = (XPointer *)Xmalloc(n * sizeof(XPointer)))) { if ((newArray = Xmalloc(n * sizeof(XPointer)))) {
memcpy((char *)(newArray+1),(char *)pap, memcpy((char *)(newArray+1),(char *)pap,
(unsigned)((n-1) * sizeof(XPointer))); (unsigned)((n-1) * sizeof(XPointer)));
*newArray = p; *newArray = p;
...@@ -183,8 +183,7 @@ _XcmsInitDefaultCCCs( ...@@ -183,8 +183,7 @@ _XcmsInitDefaultCCCs(
* Create an array of XcmsCCC structures, one for each screen. * Create an array of XcmsCCC structures, one for each screen.
* They serve as the screen's default CCC. * They serve as the screen's default CCC.
*/ */
if (!(ccc = (XcmsCCC) if (!(ccc = Xcalloc((unsigned)nScrn, (unsigned) sizeof(XcmsCCCRec)))) {
Xcalloc((unsigned)nScrn, (unsigned) sizeof(XcmsCCCRec)))) {
return(0); return(0);
} }
dpy->cms.defaultCCCs = (XPointer)ccc; dpy->cms.defaultCCCs = (XPointer)ccc;
...@@ -322,7 +321,7 @@ _XcmsInitScrnInfo( ...@@ -322,7 +321,7 @@ _XcmsInitScrnInfo(
* for the latter (see XcmsCreateCCC). The ones created * for the latter (see XcmsCreateCCC). The ones created
* here are referenced by the default CCC. * here are referenced by the default CCC.
*/ */
if (!(defaultccc->pPerScrnInfo = (XcmsPerScrnInfo *) if (!(defaultccc->pPerScrnInfo =
Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) { Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) {
return(0); return(0);
} }
......
...@@ -230,9 +230,9 @@ _XimCbDispatch(Xim xim, ...@@ -230,9 +230,9 @@ _XimCbDispatch(Xim xim,
/* queue the protocol /* queue the protocol
*/ */
XimPendingCallback pcb; XimPendingCallback pcb;
char *proto_buf = (proto_len > 0) ? (char*)Xmalloc(proto_len) : NULL; char *proto_buf = (proto_len > 0) ? Xmalloc(proto_len) : NULL;
pcb = (XimPendingCallback)Xmalloc(sizeof(XimPendingCallbackRec)); pcb = Xmalloc(sizeof(XimPendingCallbackRec));
if (pcb && (proto_len <= 0 || proto_buf)) { if (pcb && (proto_len <= 0 || proto_buf)) {
if (proto_len > 0) if (proto_len > 0)
memcpy(proto_buf, proto, proto_len); memcpy(proto_buf, proto, proto_len);
...@@ -339,7 +339,7 @@ _XimStrConversionCallback(Xim im, ...@@ -339,7 +339,7 @@ _XimStrConversionCallback(Xim im,
2 + length_in_bytes + 2 + length_in_bytes +
XIM_PAD(2 + length_in_bytes) + XIM_PAD(2 + length_in_bytes) +
2 + 2 + sz_CARD32 * cbrec.text->length; 2 + 2 + sz_CARD32 * cbrec.text->length;
buf = (CARD8*)Xmalloc(buf_len); buf = Xmalloc(buf_len);
} }
_XimSetHeader((XPointer)buf, XIM_STR_CONVERSION_REPLY, 0, &buf_len); _XimSetHeader((XPointer)buf, XIM_STR_CONVERSION_REPLY, 0, &buf_len);
buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */ buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */
...@@ -461,12 +461,12 @@ _read_text_from_packet(Xim im, ...@@ -461,12 +461,12 @@ _read_text_from_packet(Xim im,
return; return;
} }
*text_ptr = text = (XIMText*)Xmalloc(sizeof(XIMText)); *text_ptr = text = Xmalloc(sizeof(XIMText));
if (text == (XIMText*)NULL) return; if (text == (XIMText*)NULL) return;
tmp_len = (int)*(CARD16*)buf; tmp_len = (int)*(CARD16*)buf;
buf += sz_CARD16; buf += sz_CARD16;
if ((tmp_buf = (char*)Xmalloc(tmp_len + 1))) { if ((tmp_buf = Xmalloc(tmp_len + 1))) {
memcpy(tmp_buf, buf, tmp_len); memcpy(tmp_buf, buf, tmp_len);
tmp_buf[tmp_len] = '\0'; tmp_buf[tmp_len] = '\0';
...@@ -477,11 +477,10 @@ _read_text_from_packet(Xim im, ...@@ -477,11 +477,10 @@ _read_text_from_packet(Xim im,
if (s != XLookupNone) { if (s != XLookupNone) {
#ifndef NO_DEC_I18N_FIX #ifndef NO_DEC_I18N_FIX
/* Allow for NULL-terminated */ /* Allow for NULL-terminated */
if ((text->string.multi_byte = if ((text->string.multi_byte = Xmalloc(text->length *
(char*)Xmalloc(text->length *
XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1))) { XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1))) {
#else #else
if (text->string.multi_byte = (char*)Xmalloc(text->length+1)) { if (text->string.multi_byte = Xmalloc(text->length+1)) {
#endif #endif
int tmp; int tmp;
#ifndef NO_DEC_I18N_FIX #ifndef NO_DEC_I18N_FIX
...@@ -530,7 +529,7 @@ _read_text_from_packet(Xim im, ...@@ -530,7 +529,7 @@ _read_text_from_packet(Xim im,
i = (int)*(CARD16*)buf; buf += sz_CARD16; i = (int)*(CARD16*)buf; buf += sz_CARD16;
buf += sz_CARD16; /* skip `unused' */ buf += sz_CARD16; /* skip `unused' */
text->feedback = (XIMFeedback*)Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32))); text->feedback = Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32)));
j = 0; j = 0;
while (i > 0) { while (i > 0) {
text->feedback[j] = (XIMFeedback)*(CARD32*)buf; text->feedback[j] = (XIMFeedback)*(CARD32*)buf;
......
...@@ -108,7 +108,7 @@ _XimReCreateIC(ic) ...@@ -108,7 +108,7 @@ _XimReCreateIC(ic)
XPointer preply; XPointer preply;
int ret_code; int ret_code;
if (!(save_ic = (Xic)Xmalloc(sizeof(XicRec)))) if (!(save_ic = Xmalloc(sizeof(XicRec))))
return False; return False;
memcpy((char *)save_ic, (char *)ic, sizeof(XicRec)); memcpy((char *)save_ic, (char *)ic, sizeof(XicRec));
...@@ -120,7 +120,7 @@ _XimReCreateIC(ic) ...@@ -120,7 +120,7 @@ _XimReCreateIC(ic)
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
buf_size = sizeof(XIMResource) * num; buf_size = sizeof(XIMResource) * num;
if (!(res = (XIMResourceList)Xmalloc(buf_size))) if (!(res = Xmalloc(buf_size)))
goto ErrorOnReCreateIC; goto ErrorOnReCreateIC;
(void)memcpy((char *)res, (char *)im->core.ic_resources, buf_size); (void)memcpy((char *)res, (char *)im->core.ic_resources, buf_size);
ic->private.proto.ic_resources = res; ic->private.proto.ic_resources = res;
...@@ -128,7 +128,7 @@ _XimReCreateIC(ic) ...@@ -128,7 +128,7 @@ _XimReCreateIC(ic)
num = im->private.proto.ic_num_inner_resources; num = im->private.proto.ic_num_inner_resources;
buf_size = sizeof(XIMResource) * num; buf_size = sizeof(XIMResource) * num;
if (!(res = (XIMResourceList)Xmalloc(buf_size))) if (!(res = Xmalloc(buf_size)))
goto ErrorOnReCreateIC; goto ErrorOnReCreateIC;
(void)memcpy((char *)res, (void)memcpy((char *)res,
(char *)im->private.proto.ic_inner_resources, buf_size); (char *)im->private.proto.ic_inner_resources, buf_size);
...@@ -164,13 +164,13 @@ _XimReCreateIC(ic) ...@@ -164,13 +164,13 @@ _XimReCreateIC(ic)
buf_size += ret_len; buf_size += ret_len;
if (buf == tmp_buf) { if (buf == tmp_buf) {
if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { if (!(tmp = Xmalloc(buf_size + data_len))) {
goto ErrorOnReCreateIC; goto ErrorOnReCreateIC;
} }
memcpy(tmp, buf, buf_size); memcpy(tmp, buf, buf_size);
buf = tmp; buf = tmp;
} else { } else {
if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) {
Xfree(buf); Xfree(buf);
goto ErrorOnReCreateIC; goto ErrorOnReCreateIC;
} }
...@@ -203,7 +203,7 @@ _XimReCreateIC(ic) ...@@ -203,7 +203,7 @@ _XimReCreateIC(ic)
preply = reply; preply = reply;
} else { } else {
buf_size = (int)len; buf_size = (int)len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimCreateICCheck, 0); _XimCreateICCheck, 0);
if (ret_code != XIM_TRUE) { if (ret_code != XIM_TRUE) {
...@@ -351,7 +351,7 @@ _XimProtoGetICValues( ...@@ -351,7 +351,7 @@ _XimProtoGetICValues(
+ sizeof(INT16) + sizeof(INT16)
+ XIM_PAD(2 + buf_size); + XIM_PAD(2 + buf_size);
if (!(buf = (CARD8 *)Xmalloc(buf_size))) if (!(buf = Xmalloc(buf_size)))
return arg->name; return arg->name;
buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
...@@ -385,7 +385,7 @@ _XimProtoGetICValues( ...@@ -385,7 +385,7 @@ _XimProtoGetICValues(
preply = reply; preply = reply;
} else { } else {
buf_size = (int)len; buf_size = (int)len;
preply = (XPointer)Xmalloc(len); preply = Xmalloc(len);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimGetICValuesCheck, (XPointer)ic); _XimGetICValuesCheck, (XPointer)ic);
if (ret_code != XIM_TRUE) { if (ret_code != XIM_TRUE) {
...@@ -465,7 +465,7 @@ _XimCheckNestedQuarkList(quark_list, idx, num_quark, arg, separator) ...@@ -465,7 +465,7 @@ _XimCheckNestedQuarkList(quark_list, idx, num_quark, arg, separator)
quark, separator)) { quark, separator)) {
continue; continue;
} }
if (!(tmp = (XrmQuark *)Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) { if (!(tmp = Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) {
*quark_list = q_list; *quark_list = q_list;
*num_quark = n_quark; *num_quark = n_quark;
return False; return False;
...@@ -535,7 +535,7 @@ _XimSaveICValues(ic, arg) ...@@ -535,7 +535,7 @@ _XimSaveICValues(ic, arg)
for (pp = (XIMArg *)p->value, nn = 0; for (pp = (XIMArg *)p->value, nn = 0;
pp && pp->name; pp++, nn++); pp && pp->name; pp++, nn++);
if (!(tmp = (XrmQuark *)Xrealloc(quark_list, if (!(tmp = Xrealloc(quark_list,
(sizeof(XrmQuark) * (num_quark + nn + 2))))) { (sizeof(XrmQuark) * (num_quark + nn + 2))))) {
ic->private.proto.saved_icvalues = quark_list; ic->private.proto.saved_icvalues = quark_list;
ic->private.proto.num_saved_icvalues = num_quark; ic->private.proto.num_saved_icvalues = num_quark;
...@@ -562,7 +562,7 @@ _XimSaveICValues(ic, arg) ...@@ -562,7 +562,7 @@ _XimSaveICValues(ic, arg)
if (_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { if (_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) {
continue; continue;
} }
if (!(tmp = (XrmQuark *)Xrealloc(quark_list, if (!(tmp = Xrealloc(quark_list,
(sizeof(XrmQuark) * (num_quark + 1))))) { (sizeof(XrmQuark) * (num_quark + 1))))) {
ic->private.proto.saved_icvalues = quark_list; ic->private.proto.saved_icvalues = quark_list;
ic->private.proto.num_saved_icvalues = num_quark; ic->private.proto.num_saved_icvalues = num_quark;
...@@ -589,7 +589,7 @@ _XimSaveICValues(ic, arg) ...@@ -589,7 +589,7 @@ _XimSaveICValues(ic, arg)
} }
} }
if (!(quark_list = (XrmQuark *)Xmalloc(sizeof(XrmQuark) * n))) { if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) {
return False; return False;
} }
...@@ -731,13 +731,13 @@ _XimProtoSetICValues( ...@@ -731,13 +731,13 @@ _XimProtoSetICValues(
buf_size += ret_len; buf_size += ret_len;
if (buf == tmp_buf) { if (buf == tmp_buf) {
if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { if (!(tmp = Xmalloc(buf_size + data_len))) {
return tmp_name; return tmp_name;
} }
memcpy(tmp, buf, buf_size); memcpy(tmp, buf, buf_size);
buf = tmp; buf = tmp;
} else { } else {
if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) {
Xfree(buf); Xfree(buf);
return tmp_name; return tmp_name;
} }
...@@ -781,7 +781,7 @@ _XimProtoSetICValues( ...@@ -781,7 +781,7 @@ _XimProtoSetICValues(
preply = reply; preply = reply;
} else if (ret_code == XIM_OVERFLOW) { } else if (ret_code == XIM_OVERFLOW) {
buf_size = (int)len; buf_size = (int)len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimSetICValuesCheck, (XPointer)ic); _XimSetICValuesCheck, (XPointer)ic);
if (ret_code != XIM_TRUE) { if (ret_code != XIM_TRUE) {
...@@ -915,7 +915,7 @@ _XimProtoDestroyIC( ...@@ -915,7 +915,7 @@ _XimProtoDestroyIC(
_XimDestroyICCheck, (XPointer)ic); _XimDestroyICCheck, (XPointer)ic);
if (ret_code == XIM_OVERFLOW) { if (ret_code == XIM_OVERFLOW) {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
(void)_XimRead(im, &len, preply, buf_size, (void)_XimRead(im, &len, preply, buf_size,
_XimDestroyICCheck, (XPointer)ic); _XimDestroyICCheck, (XPointer)ic);
Xfree(preply); Xfree(preply);
...@@ -1088,7 +1088,7 @@ _XimProtoReset( ...@@ -1088,7 +1088,7 @@ _XimProtoReset(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimResetICCheck, (XPointer)ic); _XimResetICCheck, (XPointer)ic);
if (ret_code != XIM_TRUE) { if (ret_code != XIM_TRUE) {
...@@ -1139,7 +1139,7 @@ _XimCommitedMbString( ...@@ -1139,7 +1139,7 @@ _XimCommitedMbString(
if ( len == 0 ) if ( len == 0 )
return( NULL ); return( NULL );
if (!(commit = (char *)Xmalloc(len + 1))) if (!(commit = Xmalloc(len + 1)))
goto Error_On_Reset; goto Error_On_Reset;
str = commit; str = commit;
...@@ -1196,7 +1196,7 @@ _XimCommitedWcString( ...@@ -1196,7 +1196,7 @@ _XimCommitedWcString(
if ( len == 0 ) if ( len == 0 )
return( (wchar_t *)NULL ); return( (wchar_t *)NULL );
if (!(commit = (char *)Xmalloc(len + 1))) if (!(commit = Xmalloc(len + 1)))
goto Error_On_Reset; goto Error_On_Reset;
str = commit; str = commit;
...@@ -1255,7 +1255,7 @@ _XimCommitedUtf8String( ...@@ -1255,7 +1255,7 @@ _XimCommitedUtf8String(
if ( len == 0 ) if ( len == 0 )
return( NULL ); return( NULL );
if (!(commit = (char *)Xmalloc(len + 1))) if (!(commit = Xmalloc(len + 1)))
goto Error_On_Reset; goto Error_On_Reset;
str = commit; str = commit;
...@@ -1368,7 +1368,7 @@ _XimReconnectModeCreateIC(ic) ...@@ -1368,7 +1368,7 @@ _XimReconnectModeCreateIC(ic)
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
if (!(res = (XIMResourceList)Xmalloc(len))) if (!(res = Xmalloc(len)))
return False; return False;
(void)memcpy((char *)res, (char *)im->core.ic_resources, len); (void)memcpy((char *)res, (char *)im->core.ic_resources, len);
ic->private.proto.ic_resources = res; ic->private.proto.ic_resources = res;
...@@ -1430,7 +1430,7 @@ _XimProtoCreateIC( ...@@ -1430,7 +1430,7 @@ _XimProtoCreateIC(
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
if (!(res = (XIMResourceList)Xmalloc(len))) if (!(res = Xmalloc(len)))
goto ErrorOnCreatingIC; goto ErrorOnCreatingIC;
(void)memcpy((char *)res, (char *)im->core.ic_resources, len); (void)memcpy((char *)res, (char *)im->core.ic_resources, len);
ic->private.proto.ic_resources = res; ic->private.proto.ic_resources = res;
...@@ -1458,7 +1458,7 @@ _XimProtoCreateIC( ...@@ -1458,7 +1458,7 @@ _XimProtoCreateIC(
num = im->private.proto.ic_num_inner_resources; num = im->private.proto.ic_num_inner_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
if (!(res = (XIMResourceList)Xmalloc(len))) if (!(res = Xmalloc(len)))
goto ErrorOnCreatingIC; goto ErrorOnCreatingIC;
(void)memcpy((char *)res, (void)memcpy((char *)res,
(char *)im->private.proto.ic_inner_resources, len); (char *)im->private.proto.ic_inner_resources, len);
...@@ -1492,13 +1492,13 @@ _XimProtoCreateIC( ...@@ -1492,13 +1492,13 @@ _XimProtoCreateIC(
buf_size += ret_len; buf_size += ret_len;
if (buf == tmp_buf) { if (buf == tmp_buf) {
if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { if (!(tmp = Xmalloc(buf_size + data_len))) {
goto ErrorOnCreatingIC; goto ErrorOnCreatingIC;
} }
memcpy(tmp, buf, buf_size); memcpy(tmp, buf, buf_size);
buf = tmp; buf = tmp;
} else { } else {
if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) {
Xfree(buf); Xfree(buf);
goto ErrorOnCreatingIC; goto ErrorOnCreatingIC;
} }
...@@ -1538,7 +1538,7 @@ _XimProtoCreateIC( ...@@ -1538,7 +1538,7 @@ _XimProtoCreateIC(
preply = reply; preply = reply;
} else { } else {
buf_size = (int)len; buf_size = (int)len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimCreateICCheck, 0); _XimCreateICCheck, 0);
if (ret_code != XIM_TRUE) { if (ret_code != XIM_TRUE) {
......
...@@ -616,7 +616,7 @@ _XimConnection( ...@@ -616,7 +616,7 @@ _XimConnection(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0); ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
Xfree(preply); Xfree(preply);
...@@ -759,7 +759,7 @@ _XimDisconnect( ...@@ -759,7 +759,7 @@ _XimDisconnect(
if(ret_code == XIM_OVERFLOW) { if(ret_code == XIM_OVERFLOW) {
if(len > 0) { if(len > 0) {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimDisconnectCheck, 0); _XimDisconnectCheck, 0);
Xfree(preply); Xfree(preply);
...@@ -831,7 +831,7 @@ _XimOpen( ...@@ -831,7 +831,7 @@ _XimOpen(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimOpenCheck, 0); _XimOpenCheck, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -950,7 +950,7 @@ _XimClose( ...@@ -950,7 +950,7 @@ _XimClose(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0); ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
Xfree(preply); Xfree(preply);
...@@ -1173,7 +1173,7 @@ _XimSaveIMValues( ...@@ -1173,7 +1173,7 @@ _XimSaveIMValues(
if (_XimCheckIMQuarkList(quark_list, num_quark, quark)) { if (_XimCheckIMQuarkList(quark_list, num_quark, quark)) {
continue; continue;
} }
if (!(tmp = (XrmQuark *)Xrealloc(quark_list, if (!(tmp = Xrealloc(quark_list,
(sizeof(XrmQuark) * (num_quark + 1))))) { (sizeof(XrmQuark) * (num_quark + 1))))) {
im->private.proto.saved_imvalues = quark_list; im->private.proto.saved_imvalues = quark_list;
im->private.proto.num_saved_imvalues = num_quark; im->private.proto.num_saved_imvalues = num_quark;
...@@ -1190,7 +1190,7 @@ _XimSaveIMValues( ...@@ -1190,7 +1190,7 @@ _XimSaveIMValues(
for (p = arg, n = 0; p && p->name; p++, n++); for (p = arg, n = 0; p && p->name; p++, n++);
if (!(quark_list = (XrmQuark *)Xmalloc(sizeof(XrmQuark) * n))) { if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) {
return False; return False;
} }
...@@ -1311,13 +1311,13 @@ _XimProtoSetIMValues( ...@@ -1311,13 +1311,13 @@ _XimProtoSetIMValues(
buf_size += ret_len; buf_size += ret_len;
if (buf == tmp_buf) { if (buf == tmp_buf) {
if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { if (!(tmp = Xmalloc(buf_size + data_len))) {
return arg->name; return arg->name;
} }
memcpy(tmp, buf, buf_size); memcpy(tmp, buf, buf_size);
buf = tmp; buf = tmp;
} else { } else {
if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) {
Xfree(buf); Xfree(buf);
return arg->name; return arg->name;
} }
...@@ -1353,7 +1353,7 @@ _XimProtoSetIMValues( ...@@ -1353,7 +1353,7 @@ _XimProtoSetIMValues(
preply = reply; preply = reply;
} else { } else {
buf_size = (int)len; buf_size = (int)len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, reply, buf_size, ret_code = _XimRead(im, &len, reply, buf_size,
_XimSetIMValuesCheck, 0); _XimSetIMValuesCheck, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -1462,7 +1462,7 @@ _XimProtoGetIMValues( ...@@ -1462,7 +1462,7 @@ _XimProtoGetIMValues(
+ sizeof(INT16) + sizeof(INT16)
+ XIM_PAD(buf_size); + XIM_PAD(buf_size);
if (!(buf = (CARD8 *)Xmalloc(buf_size))) if (!(buf = Xmalloc(buf_size)))
return arg->name; return arg->name;
buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
...@@ -1494,7 +1494,7 @@ _XimProtoGetIMValues( ...@@ -1494,7 +1494,7 @@ _XimProtoGetIMValues(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimGetIMValuesCheck, 0); _XimGetIMValuesCheck, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -1556,7 +1556,7 @@ _XimSetEncodingByName( ...@@ -1556,7 +1556,7 @@ _XimSetEncodingByName(
encoding_len = strlen(encoding); encoding_len = strlen(encoding);
compound_len = strlen("COMPOUND_TEXT"); compound_len = strlen("COMPOUND_TEXT");
*len = encoding_len + sizeof(BYTE) + compound_len + sizeof(BYTE); *len = encoding_len + sizeof(BYTE) + compound_len + sizeof(BYTE);
if (!(ret = (BYTE *)Xmalloc(*len))) { if (!(ret = Xmalloc(*len))) {
return False; return False;
} }
*buf = (char *)ret; *buf = (char *)ret;
...@@ -1724,7 +1724,7 @@ _XimEncodingNegotiation( ...@@ -1724,7 +1724,7 @@ _XimEncodingNegotiation(
+ sizeof(CARD16) + sizeof(CARD16)
+ detail_len; + detail_len;
if (!(buf = (CARD8 *)Xmalloc(XIM_HEADER_SIZE + len))) if (!(buf = Xmalloc(XIM_HEADER_SIZE + len)))
goto free_detail_ptr; goto free_detail_ptr;
buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
...@@ -1757,7 +1757,7 @@ _XimEncodingNegotiation( ...@@ -1757,7 +1757,7 @@ _XimEncodingNegotiation(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimEncodingNegoCheck, 0); _XimEncodingNegoCheck, 0);
if(ret_code != XIM_TRUE) if(ret_code != XIM_TRUE)
...@@ -1844,13 +1844,13 @@ _XimSendSavedIMValues( ...@@ -1844,13 +1844,13 @@ _XimSendSavedIMValues(
buf_size += ret_len; buf_size += ret_len;
if (buf == tmp_buf) { if (buf == tmp_buf) {
if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { if (!(tmp = Xmalloc(buf_size + data_len))) {
return False; return False;
} }
memcpy(tmp, buf, buf_size); memcpy(tmp, buf, buf_size);
buf = tmp; buf = tmp;
} else { } else {
if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) {
Xfree(buf); Xfree(buf);
return False; return False;
} }
...@@ -1885,7 +1885,7 @@ _XimSendSavedIMValues( ...@@ -1885,7 +1885,7 @@ _XimSendSavedIMValues(
preply = reply; preply = reply;
} else { } else {
buf_size = (int)len; buf_size = (int)len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, reply, buf_size, ret_code = _XimRead(im, &len, reply, buf_size,
_XimSetIMValuesCheck, 0); _XimSetIMValuesCheck, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -1938,7 +1938,7 @@ _XimConnectServer( ...@@ -1938,7 +1938,7 @@ _XimConnectServer(
{ {
Xim save_im; Xim save_im;
if (!(save_im = (Xim)Xmalloc(sizeof(XimRec)))) if (!(save_im = Xmalloc(sizeof(XimRec))))
return False; return False;
memcpy((char *)save_im, (char *)im, sizeof(XimRec)); memcpy((char *)save_im, (char *)im, sizeof(XimRec));
......
...@@ -162,7 +162,7 @@ _XimSync( ...@@ -162,7 +162,7 @@ _XimSync(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(len); preply = Xmalloc(len);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimSyncCheck, (XPointer)ic); _XimSyncCheck, (XPointer)ic);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -302,7 +302,7 @@ _XimForwardEventCore( ...@@ -302,7 +302,7 @@ _XimForwardEventCore(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(len); preply = Xmalloc(len);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimSyncCheck, (XPointer)ic); _XimSyncCheck, (XPointer)ic);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -417,7 +417,7 @@ _XimRegisterTriggerkey( ...@@ -417,7 +417,7 @@ _XimRegisterTriggerkey(
len = buf_l[0]; /* length of on-keys */ len = buf_l[0]; /* length of on-keys */
len += sizeof(INT32); /* sizeof length of on-keys */ len += sizeof(INT32); /* sizeof length of on-keys */
if (!(key = (CARD32 *)Xmalloc(len))) { if (!(key = Xmalloc(len))) {
_XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL);
return False; return False;
} }
...@@ -434,7 +434,7 @@ _XimRegisterTriggerkey( ...@@ -434,7 +434,7 @@ _XimRegisterTriggerkey(
len = buf_l[0]; /* length of off-keys */ len = buf_l[0]; /* length of off-keys */
len += sizeof(INT32); /* sizeof length of off-keys */ len += sizeof(INT32); /* sizeof length of off-keys */
if (!(key = (CARD32 *)Xmalloc(len))) { if (!(key = Xmalloc(len))) {
_XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL);
return False; return False;
} }
...@@ -546,7 +546,7 @@ _XimTriggerNotify( ...@@ -546,7 +546,7 @@ _XimTriggerNotify(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(len); preply = Xmalloc(len);
ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, ret_code = _XimRead(im, &len, (XPointer)reply, buf_size,
_XimTriggerNotifyCheck, (XPointer)ic); _XimTriggerNotifyCheck, (XPointer)ic);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -579,7 +579,7 @@ _XimRegCommitInfo( ...@@ -579,7 +579,7 @@ _XimRegCommitInfo(
{ {
XimCommitInfo info; XimCommitInfo info;
if (!(info = (XimCommitInfo)Xmalloc(sizeof(XimCommitInfoRec)))) if (!(info = Xmalloc(sizeof(XimCommitInfoRec))))
return False; return False;
info->string = string; info->string = string;
info->string_len = string_len; info->string_len = string_len;
...@@ -626,7 +626,7 @@ _XimProcKeySym( ...@@ -626,7 +626,7 @@ _XimProcKeySym(
{ {
Xim im = (Xim)ic->core.im; Xim im = (Xim)ic->core.im;
if (!(*xim_keysym = (KeySym *)Xmalloc(sizeof(KeySym)))) { if (!(*xim_keysym = Xmalloc(sizeof(KeySym)))) {
_XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL);
return False; return False;
} }
...@@ -648,7 +648,7 @@ _XimProcCommit( ...@@ -648,7 +648,7 @@ _XimProcCommit(
Xim im = (Xim)ic->core.im; Xim im = (Xim)ic->core.im;
char *string; char *string;
if (!(string = (char *)Xmalloc(len + 1))) { if (!(string = Xmalloc(len + 1))) {
_XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL);
return False; return False;
} }
......
...@@ -49,7 +49,7 @@ _XimRegProtoIntrCallback( ...@@ -49,7 +49,7 @@ _XimRegProtoIntrCallback(
{ {
XimProtoIntrRec *rec; XimProtoIntrRec *rec;
if (!(rec = (XimProtoIntrRec *)Xmalloc(sizeof(XimProtoIntrRec)))) if (!(rec = Xmalloc(sizeof(XimProtoIntrRec))))
return False; return False;
rec->func = proc; rec->func = proc;
rec->major_code = major_code; rec->major_code = major_code;
......
...@@ -271,7 +271,7 @@ _XimExtForwardKeyEvent( ...@@ -271,7 +271,7 @@ _XimExtForwardKeyEvent(
preply = reply; preply = reply;
} else { } else {
buf_sizex = len; buf_sizex = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, preply, buf_size, ret_code = _XimRead(im, &len, preply, buf_size,
_XimExtForwardKeyEventCheck, (XPointer)ic); _XimExtForwardKeyEventCheck, (XPointer)ic);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
...@@ -436,7 +436,7 @@ _XimExtension( ...@@ -436,7 +436,7 @@ _XimExtension(
+ len + len
+ XIM_PAD(len); + XIM_PAD(len);
if (!(buf = (CARD8 *)Xmalloc(buf_len))) if (!(buf = Xmalloc(buf_len)))
return False; return False;
buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
...@@ -465,7 +465,7 @@ _XimExtension( ...@@ -465,7 +465,7 @@ _XimExtension(
preply = reply; preply = reply;
} else { } else {
buf_size = len; buf_size = len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimRead(im, &len, reply, buf_size, ret_code = _XimRead(im, &len, reply, buf_size,
_XimQueryExtensionCheck, 0); _XimQueryExtensionCheck, 0);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
......
...@@ -168,7 +168,7 @@ _XimRegisterIMInstantiateCallback( ...@@ -168,7 +168,7 @@ _XimRegisterIMInstantiateCallback(
if( lock ) if( lock )
return( False ); return( False );
icb = (XimInstCallback)Xmalloc(sizeof(XimInstCallbackRec)); icb = Xmalloc(sizeof(XimInstCallbackRec));
if( !icb ) if( !icb )
return( False ); return( False );
icb->call = icb->destroy = False; icb->call = icb->destroy = False;
......
...@@ -48,7 +48,7 @@ _XimSetIMStructureList( ...@@ -48,7 +48,7 @@ _XimSetIMStructureList(
Xim *xim; Xim *xim;
if(!(_XimCurrentIMlist)) { if(!(_XimCurrentIMlist)) {
if(!(_XimCurrentIMlist = (Xim *)Xmalloc(sizeof(Xim)))) if(!(_XimCurrentIMlist = Xmalloc(sizeof(Xim))))
return False; return False;
_XimCurrentIMlist[0] = im; _XimCurrentIMlist[0] = im;
_XimCurrentIMcount = 1; _XimCurrentIMcount = 1;
...@@ -61,7 +61,7 @@ _XimSetIMStructureList( ...@@ -61,7 +61,7 @@ _XimSetIMStructureList(
} }
} }
if(i >= _XimCurrentIMcount) { if(i >= _XimCurrentIMcount) {
if(!(xim = (Xim *)Xrealloc(_XimCurrentIMlist, if(!(xim = Xrealloc(_XimCurrentIMlist,
((i + 1) * sizeof(Xim))))) ((i + 1) * sizeof(Xim)))))
return False; return False;
_XimCurrentIMlist = xim; _XimCurrentIMlist = xim;
......
...@@ -158,7 +158,7 @@ _XimLocalCreateIC( ...@@ -158,7 +158,7 @@ _XimLocalCreateIC(
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
if((res = (XIMResourceList)Xmalloc(len)) == (XIMResourceList)NULL) { if((res = Xmalloc(len)) == (XIMResourceList)NULL) {
goto Set_Error; goto Set_Error;
} }
(void)memcpy((char *)res, (char *)im->core.ic_resources, len); (void)memcpy((char *)res, (char *)im->core.ic_resources, len);
......
...@@ -207,7 +207,7 @@ _XimSetProtoResource(im) ...@@ -207,7 +207,7 @@ _XimSetProtoResource(im)
if(!status_style) if(!status_style)
status_style = XIMStatusNothing; status_style = XIMStatusNothing;
if(!(imstyles = (XIMStyles *)Xmalloc(sizeof(XIMStyles) + sizeof(XIMStyle)))){ if(!(imstyles = Xmalloc(sizeof(XIMStyles) + sizeof(XIMStyle)))){
if (res_name != res_name_buf) Xfree (res_name); if (res_name != res_name_buf) Xfree (res_name);
if (res_class != res_class_buf) Xfree (res_class); if (res_class != res_class_buf) Xfree (res_class);
return; return;
...@@ -902,7 +902,7 @@ _XimEncodeHotKey( ...@@ -902,7 +902,7 @@ _XimEncodeHotKey(
} }
len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = Xmalloc(len))) {
return False; return False;
} }
...@@ -1159,7 +1159,7 @@ _XimDecodeCallback( ...@@ -1159,7 +1159,7 @@ _XimDecodeCallback(
XIMCallback *callback; XIMCallback *callback;
in = (XIMCallback *)((char *)top + info->offset); in = (XIMCallback *)((char *)top + info->offset);
if(!(callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback)))) { if(!(callback = Xmalloc(sizeof(XIMCallback)))) {
return False; return False;
} }
callback->client_data = in->client_data; callback->client_data = in->client_data;
...@@ -1272,7 +1272,7 @@ _XimDecodeHotKey( ...@@ -1272,7 +1272,7 @@ _XimDecodeHotKey(
in = *((XIMHotKeyTriggers **)((char *)top + info->offset)); in = *((XIMHotKeyTriggers **)((char *)top + info->offset));
num = in->num_hot_key; num = in->num_hot_key;
len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = Xmalloc(len))) {
return False; return False;
} }
...@@ -1312,7 +1312,7 @@ _XimDecodeRectangle( ...@@ -1312,7 +1312,7 @@ _XimDecodeRectangle(
XRectangle *rect; XRectangle *rect;
in = (XRectangle *)((char *)top + info->offset); in = (XRectangle *)((char *)top + info->offset);
if(!(rect = (XRectangle *)Xmalloc(sizeof(XRectangle)))) { if(!(rect = Xmalloc(sizeof(XRectangle)))) {
return False; return False;
} }
*rect = *in; *rect = *in;
...@@ -1330,7 +1330,7 @@ _XimDecodeSpot( ...@@ -1330,7 +1330,7 @@ _XimDecodeSpot(
XPoint *spot; XPoint *spot;
in = (XPoint *)((char *)top + info->offset); in = (XPoint *)((char *)top + info->offset);
if(!(spot = (XPoint *)Xmalloc(sizeof(XPoint)))) { if(!(spot = Xmalloc(sizeof(XPoint)))) {
return False; return False;
} }
*spot = *in; *spot = *in;
......
...@@ -238,7 +238,7 @@ _XimAttributeToValue( ...@@ -238,7 +238,7 @@ _XimAttributeToValue(
if (!(value)) if (!(value))
return False; return False;
if (!(str = (char *)Xmalloc(data_len + 1))) if (!(str = Xmalloc(data_len + 1)))
return False; return False;
(void)memcpy(str, (char *)data, data_len); (void)memcpy(str, (char *)data, data_len);
...@@ -262,7 +262,7 @@ _XimAttributeToValue( ...@@ -262,7 +262,7 @@ _XimAttributeToValue(
return False; return False;
alloc_len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; alloc_len = sizeof(XIMStyles) + sizeof(XIMStyle) * num;
if (!(p = (char *)Xmalloc(alloc_len))) if (!(p = Xmalloc(alloc_len)))
return False; return False;
rep = (XIMStyles *)p; rep = (XIMStyles *)p;
...@@ -284,7 +284,7 @@ _XimAttributeToValue( ...@@ -284,7 +284,7 @@ _XimAttributeToValue(
if (!(value)) if (!(value))
return False; return False;
if (!(rep = (XRectangle *)Xmalloc(sizeof(XRectangle)))) if (!(rep = Xmalloc(sizeof(XRectangle))))
return False; return False;
rep->x = data[0]; rep->x = data[0];
...@@ -302,7 +302,7 @@ _XimAttributeToValue( ...@@ -302,7 +302,7 @@ _XimAttributeToValue(
if (!(value)) if (!(value))
return False; return False;
if (!(rep = (XPoint *)Xmalloc(sizeof(XPoint)))) if (!(rep = Xmalloc(sizeof(XPoint))))
return False; return False;
rep->x = data[0]; rep->x = data[0];
...@@ -325,7 +325,7 @@ _XimAttributeToValue( ...@@ -325,7 +325,7 @@ _XimAttributeToValue(
if (!ic) if (!ic)
return False; return False;
if (!(base_name = (char *)Xmalloc(len + 1))) if (!(base_name = Xmalloc(len + 1)))
return False; return False;
(void)strncpy(base_name, (char *)&data[1], (int)len); (void)strncpy(base_name, (char *)&data[1], (int)len);
...@@ -370,7 +370,7 @@ _XimAttributeToValue( ...@@ -370,7 +370,7 @@ _XimAttributeToValue(
alloc_len = sizeof(XIMHotKeyTriggers) alloc_len = sizeof(XIMHotKeyTriggers)
+ sizeof(XIMHotKeyTrigger) * num; + sizeof(XIMHotKeyTrigger) * num;
if (!(p = (char *)Xmalloc(alloc_len))) if (!(p = Xmalloc(alloc_len)))
return False; return False;
rep = (XIMHotKeyTriggers *)p; rep = (XIMHotKeyTriggers *)p;
......
...@@ -165,13 +165,13 @@ _XimThaiCreateIC( ...@@ -165,13 +165,13 @@ _XimThaiCreateIC(
ic->core.im = im; ic->core.im = im;
ic->core.filter_events = KeyPressMask; ic->core.filter_events = KeyPressMask;
if (! (ic->private.local.base.tree = tree = (DefTree *)Xmalloc(sizeof(DefTree)*3)) ) if (! (ic->private.local.base.tree = tree = Xmalloc(sizeof(DefTree)*3)) )
goto Set_Error; goto Set_Error;
if (! (ic->private.local.base.mb = (char *)Xmalloc(21)) ) if (! (ic->private.local.base.mb = Xmalloc(21)) )
goto Set_Error; goto Set_Error;
if (! (ic->private.local.base.wc = (wchar_t*)Xmalloc(sizeof(wchar_t)*21)) ) if (! (ic->private.local.base.wc = Xmalloc(sizeof(wchar_t)*21)) )
goto Set_Error; goto Set_Error;
if (! (ic->private.local.base.utf8 = (char *)Xmalloc(21)) ) if (! (ic->private.local.base.utf8 = Xmalloc(21)) )
goto Set_Error; goto Set_Error;
ic->private.local.context = 1; ic->private.local.context = 1;
tree[1].mb = 1; tree[1].mb = 1;
...@@ -188,7 +188,7 @@ _XimThaiCreateIC( ...@@ -188,7 +188,7 @@ _XimThaiCreateIC(
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
if((res = (XIMResourceList)Xmalloc(len)) == (XIMResourceList)NULL) { if((res = Xmalloc(len)) == (XIMResourceList)NULL) {
goto Set_Error; goto Set_Error;
} }
(void)memcpy((char *)res, (char *)im->core.ic_resources, len); (void)memcpy((char *)res, (char *)im->core.ic_resources, len);
......
...@@ -71,7 +71,7 @@ _XimXRegisterDispatcher( ...@@ -71,7 +71,7 @@ _XimXRegisterDispatcher(
XIntrCallbackPtr rec; XIntrCallbackPtr rec;
XSpecRec *spec = (XSpecRec *)im->private.proto.spec; XSpecRec *spec = (XSpecRec *)im->private.proto.spec;
if (!(rec = (XIntrCallbackPtr)Xmalloc(sizeof(XIntrCallbackRec)))) if (!(rec = Xmalloc(sizeof(XIntrCallbackRec))))
return False; return False;
rec->func = callback; rec->func = callback;
......
...@@ -153,7 +153,7 @@ _XimTransRegisterDispatcher( ...@@ -153,7 +153,7 @@ _XimTransRegisterDispatcher(
TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec;
TransIntrCallbackPtr rec; TransIntrCallbackPtr rec;
if (!(rec = (TransIntrCallbackPtr)Xmalloc(sizeof(TransIntrCallbackRec)))) if (!(rec = Xmalloc(sizeof(TransIntrCallbackRec))))
return False; return False;
rec->func = callback; rec->func = callback;
......
...@@ -138,7 +138,7 @@ _XimReadData( ...@@ -138,7 +138,7 @@ _XimReadData(
data_len -= i; data_len -= i;
if (data_len) { if (data_len) {
if (!(tmp = (char *)Xmalloc(data_len))) { if (!(tmp = Xmalloc(data_len))) {
return XIM_FALSE; return XIM_FALSE;
} }
memcpy(tmp, &hold_buf[i], data_len); memcpy(tmp, &hold_buf[i], data_len);
...@@ -173,7 +173,7 @@ _XimReadData( ...@@ -173,7 +173,7 @@ _XimReadData(
} }
if (packet_size > buf_size) { if (packet_size > buf_size) {
if (!(tmp = (char *)Xmalloc(data_len))) { if (!(tmp = Xmalloc(data_len))) {
return XIM_FALSE; return XIM_FALSE;
} }
memcpy(tmp, buf, data_len); memcpy(tmp, buf, data_len);
...@@ -200,7 +200,7 @@ _XimReadData( ...@@ -200,7 +200,7 @@ _XimReadData(
data_len -= i; data_len -= i;
if (data_len) { if (data_len) {
if (!(tmp = (char *)Xmalloc(data_len))) { if (!(tmp = Xmalloc(data_len))) {
return XIM_FALSE; return XIM_FALSE;
} }
memcpy(tmp, &buf[i], data_len); memcpy(tmp, &buf[i], data_len);
...@@ -283,7 +283,7 @@ _XimFilterWaitEvent(Xim im) ...@@ -283,7 +283,7 @@ _XimFilterWaitEvent(Xim im)
preply = reply; preply = reply;
} else { } else {
buf_size = (int)read_len; buf_size = (int)read_len;
preply = (XPointer)Xmalloc(buf_size); preply = Xmalloc(buf_size);
ret_code = _XimReadData(im, &read_len, preply, buf_size); ret_code = _XimReadData(im, &read_len, preply, buf_size);
if(ret_code != XIM_TRUE) { if(ret_code != XIM_TRUE) {
if (preply != reply) if (preply != reply)
......
...@@ -478,7 +478,7 @@ _XlcAddCT( ...@@ -478,7 +478,7 @@ _XlcAddCT(
/* Allocate a CTinfo record. */ /* Allocate a CTinfo record. */
length = strlen(ct_sequence); length = strlen(ct_sequence);
ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec) + length+1); ct_info = Xmalloc(sizeof(CTInfoRec) + length+1);
if (ct_info == NULL) if (ct_info == NULL)
return charset; return charset;
...@@ -514,7 +514,7 @@ _XlcAddCT( ...@@ -514,7 +514,7 @@ _XlcAddCT(
Xfree(ct_info); Xfree(ct_info);
return charset; return charset;
} }
p = (char *) Xmalloc(n+1); p = Xmalloc(n+1);
if (p == NULL) { if (p == NULL) {
Xfree(ct_info); Xfree(ct_info);
return charset; return charset;
...@@ -1169,7 +1169,7 @@ create_conv( ...@@ -1169,7 +1169,7 @@ create_conv(
{ {
XlcConv conv; XlcConv conv;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec)); conv = Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
......
...@@ -92,7 +92,7 @@ _XlcAddCharSet( ...@@ -92,7 +92,7 @@ _XlcAddCharSet(
if (_XlcGetCharSet(charset->name)) if (_XlcGetCharSet(charset->name))
return False; return False;
list = (XlcCharSetList) Xmalloc(sizeof(XlcCharSetListRec)); list = Xmalloc(sizeof(XlcCharSetListRec));
if (list == NULL) if (list == NULL)
return False; return False;
...@@ -184,7 +184,7 @@ _XlcCreateDefaultCharSet( ...@@ -184,7 +184,7 @@ _XlcCreateDefaultCharSet(
ct_sequence_len = strlen(ct_sequence); ct_sequence_len = strlen(ct_sequence);
/* Fill in name and xrm_name. */ /* Fill in name and xrm_name. */
tmp = (char *) Xmalloc(name_len + 1 + ct_sequence_len + 1); tmp = Xmalloc(name_len + 1 + ct_sequence_len + 1);
if (tmp == NULL) { if (tmp == NULL) {
Xfree((char *) charset); Xfree((char *) charset);
return (XlcCharSet) NULL; return (XlcCharSet) NULL;
...@@ -196,7 +196,7 @@ _XlcCreateDefaultCharSet( ...@@ -196,7 +196,7 @@ _XlcCreateDefaultCharSet(
/* Fill in encoding_name and xrm_encoding_name. */ /* Fill in encoding_name and xrm_encoding_name. */
if ((colon = strchr(charset->name, ':')) != NULL) { if ((colon = strchr(charset->name, ':')) != NULL) {
unsigned int length = colon - charset->name; unsigned int length = colon - charset->name;
char *encoding_tmp = (char *) Xmalloc(length + 1); char *encoding_tmp = Xmalloc(length + 1);
if (encoding_tmp == NULL) { if (encoding_tmp == NULL) {
Xfree((char *) charset->name); Xfree((char *) charset->name);
Xfree((char *) charset); Xfree((char *) charset);
......
...@@ -101,7 +101,7 @@ _XlcSetConverter( ...@@ -101,7 +101,7 @@ _XlcSetConverter(
} }
} }
list = (XlcConverterList) Xmalloc(sizeof(XlcConverterListRec)); list = Xmalloc(sizeof(XlcConverterListRec));
if (list == NULL) if (list == NULL)
return False; return False;
...@@ -250,13 +250,13 @@ open_indirect_converter( ...@@ -250,13 +250,13 @@ open_indirect_converter(
to_type == QChar) to_type == QChar)
return (XlcConv) NULL; return (XlcConv) NULL;
lc_conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); lc_conv = Xmalloc(sizeof(XlcConvRec));
if (lc_conv == NULL) if (lc_conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
lc_conv->methods = &conv_methods; lc_conv->methods = &conv_methods;
lc_conv->state = (XPointer) Xcalloc(1, sizeof(ConvRec)); lc_conv->state = Xcalloc(1, sizeof(ConvRec));
if (lc_conv->state == NULL) if (lc_conv->state == NULL)
goto err; goto err;
......
...@@ -165,7 +165,7 @@ init_parse_info (void) ...@@ -165,7 +165,7 @@ init_parse_info (void)
int size; int size;
if (!allocated) { if (!allocated) {
bzero(&parse_info, sizeof(DBParseInfo)); bzero(&parse_info, sizeof(DBParseInfo));
parse_info.buf = (char *)Xmalloc(BUFSIZE); parse_info.buf = Xmalloc(BUFSIZE);
parse_info.bufMaxSize = BUFSIZE; parse_info.bufMaxSize = BUFSIZE;
allocated = 1; allocated = 1;
return; return;
...@@ -248,9 +248,9 @@ realloc_line( ...@@ -248,9 +248,9 @@ realloc_line(
char *str = line->str; char *str = line->str;
if (str != NULL) { if (str != NULL) {
str = (char *)Xrealloc(str, size); str = Xrealloc(str, size);
} else { } else {
str = (char *)Xmalloc(size); str = Xmalloc(size);
} }
if (str == NULL) { if (str == NULL) {
/* malloc error */ /* malloc error */
...@@ -486,7 +486,7 @@ append_value_list (void) ...@@ -486,7 +486,7 @@ append_value_list (void)
} }
if (value_list == (char **)NULL) { if (value_list == (char **)NULL) {
value_list = (char **)Xmalloc(sizeof(char *) * 2); value_list = Xmalloc(sizeof(char *) * 2);
*value_list = NULL; *value_list = NULL;
} else { } else {
char **prev_list = value_list; char **prev_list = value_list;
...@@ -502,11 +502,11 @@ append_value_list (void) ...@@ -502,11 +502,11 @@ append_value_list (void)
value = *value_list; value = *value_list;
if (value == NULL) { if (value == NULL) {
value = (char *)Xmalloc(value_len + len + 1); value = Xmalloc(value_len + len + 1);
} else { } else {
char *prev_value = value; char *prev_value = value;
value = (char *)Xrealloc(value, value_len + len + 1); value = Xrealloc(value, value_len + len + 1);
if (value == NULL) { if (value == NULL) {
Xfree(prev_value); Xfree(prev_value);
} }
...@@ -1314,7 +1314,7 @@ _XlcCreateLocaleDataBase( ...@@ -1314,7 +1314,7 @@ _XlcCreateLocaleDataBase(
lc_db[i].db = p; lc_db[i].db = p;
} }
new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec)); new = Xmalloc(sizeof(XlcDatabaseListRec));
if (new == (XlcDatabaseList)NULL) { if (new == (XlcDatabaseList)NULL) {
goto err; goto err;
} }
......
...@@ -577,11 +577,11 @@ create_conv( ...@@ -577,11 +577,11 @@ create_conv(
XlcConv conv; XlcConv conv;
State state; State state;
conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec)); conv = Xcalloc(1, sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
state = (State) Xmalloc(sizeof(StateRec)); state = Xmalloc(sizeof(StateRec));
if (state == NULL) { if (state == NULL) {
close_converter(conv); close_converter(conv);
return (XlcConv) NULL; return (XlcConv) NULL;
......
...@@ -671,7 +671,7 @@ create_conv( ...@@ -671,7 +671,7 @@ create_conv(
{ {
XlcConv conv; XlcConv conv;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
......
...@@ -2619,11 +2619,11 @@ create_conv( ...@@ -2619,11 +2619,11 @@ create_conv(
XlcConv conv; XlcConv conv;
State state; State state;
conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec)); conv = Xcalloc(1, sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec)); conv->methods = Xmalloc(sizeof(XlcConvMethodsRec));
if (conv->methods == NULL) if (conv->methods == NULL)
goto err; goto err;
*conv->methods = *methods; *conv->methods = *methods;
......
...@@ -68,7 +68,7 @@ create( ...@@ -68,7 +68,7 @@ create(
if (lcd->core == NULL) if (lcd->core == NULL)
goto err; goto err;
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); new = Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL) if (new == NULL)
goto err; goto err;
memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); memcpy(new,methods,sizeof(XLCdPublicMethodsRec));
...@@ -156,10 +156,10 @@ add_charset( ...@@ -156,10 +156,10 @@ add_charset(
int num; int num;
if ((num = codeset->num_charsets)) if ((num = codeset->num_charsets))
new_list = (XlcCharSet *) Xrealloc(codeset->charset_list, new_list = Xrealloc(codeset->charset_list,
(num + 1) * sizeof(XlcCharSet)); (num + 1) * sizeof(XlcCharSet));
else else
new_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet)); new_list = Xmalloc(sizeof(XlcCharSet));
if (new_list == NULL) if (new_list == NULL)
return False; return False;
...@@ -183,10 +183,10 @@ add_codeset( ...@@ -183,10 +183,10 @@ add_codeset(
return NULL; return NULL;
if ((num = gen->codeset_num)) if ((num = gen->codeset_num))
new_list = (CodeSet *) Xrealloc(gen->codeset_list, new_list = Xrealloc(gen->codeset_list,
(num + 1) * sizeof(CodeSet)); (num + 1) * sizeof(CodeSet));
else else
new_list = (CodeSet *) Xmalloc(sizeof(CodeSet)); new_list = Xmalloc(sizeof(CodeSet));
if (new_list == NULL) if (new_list == NULL)
goto err; goto err;
...@@ -230,10 +230,10 @@ add_parse_list( ...@@ -230,10 +230,10 @@ add_parse_list(
} }
if ((num = gen->mb_parse_list_num)) if ((num = gen->mb_parse_list_num))
new_list = (ParseInfo *) Xrealloc(gen->mb_parse_list, new_list = Xrealloc(gen->mb_parse_list,
(num + 2) * sizeof(ParseInfo)); (num + 2) * sizeof(ParseInfo));
else { else {
new_list = (ParseInfo *) Xmalloc(2 * sizeof(ParseInfo)); new_list = Xmalloc(2 * sizeof(ParseInfo));
} }
if (new_list == NULL) if (new_list == NULL)
...@@ -351,7 +351,7 @@ _XlcParse_scopemaps( ...@@ -351,7 +351,7 @@ _XlcParse_scopemaps(
const char *str_sc; const char *str_sc;
num = count_scopemap(str); num = count_scopemap(str);
scope = (FontScope) Xmalloc(num * sizeof(FontScopeRec)); scope = Xmalloc(num * sizeof(FontScopeRec));
if (scope == NULL) if (scope == NULL)
return NULL; return NULL;
...@@ -504,7 +504,7 @@ read_charset_define( ...@@ -504,7 +504,7 @@ read_charset_define(
Xfree(charsetd->ct_sequence); Xfree(charsetd->ct_sequence);
} }
*/ */
tmp = (char *)Xmalloc(strlen(value[0])+1); tmp = Xmalloc(strlen(value[0])+1);
if (tmp == NULL) if (tmp == NULL)
return; return;
charsetd->ct_sequence = tmp; charsetd->ct_sequence = tmp;
...@@ -536,10 +536,10 @@ add_conversion( ...@@ -536,10 +536,10 @@ add_conversion(
int num; int num;
if ((num = gen->segment_conv_num) > 0) { if ((num = gen->segment_conv_num) > 0) {
new_list = (SegConv) Xrealloc(gen->segment_conv, new_list = Xrealloc(gen->segment_conv,
(num + 1) * sizeof(SegConvRec)); (num + 1) * sizeof(SegConvRec));
} else { } else {
new_list = (SegConv) Xmalloc(sizeof(SegConvRec)); new_list = Xmalloc(sizeof(SegConvRec));
} }
if (new_list == NULL) if (new_list == NULL)
...@@ -638,7 +638,7 @@ create_ctextseg( ...@@ -638,7 +638,7 @@ create_ctextseg(
size_t cset_len; size_t cset_len;
int i,new; int i,new;
FontScope scope; FontScope scope;
ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec)); ret = Xmalloc(sizeof(ExtdSegmentRec));
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
ret->name = strdup(value[0]); ret->name = strdup(value[0]);
...@@ -668,7 +668,7 @@ create_ctextseg( ...@@ -668,7 +668,7 @@ create_ctextseg(
ret->side = XlcGLGR; ret->side = XlcGLGR;
strcpy(cset_name,ret->name); strcpy(cset_name,ret->name);
} }
ret->area = (FontScope)Xmalloc((num - 1)*sizeof(FontScopeRec)); ret->area = Xmalloc((num - 1)*sizeof(FontScopeRec));
if (ret->area == NULL) { if (ret->area == NULL) {
Xfree (cset_name); Xfree (cset_name);
Xfree (ret->name); Xfree (ret->name);
...@@ -871,8 +871,7 @@ load_generic( ...@@ -871,8 +871,7 @@ load_generic(
codeset->byteM = NULL; codeset->byteM = NULL;
break ; break ;
} }
codeset->byteM = codeset->byteM = Xmalloc(
(ByteInfoListRec *)Xmalloc(
(codeset->length)*sizeof(ByteInfoListRec)); (codeset->length)*sizeof(ByteInfoListRec));
if (codeset->byteM == NULL) { if (codeset->byteM == NULL) {
goto err; goto err;
...@@ -884,7 +883,7 @@ load_generic( ...@@ -884,7 +883,7 @@ load_generic(
(codeset->byteM)[M-1].M = M; (codeset->byteM)[M-1].M = M;
(codeset->byteM)[M-1].byteinfo_num = num; (codeset->byteM)[M-1].byteinfo_num = num;
(codeset->byteM)[M-1].byteinfo = (codeset->byteM)[M-1].byteinfo =
(ByteInfo)Xmalloc( num * sizeof(ByteInfoRec)); Xmalloc(num * sizeof(ByteInfoRec));
for (ii = 0 ; ii < num ; ii++) { for (ii = 0 ; ii < num ; ii++) {
tmpb = (codeset->byteM)[M-1].byteinfo ; tmpb = (codeset->byteM)[M-1].byteinfo ;
/* default 0x00 - 0xff */ /* default 0x00 - 0xff */
......
...@@ -534,11 +534,11 @@ create_conv( ...@@ -534,11 +534,11 @@ create_conv(
XlcConv conv; XlcConv conv;
State state; State state;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec)); conv->methods = Xmalloc(sizeof(XlcConvMethodsRec));
if (conv->methods == NULL) if (conv->methods == NULL)
goto err; goto err;
*conv->methods = *methods; *conv->methods = *methods;
......
...@@ -40,11 +40,11 @@ alloc_list( ...@@ -40,11 +40,11 @@ alloc_list(
if (is_wide_char) { if (is_wide_char) {
wchar_t **wstr_list; wchar_t **wstr_list;
wstr_list = (wchar_t **) Xmalloc(count * sizeof(wchar_t *)); wstr_list = Xmalloc(count * sizeof(wchar_t *));
if (wstr_list == NULL) if (wstr_list == NULL)
return (XPointer *) NULL; return (XPointer *) NULL;
*wstr_list = (wchar_t *) Xmalloc(nitems * sizeof(wchar_t)); *wstr_list = Xmalloc(nitems * sizeof(wchar_t));
if (*wstr_list == NULL) { if (*wstr_list == NULL) {
Xfree(wstr_list); Xfree(wstr_list);
return (XPointer *) NULL; return (XPointer *) NULL;
...@@ -54,11 +54,11 @@ alloc_list( ...@@ -54,11 +54,11 @@ alloc_list(
} else { } else {
char **str_list; char **str_list;
str_list = (char **) Xmalloc(count * sizeof(char *)); str_list = Xmalloc(count * sizeof(char *));
if (str_list == NULL) if (str_list == NULL)
return (XPointer *) NULL; return (XPointer *) NULL;
*str_list = (char *) Xmalloc(nitems); *str_list = Xmalloc(nitems);
if (*str_list == NULL) { if (*str_list == NULL) {
Xfree(str_list); Xfree(str_list);
return (XPointer *) NULL; return (XPointer *) NULL;
...@@ -156,7 +156,7 @@ _XTextPropertyToTextList( ...@@ -156,7 +156,7 @@ _XTextPropertyToTextList(
else else
buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1; buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1;
} }
buf = (XPointer) Xmalloc(buf_len); buf = Xmalloc(buf_len);
if (buf == NULL) if (buf == NULL)
return XNoMemory; return XNoMemory;
to = buf; to = buf;
......
...@@ -78,7 +78,7 @@ _XlcCreateLC( ...@@ -78,7 +78,7 @@ _XlcCreateLC(
return (XLCd) NULL; return (XLCd) NULL;
if (lcd->core->name == NULL) { if (lcd->core->name == NULL) {
lcd->core->name = (char*) Xmalloc(strlen(name) + 1); lcd->core->name = Xmalloc(strlen(name) + 1);
if (lcd->core->name == NULL) if (lcd->core->name == NULL)
goto err; goto err;
strcpy(lcd->core->name, name); strcpy(lcd->core->name, name);
......
...@@ -88,7 +88,7 @@ create( ...@@ -88,7 +88,7 @@ create(
if (lcd->core == NULL) if (lcd->core == NULL)
goto err; goto err;
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); new = Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL) if (new == NULL)
goto err; goto err;
memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); memcpy(new,methods,sizeof(XLCdPublicMethodsRec));
......
...@@ -197,7 +197,7 @@ _XrmDefaultInitParseInfo( ...@@ -197,7 +197,7 @@ _XrmDefaultInitParseInfo(
{ {
if (XLC_PUBLIC(lcd, mb_cur_max) == 1) { if (XLC_PUBLIC(lcd, mb_cur_max) == 1) {
/* Unibyte case. */ /* Unibyte case. */
UbState state = (UbState) Xmalloc(sizeof(UbStateRec)); UbState state = Xmalloc(sizeof(UbStateRec));
if (state == NULL) if (state == NULL)
return (XrmMethods) NULL; return (XrmMethods) NULL;
...@@ -207,7 +207,7 @@ _XrmDefaultInitParseInfo( ...@@ -207,7 +207,7 @@ _XrmDefaultInitParseInfo(
return &ub_methods; return &ub_methods;
} else { } else {
/* Multibyte case. */ /* Multibyte case. */
MbState state = (MbState) Xmalloc(sizeof(MbStateRec)); MbState state = Xmalloc(sizeof(MbStateRec));
if (state == NULL) if (state == NULL)
return (XrmMethods) NULL; return (XrmMethods) NULL;
......
...@@ -1431,7 +1431,7 @@ create_conv( ...@@ -1431,7 +1431,7 @@ create_conv(
{ {
XlcConv conv; XlcConv conv;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
......
...@@ -89,7 +89,7 @@ _XTextListToTextProperty( ...@@ -89,7 +89,7 @@ _XTextListToTextProperty(
is_wide_char = True; is_wide_char = True;
buf_len = get_buf_size(is_wide_char, list, count); buf_len = get_buf_size(is_wide_char, list, count);
if ((buf = (char *) Xmalloc(buf_len)) == NULL) if ((buf = Xmalloc(buf_len)) == NULL)
return XNoMemory; return XNoMemory;
switch (style) { switch (style) {
...@@ -194,7 +194,7 @@ retry: ...@@ -194,7 +194,7 @@ retry:
done: done:
if (nitems <= 0) if (nitems <= 0)
nitems = 1; nitems = 1;
value = (char *) Xmalloc(nitems); value = Xmalloc(nitems);
if (value == NULL) { if (value == NULL) {
Xfree(buf); Xfree(buf);
return XNoMemory; return XNoMemory;
......
...@@ -86,7 +86,7 @@ create_conv( ...@@ -86,7 +86,7 @@ create_conv(
{ {
XlcConv conv; XlcConv conv;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = Xmalloc(sizeof(XlcConvRec));
if (conv == (XlcConv) NULL) if (conv == (XlcConv) NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
...@@ -498,7 +498,7 @@ create_tocs_conv( ...@@ -498,7 +498,7 @@ create_tocs_conv(
if (charset_num > all_charsets_count-1) if (charset_num > all_charsets_count-1)
charset_num = all_charsets_count-1; charset_num = all_charsets_count-1;
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) conv = Xmalloc(sizeof(XlcConvRec)
+ (charset_num + 1) * sizeof(Utf8Conv)); + (charset_num + 1) * sizeof(Utf8Conv));
if (conv == (XlcConv) NULL) if (conv == (XlcConv) NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
...@@ -961,7 +961,7 @@ create_ucstocs_conv( ...@@ -961,7 +961,7 @@ create_ucstocs_conv(
lazy_init_all_charsets(); lazy_init_all_charsets();
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv)); conv = Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv));
if (conv == (XlcConv) NULL) if (conv == (XlcConv) NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec));
...@@ -1742,7 +1742,7 @@ create_tofontcs_conv( ...@@ -1742,7 +1742,7 @@ create_tofontcs_conv(
num += count; num += count;
} }
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv)); conv = Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv));
if (conv == (XlcConv) NULL) if (conv == (XlcConv) NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec));
......
...@@ -65,7 +65,7 @@ int main (int argc, char *argv[]) ...@@ -65,7 +65,7 @@ int main (int argc, char *argv[])
if (argc > 3) { if (argc > 3) {
filename = argv[3]; filename = argv[3];
} else { } else {
char* s = (char*) malloc(strlen(c_charsetname)+strlen(".h")+1); char* s = malloc(strlen(c_charsetname)+strlen(".h")+1);
strcpy(s,c_charsetname); strcat(s,".h"); strcpy(s,c_charsetname); strcat(s,".h");
filename = s; filename = s;
} }
...@@ -361,11 +361,11 @@ int main (int argc, char *argv[]) ...@@ -361,11 +361,11 @@ int main (int argc, char *argv[])
if (tables[t].usecount > 1) { if (tables[t].usecount > 1) {
char* s; char* s;
if (p == tables[t].minline >> 5) { if (p == tables[t].minline >> 5) {
s = (char*) malloc(5+1); s = malloc(5+1);
sprintf(s, "%02x_%d", p, ++i); sprintf(s, "%02x_%d", p, ++i);
} else { } else {
p = tables[t].minline >> 5; p = tables[t].minline >> 5;
s = (char*) malloc(2+1); s = malloc(2+1);
sprintf(s, "%02x", p); sprintf(s, "%02x", p);
} }
tables[t].suffix = s; tables[t].suffix = s;
......
...@@ -70,9 +70,9 @@ static void read_table (Encoding* enc) ...@@ -70,9 +70,9 @@ static void read_table (Encoding* enc)
{ {
int row, col, i, i1, i2, c, j; int row, col, i, i1, i2, c, j;
enc->charset2uni = (int**) malloc(enc->rows*sizeof(int*)); enc->charset2uni = malloc(enc->rows*sizeof(int*));
for (row = 0; row < enc->rows; row++) for (row = 0; row < enc->rows; row++)
enc->charset2uni[row] = (int*) malloc(enc->cols*sizeof(int)); enc->charset2uni[row] = malloc(enc->cols*sizeof(int));
for (row = 0; row < enc->rows; row++) for (row = 0; row < enc->rows; row++)
for (col = 0; col < enc->cols; col++) for (col = 0; col < enc->cols; col++)
...@@ -136,7 +136,7 @@ static void find_charset2uni_pages (Encoding* enc) ...@@ -136,7 +136,7 @@ static void find_charset2uni_pages (Encoding* enc)
{ {
int row, col; int row, col;
enc->charsetpage = (int*) malloc((enc->rows+1)*sizeof(int)); enc->charsetpage = malloc((enc->rows+1)*sizeof(int));
for (row = 0; row <= enc->rows; row++) for (row = 0; row <= enc->rows; row++)
enc->charsetpage[row] = 0; enc->charsetpage[row] = 0;
...@@ -157,7 +157,7 @@ static void find_charset2uni_blocks (Encoding* enc) ...@@ -157,7 +157,7 @@ static void find_charset2uni_blocks (Encoding* enc)
{ {
int n, row, lastrow; int n, row, lastrow;
enc->charsetblocks = (Block*) malloc(enc->rows*sizeof(Block)); enc->charsetblocks = malloc(enc->rows*sizeof(Block));
n = 0; n = 0;
for (row = 0; row < enc->rows; row++) for (row = 0; row < enc->rows; row++)
...@@ -266,7 +266,7 @@ static void invert (Encoding* enc) ...@@ -266,7 +266,7 @@ static void invert (Encoding* enc)
{ {
int row, col, j; int row, col, j;
enc->uni2charset = (int*) malloc(0x10000*sizeof(int)); enc->uni2charset = malloc(0x10000*sizeof(int));
for (j = 0; j < 0x10000; j++) for (j = 0; j < 0x10000; j++)
enc->uni2charset[j] = 0; enc->uni2charset[j] = 0;
...@@ -764,9 +764,9 @@ static void read_table_ksc5601 (Encoding* enc) ...@@ -764,9 +764,9 @@ static void read_table_ksc5601 (Encoding* enc)
{ {
int row, col, i, i1, i2, c, j; int row, col, i, i1, i2, c, j;
enc->charset2uni = (int**) malloc(enc->rows*sizeof(int*)); enc->charset2uni = malloc(enc->rows*sizeof(int*));
for (row = 0; row < enc->rows; row++) for (row = 0; row < enc->rows; row++)
enc->charset2uni[row] = (int*) malloc(enc->cols*sizeof(int)); enc->charset2uni[row] = malloc(enc->cols*sizeof(int));
for (row = 0; row < enc->rows; row++) for (row = 0; row < enc->rows; row++)
for (col = 0; col < enc->cols; col++) for (col = 0; col < enc->cols; col++)
......
...@@ -218,7 +218,7 @@ _XlcAddLoader( ...@@ -218,7 +218,7 @@ _XlcAddLoader(
_XlcRemoveLoader(proc); /* remove old loader, if exist */ _XlcRemoveLoader(proc); /* remove old loader, if exist */
loader = (XlcLoaderList) Xmalloc(sizeof(XlcLoaderListRec)); loader = Xmalloc(sizeof(XlcLoaderListRec));
if (loader == NULL) if (loader == NULL)
return False; return False;
...@@ -293,7 +293,7 @@ _XOpenLC( ...@@ -293,7 +293,7 @@ _XOpenLC(
for (loader = loader_list; loader; loader = loader->next) { for (loader = loader_list; loader; loader = loader->next) {
lcd = (*loader->proc)(name); lcd = (*loader->proc)(name);
if (lcd) { if (lcd) {
cur = (XLCdList) Xmalloc (sizeof(XLCdListRec)); cur = Xmalloc (sizeof(XLCdListRec));
if (cur) { if (cur) {
cur->lcd = lcd; cur->lcd = lcd;
cur->ref_count = 1; cur->ref_count = 1;
...@@ -565,7 +565,7 @@ _XlcVaToArgList( ...@@ -565,7 +565,7 @@ _XlcVaToArgList(
{ {
XlcArgList args; XlcArgList args;
*args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count); *args_ret = args = Xmalloc(sizeof(XlcArg) * count);
if (args == (XlcArgList) NULL) if (args == (XlcArgList) NULL)
return; return;
......
...@@ -101,7 +101,7 @@ init_fontdata( ...@@ -101,7 +101,7 @@ init_fontdata(
FontData fd; FontData fd;
int i; int i;
fd = (FontData)Xmalloc(sizeof(FontDataRec) * font_data_count); fd = Xmalloc(sizeof(FontDataRec) * font_data_count);
if(fd == (FontData) NULL) if(fd == (FontData) NULL)
return False; return False;
...@@ -126,7 +126,7 @@ init_vrotate( ...@@ -126,7 +126,7 @@ init_vrotate(
if(type == VROTATE_NONE) if(type == VROTATE_NONE)
return (VRotate)NULL; return (VRotate)NULL;
vrotate = (VRotate)Xmalloc(sizeof(VRotateRec) * font_data_count); vrotate = Xmalloc(sizeof(VRotateRec) * font_data_count);
if(vrotate == (VRotate) NULL) if(vrotate == (VRotate) NULL)
return False; return False;
...@@ -155,7 +155,7 @@ init_fontset( ...@@ -155,7 +155,7 @@ init_fontset(
count = XOM_GENERIC(oc->core.om)->data_num; count = XOM_GENERIC(oc->core.om)->data_num;
data = XOM_GENERIC(oc->core.om)->data; data = XOM_GENERIC(oc->core.om)->data;
font_set = (FontSet) Xmalloc(sizeof(FontSetRec) * count); font_set = Xmalloc(sizeof(FontSetRec) * count);
if (font_set == NULL) if (font_set == NULL)
return False; return False;
memset((char *) font_set, 0x00, sizeof(FontSetRec) * count); memset((char *) font_set, 0x00, sizeof(FontSetRec) * count);
...@@ -463,15 +463,15 @@ init_core_part( ...@@ -463,15 +463,15 @@ init_core_part(
if (count == 0) if (count == 0)
return False; return False;
font_struct_list = (XFontStruct **) Xmalloc(sizeof(XFontStruct *) * count); font_struct_list = Xmalloc(sizeof(XFontStruct *) * count);
if (font_struct_list == NULL) if (font_struct_list == NULL)
return False; return False;
font_name_list = (char **) Xmalloc(sizeof(char *) * count); font_name_list = Xmalloc(sizeof(char *) * count);
if (font_name_list == NULL) if (font_name_list == NULL)
goto err; goto err;
font_name_buf = (char *) Xmalloc(length); font_name_buf = Xmalloc(length);
if (font_name_buf == NULL) if (font_name_buf == NULL)
goto err; goto err;
...@@ -603,7 +603,7 @@ get_rotate_fontname( ...@@ -603,7 +603,7 @@ get_rotate_fontname(
if (len > XLFD_MAX_LEN) if (len > XLFD_MAX_LEN)
goto free_pattern; goto free_pattern;
rotate_font_ptr = (char *)Xmalloc(len + 1); rotate_font_ptr = Xmalloc(len + 1);
if(!rotate_font_ptr) if(!rotate_font_ptr)
goto free_pattern; goto free_pattern;
...@@ -1098,7 +1098,7 @@ parse_vw( ...@@ -1098,7 +1098,7 @@ parse_vw(
Xfree(vrotate); Xfree(vrotate);
if(sub_num > 0) { if(sub_num > 0) {
vrotate = font_set->vrotate = (VRotate)Xmalloc vrotate = font_set->vrotate = Xmalloc
(sizeof(VRotateRec) * sub_num); (sizeof(VRotateRec) * sub_num);
if(font_set->vrotate == (VRotate)NULL) if(font_set->vrotate == (VRotate)NULL)
return (-1); return (-1);
...@@ -1288,12 +1288,12 @@ set_missing_list( ...@@ -1288,12 +1288,12 @@ set_missing_list(
return True; return True;
} }
charset_list = (char **) Xmalloc(sizeof(char *) * count); charset_list = Xmalloc(sizeof(char *) * count);
if (charset_list == NULL) { if (charset_list == NULL) {
return False; return False;
} }
charset_buf = (char *) Xmalloc(length); charset_buf = Xmalloc(length);
if (charset_buf == NULL) { if (charset_buf == NULL) {
Xfree(charset_list); Xfree(charset_list);
return False; return False;
...@@ -1869,9 +1869,9 @@ add_data( ...@@ -1869,9 +1869,9 @@ add_data(
int num; int num;
if ((num = gen->data_num)) if ((num = gen->data_num))
new = (OMData) Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec)); new = Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec));
else else
new = (OMData) Xmalloc(sizeof(OMDataRec)); new = Xmalloc(sizeof(OMDataRec));
if (new == NULL) if (new == NULL)
return NULL; return NULL;
...@@ -1910,7 +1910,7 @@ read_EncodingInfo( ...@@ -1910,7 +1910,7 @@ read_EncodingInfo(
bufptr++ ; bufptr++ ;
} else } else
len = strlen(buf); len = strlen(buf);
font_data->name = (char *) Xmalloc(len + 1); font_data->name = Xmalloc(len + 1);
if (font_data->name == NULL) { if (font_data->name == NULL) {
Xfree(font_data); Xfree(font_data);
return NULL; return NULL;
...@@ -2019,7 +2019,7 @@ init_om( ...@@ -2019,7 +2019,7 @@ init_om(
if (data == NULL) if (data == NULL)
return False; return False;
charset_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet) * count); charset_list = Xmalloc(sizeof(XlcCharSet) * count);
if (charset_list == NULL) if (charset_list == NULL)
return False; return False;
data->charset_list = charset_list; data->charset_list = charset_list;
...@@ -2033,7 +2033,7 @@ init_om( ...@@ -2033,7 +2033,7 @@ init_om(
if( count > 0){ if( count > 0){
UDCArea udc; UDCArea udc;
int i,flag = 0; int i,flag = 0;
udc = (UDCArea)Xmalloc(count * sizeof(UDCAreaRec)); udc = Xmalloc(count * sizeof(UDCAreaRec));
if (udc == NULL) if (udc == NULL)
return False; return False;
for(i=0;i<count;i++){ for(i=0;i<count;i++){
...@@ -2093,7 +2093,7 @@ init_om( ...@@ -2093,7 +2093,7 @@ init_om(
} }
/* required charset list */ /* required charset list */
required_list = (char **) Xmalloc(sizeof(char *) * gen->data_num); required_list = Xmalloc(sizeof(char *) * gen->data_num);
if (required_list == NULL) if (required_list == NULL)
return False; return False;
...@@ -2104,7 +2104,7 @@ init_om( ...@@ -2104,7 +2104,7 @@ init_om(
data = gen->data; data = gen->data;
if (count > 0) { if (count > 0) {
bufptr = (char *) Xmalloc(length); bufptr = Xmalloc(length);
if (bufptr == NULL) { if (bufptr == NULL) {
Xfree(required_list); Xfree(required_list);
return False; return False;
...@@ -2118,7 +2118,7 @@ init_om( ...@@ -2118,7 +2118,7 @@ init_om(
} }
/* orientation list */ /* orientation list */
orientation = (XOrientation *) Xmalloc(sizeof(XOrientation) * 2); orientation = Xmalloc(sizeof(XOrientation) * 2);
if (orientation == NULL) if (orientation == NULL)
return False; return False;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment