diff options
author | Daniel Stone <daniel@fooishbar.org> | 2005-06-29 18:46:53 +0000 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2005-06-29 18:46:53 +0000 |
commit | caa910e492e4d15208f3d179021687c25a84f36e (patch) | |
tree | 023db68903023ac7077902e4e349ffa7b4e91ca4 /src/library.c | |
parent | e67de73f5ca7ae854c18fa1500c8eaf412b44c6c (diff) |
Import Xcursor 1.1.4 from freedesktop.org xlibs tree.
Diffstat (limited to 'src/library.c')
-rw-r--r-- | src/library.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/library.c b/src/library.c index 90bb6eb..d7d2eaa 100644 --- a/src/library.c +++ b/src/library.c @@ -1,4 +1,5 @@ /* + * $Id$ * * Copyright © 2002 Keith Packard * @@ -80,6 +81,9 @@ _XcursorBuildThemeDir (const char *dir, const char *theme) int themelen; int len; + if (!dir || !theme) + return NULL; + colon = strchr (dir, ':'); if (!colon) colon = dir + strlen (dir); @@ -127,6 +131,9 @@ _XcursorBuildFullname (const char *dir, const char *subdir, const char *file) { char *full; + if (!dir || !subdir || !file) + return NULL; + full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1); if (!full) return 0; @@ -157,6 +164,9 @@ _XcursorThemeInherits (const char *full) char *result = 0; FILE *f; + if (!full) + return NULL; + f = fopen (full, "r"); if (f) { @@ -207,6 +217,9 @@ XcursorScanTheme (const char *theme, const char *name) char *inherits = 0; const char *i; + if (!theme || !name) + return NULL; + /* * XCURSOR_CORE_THEME is a magic name; cursors from the core set * are never found in any directory. Instead, a magic value is @@ -259,6 +272,9 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size) FILE *f = 0; XcursorImage *image = 0; + if (!file) + return NULL; + if (theme) f = XcursorScanTheme (theme, file); if (!f) @@ -279,6 +295,9 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size) FILE *f = 0; XcursorImages *images = 0; + if (!file) + return NULL; + if (theme) f = XcursorScanTheme (theme, file); if (!f) @@ -303,6 +322,9 @@ XcursorLibraryLoadCursor (Display *dpy, const char *file) XcursorImages *images = XcursorLibraryLoadImages (file, theme, size); Cursor cursor; + if (!file) + return 0; + if (!images) { int id = XcursorLibraryShape (file); @@ -328,6 +350,9 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file) XcursorImages *images = XcursorLibraryLoadImages (file, theme, size); XcursorCursors *cursors; + if (!file) + return NULL; + if (!images) { int id = XcursorLibraryShape (file); |