aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-15 23:34:40 -0800
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:26 +0200
commit5e0584c43d3511a5544246a0f82c759ce860a0c2 (patch)
tree6aa798f5195680080ade0bfd1e3dd6c5d91a8bf8 /nx-X11/lib/X11
parentd91c145a46bcece11623121f5e468d24d5031cab (diff)
downloadnx-libs-5e0584c43d3511a5544246a0f82c759ce860a0c2.tar.gz
nx-libs-5e0584c43d3511a5544246a0f82c759ce860a0c2.tar.bz2
nx-libs-5e0584c43d3511a5544246a0f82c759ce860a0c2.zip
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 <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11')
-rw-r--r--nx-X11/lib/X11/ChProp.c6
-rw-r--r--nx-X11/lib/X11/SetHints.c4
-rw-r--r--nx-X11/lib/X11/SetPntMap.c2
-rw-r--r--nx-X11/lib/X11/StBytes.c2
-rw-r--r--nx-X11/lib/X11/StName.c6
-rw-r--r--nx-X11/lib/X11/XlibInt.c4
-rw-r--r--nx-X11/lib/X11/Xlibint.h8
7 files changed, 17 insertions, 15 deletions
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;
diff --git a/nx-X11/lib/X11/SetHints.c b/nx-X11/lib/X11/SetHints.c
index 7301ce42a..102619622 100644
--- a/nx-X11/lib/X11/SetHints.c
+++ b/nx-X11/lib/X11/SetHints.c
@@ -259,7 +259,9 @@ XSetStandardProperties (
if (icon_string != NULL) {
XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8,
- PropModeReplace, (unsigned char *)icon_string, safestrlen(icon_string));
+ PropModeReplace,
+ (_Xconst unsigned char *)icon_string,
+ safestrlen(icon_string));
}
if (icon_pixmap != None) {
diff --git a/nx-X11/lib/X11/SetPntMap.c b/nx-X11/lib/X11/SetPntMap.c
index 45571ada0..5dd9beef8 100644
--- a/nx-X11/lib/X11/SetPntMap.c
+++ b/nx-X11/lib/X11/SetPntMap.c
@@ -43,7 +43,7 @@ XSetPointerMapping (
GetReq (SetPointerMapping, req);
req->nElts = nmaps;
req->length += (nmaps + 3)>>2;
- Data (dpy, (char *)map, (long) nmaps);
+ Data (dpy, (_Xconst char *)map, (long) nmaps);
if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0)
rep.success = MappingSuccess;
UnlockDisplay(dpy);
diff --git a/nx-X11/lib/X11/StBytes.c b/nx-X11/lib/X11/StBytes.c
index 0cbbb25f6..390f66832 100644
--- a/nx-X11/lib/X11/StBytes.c
+++ b/nx-X11/lib/X11/StBytes.c
@@ -94,7 +94,7 @@ XStoreBuffer (
{
if ((buffer < 0) || (buffer > 7)) return 0;
return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer],
- XA_STRING, 8, PropModeReplace, (unsigned char *) bytes, nbytes);
+ XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *) bytes, nbytes);
}
int
diff --git a/nx-X11/lib/X11/StName.c b/nx-X11/lib/X11/StName.c
index 3f33472d3..a003a109e 100644
--- a/nx-X11/lib/X11/StName.c
+++ b/nx-X11/lib/X11/StName.c
@@ -37,7 +37,7 @@ XStoreName (
_Xconst char *name)
{
return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING,
- 8, PropModeReplace, (unsigned char *)name,
+ 8, PropModeReplace, (_Xconst unsigned char *)name,
name ? strlen(name) : 0);
}
@@ -47,7 +47,7 @@ XSetIconName (
Window w,
_Xconst char *icon_name)
{
- return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING,
- 8, PropModeReplace, (unsigned char *)icon_name,
+ return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8,
+ PropModeReplace, (_Xconst unsigned char *)icon_name,
icon_name ? strlen(icon_name) : 0);
}
diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c
index 8dc07ad1b..2d84c626d 100644
--- a/nx-X11/lib/X11/XlibInt.c
+++ b/nx-X11/lib/X11/XlibInt.c
@@ -3852,7 +3852,7 @@ void _Xbcopy(b1, b2, length)
#ifdef DataRoutineIsProcedure
void Data(
Display *dpy,
- char *data,
+ _Xconst char *data,
long len)
{
if (dpy->bufptr + (len) <= dpy->bufmax) {
@@ -3869,7 +3869,7 @@ void Data(
int
_XData32(
Display *dpy,
- register long *data,
+ register _Xconst long *data,
unsigned len)
{
register int *buf;
diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h
index 603139fd6..e3d63f29a 100644
--- a/nx-X11/lib/X11/Xlibint.h
+++ b/nx-X11/lib/X11/Xlibint.h
@@ -620,14 +620,14 @@ extern void _XFlushGCCache(Display *dpy, GC gc);
(void)ptr; \
dpy->bufptr += (n);
-#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
+#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
#ifdef LONG64
-#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
+#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len)
extern int _XData32(
Display *dpy,
- register long *data,
+ register _Xconst long *data,
unsigned len
);
extern void _XRead32(
@@ -636,7 +636,7 @@ extern void _XRead32(
long len
);
#else
-#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
+#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
#endif