[PATCH/libX11] Return name instead of value in XGetIMValues() and XSetIMValues()

Jeremy Huddleston jeremyhu at apple.com
Mon Oct 10 14:00:54 PDT 2011


The src changes look right, but I'm wondering if this is a documentation bug rather than an implementation bug.  Is anyone relying on the current (undocumented) behavior?


On Oct 9, 2011, at 08:56, Yann Droneaud wrote:

> As stated in man page (XOpenIM) and Xlib documentation (chapter 13.5.3),
> XGetIMValues() and XSetImValues() "returns the name of the first argument
> that could not be obtained."
> 
> But currently,
> 
>  err = XGetIMValues(im, "invalid", &arg, NULL);
> 
> returns &arg instead of "invalid".
> 
> This patch fixes https://bugs.freedesktop.org/show_bug.cgi?id=12897
> 
> Signed-off-by: Yann Droneaud <yann at droneaud.fr>
> ---
> modules/im/ximcp/imRm.c |   12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/modules/im/ximcp/imRm.c b/modules/im/ximcp/imRm.c
> index da1207c..53b2458 100644
> --- a/modules/im/ximcp/imRm.c
> +++ b/modules/im/ximcp/imRm.c
> @@ -2250,17 +2250,17 @@ _XimSetIMValueData(
> 
>     for(p = values; p->name != NULL; p++) {
> 	if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) {
> -	    return p->value;
> +	    return p->name;
> 	}
> 	check = _XimCheckIMMode(res, XIM_SETIMVALUES);
> 	if(check == XIM_CHECK_INVALID) {
> 	    continue;
> 	} else if (check == XIM_CHECK_ERROR) {
> -	    return p->value;
> +	    return p->name;
> 	}
> 
> 	if(!_XimEncodeLocalIMAttr(res, top, p->value)) {
> -	    return p->value;
> +	    return p->name;
> 	}
>     }
>     return NULL;
> @@ -2280,17 +2280,17 @@ _XimGetIMValueData(
> 
>     for(p = values; p->name != NULL; p++) {
> 	if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) {
> -	    return p->value;
> +	    return p->name;
> 	}
> 	check = _XimCheckIMMode(res, XIM_GETIMVALUES);
> 	if(check == XIM_CHECK_INVALID) {
> 	    continue;
> 	} else if (check == XIM_CHECK_ERROR) {
> -	    return p->value;
> +	    return p->name;
> 	}
> 
> 	if(!_XimDecodeLocalIMAttr(res, top, p->value)) {
> -	    return p->value;
> +	    return p->name;
> 	}
>     }
>     return NULL;
> -- 
> 1.7.6.4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list