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/StBytes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/X11/StBytes.c') 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 -- cgit v1.2.3 From 26256188b498e122e21ce0e05521dfc58f8b60a5 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 11 Aug 2013 00:07:33 -0700 Subject: Remove unnecessary casts of pointers to (char *) in calls to Xfree() Left one cast behind that is necessary to change from const char * to char * in nx-X11/lib/X11/lcCharSet.c. Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/StBytes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/X11/StBytes.c') diff --git a/nx-X11/lib/X11/StBytes.c b/nx-X11/lib/X11/StBytes.c index 390f66832..df533c95d 100644 --- a/nx-X11/lib/X11/StBytes.c +++ b/nx-X11/lib/X11/StBytes.c @@ -74,7 +74,7 @@ char *XFetchBuffer ( *nbytes = nitems; return((char *)data); } - if ((char *) data != NULL) Xfree ((char *)data); + if ((char *) data != NULL) Xfree (data); return(NULL); } -- cgit v1.2.3 From fc26b97ea9053a2aba54824243282e27bc4a1e15 Mon Sep 17 00:00:00 2001 From: walter harms Date: Thu, 5 Jun 2014 18:37:40 +0200 Subject: Remove redundant null checks before free This patch removes some redundant null checks before free. It should not change the code otherwise. Be aware that this is only the first series. Signed-off-by: Harms Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/StBytes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/X11/StBytes.c') diff --git a/nx-X11/lib/X11/StBytes.c b/nx-X11/lib/X11/StBytes.c index df533c95d..f058d354b 100644 --- a/nx-X11/lib/X11/StBytes.c +++ b/nx-X11/lib/X11/StBytes.c @@ -74,7 +74,7 @@ char *XFetchBuffer ( *nbytes = nitems; return((char *)data); } - if ((char *) data != NULL) Xfree (data); + Xfree (data); return(NULL); } -- cgit v1.2.3