From f807ac9c786714ef4e86ad7edfa60f92baf0b4a6 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Mon, 3 May 2021 20:25:43 -0400 Subject: cppcheck style-fixes Signed-off-by: Thomas E. Dickey --- src/display.c | 4 ++-- src/file.c | 3 +-- src/library.c | 9 +++------ src/xlib.c | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/display.c b/src/display.c index 2c56ba9..a61b5fd 100644 --- a/src/display.c +++ b/src/display.c @@ -72,7 +72,7 @@ _XcursorCloseDisplay (Display *dpy, XExtCodes *codes) static int _XcursorDefaultParseBool (char *v) { - char c0, c1; + char c0; c0 = *v; if (isupper ((int)c0)) @@ -83,7 +83,7 @@ _XcursorDefaultParseBool (char *v) return 0; if (c0 == 'o') { - c1 = v[1]; + char c1 = v[1]; if (isupper ((int)c1)) c1 = (char) tolower (c1); if (c1 == 'n') diff --git a/src/file.c b/src/file.c index 275ce9b..dacbf5c 100644 --- a/src/file.c +++ b/src/file.c @@ -655,7 +655,6 @@ XcursorXcFileLoadImages (XcursorFile *file, int size) int nsize; XcursorImages *images; int n; - int toc; if (!file || size < 0) return NULL; @@ -676,7 +675,7 @@ XcursorXcFileLoadImages (XcursorFile *file, int size) } for (n = 0; n < nsize; n++) { - toc = _XcursorFindImageToc (fileHeader, bestSize, n); + int toc = _XcursorFindImageToc (fileHeader, bestSize, n); if (toc < 0) break; images->images[images->nimage] = _XcursorReadImage (file, fileHeader, diff --git a/src/library.c b/src/library.c index 83527c4..c43d190 100644 --- a/src/library.c +++ b/src/library.c @@ -180,7 +180,6 @@ _XcursorThemeInherits (const char *full) if (!strncmp (line, "Inherits", 8)) { char *l = line + 8; - char *r; while (*l == ' ') l++; if (*l != '=') continue; l++; @@ -188,7 +187,7 @@ _XcursorThemeInherits (const char *full) result = malloc (strlen (l) + 1); if (result) { - r = result; + char *r = result; while (*l) { while (XcursorSep(*l) || XcursorWhite (*l)) l++; @@ -561,15 +560,13 @@ int XcursorLibraryShape (const char *library) { int low, high; - int mid; - int c; low = 0; high = NUM_STANDARD_NAMES - 1; while (low < high - 1) { - mid = (low + high) >> 1; - c = strcmp (library, STANDARD_NAME (mid)); + int mid = (low + high) >> 1; + int c = strcmp (library, STANDARD_NAME (mid)); if (c == 0) return (mid << 1); if (c > 0) diff --git a/src/xlib.c b/src/xlib.c index 4443ffe..63f0225 100644 --- a/src/xlib.c +++ b/src/xlib.c @@ -32,7 +32,6 @@ _XcursorFontIsCursor (Display *dpy, Font font) XcursorDisplayInfo *info; XcursorBool ret; XFontStruct *fs; - int n; Atom cursor; if (!dpy || !font) @@ -57,6 +56,7 @@ _XcursorFontIsCursor (Display *dpy, Font font) fs = XQueryFont (dpy, font); if (fs) { + int n; cursor = XInternAtom (dpy, "cursor", False); for (n = 0; n < fs->n_properties; n++) if (fs->properties[n].name == XA_FONT) -- cgit v1.2.1