[PATCH:libX11 15/22] Fix const handling in XSetLocaleModifiers

Alan Coopersmith alan.coopersmith at oracle.com
Mon Aug 12 00:04:06 PDT 2013


Instead of reusing the input parameter to store the output, make a
result variable instead, so that there's less const confusion.

Fixes gcc warnings:
lcWrap.c: In function 'XSetLocaleModifiers':
lcWrap.c:87:18: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
lcWrap.c:91:25: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
lcWrap.c:93:12: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/xlibi18n/lcWrap.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/xlibi18n/lcWrap.c b/src/xlibi18n/lcWrap.c
index c3f5ca5..e6143fd 100644
--- a/src/xlibi18n/lcWrap.c
+++ b/src/xlibi18n/lcWrap.c
@@ -77,20 +77,20 @@ XSetLocaleModifiers(
 {
     XLCd lcd = _XlcCurrentLC();
     char *user_mods;
+    char *mapped_mods;
 
     if (!lcd)
 	return (char *) NULL;
     if (!modifiers)
 	return lcd->core->modifiers;
     user_mods = getenv("XMODIFIERS");
-    modifiers = (*lcd->methods->map_modifiers) (lcd,
-						user_mods, (char *)modifiers);
-    if (modifiers) {
+    mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers);
+    if (mapped_mods) {
 	if (lcd->core->modifiers)
 	    Xfree(lcd->core->modifiers);
-	lcd->core->modifiers = (char *)modifiers;
+	lcd->core->modifiers = mapped_mods;
     }
-    return (char *)modifiers;
+    return mapped_mods;
 }
 
 Bool
-- 
1.7.9.2



More information about the xorg-devel mailing list