From c161df4fee61819a28089682963cc2e721ca22c8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 10 Aug 2013 23:51:08 -0700 Subject: Remove even more casts of return values from Xmalloc/Xrealloc Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/CCC.c | 4 +-- nx-X11/lib/X11/CvCols.c | 2 +- nx-X11/lib/X11/ICWrap.c | 2 +- nx-X11/lib/X11/IdOfPr.c | 2 +- nx-X11/lib/X11/SetGetCols.c | 2 +- nx-X11/lib/X11/StCols.c | 2 +- nx-X11/lib/X11/XDefaultIMIF.c | 12 ++++---- nx-X11/lib/X11/XDefaultOMIF.c | 18 +++++------ nx-X11/lib/X11/XlcDL.c | 3 +- nx-X11/lib/X11/cmsCmap.c | 4 +-- nx-X11/lib/X11/cmsColNm.c | 8 ++--- nx-X11/lib/X11/cmsInt.c | 9 +++--- nx-X11/lib/X11/imCallbk.c | 17 +++++------ nx-X11/lib/X11/imDefIc.c | 52 ++++++++++++++++---------------- nx-X11/lib/X11/imDefIm.c | 36 +++++++++++----------- nx-X11/lib/X11/imDefLkup.c | 16 +++++----- nx-X11/lib/X11/imDispch.c | 2 +- nx-X11/lib/X11/imExten.c | 6 ++-- nx-X11/lib/X11/imInsClbk.c | 2 +- nx-X11/lib/X11/imInt.c | 4 +-- nx-X11/lib/X11/imLcIc.c | 2 +- nx-X11/lib/X11/imRm.c | 12 ++++---- nx-X11/lib/X11/imRmAttr.c | 12 ++++---- nx-X11/lib/X11/imThaiIc.c | 10 +++--- nx-X11/lib/X11/imTrX.c | 2 +- nx-X11/lib/X11/imTrans.c | 2 +- nx-X11/lib/X11/imTransR.c | 8 ++--- nx-X11/lib/X11/lcCT.c | 6 ++-- nx-X11/lib/X11/lcCharSet.c | 6 ++-- nx-X11/lib/X11/lcConv.c | 6 ++-- nx-X11/lib/X11/lcDB.c | 14 ++++----- nx-X11/lib/X11/lcDefConv.c | 4 +-- nx-X11/lib/X11/lcEuc.c | 2 +- nx-X11/lib/X11/lcGenConv.c | 4 +-- nx-X11/lib/X11/lcGeneric.c | 31 +++++++++---------- nx-X11/lib/X11/lcJis.c | 4 +-- nx-X11/lib/X11/lcPrTxt.c | 10 +++--- nx-X11/lib/X11/lcPubWrap.c | 2 +- nx-X11/lib/X11/lcPublic.c | 2 +- nx-X11/lib/X11/lcRM.c | 4 +-- nx-X11/lib/X11/lcSjis.c | 2 +- nx-X11/lib/X11/lcTxtPr.c | 4 +-- nx-X11/lib/X11/lcUTF8.c | 8 ++--- nx-X11/lib/X11/lcUniConv/8bit_tab_to_h.c | 6 ++-- nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c | 14 ++++----- nx-X11/lib/X11/lcWrap.c | 6 ++-- nx-X11/lib/X11/omGeneric.c | 36 +++++++++++----------- 47 files changed, 209 insertions(+), 213 deletions(-) (limited to 'nx-X11/lib/X11') diff --git a/nx-X11/lib/X11/CCC.c b/nx-X11/lib/X11/CCC.c index 090b1078c..da8b661dc 100644 --- a/nx-X11/lib/X11/CCC.c +++ b/nx-X11/lib/X11/CCC.c @@ -111,7 +111,7 @@ XcmsCreateCCC( XcmsPerScrnInfo *pNewScrnInfo; if (pDefaultCCC == NULL || - !(newccc = (XcmsCCC) Xcalloc(1, (unsigned) sizeof(XcmsCCCRec)))) { + !(newccc = Xcalloc(1, (unsigned) sizeof(XcmsCCCRec)))) { return(NULL); } @@ -144,7 +144,7 @@ XcmsCreateCCC( * If one exists replace the pPerScrnInfo. */ if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) { - if (!(pNewScrnInfo = (XcmsPerScrnInfo *) + if (!(pNewScrnInfo = Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) { Xfree(newccc); return(NULL); diff --git a/nx-X11/lib/X11/CvCols.c b/nx-X11/lib/X11/CvCols.c index ed3582663..f543f277b 100644 --- a/nx-X11/lib/X11/CvCols.c +++ b/nx-X11/lib/X11/CvCols.c @@ -796,7 +796,7 @@ XcmsConvertColors( * Make copy of array of color specifications */ if (nColors > 1) { - pColors_tmp = (XcmsColor *) Xmalloc(nColors * sizeof(XcmsColor)); + pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); } else { pColors_tmp = &Color1; } diff --git a/nx-X11/lib/X11/ICWrap.c b/nx-X11/lib/X11/ICWrap.c index 1eacfa5f1..8584e36a7 100644 --- a/nx-X11/lib/X11/ICWrap.c +++ b/nx-X11/lib/X11/ICWrap.c @@ -128,7 +128,7 @@ _XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return) return; } - args = (XIMArg *)Xmalloc((unsigned)(max_count + 1) * sizeof(XIMArg)); + args = Xmalloc((unsigned)(max_count + 1) * sizeof(XIMArg)); *args_return = args; if (!args) return; diff --git a/nx-X11/lib/X11/IdOfPr.c b/nx-X11/lib/X11/IdOfPr.c index 3a92e0a11..e15f34fec 100644 --- a/nx-X11/lib/X11/IdOfPr.c +++ b/nx-X11/lib/X11/IdOfPr.c @@ -67,7 +67,7 @@ XcmsFormatOfPrefix(char *prefix) * While copying prefix to string_lowered, convert to lowercase */ if ((len = strlen(prefix)) >= sizeof(string_buf)) { - string_lowered = (char *) Xmalloc(len+1); + string_lowered = Xmalloc(len+1); } else { string_lowered = string_buf; } diff --git a/nx-X11/lib/X11/SetGetCols.c b/nx-X11/lib/X11/SetGetCols.c index 9b548dbb2..fc3708585 100644 --- a/nx-X11/lib/X11/SetGetCols.c +++ b/nx-X11/lib/X11/SetGetCols.c @@ -237,7 +237,7 @@ _XcmsSetGetColors( /* * Allocate space for XColors */ - if ((pXColors_in_out = (XColor *)Xcalloc(nColors, sizeof(XColor))) == + if ((pXColors_in_out = Xcalloc(nColors, sizeof(XColor))) == NULL) { return(XcmsFailure); } diff --git a/nx-X11/lib/X11/StCols.c b/nx-X11/lib/X11/StCols.c index 24ccd386f..95fd6eeba 100644 --- a/nx-X11/lib/X11/StCols.c +++ b/nx-X11/lib/X11/StCols.c @@ -85,7 +85,7 @@ XcmsStoreColors( * overwrite the contents. */ if (nColors > 1) { - pColors_tmp = (XcmsColor *) Xmalloc(nColors * sizeof(XcmsColor)); + pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); } else { pColors_tmp = &Color1; } diff --git a/nx-X11/lib/X11/XDefaultIMIF.c b/nx-X11/lib/X11/XDefaultIMIF.c index e97d2f444..db0f5d1fa 100644 --- a/nx-X11/lib/X11/XDefaultIMIF.c +++ b/nx-X11/lib/X11/XDefaultIMIF.c @@ -184,10 +184,10 @@ _XDefaultOpenIM( return((XIM)NULL); } - if ((im = (StaticXIM)Xmalloc(sizeof(StaticXIMRec))) == (StaticXIM)NULL) { + if ((im = Xmalloc(sizeof(StaticXIMRec))) == (StaticXIM)NULL) { return((XIM)NULL); } - if ((local_impart = (XIMStaticXIMRec*)Xmalloc(sizeof(XIMStaticXIMRec))) + if ((local_impart = Xmalloc(sizeof(XIMStaticXIMRec))) == (XIMStaticXIMRec *)NULL) { Xfree(im); return((XIM)NULL); @@ -273,11 +273,11 @@ _GetIMValues( for (p = values; p->name != NULL; p++) { if (strcmp(p->name, XNQueryInputStyle) == 0) { - styles = (XIMStyles *)Xmalloc(sizeof(XIMStyles)); + styles = Xmalloc(sizeof(XIMStyles)); *(XIMStyles **)p->value = styles; styles->count_styles = 1; styles->supported_styles = - (XIMStyle*)Xmalloc(styles->count_styles * sizeof(XIMStyle)); + Xmalloc(styles->count_styles * sizeof(XIMStyle)); styles->supported_styles[0] = (XIMPreeditNone | XIMStatusNone); } else { break; @@ -344,7 +344,7 @@ _CreateIC(XIM im, XIMArg *arg) { XIC ic; - if ((ic = (XIC)Xmalloc(sizeof(XICRec))) == (XIC)NULL) { + if ((ic = Xmalloc(sizeof(XICRec))) == (XIC)NULL) { return ((XIC)NULL); } memset(ic, 0, sizeof(XICRec)); @@ -452,7 +452,7 @@ _WcLookupString( XComposeStatus NotSupportedYet ; int length; /* 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); diff --git a/nx-X11/lib/X11/XDefaultOMIF.c b/nx-X11/lib/X11/XDefaultOMIF.c index a8faa2af1..71dc810eb 100644 --- a/nx-X11/lib/X11/XDefaultOMIF.c +++ b/nx-X11/lib/X11/XDefaultOMIF.c @@ -76,7 +76,7 @@ Sun Microsystems, Inc. or its licensors is granted. #define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen) #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) typedef struct _FontDataRec { @@ -332,15 +332,15 @@ init_core_part( if (count == 0) return False; - font_struct_list = (XFontStruct **) Xmalloc(sizeof(XFontStruct *)); + font_struct_list = Xmalloc(sizeof(XFontStruct *)); if (font_struct_list == NULL) return False; - font_name_list = (char **) Xmalloc(sizeof(char *)); + font_name_list = Xmalloc(sizeof(char *)); if (font_name_list == NULL) goto err; - font_name_buf = (char *) Xmalloc(length); + font_name_buf = Xmalloc(length); if (font_name_buf == NULL) goto err; @@ -578,11 +578,11 @@ set_missing_list( if (count == 0) return True; - charset_list = (char **) Xmalloc(sizeof(char *)); + charset_list = Xmalloc(sizeof(char *)); if (charset_list == NULL) return False; - charset_buf = (char *) Xmalloc(length); + charset_buf = Xmalloc(length); if (charset_buf == NULL) { Xfree(charset_list); return False; @@ -1172,11 +1172,11 @@ init_om( length += strlen(data->font_data->name) + 1; /* required charset list */ - required_list = (char **) Xmalloc(sizeof(char *)); + required_list = Xmalloc(sizeof(char *)); if (required_list == NULL) return False; - bufptr = (char *) Xmalloc(length); + bufptr = Xmalloc(length); if (bufptr == NULL) { Xfree(required_list); return False; @@ -1192,7 +1192,7 @@ init_om( bufptr += strlen(bufptr) + 1; /* orientation list */ - orientation = (XOrientation *) Xmalloc(sizeof(XOrientation)); + orientation = Xmalloc(sizeof(XOrientation)); if (orientation == NULL) return False; diff --git a/nx-X11/lib/X11/XlcDL.c b/nx-X11/lib/X11/XlcDL.c index 18fb3e3b1..a23603865 100644 --- a/nx-X11/lib/X11/XlcDL.c +++ b/nx-X11/lib/X11/XlcDL.c @@ -185,8 +185,7 @@ resolve_object(char *path, const char *lc_name) 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; } snprintf(filename, sizeof(filename), "%s/%s", path, "XI18N_OBJS"); diff --git a/nx-X11/lib/X11/cmsCmap.c b/nx-X11/lib/X11/cmsCmap.c index 00816ce03..45843e3b8 100644 --- a/nx-X11/lib/X11/cmsCmap.c +++ b/nx-X11/lib/X11/cmsCmap.c @@ -250,7 +250,7 @@ _XcmsAddCmapRec( { XcmsCmapRec *pNew; - if ((pNew = (XcmsCmapRec *) Xcalloc(1, (unsigned) sizeof(XcmsCmapRec))) + if ((pNew = Xcalloc(1, (unsigned) sizeof(XcmsCmapRec))) == NULL) { return((XcmsCmapRec *)NULL); } @@ -301,7 +301,7 @@ _XcmsCopyCmapRecAndFree( pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID, pRec_src->visual); 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, sizeof(XcmsCCCRec)); } diff --git a/nx-X11/lib/X11/cmsColNm.c b/nx-X11/lib/X11/cmsColNm.c index a56141021..bd5c253fe 100644 --- a/nx-X11/lib/X11/cmsColNm.c +++ b/nx-X11/lib/X11/cmsColNm.c @@ -209,7 +209,7 @@ _XcmsParseColorString( * While copying color_string to string_lowered, convert to lowercase */ if ((len = strlen(color_string)) >= sizeof(string_buf)) { - string_lowered = (char *) Xmalloc(len+1); + string_lowered = Xmalloc(len+1); } else { string_lowered = string_buf; } @@ -418,7 +418,7 @@ _XcmsLookupColorName( Retry: if ((len = strlen(tmpName)) > 63) { - name_lowered = (char *) Xmalloc(len+1); + name_lowered = Xmalloc(len+1); } else { name_lowered = name_lowered_64; } @@ -760,8 +760,8 @@ LoadColornameDB(void) } rewind(stream); - strings = (char *) Xmalloc(size); - pairs = (XcmsPair *)Xcalloc(nEntries, sizeof(XcmsPair)); + strings = Xmalloc(size); + pairs = Xcalloc(nEntries, sizeof(XcmsPair)); ReadColornameDB(stream, pairs, strings); (void) fclose(stream); diff --git a/nx-X11/lib/X11/cmsInt.c b/nx-X11/lib/X11/cmsInt.c index b7c321472..cefa1e680 100644 --- a/nx-X11/lib/X11/cmsInt.c +++ b/nx-X11/lib/X11/cmsInt.c @@ -82,7 +82,7 @@ _XcmsCopyPointerArray( for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); 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, (unsigned)(n * sizeof(XPointer))); } @@ -141,7 +141,7 @@ _XcmsPushPointerArray( /* add 2: 1 for the new pointer and another for the NULL pointer */ n += 2; - if ((newArray = (XPointer *)Xmalloc(n * sizeof(XPointer)))) { + if ((newArray = Xmalloc(n * sizeof(XPointer)))) { memcpy((char *)(newArray+1),(char *)pap, (unsigned)((n-1) * sizeof(XPointer))); *newArray = p; @@ -183,8 +183,7 @@ _XcmsInitDefaultCCCs( * Create an array of XcmsCCC structures, one for each screen. * They serve as the screen's default CCC. */ - if (!(ccc = (XcmsCCC) - Xcalloc((unsigned)nScrn, (unsigned) sizeof(XcmsCCCRec)))) { + if (!(ccc = Xcalloc((unsigned)nScrn, (unsigned) sizeof(XcmsCCCRec)))) { return(0); } dpy->cms.defaultCCCs = (XPointer)ccc; @@ -322,7 +321,7 @@ _XcmsInitScrnInfo( * for the latter (see XcmsCreateCCC). The ones created * here are referenced by the default CCC. */ - if (!(defaultccc->pPerScrnInfo = (XcmsPerScrnInfo *) + if (!(defaultccc->pPerScrnInfo = Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) { return(0); } diff --git a/nx-X11/lib/X11/imCallbk.c b/nx-X11/lib/X11/imCallbk.c index f57a8de31..edffac173 100644 --- a/nx-X11/lib/X11/imCallbk.c +++ b/nx-X11/lib/X11/imCallbk.c @@ -230,9 +230,9 @@ _XimCbDispatch(Xim xim, /* queue the protocol */ 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 (proto_len > 0) memcpy(proto_buf, proto, proto_len); @@ -339,7 +339,7 @@ _XimStrConversionCallback(Xim im, 2 + length_in_bytes + XIM_PAD(2 + length_in_bytes) + 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); buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */ @@ -461,12 +461,12 @@ _read_text_from_packet(Xim im, return; } - *text_ptr = text = (XIMText*)Xmalloc(sizeof(XIMText)); + *text_ptr = text = Xmalloc(sizeof(XIMText)); if (text == (XIMText*)NULL) return; tmp_len = (int)*(CARD16*)buf; buf += sz_CARD16; - if ((tmp_buf = (char*)Xmalloc(tmp_len + 1))) { + if ((tmp_buf = Xmalloc(tmp_len + 1))) { memcpy(tmp_buf, buf, tmp_len); tmp_buf[tmp_len] = '\0'; @@ -477,11 +477,10 @@ _read_text_from_packet(Xim im, if (s != XLookupNone) { #ifndef NO_DEC_I18N_FIX /* Allow for NULL-terminated */ - if ((text->string.multi_byte = - (char*)Xmalloc(text->length * + if ((text->string.multi_byte = Xmalloc(text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1))) { #else - if (text->string.multi_byte = (char*)Xmalloc(text->length+1)) { + if (text->string.multi_byte = Xmalloc(text->length+1)) { #endif int tmp; #ifndef NO_DEC_I18N_FIX @@ -530,7 +529,7 @@ _read_text_from_packet(Xim im, i = (int)*(CARD16*)buf; buf += sz_CARD16; buf += sz_CARD16; /* skip `unused' */ - text->feedback = (XIMFeedback*)Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32))); + text->feedback = Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32))); j = 0; while (i > 0) { text->feedback[j] = (XIMFeedback)*(CARD32*)buf; diff --git a/nx-X11/lib/X11/imDefIc.c b/nx-X11/lib/X11/imDefIc.c index 3b5fa4147..a5b14ec9a 100644 --- a/nx-X11/lib/X11/imDefIc.c +++ b/nx-X11/lib/X11/imDefIc.c @@ -108,7 +108,7 @@ _XimReCreateIC(ic) XPointer preply; int ret_code; - if (!(save_ic = (Xic)Xmalloc(sizeof(XicRec)))) + if (!(save_ic = Xmalloc(sizeof(XicRec)))) return False; memcpy((char *)save_ic, (char *)ic, sizeof(XicRec)); @@ -120,7 +120,7 @@ _XimReCreateIC(ic) num = im->core.ic_num_resources; buf_size = sizeof(XIMResource) * num; - if (!(res = (XIMResourceList)Xmalloc(buf_size))) + if (!(res = Xmalloc(buf_size))) goto ErrorOnReCreateIC; (void)memcpy((char *)res, (char *)im->core.ic_resources, buf_size); ic->private.proto.ic_resources = res; @@ -128,7 +128,7 @@ _XimReCreateIC(ic) num = im->private.proto.ic_num_inner_resources; buf_size = sizeof(XIMResource) * num; - if (!(res = (XIMResourceList)Xmalloc(buf_size))) + if (!(res = Xmalloc(buf_size))) goto ErrorOnReCreateIC; (void)memcpy((char *)res, (char *)im->private.proto.ic_inner_resources, buf_size); @@ -164,13 +164,13 @@ _XimReCreateIC(ic) buf_size += ret_len; if (buf == tmp_buf) { - if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { + if (!(tmp = Xmalloc(buf_size + data_len))) { goto ErrorOnReCreateIC; } memcpy(tmp, buf, buf_size); buf = tmp; } else { - if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); goto ErrorOnReCreateIC; } @@ -203,7 +203,7 @@ _XimReCreateIC(ic) preply = reply; } else { buf_size = (int)len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimCreateICCheck, 0); if (ret_code != XIM_TRUE) { @@ -351,7 +351,7 @@ _XimProtoGetICValues( + sizeof(INT16) + XIM_PAD(2 + buf_size); - if (!(buf = (CARD8 *)Xmalloc(buf_size))) + if (!(buf = Xmalloc(buf_size))) return arg->name; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; @@ -385,7 +385,7 @@ _XimProtoGetICValues( preply = reply; } else { buf_size = (int)len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimGetICValuesCheck, (XPointer)ic); if (ret_code != XIM_TRUE) { @@ -465,7 +465,7 @@ _XimCheckNestedQuarkList(quark_list, idx, num_quark, arg, separator) quark, separator)) { continue; } - if (!(tmp = (XrmQuark *)Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) { + if (!(tmp = Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) { *quark_list = q_list; *num_quark = n_quark; return False; @@ -535,7 +535,7 @@ _XimSaveICValues(ic, arg) for (pp = (XIMArg *)p->value, nn = 0; pp && pp->name; pp++, nn++); - if (!(tmp = (XrmQuark *)Xrealloc(quark_list, + if (!(tmp = Xrealloc(quark_list, (sizeof(XrmQuark) * (num_quark + nn + 2))))) { ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = num_quark; @@ -562,7 +562,7 @@ _XimSaveICValues(ic, arg) if (_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { continue; } - if (!(tmp = (XrmQuark *)Xrealloc(quark_list, + if (!(tmp = Xrealloc(quark_list, (sizeof(XrmQuark) * (num_quark + 1))))) { ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = num_quark; @@ -589,7 +589,7 @@ _XimSaveICValues(ic, arg) } } - if (!(quark_list = (XrmQuark *)Xmalloc(sizeof(XrmQuark) * n))) { + if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { return False; } @@ -731,13 +731,13 @@ _XimProtoSetICValues( buf_size += ret_len; if (buf == tmp_buf) { - if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { + if (!(tmp = Xmalloc(buf_size + data_len))) { return tmp_name; } memcpy(tmp, buf, buf_size); buf = tmp; } else { - if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); return tmp_name; } @@ -781,7 +781,7 @@ _XimProtoSetICValues( preply = reply; } else if (ret_code == XIM_OVERFLOW) { buf_size = (int)len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimSetICValuesCheck, (XPointer)ic); if (ret_code != XIM_TRUE) { @@ -915,7 +915,7 @@ _XimProtoDestroyIC( _XimDestroyICCheck, (XPointer)ic); if (ret_code == XIM_OVERFLOW) { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); (void)_XimRead(im, &len, preply, buf_size, _XimDestroyICCheck, (XPointer)ic); Xfree(preply); @@ -1088,7 +1088,7 @@ _XimProtoReset( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimResetICCheck, (XPointer)ic); if (ret_code != XIM_TRUE) { @@ -1139,7 +1139,7 @@ _XimCommitedMbString( if ( len == 0 ) return( NULL ); - if (!(commit = (char *)Xmalloc(len + 1))) + if (!(commit = Xmalloc(len + 1))) goto Error_On_Reset; str = commit; @@ -1196,7 +1196,7 @@ _XimCommitedWcString( if ( len == 0 ) return( (wchar_t *)NULL ); - if (!(commit = (char *)Xmalloc(len + 1))) + if (!(commit = Xmalloc(len + 1))) goto Error_On_Reset; str = commit; @@ -1255,7 +1255,7 @@ _XimCommitedUtf8String( if ( len == 0 ) return( NULL ); - if (!(commit = (char *)Xmalloc(len + 1))) + if (!(commit = Xmalloc(len + 1))) goto Error_On_Reset; str = commit; @@ -1368,7 +1368,7 @@ _XimReconnectModeCreateIC(ic) num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; - if (!(res = (XIMResourceList)Xmalloc(len))) + if (!(res = Xmalloc(len))) return False; (void)memcpy((char *)res, (char *)im->core.ic_resources, len); ic->private.proto.ic_resources = res; @@ -1430,7 +1430,7 @@ _XimProtoCreateIC( num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; - if (!(res = (XIMResourceList)Xmalloc(len))) + if (!(res = Xmalloc(len))) goto ErrorOnCreatingIC; (void)memcpy((char *)res, (char *)im->core.ic_resources, len); ic->private.proto.ic_resources = res; @@ -1458,7 +1458,7 @@ _XimProtoCreateIC( num = im->private.proto.ic_num_inner_resources; len = sizeof(XIMResource) * num; - if (!(res = (XIMResourceList)Xmalloc(len))) + if (!(res = Xmalloc(len))) goto ErrorOnCreatingIC; (void)memcpy((char *)res, (char *)im->private.proto.ic_inner_resources, len); @@ -1492,13 +1492,13 @@ _XimProtoCreateIC( buf_size += ret_len; if (buf == tmp_buf) { - if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { + if (!(tmp = Xmalloc(buf_size + data_len))) { goto ErrorOnCreatingIC; } memcpy(tmp, buf, buf_size); buf = tmp; } else { - if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); goto ErrorOnCreatingIC; } @@ -1538,7 +1538,7 @@ _XimProtoCreateIC( preply = reply; } else { buf_size = (int)len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimCreateICCheck, 0); if (ret_code != XIM_TRUE) { diff --git a/nx-X11/lib/X11/imDefIm.c b/nx-X11/lib/X11/imDefIm.c index 5f65b5312..ce2856bb2 100644 --- a/nx-X11/lib/X11/imDefIm.c +++ b/nx-X11/lib/X11/imDefIm.c @@ -616,7 +616,7 @@ _XimConnection( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0); if(ret_code != XIM_TRUE) { Xfree(preply); @@ -759,7 +759,7 @@ _XimDisconnect( if(ret_code == XIM_OVERFLOW) { if(len > 0) { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimDisconnectCheck, 0); Xfree(preply); @@ -831,7 +831,7 @@ _XimOpen( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimOpenCheck, 0); if(ret_code != XIM_TRUE) { @@ -950,7 +950,7 @@ _XimClose( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); @@ -1173,7 +1173,7 @@ _XimSaveIMValues( if (_XimCheckIMQuarkList(quark_list, num_quark, quark)) { continue; } - if (!(tmp = (XrmQuark *)Xrealloc(quark_list, + if (!(tmp = Xrealloc(quark_list, (sizeof(XrmQuark) * (num_quark + 1))))) { im->private.proto.saved_imvalues = quark_list; im->private.proto.num_saved_imvalues = num_quark; @@ -1190,7 +1190,7 @@ _XimSaveIMValues( 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; } @@ -1311,13 +1311,13 @@ _XimProtoSetIMValues( buf_size += ret_len; if (buf == tmp_buf) { - if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { + if (!(tmp = Xmalloc(buf_size + data_len))) { return arg->name; } memcpy(tmp, buf, buf_size); buf = tmp; } else { - if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); return arg->name; } @@ -1353,7 +1353,7 @@ _XimProtoSetIMValues( preply = reply; } else { buf_size = (int)len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, reply, buf_size, _XimSetIMValuesCheck, 0); if(ret_code != XIM_TRUE) { @@ -1462,7 +1462,7 @@ _XimProtoGetIMValues( + sizeof(INT16) + XIM_PAD(buf_size); - if (!(buf = (CARD8 *)Xmalloc(buf_size))) + if (!(buf = Xmalloc(buf_size))) return arg->name; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; @@ -1494,7 +1494,7 @@ _XimProtoGetIMValues( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimGetIMValuesCheck, 0); if(ret_code != XIM_TRUE) { @@ -1556,7 +1556,7 @@ _XimSetEncodingByName( encoding_len = strlen(encoding); compound_len = strlen("COMPOUND_TEXT"); *len = encoding_len + sizeof(BYTE) + compound_len + sizeof(BYTE); - if (!(ret = (BYTE *)Xmalloc(*len))) { + if (!(ret = Xmalloc(*len))) { return False; } *buf = (char *)ret; @@ -1724,7 +1724,7 @@ _XimEncodingNegotiation( + sizeof(CARD16) + detail_len; - if (!(buf = (CARD8 *)Xmalloc(XIM_HEADER_SIZE + len))) + if (!(buf = Xmalloc(XIM_HEADER_SIZE + len))) goto free_detail_ptr; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; @@ -1757,7 +1757,7 @@ _XimEncodingNegotiation( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimEncodingNegoCheck, 0); if(ret_code != XIM_TRUE) @@ -1844,13 +1844,13 @@ _XimSendSavedIMValues( buf_size += ret_len; if (buf == tmp_buf) { - if (!(tmp = (char *)Xmalloc(buf_size + data_len))) { + if (!(tmp = Xmalloc(buf_size + data_len))) { return False; } memcpy(tmp, buf, buf_size); buf = tmp; } else { - if (!(tmp = (char *)Xrealloc(buf, (buf_size + data_len)))) { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); return False; } @@ -1885,7 +1885,7 @@ _XimSendSavedIMValues( preply = reply; } else { buf_size = (int)len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, reply, buf_size, _XimSetIMValuesCheck, 0); if(ret_code != XIM_TRUE) { @@ -1938,7 +1938,7 @@ _XimConnectServer( { Xim save_im; - if (!(save_im = (Xim)Xmalloc(sizeof(XimRec)))) + if (!(save_im = Xmalloc(sizeof(XimRec)))) return False; memcpy((char *)save_im, (char *)im, sizeof(XimRec)); diff --git a/nx-X11/lib/X11/imDefLkup.c b/nx-X11/lib/X11/imDefLkup.c index 3317831e6..1cbd15b54 100644 --- a/nx-X11/lib/X11/imDefLkup.c +++ b/nx-X11/lib/X11/imDefLkup.c @@ -162,7 +162,7 @@ _XimSync( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -302,7 +302,7 @@ _XimForwardEventCore( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -417,7 +417,7 @@ _XimRegisterTriggerkey( len = buf_l[0]; /* 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); return False; } @@ -434,7 +434,7 @@ _XimRegisterTriggerkey( len = buf_l[0]; /* 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); return False; } @@ -546,7 +546,7 @@ _XimTriggerNotify( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(len); + preply = Xmalloc(len); ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimTriggerNotifyCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -579,7 +579,7 @@ _XimRegCommitInfo( { XimCommitInfo info; - if (!(info = (XimCommitInfo)Xmalloc(sizeof(XimCommitInfoRec)))) + if (!(info = Xmalloc(sizeof(XimCommitInfoRec)))) return False; info->string = string; info->string_len = string_len; @@ -626,7 +626,7 @@ _XimProcKeySym( { 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); return False; } @@ -648,7 +648,7 @@ _XimProcCommit( Xim im = (Xim)ic->core.im; char *string; - if (!(string = (char *)Xmalloc(len + 1))) { + if (!(string = Xmalloc(len + 1))) { _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } diff --git a/nx-X11/lib/X11/imDispch.c b/nx-X11/lib/X11/imDispch.c index 888e2fd4b..862a9b651 100644 --- a/nx-X11/lib/X11/imDispch.c +++ b/nx-X11/lib/X11/imDispch.c @@ -49,7 +49,7 @@ _XimRegProtoIntrCallback( { XimProtoIntrRec *rec; - if (!(rec = (XimProtoIntrRec *)Xmalloc(sizeof(XimProtoIntrRec)))) + if (!(rec = Xmalloc(sizeof(XimProtoIntrRec)))) return False; rec->func = proc; rec->major_code = major_code; diff --git a/nx-X11/lib/X11/imExten.c b/nx-X11/lib/X11/imExten.c index 779cead0b..7ed4c6be9 100644 --- a/nx-X11/lib/X11/imExten.c +++ b/nx-X11/lib/X11/imExten.c @@ -271,7 +271,7 @@ _XimExtForwardKeyEvent( preply = reply; } else { buf_sizex = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimExtForwardKeyEventCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { @@ -436,7 +436,7 @@ _XimExtension( + len + XIM_PAD(len); - if (!(buf = (CARD8 *)Xmalloc(buf_len))) + if (!(buf = Xmalloc(buf_len))) return False; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; @@ -465,7 +465,7 @@ _XimExtension( preply = reply; } else { buf_size = len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, reply, buf_size, _XimQueryExtensionCheck, 0); if(ret_code != XIM_TRUE) { diff --git a/nx-X11/lib/X11/imInsClbk.c b/nx-X11/lib/X11/imInsClbk.c index 47a56c508..3ae6b1bd7 100644 --- a/nx-X11/lib/X11/imInsClbk.c +++ b/nx-X11/lib/X11/imInsClbk.c @@ -168,7 +168,7 @@ _XimRegisterIMInstantiateCallback( if( lock ) return( False ); - icb = (XimInstCallback)Xmalloc(sizeof(XimInstCallbackRec)); + icb = Xmalloc(sizeof(XimInstCallbackRec)); if( !icb ) return( False ); icb->call = icb->destroy = False; diff --git a/nx-X11/lib/X11/imInt.c b/nx-X11/lib/X11/imInt.c index e6929207a..dcfb476d9 100644 --- a/nx-X11/lib/X11/imInt.c +++ b/nx-X11/lib/X11/imInt.c @@ -48,7 +48,7 @@ _XimSetIMStructureList( Xim *xim; if(!(_XimCurrentIMlist)) { - if(!(_XimCurrentIMlist = (Xim *)Xmalloc(sizeof(Xim)))) + if(!(_XimCurrentIMlist = Xmalloc(sizeof(Xim)))) return False; _XimCurrentIMlist[0] = im; _XimCurrentIMcount = 1; @@ -61,7 +61,7 @@ _XimSetIMStructureList( } } if(i >= _XimCurrentIMcount) { - if(!(xim = (Xim *)Xrealloc(_XimCurrentIMlist, + if(!(xim = Xrealloc(_XimCurrentIMlist, ((i + 1) * sizeof(Xim))))) return False; _XimCurrentIMlist = xim; diff --git a/nx-X11/lib/X11/imLcIc.c b/nx-X11/lib/X11/imLcIc.c index 46323061e..7ab9050c1 100644 --- a/nx-X11/lib/X11/imLcIc.c +++ b/nx-X11/lib/X11/imLcIc.c @@ -158,7 +158,7 @@ _XimLocalCreateIC( num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; - if((res = (XIMResourceList)Xmalloc(len)) == (XIMResourceList)NULL) { + if((res = Xmalloc(len)) == (XIMResourceList)NULL) { goto Set_Error; } (void)memcpy((char *)res, (char *)im->core.ic_resources, len); diff --git a/nx-X11/lib/X11/imRm.c b/nx-X11/lib/X11/imRm.c index d46500ac7..373217173 100644 --- a/nx-X11/lib/X11/imRm.c +++ b/nx-X11/lib/X11/imRm.c @@ -207,7 +207,7 @@ _XimSetProtoResource(im) if(!status_style) 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_class != res_class_buf) Xfree (res_class); return; @@ -902,7 +902,7 @@ _XimEncodeHotKey( } len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; - if(!(tmp = (XPointer)Xmalloc(len))) { + if(!(tmp = Xmalloc(len))) { return False; } @@ -1159,7 +1159,7 @@ _XimDecodeCallback( XIMCallback *callback; in = (XIMCallback *)((char *)top + info->offset); - if(!(callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback)))) { + if(!(callback = Xmalloc(sizeof(XIMCallback)))) { return False; } callback->client_data = in->client_data; @@ -1272,7 +1272,7 @@ _XimDecodeHotKey( in = *((XIMHotKeyTriggers **)((char *)top + info->offset)); num = in->num_hot_key; len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; - if(!(tmp = (XPointer)Xmalloc(len))) { + if(!(tmp = Xmalloc(len))) { return False; } @@ -1312,7 +1312,7 @@ _XimDecodeRectangle( XRectangle *rect; in = (XRectangle *)((char *)top + info->offset); - if(!(rect = (XRectangle *)Xmalloc(sizeof(XRectangle)))) { + if(!(rect = Xmalloc(sizeof(XRectangle)))) { return False; } *rect = *in; @@ -1330,7 +1330,7 @@ _XimDecodeSpot( XPoint *spot; in = (XPoint *)((char *)top + info->offset); - if(!(spot = (XPoint *)Xmalloc(sizeof(XPoint)))) { + if(!(spot = Xmalloc(sizeof(XPoint)))) { return False; } *spot = *in; diff --git a/nx-X11/lib/X11/imRmAttr.c b/nx-X11/lib/X11/imRmAttr.c index ef3ac2ca7..ad5290ee5 100644 --- a/nx-X11/lib/X11/imRmAttr.c +++ b/nx-X11/lib/X11/imRmAttr.c @@ -238,7 +238,7 @@ _XimAttributeToValue( if (!(value)) return False; - if (!(str = (char *)Xmalloc(data_len + 1))) + if (!(str = Xmalloc(data_len + 1))) return False; (void)memcpy(str, (char *)data, data_len); @@ -262,7 +262,7 @@ _XimAttributeToValue( return False; alloc_len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; - if (!(p = (char *)Xmalloc(alloc_len))) + if (!(p = Xmalloc(alloc_len))) return False; rep = (XIMStyles *)p; @@ -284,7 +284,7 @@ _XimAttributeToValue( if (!(value)) return False; - if (!(rep = (XRectangle *)Xmalloc(sizeof(XRectangle)))) + if (!(rep = Xmalloc(sizeof(XRectangle)))) return False; rep->x = data[0]; @@ -302,7 +302,7 @@ _XimAttributeToValue( if (!(value)) return False; - if (!(rep = (XPoint *)Xmalloc(sizeof(XPoint)))) + if (!(rep = Xmalloc(sizeof(XPoint)))) return False; rep->x = data[0]; @@ -325,7 +325,7 @@ _XimAttributeToValue( if (!ic) return False; - if (!(base_name = (char *)Xmalloc(len + 1))) + if (!(base_name = Xmalloc(len + 1))) return False; (void)strncpy(base_name, (char *)&data[1], (int)len); @@ -370,7 +370,7 @@ _XimAttributeToValue( alloc_len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; - if (!(p = (char *)Xmalloc(alloc_len))) + if (!(p = Xmalloc(alloc_len))) return False; rep = (XIMHotKeyTriggers *)p; diff --git a/nx-X11/lib/X11/imThaiIc.c b/nx-X11/lib/X11/imThaiIc.c index 4211038e3..002219920 100644 --- a/nx-X11/lib/X11/imThaiIc.c +++ b/nx-X11/lib/X11/imThaiIc.c @@ -165,13 +165,13 @@ _XimThaiCreateIC( ic->core.im = im; 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; - if (! (ic->private.local.base.mb = (char *)Xmalloc(21)) ) + if (! (ic->private.local.base.mb = Xmalloc(21)) ) 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; - if (! (ic->private.local.base.utf8 = (char *)Xmalloc(21)) ) + if (! (ic->private.local.base.utf8 = Xmalloc(21)) ) goto Set_Error; ic->private.local.context = 1; tree[1].mb = 1; @@ -188,7 +188,7 @@ _XimThaiCreateIC( num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; - if((res = (XIMResourceList)Xmalloc(len)) == (XIMResourceList)NULL) { + if((res = Xmalloc(len)) == (XIMResourceList)NULL) { goto Set_Error; } (void)memcpy((char *)res, (char *)im->core.ic_resources, len); diff --git a/nx-X11/lib/X11/imTrX.c b/nx-X11/lib/X11/imTrX.c index 6b1d61f2d..148b7fc90 100644 --- a/nx-X11/lib/X11/imTrX.c +++ b/nx-X11/lib/X11/imTrX.c @@ -71,7 +71,7 @@ _XimXRegisterDispatcher( XIntrCallbackPtr rec; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - if (!(rec = (XIntrCallbackPtr)Xmalloc(sizeof(XIntrCallbackRec)))) + if (!(rec = Xmalloc(sizeof(XIntrCallbackRec)))) return False; rec->func = callback; diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index 3cea659f9..7f936cff6 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -153,7 +153,7 @@ _XimTransRegisterDispatcher( TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransIntrCallbackPtr rec; - if (!(rec = (TransIntrCallbackPtr)Xmalloc(sizeof(TransIntrCallbackRec)))) + if (!(rec = Xmalloc(sizeof(TransIntrCallbackRec)))) return False; rec->func = callback; diff --git a/nx-X11/lib/X11/imTransR.c b/nx-X11/lib/X11/imTransR.c index caa530904..50b549e71 100644 --- a/nx-X11/lib/X11/imTransR.c +++ b/nx-X11/lib/X11/imTransR.c @@ -138,7 +138,7 @@ _XimReadData( data_len -= i; if (data_len) { - if (!(tmp = (char *)Xmalloc(data_len))) { + if (!(tmp = Xmalloc(data_len))) { return XIM_FALSE; } memcpy(tmp, &hold_buf[i], data_len); @@ -173,7 +173,7 @@ _XimReadData( } if (packet_size > buf_size) { - if (!(tmp = (char *)Xmalloc(data_len))) { + if (!(tmp = Xmalloc(data_len))) { return XIM_FALSE; } memcpy(tmp, buf, data_len); @@ -200,7 +200,7 @@ _XimReadData( data_len -= i; if (data_len) { - if (!(tmp = (char *)Xmalloc(data_len))) { + if (!(tmp = Xmalloc(data_len))) { return XIM_FALSE; } memcpy(tmp, &buf[i], data_len); @@ -283,7 +283,7 @@ _XimFilterWaitEvent(Xim im) preply = reply; } else { buf_size = (int)read_len; - preply = (XPointer)Xmalloc(buf_size); + preply = Xmalloc(buf_size); ret_code = _XimReadData(im, &read_len, preply, buf_size); if(ret_code != XIM_TRUE) { if (preply != reply) diff --git a/nx-X11/lib/X11/lcCT.c b/nx-X11/lib/X11/lcCT.c index 317e3999f..ee3c76878 100644 --- a/nx-X11/lib/X11/lcCT.c +++ b/nx-X11/lib/X11/lcCT.c @@ -478,7 +478,7 @@ _XlcAddCT( /* Allocate a CTinfo record. */ length = strlen(ct_sequence); - ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec) + length+1); + ct_info = Xmalloc(sizeof(CTInfoRec) + length+1); if (ct_info == NULL) return charset; @@ -514,7 +514,7 @@ _XlcAddCT( Xfree(ct_info); return charset; } - p = (char *) Xmalloc(n+1); + p = Xmalloc(n+1); if (p == NULL) { Xfree(ct_info); return charset; @@ -1169,7 +1169,7 @@ create_conv( { XlcConv conv; - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec)); + conv = Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec)); if (conv == NULL) return (XlcConv) NULL; diff --git a/nx-X11/lib/X11/lcCharSet.c b/nx-X11/lib/X11/lcCharSet.c index 5d287811c..57f13d501 100644 --- a/nx-X11/lib/X11/lcCharSet.c +++ b/nx-X11/lib/X11/lcCharSet.c @@ -92,7 +92,7 @@ _XlcAddCharSet( if (_XlcGetCharSet(charset->name)) return False; - list = (XlcCharSetList) Xmalloc(sizeof(XlcCharSetListRec)); + list = Xmalloc(sizeof(XlcCharSetListRec)); if (list == NULL) return False; @@ -184,7 +184,7 @@ _XlcCreateDefaultCharSet( ct_sequence_len = strlen(ct_sequence); /* 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) { Xfree((char *) charset); return (XlcCharSet) NULL; @@ -196,7 +196,7 @@ _XlcCreateDefaultCharSet( /* Fill in encoding_name and xrm_encoding_name. */ if ((colon = strchr(charset->name, ':')) != NULL) { unsigned int length = colon - charset->name; - char *encoding_tmp = (char *) Xmalloc(length + 1); + char *encoding_tmp = Xmalloc(length + 1); if (encoding_tmp == NULL) { Xfree((char *) charset->name); Xfree((char *) charset); diff --git a/nx-X11/lib/X11/lcConv.c b/nx-X11/lib/X11/lcConv.c index 9797e7ed3..0a8a67752 100644 --- a/nx-X11/lib/X11/lcConv.c +++ b/nx-X11/lib/X11/lcConv.c @@ -101,7 +101,7 @@ _XlcSetConverter( } } - list = (XlcConverterList) Xmalloc(sizeof(XlcConverterListRec)); + list = Xmalloc(sizeof(XlcConverterListRec)); if (list == NULL) return False; @@ -250,13 +250,13 @@ open_indirect_converter( to_type == QChar) return (XlcConv) NULL; - lc_conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); + lc_conv = Xmalloc(sizeof(XlcConvRec)); if (lc_conv == NULL) return (XlcConv) NULL; 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) goto err; diff --git a/nx-X11/lib/X11/lcDB.c b/nx-X11/lib/X11/lcDB.c index cb509d273..66250a023 100644 --- a/nx-X11/lib/X11/lcDB.c +++ b/nx-X11/lib/X11/lcDB.c @@ -165,7 +165,7 @@ init_parse_info (void) int size; if (!allocated) { bzero(&parse_info, sizeof(DBParseInfo)); - parse_info.buf = (char *)Xmalloc(BUFSIZE); + parse_info.buf = Xmalloc(BUFSIZE); parse_info.bufMaxSize = BUFSIZE; allocated = 1; return; @@ -248,9 +248,9 @@ realloc_line( char *str = line->str; if (str != NULL) { - str = (char *)Xrealloc(str, size); + str = Xrealloc(str, size); } else { - str = (char *)Xmalloc(size); + str = Xmalloc(size); } if (str == NULL) { /* malloc error */ @@ -486,7 +486,7 @@ append_value_list (void) } if (value_list == (char **)NULL) { - value_list = (char **)Xmalloc(sizeof(char *) * 2); + value_list = Xmalloc(sizeof(char *) * 2); *value_list = NULL; } else { char **prev_list = value_list; @@ -502,11 +502,11 @@ append_value_list (void) value = *value_list; if (value == NULL) { - value = (char *)Xmalloc(value_len + len + 1); + value = Xmalloc(value_len + len + 1); } else { char *prev_value = value; - value = (char *)Xrealloc(value, value_len + len + 1); + value = Xrealloc(value, value_len + len + 1); if (value == NULL) { Xfree(prev_value); } @@ -1314,7 +1314,7 @@ _XlcCreateLocaleDataBase( lc_db[i].db = p; } - new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec)); + new = Xmalloc(sizeof(XlcDatabaseListRec)); if (new == (XlcDatabaseList)NULL) { goto err; } diff --git a/nx-X11/lib/X11/lcDefConv.c b/nx-X11/lib/X11/lcDefConv.c index 12a48615e..a17d358a6 100644 --- a/nx-X11/lib/X11/lcDefConv.c +++ b/nx-X11/lib/X11/lcDefConv.c @@ -577,11 +577,11 @@ create_conv( XlcConv conv; State state; - conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec)); + conv = Xcalloc(1, sizeof(XlcConvRec)); if (conv == NULL) return (XlcConv) NULL; - state = (State) Xmalloc(sizeof(StateRec)); + state = Xmalloc(sizeof(StateRec)); if (state == NULL) { close_converter(conv); return (XlcConv) NULL; diff --git a/nx-X11/lib/X11/lcEuc.c b/nx-X11/lib/X11/lcEuc.c index 442e3090f..6917a0443 100644 --- a/nx-X11/lib/X11/lcEuc.c +++ b/nx-X11/lib/X11/lcEuc.c @@ -671,7 +671,7 @@ create_conv( { XlcConv conv; - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); + conv = Xmalloc(sizeof(XlcConvRec)); if (conv == NULL) return (XlcConv) NULL; diff --git a/nx-X11/lib/X11/lcGenConv.c b/nx-X11/lib/X11/lcGenConv.c index 96904afa3..4edc1250d 100644 --- a/nx-X11/lib/X11/lcGenConv.c +++ b/nx-X11/lib/X11/lcGenConv.c @@ -2619,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; diff --git a/nx-X11/lib/X11/lcGeneric.c b/nx-X11/lib/X11/lcGeneric.c index f604fe23d..20c455c13 100644 --- a/nx-X11/lib/X11/lcGeneric.c +++ b/nx-X11/lib/X11/lcGeneric.c @@ -68,7 +68,7 @@ create( if (lcd->core == NULL) goto err; - new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); + new = Xmalloc(sizeof(XLCdPublicMethodsRec)); if (new == NULL) goto err; memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); @@ -156,10 +156,10 @@ add_charset( int num; if ((num = codeset->num_charsets)) - new_list = (XlcCharSet *) Xrealloc(codeset->charset_list, + new_list = Xrealloc(codeset->charset_list, (num + 1) * sizeof(XlcCharSet)); else - new_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet)); + new_list = Xmalloc(sizeof(XlcCharSet)); if (new_list == NULL) return False; @@ -183,10 +183,10 @@ add_codeset( return NULL; if ((num = gen->codeset_num)) - new_list = (CodeSet *) Xrealloc(gen->codeset_list, + new_list = Xrealloc(gen->codeset_list, (num + 1) * sizeof(CodeSet)); else - new_list = (CodeSet *) Xmalloc(sizeof(CodeSet)); + new_list = Xmalloc(sizeof(CodeSet)); if (new_list == NULL) goto err; @@ -230,10 +230,10 @@ add_parse_list( } 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)); else { - new_list = (ParseInfo *) Xmalloc(2 * sizeof(ParseInfo)); + new_list = Xmalloc(2 * sizeof(ParseInfo)); } if (new_list == NULL) @@ -351,7 +351,7 @@ _XlcParse_scopemaps( const char *str_sc; num = count_scopemap(str); - scope = (FontScope) Xmalloc(num * sizeof(FontScopeRec)); + scope = Xmalloc(num * sizeof(FontScopeRec)); if (scope == NULL) return NULL; @@ -504,7 +504,7 @@ read_charset_define( Xfree(charsetd->ct_sequence); } */ - tmp = (char *)Xmalloc(strlen(value[0])+1); + tmp = Xmalloc(strlen(value[0])+1); if (tmp == NULL) return; charsetd->ct_sequence = tmp; @@ -536,10 +536,10 @@ add_conversion( int num; if ((num = gen->segment_conv_num) > 0) { - new_list = (SegConv) Xrealloc(gen->segment_conv, + new_list = Xrealloc(gen->segment_conv, (num + 1) * sizeof(SegConvRec)); } else { - new_list = (SegConv) Xmalloc(sizeof(SegConvRec)); + new_list = Xmalloc(sizeof(SegConvRec)); } if (new_list == NULL) @@ -638,7 +638,7 @@ create_ctextseg( size_t cset_len; int i,new; FontScope scope; - ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec)); + ret = Xmalloc(sizeof(ExtdSegmentRec)); if (ret == NULL) return NULL; ret->name = strdup(value[0]); @@ -668,7 +668,7 @@ create_ctextseg( ret->side = XlcGLGR; strcpy(cset_name,ret->name); } - ret->area = (FontScope)Xmalloc((num - 1)*sizeof(FontScopeRec)); + ret->area = Xmalloc((num - 1)*sizeof(FontScopeRec)); if (ret->area == NULL) { Xfree (cset_name); Xfree (ret->name); @@ -871,8 +871,7 @@ load_generic( codeset->byteM = NULL; break ; } - codeset->byteM = - (ByteInfoListRec *)Xmalloc( + codeset->byteM = Xmalloc( (codeset->length)*sizeof(ByteInfoListRec)); if (codeset->byteM == NULL) { goto err; @@ -884,7 +883,7 @@ load_generic( (codeset->byteM)[M-1].M = M; (codeset->byteM)[M-1].byteinfo_num = num; (codeset->byteM)[M-1].byteinfo = - (ByteInfo)Xmalloc( num * sizeof(ByteInfoRec)); + Xmalloc(num * sizeof(ByteInfoRec)); for (ii = 0 ; ii < num ; ii++) { tmpb = (codeset->byteM)[M-1].byteinfo ; /* default 0x00 - 0xff */ diff --git a/nx-X11/lib/X11/lcJis.c b/nx-X11/lib/X11/lcJis.c index 551862d9b..dc2822ed9 100644 --- a/nx-X11/lib/X11/lcJis.c +++ b/nx-X11/lib/X11/lcJis.c @@ -534,11 +534,11 @@ create_conv( XlcConv conv; State state; - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); + conv = Xmalloc(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; diff --git a/nx-X11/lib/X11/lcPrTxt.c b/nx-X11/lib/X11/lcPrTxt.c index b86fb7f5e..2ed7d8515 100644 --- a/nx-X11/lib/X11/lcPrTxt.c +++ b/nx-X11/lib/X11/lcPrTxt.c @@ -40,11 +40,11 @@ alloc_list( if (is_wide_char) { wchar_t **wstr_list; - wstr_list = (wchar_t **) Xmalloc(count * sizeof(wchar_t *)); + wstr_list = Xmalloc(count * sizeof(wchar_t *)); if (wstr_list == NULL) return (XPointer *) NULL; - *wstr_list = (wchar_t *) Xmalloc(nitems * sizeof(wchar_t)); + *wstr_list = Xmalloc(nitems * sizeof(wchar_t)); if (*wstr_list == NULL) { Xfree(wstr_list); return (XPointer *) NULL; @@ -54,11 +54,11 @@ alloc_list( } else { char **str_list; - str_list = (char **) Xmalloc(count * sizeof(char *)); + str_list = Xmalloc(count * sizeof(char *)); if (str_list == NULL) return (XPointer *) NULL; - *str_list = (char *) Xmalloc(nitems); + *str_list = Xmalloc(nitems); if (*str_list == NULL) { Xfree(str_list); return (XPointer *) NULL; @@ -156,7 +156,7 @@ _XTextPropertyToTextList( else buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1; } - buf = (XPointer) Xmalloc(buf_len); + buf = Xmalloc(buf_len); if (buf == NULL) return XNoMemory; to = buf; diff --git a/nx-X11/lib/X11/lcPubWrap.c b/nx-X11/lib/X11/lcPubWrap.c index 2a5ac08d8..d1096d570 100644 --- a/nx-X11/lib/X11/lcPubWrap.c +++ b/nx-X11/lib/X11/lcPubWrap.c @@ -78,7 +78,7 @@ _XlcCreateLC( return (XLCd) 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) goto err; strcpy(lcd->core->name, name); diff --git a/nx-X11/lib/X11/lcPublic.c b/nx-X11/lib/X11/lcPublic.c index 4b26710b2..39ec0829b 100644 --- a/nx-X11/lib/X11/lcPublic.c +++ b/nx-X11/lib/X11/lcPublic.c @@ -88,7 +88,7 @@ create( if (lcd->core == NULL) goto err; - new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); + new = Xmalloc(sizeof(XLCdPublicMethodsRec)); if (new == NULL) goto err; memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); diff --git a/nx-X11/lib/X11/lcRM.c b/nx-X11/lib/X11/lcRM.c index 9f72504ee..aec93a2a3 100644 --- a/nx-X11/lib/X11/lcRM.c +++ b/nx-X11/lib/X11/lcRM.c @@ -197,7 +197,7 @@ _XrmDefaultInitParseInfo( { if (XLC_PUBLIC(lcd, mb_cur_max) == 1) { /* Unibyte case. */ - UbState state = (UbState) Xmalloc(sizeof(UbStateRec)); + UbState state = Xmalloc(sizeof(UbStateRec)); if (state == NULL) return (XrmMethods) NULL; @@ -207,7 +207,7 @@ _XrmDefaultInitParseInfo( return &ub_methods; } else { /* Multibyte case. */ - MbState state = (MbState) Xmalloc(sizeof(MbStateRec)); + MbState state = Xmalloc(sizeof(MbStateRec)); if (state == NULL) return (XrmMethods) NULL; diff --git a/nx-X11/lib/X11/lcSjis.c b/nx-X11/lib/X11/lcSjis.c index 74dd033ec..eb5e4cad1 100644 --- a/nx-X11/lib/X11/lcSjis.c +++ b/nx-X11/lib/X11/lcSjis.c @@ -1431,7 +1431,7 @@ create_conv( { XlcConv conv; - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); + conv = Xmalloc(sizeof(XlcConvRec)); if (conv == NULL) return (XlcConv) NULL; diff --git a/nx-X11/lib/X11/lcTxtPr.c b/nx-X11/lib/X11/lcTxtPr.c index e980f0168..cf25e3d0e 100644 --- a/nx-X11/lib/X11/lcTxtPr.c +++ b/nx-X11/lib/X11/lcTxtPr.c @@ -89,7 +89,7 @@ _XTextListToTextProperty( is_wide_char = True; 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; switch (style) { @@ -194,7 +194,7 @@ retry: done: if (nitems <= 0) nitems = 1; - value = (char *) Xmalloc(nitems); + value = Xmalloc(nitems); if (value == NULL) { Xfree(buf); return XNoMemory; diff --git a/nx-X11/lib/X11/lcUTF8.c b/nx-X11/lib/X11/lcUTF8.c index 84d87772f..f9739c10a 100644 --- a/nx-X11/lib/X11/lcUTF8.c +++ b/nx-X11/lib/X11/lcUTF8.c @@ -86,7 +86,7 @@ create_conv( { XlcConv conv; - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); + conv = Xmalloc(sizeof(XlcConvRec)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; @@ -498,7 +498,7 @@ create_tocs_conv( if (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)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; @@ -961,7 +961,7 @@ create_ucstocs_conv( lazy_init_all_charsets(); - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv)); + conv = Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); @@ -1742,7 +1742,7 @@ create_tofontcs_conv( num += count; } - conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv)); + conv = Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); diff --git a/nx-X11/lib/X11/lcUniConv/8bit_tab_to_h.c b/nx-X11/lib/X11/lcUniConv/8bit_tab_to_h.c index 1caa28a21..993979aeb 100644 --- a/nx-X11/lib/X11/lcUniConv/8bit_tab_to_h.c +++ b/nx-X11/lib/X11/lcUniConv/8bit_tab_to_h.c @@ -65,7 +65,7 @@ int main (int argc, char *argv[]) if (argc > 3) { filename = argv[3]; } 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"); filename = s; } @@ -361,11 +361,11 @@ int main (int argc, char *argv[]) if (tables[t].usecount > 1) { char* s; if (p == tables[t].minline >> 5) { - s = (char*) malloc(5+1); + s = malloc(5+1); sprintf(s, "%02x_%d", p, ++i); } else { p = tables[t].minline >> 5; - s = (char*) malloc(2+1); + s = malloc(2+1); sprintf(s, "%02x", p); } tables[t].suffix = s; diff --git a/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c b/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c index 6934789cf..f70fe5e11 100644 --- a/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c +++ b/nx-X11/lib/X11/lcUniConv/cjk_tab_to_h.c @@ -70,9 +70,9 @@ static void read_table (Encoding* enc) { 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++) - 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 (col = 0; col < enc->cols; col++) @@ -136,7 +136,7 @@ static void find_charset2uni_pages (Encoding* enc) { 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++) enc->charsetpage[row] = 0; @@ -157,7 +157,7 @@ static void find_charset2uni_blocks (Encoding* enc) { int n, row, lastrow; - enc->charsetblocks = (Block*) malloc(enc->rows*sizeof(Block)); + enc->charsetblocks = malloc(enc->rows*sizeof(Block)); n = 0; for (row = 0; row < enc->rows; row++) @@ -266,7 +266,7 @@ static void invert (Encoding* enc) { int row, col, j; - enc->uni2charset = (int*) malloc(0x10000*sizeof(int)); + enc->uni2charset = malloc(0x10000*sizeof(int)); for (j = 0; j < 0x10000; j++) enc->uni2charset[j] = 0; @@ -764,9 +764,9 @@ static void read_table_ksc5601 (Encoding* enc) { 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++) - 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 (col = 0; col < enc->cols; col++) diff --git a/nx-X11/lib/X11/lcWrap.c b/nx-X11/lib/X11/lcWrap.c index 358748fdc..b71de7abb 100644 --- a/nx-X11/lib/X11/lcWrap.c +++ b/nx-X11/lib/X11/lcWrap.c @@ -218,7 +218,7 @@ _XlcAddLoader( _XlcRemoveLoader(proc); /* remove old loader, if exist */ - loader = (XlcLoaderList) Xmalloc(sizeof(XlcLoaderListRec)); + loader = Xmalloc(sizeof(XlcLoaderListRec)); if (loader == NULL) return False; @@ -293,7 +293,7 @@ _XOpenLC( for (loader = loader_list; loader; loader = loader->next) { lcd = (*loader->proc)(name); if (lcd) { - cur = (XLCdList) Xmalloc (sizeof(XLCdListRec)); + cur = Xmalloc (sizeof(XLCdListRec)); if (cur) { cur->lcd = lcd; cur->ref_count = 1; @@ -565,7 +565,7 @@ _XlcVaToArgList( { XlcArgList args; - *args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count); + *args_ret = args = Xmalloc(sizeof(XlcArg) * count); if (args == (XlcArgList) NULL) return; diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c index 2c5e8dd06..24d5a902e 100644 --- a/nx-X11/lib/X11/omGeneric.c +++ b/nx-X11/lib/X11/omGeneric.c @@ -101,7 +101,7 @@ init_fontdata( FontData fd; int i; - fd = (FontData)Xmalloc(sizeof(FontDataRec) * font_data_count); + fd = Xmalloc(sizeof(FontDataRec) * font_data_count); if(fd == (FontData) NULL) return False; @@ -126,7 +126,7 @@ init_vrotate( if(type == VROTATE_NONE) return (VRotate)NULL; - vrotate = (VRotate)Xmalloc(sizeof(VRotateRec) * font_data_count); + vrotate = Xmalloc(sizeof(VRotateRec) * font_data_count); if(vrotate == (VRotate) NULL) return False; @@ -155,7 +155,7 @@ init_fontset( count = XOM_GENERIC(oc->core.om)->data_num; data = XOM_GENERIC(oc->core.om)->data; - font_set = (FontSet) Xmalloc(sizeof(FontSetRec) * count); + font_set = Xmalloc(sizeof(FontSetRec) * count); if (font_set == NULL) return False; memset((char *) font_set, 0x00, sizeof(FontSetRec) * count); @@ -463,15 +463,15 @@ init_core_part( if (count == 0) return False; - font_struct_list = (XFontStruct **) Xmalloc(sizeof(XFontStruct *) * count); + font_struct_list = Xmalloc(sizeof(XFontStruct *) * count); if (font_struct_list == NULL) return False; - font_name_list = (char **) Xmalloc(sizeof(char *) * count); + font_name_list = Xmalloc(sizeof(char *) * count); if (font_name_list == NULL) goto err; - font_name_buf = (char *) Xmalloc(length); + font_name_buf = Xmalloc(length); if (font_name_buf == NULL) goto err; @@ -603,7 +603,7 @@ get_rotate_fontname( if (len > XLFD_MAX_LEN) goto free_pattern; - rotate_font_ptr = (char *)Xmalloc(len + 1); + rotate_font_ptr = Xmalloc(len + 1); if(!rotate_font_ptr) goto free_pattern; @@ -1098,7 +1098,7 @@ parse_vw( Xfree(vrotate); if(sub_num > 0) { - vrotate = font_set->vrotate = (VRotate)Xmalloc + vrotate = font_set->vrotate = Xmalloc (sizeof(VRotateRec) * sub_num); if(font_set->vrotate == (VRotate)NULL) return (-1); @@ -1288,12 +1288,12 @@ set_missing_list( return True; } - charset_list = (char **) Xmalloc(sizeof(char *) * count); + charset_list = Xmalloc(sizeof(char *) * count); if (charset_list == NULL) { return False; } - charset_buf = (char *) Xmalloc(length); + charset_buf = Xmalloc(length); if (charset_buf == NULL) { Xfree(charset_list); return False; @@ -1869,9 +1869,9 @@ add_data( int num; if ((num = gen->data_num)) - new = (OMData) Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec)); + new = Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec)); else - new = (OMData) Xmalloc(sizeof(OMDataRec)); + new = Xmalloc(sizeof(OMDataRec)); if (new == NULL) return NULL; @@ -1910,7 +1910,7 @@ read_EncodingInfo( bufptr++ ; } else len = strlen(buf); - font_data->name = (char *) Xmalloc(len + 1); + font_data->name = Xmalloc(len + 1); if (font_data->name == NULL) { Xfree(font_data); return NULL; @@ -2019,7 +2019,7 @@ init_om( if (data == NULL) return False; - charset_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet) * count); + charset_list = Xmalloc(sizeof(XlcCharSet) * count); if (charset_list == NULL) return False; data->charset_list = charset_list; @@ -2033,7 +2033,7 @@ init_om( if( count > 0){ UDCArea udc; int i,flag = 0; - udc = (UDCArea)Xmalloc(count * sizeof(UDCAreaRec)); + udc = Xmalloc(count * sizeof(UDCAreaRec)); if (udc == NULL) return False; for(i=0;idata_num); + required_list = Xmalloc(sizeof(char *) * gen->data_num); if (required_list == NULL) return False; @@ -2104,7 +2104,7 @@ init_om( data = gen->data; if (count > 0) { - bufptr = (char *) Xmalloc(length); + bufptr = Xmalloc(length); if (bufptr == NULL) { Xfree(required_list); return False; @@ -2118,7 +2118,7 @@ init_om( } /* orientation list */ - orientation = (XOrientation *) Xmalloc(sizeof(XOrientation) * 2); + orientation = Xmalloc(sizeof(XOrientation) * 2); if (orientation == NULL) return False; -- cgit v1.2.3