Summary: | XGetIMValues doesn't return the name of the first argument that could not be obtained | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | xorg | Reporter: | Yann Droneaud <yann> | ||||||
Component: | Lib/Xlib | Assignee: | Xorg Project Team <xorg-team> | ||||||
Status: | RESOLVED FIXED | QA Contact: | Xorg Project Team <xorg-team> | ||||||
Severity: | normal | ||||||||
Priority: | medium | CC: | jeremyhu, jesserayadkins | ||||||
Version: | 7.5 (2009.10) | Keywords: | i18n, patch | ||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Whiteboard: | 2011BRB_Reviewed | ||||||||
i915 platform: | i915 features: | ||||||||
Attachments: |
|
Description
Yann Droneaud
2007-10-23 09:17:37 UTC
Created attachment 12164 [details] [review] Return p->name instead of p->value (untested) Here is a little patch to change p->value to p->name in _XimSetIMValueData() and _XimGetIMValueData() My original program does the following: char *name; static const char *invalid = "INVALID"; void *arg = (void *) 0x004c754e; /* "NuL" on i386 arch */ XIMValuesList *imvl = NULL; XIMStyles *ims = NULL; /* retrieve some values, and get an error */ name = XGetIMValues(im, XNQueryIMValuesList, &imvl, XNQueryInputStyle, &ims, invalid, &arg, NULL); if (name != NULL) { /* * name should point to the name * which was not retrieved, eg. "INVALID" */ printf("XGetIMValues() returned: %p '%s'\n" "invalid name: %p '%s'\n" "invalid arg: %p\n", name, name, invalid, invalid, &arg); } And print: XGetIMValues() returned: 0xbf8d1d34 'NuL' invalid name: 0x8048adf 'INVALID' invalid arg: 0xbf8d1d34 (In reply to comment #2) This doesn't compile. Can you an example that compiles so I can check to see if this is still an issue? Created attachment 41259 [details] Working test case for XGetIMValues() (In reply to comment #3) > This doesn't compile. Can you an example that compiles so I can check to see if > this is still an issue? Here's a complete test case which demonstrate the problem: $ gcc -Wall -Wextra test-XGetIMValues.c -o test-XGetIMValues -lX11 $ ./test-XGetIMValues XLib support current locale Current locale modifier '@im=none' XGetIMValues() returned: 0x7fff220d5628 'NuL' invalid name was : 0x400db8 'INVALID' invalid arg was : 0x7fff220d5628 ERROR: XGetIMValues() returned address of argument instead of its name ERROR: valid function return would be: 0x400db8 'INVALID' As you can see XGetIMValues() returns the argument and not its name. XGetIMValues() man page : The XGetIMValues function presents a variable argument list programming interface for querying properties or features of the specified input method. This function returns NULL if it succeeds; otherwise, it returns the name of the first argument that could not be obtained. (In reply to comment #4) It was tested on Fedora Core 14 against libX11 1.3.4. Can you please send your patch to xorg-devel for review? Thanks. Pushed the fix, thanks. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.