diff options
author | marha <marha@users.sourceforge.net> | 2011-04-27 06:58:32 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-04-27 06:58:32 +0000 |
commit | 96d6df5da9cddedf4931bf8e17f96e242467c661 (patch) | |
tree | 07977c913b04e80b7dbd302e7a5890422aeacb1b /libX11/modules/im/ximcp/imRm.c | |
parent | 71372d36e1a3f0230b88808f70d35446fda12260 (diff) | |
download | vcxsrv-96d6df5da9cddedf4931bf8e17f96e242467c661.tar.gz vcxsrv-96d6df5da9cddedf4931bf8e17f96e242467c661.tar.bz2 vcxsrv-96d6df5da9cddedf4931bf8e17f96e242467c661.zip |
xserver libX11 libxtrans mesa pixman xkeyboard-config git update 27 Apr 2011
Diffstat (limited to 'libX11/modules/im/ximcp/imRm.c')
-rw-r--r-- | libX11/modules/im/ximcp/imRm.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/libX11/modules/im/ximcp/imRm.c b/libX11/modules/im/ximcp/imRm.c index 3d09b8136..da1207ca1 100644 --- a/libX11/modules/im/ximcp/imRm.c +++ b/libX11/modules/im/ximcp/imRm.c @@ -360,10 +360,9 @@ _XimDefaultStyles( n = XIMNumber(supported_local_styles) - 1; len = sizeof(XIMStyles) + sizeof(XIMStyle) * n; - if(!(tmp = (XPointer)Xmalloc(len))) { + if(!(tmp = Xcalloc(1, len))) { return False; } - bzero(tmp, len); styles = (XIMStyles *)tmp; if (n > 0) { @@ -396,10 +395,9 @@ _XimDefaultIMValues( n = XIMNumber(supported_local_im_values_list); len = sizeof(XIMValuesList) + sizeof(char **) * n; - if(!(tmp = (XPointer)Xmalloc(len))) { + if(!(tmp = Xcalloc(1, len))) { return False; } - bzero(tmp, len); values_list = (XIMValuesList *)tmp; if (n > 0) { @@ -433,10 +431,9 @@ _XimDefaultICValues( n = XIMNumber(supported_local_ic_values_list); len = sizeof(XIMValuesList) + sizeof(char **) * n; - if(!(tmp = (XPointer)Xmalloc(len))) { + if(!(tmp = Xcalloc(1, len))) { return False; } - bzero(tmp, len); values_list = (XIMValuesList *)tmp; if (n > 0) { @@ -796,19 +793,15 @@ _XimEncodeString( XPointer top, XPointer val) { - int len; char *string; char **out; if(val == (XPointer)NULL) { return False; } - len = strlen((char *)val); - if(!(string = (char *)Xmalloc(len + 1))) { + if (!(string = strdup((char *)val))) { return False; } - (void)strcpy(string, (char *)val); - string[len] = '\0'; out = (char **)((char *)top + info->offset); if(*out) { @@ -1085,10 +1078,9 @@ _XimDecodeStyles( num = styles->count_styles; len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; - if(!(tmp = (XPointer)Xmalloc(len))) { + if(!(tmp = Xcalloc(1, len))) { return False; } - bzero(tmp, len); out = (XIMStyles *)tmp; if(num >0) { @@ -1124,10 +1116,9 @@ _XimDecodeValues( num = values_list->count_values; len = sizeof(XIMValuesList) + sizeof(char **) * num; - if(!(tmp = (char *)Xmalloc(len))) { + if(!(tmp = Xcalloc(1, len))) { return False; } - bzero(tmp, len); out = (XIMValuesList *)tmp; if(num) { @@ -1168,21 +1159,18 @@ _XimDecodeString( XPointer top, XPointer val) { - int len = 0; char *in; char *string; in = *((char **)((char *)top + info->offset)); - if(in != (char *)NULL) { - len = strlen(in); + if (in != NULL) { + string = strdup(in); + } else { + string = Xcalloc(1, 1); /* strdup("") */ } - if(!(string = (char *)Xmalloc(len + 1))) { + if (string == NULL) { return False; } - if(in != (char *)NULL) { - (void)strcpy(string, in); - } - string[len] = '\0'; *((char **)val) = string; return True; } @@ -2143,10 +2131,9 @@ _XimSetResourceList( XIMResourceList res; len = sizeof(XIMResource) * num_resource; - if(!(res = (XIMResourceList)Xmalloc(len))) { + if(!(res = Xcalloc(1, len))) { return False; } - bzero((char *)res, len); for(i = 0; i < num_resource; i++, id++) { res[i] = resource[i]; |