From 5e0584c43d3511a5544246a0f82c759ce860a0c2 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 15 Feb 2013 23:34:40 -0800 Subject: Preserve constness in casting arguments through the Data*() routines Casts were annoying gcc by dropping constness when changing types, when routines simply either copy data into the request buffer or send it directly to the X server, and never modify the input. Fixes gcc warnings including: ChProp.c: In function 'XChangeProperty': ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] ChProp.c:83:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] SetHints.c: In function 'XSetStandardProperties': SetHints.c:262:20: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] SetPntMap.c: In function 'XSetPointerMapping': SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] StBytes.c: In function 'XStoreBuffer': StBytes.c:97:33: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] StName.c: In function 'XStoreName': StName.c:40:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] StName.c: In function 'XSetIconName': StName.c:51:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/ChProp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11/lib/X11/ChProp.c') diff --git a/nx-X11/lib/X11/ChProp.c b/nx-X11/lib/X11/ChProp.c index 347c3d7a1..1721168b4 100644 --- a/nx-X11/lib/X11/ChProp.c +++ b/nx-X11/lib/X11/ChProp.c @@ -62,7 +62,7 @@ XChangeProperty ( len = ((long)nelements + 3)>>2; if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { SetReqLen(req, len, len); - Data (dpy, (char *)data, nelements); + Data (dpy, (_Xconst char *)data, nelements); } /* else force BadLength */ break; @@ -71,7 +71,7 @@ XChangeProperty ( if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { SetReqLen(req, len, len); len = (long)nelements << 1; - Data16 (dpy, (short *) data, len); + Data16 (dpy, (_Xconst short *) data, len); } /* else force BadLength */ break; @@ -80,7 +80,7 @@ XChangeProperty ( if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { SetReqLen(req, len, len); len = (long)nelements << 2; - Data32 (dpy, (long *) data, len); + Data32 (dpy, (_Xconst long *) data, len); } /* else force BadLength */ break; -- cgit v1.2.3