summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cursor.c24
-rw-r--r--src/display.c16
-rw-r--r--src/file.c88
-rw-r--r--src/library.c38
-rw-r--r--src/xlib.c4
5 files changed, 85 insertions, 85 deletions
diff --git a/src/cursor.c b/src/cursor.c
index 954fda4..e4efe93 100644
--- a/src/cursor.c
+++ b/src/cursor.c
@@ -34,7 +34,7 @@ XcursorCursorsCreate (Display *dpy, int size)
cursors = malloc (sizeof (XcursorCursors) +
size * sizeof (Cursor));
if (!cursors)
- return 0;
+ return NULL;
cursors->ref = 1;
cursors->dpy = dpy;
cursors->ncursor = 0;
@@ -66,7 +66,7 @@ XcursorAnimateCreate (XcursorCursors *cursors)
animate = malloc (sizeof (XcursorAnimate));
if (!animate)
- return 0;
+ return NULL;
animate->cursors = cursors;
cursors->ref++;
animate->sequence = 0;
@@ -576,17 +576,17 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
ximage.red_mask = 0xff0000;
ximage.green_mask = 0x00ff00;
ximage.blue_mask = 0x0000ff;
- ximage.obdata = 0;
+ ximage.obdata = NULL;
if (!XInitImage (&ximage))
return None;
pixmap = XCreatePixmap (dpy, RootWindow (dpy, screen),
image->width, image->height, 32);
- gc = XCreateGC (dpy, pixmap, 0, 0);
+ gc = XCreateGC (dpy, pixmap, 0, NULL);
XPutImage (dpy, pixmap, gc, &ximage,
0, 0, 0, 0, image->width, image->height);
XFreeGC (dpy, gc);
format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
- picture = XRenderCreatePicture (dpy, pixmap, format, 0, 0);
+ picture = XRenderCreatePicture (dpy, pixmap, format, 0, NULL);
XFreePixmap (dpy, pixmap);
cursor = XRenderCreateCursor (dpy, picture,
image->xhot, image->yhot);
@@ -602,13 +602,13 @@ XcursorImageLoadCursor (Display *dpy, const XcursorImage *image)
GC gc;
XGCValues gcv;
- core.src_image = XCreateImage (dpy, 0, 1, ZPixmap,
- 0, 0, image->width, image->height,
+ core.src_image = XCreateImage (dpy, NULL, 1, ZPixmap,
+ 0, NULL, image->width, image->height,
32, 0);
core.src_image->data = Xmalloc (image->height *
core.src_image->bytes_per_line);
- core.msk_image = XCreateImage (dpy, 0, 1, ZPixmap,
- 0, 0, image->width, image->height,
+ core.msk_image = XCreateImage (dpy, NULL, 1, ZPixmap,
+ 0, NULL, image->width, image->height,
32, 0);
core.msk_image->data = Xmalloc (image->height *
core.msk_image->bytes_per_line);
@@ -678,14 +678,14 @@ XcursorImagesLoadCursors (Display *dpy, const XcursorImages *images)
int n;
if (!cursors)
- return 0;
+ return NULL;
for (n = 0; n < images->nimage; n++)
{
cursors->cursors[n] = XcursorImageLoadCursor (dpy, images->images[n]);
if (!cursors->cursors[n])
{
XcursorCursorsDestroy (cursors);
- return 0;
+ return NULL;
}
cursors->ncursor++;
}
@@ -751,7 +751,7 @@ XcursorFilenameLoadCursors (Display *dpy, const char *file)
XcursorCursors *cursors;
if (!images)
- return 0;
+ return NULL;
cursors = XcursorImagesLoadCursors (dpy, images);
XcursorImagesDestroy (images);
return cursors;
diff --git a/src/display.c b/src/display.c
index a2e685c..d3e2953 100644
--- a/src/display.c
+++ b/src/display.c
@@ -118,15 +118,15 @@ _XcursorGetDisplayInfo (Display *dpy)
return info;
info = (XcursorDisplayInfo *) malloc (sizeof (XcursorDisplayInfo));
if (!info)
- return 0;
- info->next = 0;
+ return NULL;
+ info->next = NULL;
info->display = dpy;
info->codes = XAddExtension (dpy);
if (!info->codes)
{
free (info);
- return 0;
+ return NULL;
}
(void) XESetCloseDisplay (dpy, info->codes->extension, _XcursorCloseDisplay);
@@ -200,8 +200,8 @@ _XcursorGetDisplayInfo (Display *dpy)
info->size = dim / 48;
}
- info->theme = 0;
- info->theme_from_config = 0;
+ info->theme = NULL;
+ info->theme_from_config = NULL;
/*
* Get the desired theme
@@ -258,7 +258,7 @@ _XcursorGetDisplayInfo (Display *dpy)
info->theme_core = i;
}
- info->fonts = 0;
+ info->fonts = NULL;
for (i = 0; i < NUM_BITMAPS; i++)
info->bitmaps[i].bitmap = None;
@@ -343,7 +343,7 @@ XcursorSetTheme (Display *dpy, const char *theme)
strcpy (copy, theme);
}
else
- copy = 0;
+ copy = NULL;
if (info->theme)
free (info->theme);
info->theme = copy;
@@ -356,7 +356,7 @@ XcursorGetTheme (Display *dpy)
XcursorDisplayInfo *info = _XcursorGetDisplayInfo (dpy);
if (!info)
- return 0;
+ return NULL;
return info->theme;
}
diff --git a/src/file.c b/src/file.c
index de78b05..559eb9b 100644
--- a/src/file.c
+++ b/src/file.c
@@ -34,7 +34,7 @@ XcursorImageCreate (int width, int height)
image = malloc (sizeof (XcursorImage) +
width * height * sizeof (XcursorPixel));
if (!image)
- return 0;
+ return NULL;
image->version = XCURSOR_IMAGE_VERSION;
image->pixels = (XcursorPixel *) (image + 1);
image->size = width > height ? width : height;
@@ -58,10 +58,10 @@ XcursorImagesCreate (int size)
images = malloc (sizeof (XcursorImages) +
size * sizeof (XcursorImage *));
if (!images)
- return 0;
+ return NULL;
images->nimage = 0;
images->images = (XcursorImage **) (images + 1);
- images->name = 0;
+ images->name = NULL;
return images;
}
@@ -105,11 +105,11 @@ XcursorCommentCreate (XcursorUInt comment_type, int length)
XcursorComment *comment;
if (length > XCURSOR_COMMENT_MAX_LEN)
- return 0;
+ return NULL;
comment = malloc (sizeof (XcursorComment) + length + 1);
if (!comment)
- return 0;
+ return NULL;
comment->version = XCURSOR_COMMENT_VERSION;
comment->comment_type = comment_type;
comment->comment = (char *) (comment + 1);
@@ -131,7 +131,7 @@ XcursorCommentsCreate (int size)
comments = malloc (sizeof (XcursorComments) +
size * sizeof (XcursorComment *));
if (!comments)
- return 0;
+ return NULL;
comments->ncomment = 0;
comments->comments = (XcursorComment **) (comments + 1);
return comments;
@@ -212,11 +212,11 @@ _XcursorFileHeaderCreate (int ntoc)
XcursorFileHeader *fileHeader;
if (ntoc > 0x10000)
- return 0;
+ return NULL;
fileHeader = malloc (sizeof (XcursorFileHeader) +
ntoc * sizeof (XcursorFileToc));
if (!fileHeader)
- return 0;
+ return NULL;
fileHeader->magic = XCURSOR_MAGIC;
fileHeader->header = XCURSOR_FILE_HEADER_LEN;
fileHeader->version = XCURSOR_FILE_VERSION;
@@ -236,22 +236,22 @@ _XcursorReadFileHeader (XcursorFile *file)
return NULL;
if (!_XcursorReadUInt (file, &head.magic))
- return 0;
+ return NULL;
if (head.magic != XCURSOR_MAGIC)
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.header))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.version))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.ntoc))
- return 0;
+ return NULL;
skip = head.header - XCURSOR_FILE_HEADER_LEN;
if (skip)
if ((*file->seek) (file, skip, SEEK_CUR) == EOF)
- return 0;
+ return NULL;
fileHeader = _XcursorFileHeaderCreate (head.ntoc);
if (!fileHeader)
- return 0;
+ return NULL;
fileHeader->magic = head.magic;
fileHeader->header = head.header;
fileHeader->version = head.version;
@@ -268,7 +268,7 @@ _XcursorReadFileHeader (XcursorFile *file)
if (n != fileHeader->ntoc)
{
_XcursorFileHeaderDestroy (fileHeader);
- return 0;
+ return NULL;
}
return fileHeader;
}
@@ -439,24 +439,24 @@ _XcursorReadImage (XcursorFile *file,
return NULL;
if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.width))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.height))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.xhot))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.yhot))
- return 0;
+ return NULL;
if (!_XcursorReadUInt (file, &head.delay))
- return 0;
+ return NULL;
/* sanity check data */
if (head.width >= 0x10000 || head.height > 0x10000)
- return 0;
+ return NULL;
if (head.width == 0 || head.height == 0)
- return 0;
+ return NULL;
if (head.xhot > head.width || head.yhot > head.height)
- return 0;
+ return NULL;
/* Create the image and initialize it */
image = XcursorImageCreate (head.width, head.height);
@@ -473,7 +473,7 @@ _XcursorReadImage (XcursorFile *file,
if (!_XcursorReadUInt (file, p))
{
XcursorImageDestroy (image);
- return 0;
+ return NULL;
}
p++;
}
@@ -558,17 +558,17 @@ _XcursorReadComment (XcursorFile *file,
/* read chunk header */
if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))
- return 0;
+ return NULL;
/* read extra comment header fields */
if (!_XcursorReadUInt (file, &length))
- return 0;
+ return NULL;
comment = XcursorCommentCreate (chunkHeader.subtype, length);
if (!comment)
- return 0;
+ return NULL;
if (!_XcursorReadBytes (file, comment->comment, length))
{
XcursorCommentDestroy (comment);
- return 0;
+ return NULL;
}
comment->comment[length] = '\0';
return comment;
@@ -626,16 +626,16 @@ XcursorXcFileLoadImage (XcursorFile *file, int size)
XcursorImage *image;
if (size < 0)
- return 0;
+ return NULL;
fileHeader = _XcursorReadFileHeader (file);
if (!fileHeader)
- return 0;
+ return NULL;
bestSize = _XcursorFindBestSize (fileHeader, (XcursorDim) size, &nsize);
if (!bestSize)
- return 0;
+ return NULL;
toc = _XcursorFindImageToc (fileHeader, bestSize, 0);
if (toc < 0)
- return 0;
+ return NULL;
image = _XcursorReadImage (file, fileHeader, toc);
_XcursorFileHeaderDestroy (fileHeader);
return image;
@@ -683,7 +683,7 @@ XcursorXcFileLoadImages (XcursorFile *file, int size)
if (images->nimage != nsize)
{
XcursorImagesDestroy (images);
- images = 0;
+ images = NULL;
}
return images;
}
@@ -699,11 +699,11 @@ XcursorXcFileLoadAllImages (XcursorFile *file)
int toc;
if (!file)
- return 0;
+ return NULL;
fileHeader = _XcursorReadFileHeader (file);
if (!fileHeader)
- return 0;
+ return NULL;
nimage = 0;
for (n = 0; n < fileHeader->ntoc; n++)
{
@@ -715,7 +715,7 @@ XcursorXcFileLoadAllImages (XcursorFile *file)
}
images = XcursorImagesCreate (nimage);
if (!images)
- return 0;
+ return NULL;
for (toc = 0; toc < fileHeader->ntoc; toc++)
{
switch (fileHeader->tocs[toc].type) {
@@ -733,7 +733,7 @@ XcursorXcFileLoadAllImages (XcursorFile *file)
if (images->nimage != nimage)
{
XcursorImagesDestroy (images);
- images = 0;
+ images = NULL;
}
return images;
}
@@ -805,8 +805,8 @@ XcursorXcFileLoad (XcursorFile *file,
{
XcursorImagesDestroy (images);
XcursorCommentsDestroy (comments);
- images = 0;
- comments = 0;
+ images = NULL;
+ comments = NULL;
return XcursorFalse;
}
*imagesp = images;
@@ -1010,7 +1010,7 @@ XcursorFilenameLoadImage (const char *file, int size)
f = fopen (file, "r");
if (!f)
- return 0;
+ return NULL;
image = XcursorFileLoadImage (f, size);
fclose (f);
return image;
@@ -1027,7 +1027,7 @@ XcursorFilenameLoadImages (const char *file, int size)
f = fopen (file, "r");
if (!f)
- return 0;
+ return NULL;
images = XcursorFileLoadImages (f, size);
fclose (f);
return images;
@@ -1044,7 +1044,7 @@ XcursorFilenameLoadAllImages (const char *file)
f = fopen (file, "r");
if (!f)
- return 0;
+ return NULL;
images = XcursorFileLoadAllImages (f);
fclose (f);
return images;
diff --git a/src/library.c b/src/library.c
index ea59912..2610ed9 100644
--- a/src/library.c
+++ b/src/library.c
@@ -98,13 +98,13 @@ _XcursorBuildThemeDir (const char *dir, const char *theme)
themelen = tcolon - theme;
- home = 0;
+ home = NULL;
homelen = 0;
if (*dir == '~')
{
home = getenv ("HOME");
if (!home)
- return 0;
+ return NULL;
homelen = strlen (home);
dir++;
dirlen--;
@@ -118,7 +118,7 @@ _XcursorBuildThemeDir (const char *dir, const char *theme)
full = malloc (len);
if (!full)
- return 0;
+ return NULL;
full[0] = '\0';
if (home)
@@ -138,7 +138,7 @@ _XcursorBuildFullname (const char *dir, const char *subdir, const char *file)
full = malloc (strlen (dir) + 1 + strlen (subdir) + 1 + strlen (file) + 1);
if (!full)
- return 0;
+ return NULL;
full[0] = '\0';
_XcursorAddPathElt (full, dir, -1);
_XcursorAddPathElt (full, subdir, -1);
@@ -152,7 +152,7 @@ _XcursorNextPath (const char *path)
char *colon = strchr (path, ':');
if (!colon)
- return 0;
+ return NULL;
return colon + 1;
}
@@ -163,7 +163,7 @@ static char *
_XcursorThemeInherits (const char *full)
{
char line[8192];
- char *result = 0;
+ char *result = NULL;
FILE *f;
if (!full)
@@ -212,11 +212,11 @@ _XcursorThemeInherits (const char *full)
static FILE *
XcursorScanTheme (const char *theme, const char *name)
{
- FILE *f = 0;
+ FILE *f = NULL;
char *full;
char *dir;
const char *path;
- char *inherits = 0;
+ char *inherits = NULL;
const char *i;
if (!theme || !name)
@@ -271,8 +271,8 @@ XcursorScanTheme (const char *theme, const char *name)
XcursorImage *
XcursorLibraryLoadImage (const char *file, const char *theme, int size)
{
- FILE *f = 0;
- XcursorImage *image = 0;
+ FILE *f = NULL;
+ XcursorImage *image = NULL;
if (!file)
return NULL;
@@ -282,7 +282,7 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size)
if (!f)
f = XcursorScanTheme ("default", file);
if (f == XCURSOR_SCAN_CORE)
- return 0;
+ return NULL;
if (f)
{
image = XcursorFileLoadImage (f, size);
@@ -294,8 +294,8 @@ XcursorLibraryLoadImage (const char *file, const char *theme, int size)
XcursorImages *
XcursorLibraryLoadImages (const char *file, const char *theme, int size)
{
- FILE *f = 0;
- XcursorImages *images = 0;
+ FILE *f = NULL;
+ XcursorImages *images = NULL;
if (!file)
return NULL;
@@ -305,7 +305,7 @@ XcursorLibraryLoadImages (const char *file, const char *theme, int size)
if (!f)
f = XcursorScanTheme ("default", file);
if (f == XCURSOR_SCAN_CORE)
- return 0;
+ return NULL;
if (f)
{
images = XcursorFileLoadImages (f, size);
@@ -368,14 +368,14 @@ XcursorLibraryLoadCursors (Display *dpy, const char *file)
if (cursors->cursors[0] == None)
{
XcursorCursorsDestroy (cursors);
- cursors = 0;
+ cursors = NULL;
}
else
cursors->ncursor = 1;
}
}
else
- cursors = 0;
+ cursors = NULL;
}
else
{
@@ -428,7 +428,7 @@ XcursorShapeLoadImage (unsigned int shape, const char *theme, int size)
return XcursorLibraryLoadImage (_XcursorStandardNames[id],
theme, size);
else
- return 0;
+ return NULL;
}
XcursorImages *
@@ -440,7 +440,7 @@ XcursorShapeLoadImages (unsigned int shape, const char *theme, int size)
return XcursorLibraryLoadImages (_XcursorStandardNames[id],
theme, size);
else
- return 0;
+ return NULL;
}
Cursor
@@ -462,7 +462,7 @@ XcursorShapeLoadCursors (Display *dpy, unsigned int shape)
if (id < NUM_STANDARD_NAMES)
return XcursorLibraryLoadCursors (dpy, _XcursorStandardNames[id]);
else
- return 0;
+ return NULL;
}
int
diff --git a/src/xlib.c b/src/xlib.c
index 765cf9d..d1809f9 100644
--- a/src/xlib.c
+++ b/src/xlib.c
@@ -179,7 +179,7 @@ _XcursorGetBitmap (Display *dpy, Pixmap bitmap)
info = _XcursorGetDisplayInfo (dpy);
if (!info)
- return 0;
+ return NULL;
LockDisplay (dpy);
for (i = 0; i < NUM_BITMAPS; i++)
if (info->bitmaps[i].bitmap == bitmap)
@@ -189,7 +189,7 @@ _XcursorGetBitmap (Display *dpy, Pixmap bitmap)
return &info->bitmaps[i];
}
UnlockDisplay (dpy);
- return 0;
+ return NULL;
}
static Bool