summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-19 10:36:54 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-19 10:36:54 -0800
commit82662a3129c59d5950b52ff4daf2e47c7a87327b (patch)
treeca2c0c2639e4c57fcf4fd118a350ec0d381b50c4
parente56e1003ab225d383cda67eb61737bc14e92332c (diff)
Variable scope reduction as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/Cursor.c4
-rw-r--r--src/Xfixes.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/Cursor.c b/src/Cursor.c
index 4742240..5faf681 100644
--- a/src/Cursor.c
+++ b/src/Cursor.c
@@ -77,7 +77,7 @@ XFixesGetCursorImage (Display *dpy)
xXFixesGetCursorImageAndNameReply rep;
size_t npixels;
size_t nbytes_name;
- size_t nbytes, nread, rlength;
+ size_t nbytes, nread;
XFixesCursorImage *image;
char *name;
@@ -105,6 +105,8 @@ XFixesGetCursorImage (Display *dpy)
if ((rep.length < (INT_MAX >> 2)) &&
npixels < (((INT_MAX >> 3) - sizeof (XFixesCursorImage) - 1)
- nbytes_name)) {
+ size_t rlength;
+
/* reply data length */
nbytes = (size_t) rep.length << 2;
/* bytes of actual data in the reply */
diff --git a/src/Xfixes.c b/src/Xfixes.c
index b8aca09..2f73bcd 100644
--- a/src/Xfixes.c
+++ b/src/Xfixes.c
@@ -48,7 +48,6 @@ XFixesExtAddDisplay (XFixesExtInfo *extinfo,
char *ext_name)
{
XFixesExtDisplayInfo *info;
- int ev;
info = Xmalloc (sizeof (XFixesExtDisplayInfo));
if (!info) return NULL;
@@ -65,7 +64,7 @@ XFixesExtAddDisplay (XFixesExtInfo *extinfo,
xXFixesQueryVersionReq *req;
XESetCloseDisplay (dpy, info->codes->extension,
XFixesCloseDisplay);
- for (ev = info->codes->first_event;
+ for (int ev = info->codes->first_event;
ev < info->codes->first_event + XFixesNumberEvents;
ev++)
{