more cppcheck-style fixes

Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
This commit is contained in:
Thomas E. Dickey 2021-05-06 20:10:41 -04:00
parent f807ac9c78
commit 801925839d
No known key found for this signature in database
GPG key ID: 702353E0F7E48EDB
2 changed files with 12 additions and 14 deletions

View file

@ -91,6 +91,7 @@ XcursorAnimateNext (XcursorAnimate *animate)
return cursor; return cursor;
} }
#if RENDER_MAJOR > 0 || RENDER_MINOR >= 5
static int static int
nativeByteOrder (void) nativeByteOrder (void)
{ {
@ -98,6 +99,7 @@ nativeByteOrder (void)
return (*((char *) &x) == 1) ? LSBFirst : MSBFirst; return (*((char *) &x) == 1) ? LSBFirst : MSBFirst;
} }
#endif
static XcursorUInt static XcursorUInt
_XcursorPixelBrightness (XcursorPixel p) _XcursorPixelBrightness (XcursorPixel p)

View file

@ -87,7 +87,7 @@ _XcursorBuildThemeDir (const char *dir, const char *theme)
int len; int len;
if (!dir || !theme) if (!dir || !theme)
return NULL; return NULL;
colon = strchr (dir, ':'); colon = strchr (dir, ':');
if (!colon) if (!colon)
@ -137,7 +137,7 @@ _XcursorBuildFullname (const char *dir, const char *subdir, const char *file)
char *full; char *full;
if (!dir || !subdir || !file) if (!dir || !subdir || !file)
return NULL; return NULL;
full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1);
if (!full) if (!full)
@ -170,7 +170,7 @@ _XcursorThemeInherits (const char *full)
FILE *f; FILE *f;
if (!full) if (!full)
return NULL; return NULL;
f = fopen (full, "r"); f = fopen (full, "r");
if (f) if (f)
@ -223,7 +223,7 @@ XcursorScanTheme (const char *theme, const char *name)
int d; int d;
if (!theme || !name) if (!theme || !name)
return NULL; return NULL;
/* /*
* XCURSOR_CORE_THEME is a magic name; cursors from the core set * XCURSOR_CORE_THEME is a magic name; cursors from the core set
@ -309,15 +309,13 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size)
XcursorImage *image = NULL; XcursorImage *image = NULL;
if (!file) if (!file)
return NULL; return NULL;
if (theme) if (theme)
f = XcursorScanTheme (theme, file); f = XcursorScanTheme (theme, file);
if (!f) if (!f)
f = XcursorScanTheme ("default", file); f = XcursorScanTheme ("default", file);
if (f == XCURSOR_SCAN_CORE) if (f != NULL && f != XCURSOR_SCAN_CORE)
return NULL;
if (f)
{ {
image = XcursorFileLoadImage (f, size); image = XcursorFileLoadImage (f, size);
fclose (f); fclose (f);
@ -332,15 +330,13 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size)
XcursorImages *images = NULL; XcursorImages *images = NULL;
if (!file) if (!file)
return NULL; return NULL;
if (theme) if (theme)
f = XcursorScanTheme (theme, file); f = XcursorScanTheme (theme, file);
if (!f) if (!f)
f = XcursorScanTheme ("default", file); f = XcursorScanTheme ("default", file);
if (f == XCURSOR_SCAN_CORE) if (f != NULL && f != XCURSOR_SCAN_CORE)
return NULL;
if (f)
{ {
images = XcursorFileLoadImages (f, size); images = XcursorFileLoadImages (f, size);
if (images) if (images)
@ -359,7 +355,7 @@ XcursorLibraryLoadCursor (Display *dpy, const char *file)
Cursor cursor; Cursor cursor;
if (!file) if (!file)
return 0; return 0;
if (!images) if (!images)
{ {
@ -387,7 +383,7 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file)
XcursorCursors *cursors; XcursorCursors *cursors;
if (!file) if (!file)
return NULL; return NULL;
if (!images) if (!images)
{ {