diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-02-15 23:34:40 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-02-16 10:20:53 -0800 |
commit | f0b171c8ea7b055ba520272ea9a2604e18841ac7 (patch) | |
tree | 592567b42740d724ee879dd717b8dd3aaab761e3 /include | |
parent | 6c558ee357292dd9dfc6d9006f4525f625327c52 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/X11/Xlibint.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h index 7911fd74..c2232de6 100644 --- a/include/X11/Xlibint.h +++ b/include/X11/Xlibint.h @@ -610,17 +610,17 @@ extern void _XFlushGCCache(Display *dpy, GC gc); dpy->bufptr += (n); #ifdef WORD64 -#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len) -#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len) +#define Data16(dpy, data, len) _XData16(dpy, (_Xconst short *)data, len) +#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) #else -#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( @@ -629,7 +629,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 #endif /* not WORD64 */ |