summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2010-12-30 15:43:42 +0000
committerSebastian Rasmussen <sebras@hotmail.com>2010-12-30 15:43:42 +0000
commit559252258781ed2f0eecd34d16a7b84ec52c0e21 (patch)
tree3efbcada2f2e940f44f5212b595503d52e0e8fd4
parent6e2a8f21f83b87bbf0530d92f809a3aea6aba724 (diff)
downloadmupdf-559252258781ed2f0eecd34d16a7b84ec52c0e21.tar.xz
Adhere to nil idiom.
-rw-r--r--apps/pdfapp.c2
-rw-r--r--apps/pdfclean.c12
-rw-r--r--apps/pdfdraw.c6
-rw-r--r--apps/pdfextract.c4
-rw-r--r--apps/pdfshow.c4
-rw-r--r--apps/win_main.c2
-rw-r--r--apps/x11_main.c4
-rw-r--r--draw/glyphcache.c4
-rw-r--r--fitz/base_string.c4
-rw-r--r--fitz/dev_draw.c22
-rw-r--r--fitz/res_colorspace.c8
-rw-r--r--fitz/res_font.c8
-rw-r--r--fitz/res_pixmap.c4
-rw-r--r--mupdf/pdf_store.c4
-rw-r--r--mupdf/pdf_xref.c2
15 files changed, 45 insertions, 45 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 1f451f33..20c27065 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -103,7 +103,7 @@ void pdfapp_open(pdfapp_t *app, char *filename, int fd)
*/
file = fz_openfile(fd);
- error = pdf_openxrefwithstream(&app->xref, file, NULL);
+ error = pdf_openxrefwithstream(&app->xref, file, nil);
if (error)
pdfapp_error(app, fz_rethrow(error, "cannot open document '%s'", filename));
fz_close(file);
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 430e1ac4..fbea8fd4 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -12,18 +12,18 @@
#include "fitz.h"
#include "mupdf.h"
-static FILE *out = NULL;
+static FILE *out = nil;
-static char *uselist = NULL;
-static int *ofslist = NULL;
-static int *genlist = NULL;
-static int *renumbermap = NULL;
+static char *uselist = nil;
+static int *ofslist = nil;
+static int *genlist = nil;
+static int *renumbermap = nil;
static int dogarbage = 0;
static int doexpand = 0;
static int doascii = 0;
-static pdf_xref *xref = NULL;
+static pdf_xref *xref = nil;
void die(fz_error error)
{
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index e31fd016..9ce72cf0 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -11,7 +11,7 @@
#include <sys/time.h>
#endif
-char *output = NULL;
+char *output = nil;
float resolution = 72;
float rotation = 0;
@@ -66,10 +66,10 @@ static int gettime(void)
struct timeval now;
if (once)
{
- gettimeofday(&first, NULL);
+ gettimeofday(&first, nil);
once = 0;
}
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nil);
return (now.tv_sec - first.tv_sec) * 1000 + (now.tv_usec - first.tv_usec) / 1000;
}
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index fa515638..340a351d 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -5,7 +5,7 @@
#include "fitz.h"
#include "mupdf.h"
-static pdf_xref *xref = NULL;
+static pdf_xref *xref = nil;
static int dorgb = 0;
void die(fz_error error)
@@ -142,7 +142,7 @@ static void savefont(fz_obj *dict, int num)
printf("extracting font %s\n", name);
f = fopen(name, "wb");
- if (f == NULL)
+ if (f == nil)
die(fz_throw("Error creating font file"));
n = fwrite(buf->data, 1, buf->len, f);
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 27bbd0e4..eda01e30 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -5,7 +5,7 @@
#include "fitz.h"
#include "mupdf.h"
-static pdf_xref *xref = NULL;
+static pdf_xref *xref = nil;
static int showbinary = 0;
static int showdecode = 1;
static int showcolumn;
@@ -192,7 +192,7 @@ static void showgrep(char *filename)
int main(int argc, char **argv)
{
- char *password = NULL; /* don't throw errors if encrypted */
+ char *password = nil; /* don't throw errors if encrypted */
char *filename;
fz_error error;
int c;
diff --git a/apps/win_main.c b/apps/win_main.c
index 29f2b29e..07d1e932 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -130,7 +130,7 @@ char *winpassword(pdfapp_t *app, char *filename)
win32error("cannot create password dialog");
if (pd_okay)
return pd_password;
- return NULL;
+ return nil;
}
INT CALLBACK
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 395f9fd8..9ef08012 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -93,7 +93,7 @@ void winerror(pdfapp_t *app, fz_error error)
char *winpassword(pdfapp_t *app, char *filename)
{
char *r = password;
- password = NULL;
+ password = nil;
return r;
}
@@ -289,7 +289,7 @@ static void winblit(pdfapp_t *app)
{
int i = gapp.image->w*gapp.image->h;
unsigned char *color = malloc(i*4);
- if (color != NULL)
+ if (color != nil)
{
unsigned char *s = gapp.image->samples;
unsigned char *d = color;
diff --git a/draw/glyphcache.c b/draw/glyphcache.c
index 74408862..15bb7cae 100644
--- a/draw/glyphcache.c
+++ b/draw/glyphcache.c
@@ -113,7 +113,7 @@ fz_renderglyph(fz_glyphcache *cache, fz_font *font, int cid, fz_matrix ctm)
else
{
fz_warn("assert: uninitialized font structure");
- return NULL;
+ return nil;
}
if (val)
@@ -130,5 +130,5 @@ fz_renderglyph(fz_glyphcache *cache, fz_font *font, int cid, fz_matrix ctm)
return val;
}
- return NULL;
+ return nil;
}
diff --git a/fitz/base_string.c b/fitz/base_string.c
index 4b1553ad..30d544d5 100644
--- a/fitz/base_string.c
+++ b/fitz/base_string.c
@@ -11,8 +11,8 @@ char *
fz_strsep(char **stringp, const char *delim)
{
char *ret = *stringp;
- if (ret == NULL) return NULL;
- if ((*stringp = strpbrk(*stringp, delim)) != NULL)
+ if (ret == nil) return nil;
+ if ((*stringp = strpbrk(*stringp, delim)) != nil)
*((*stringp)++) = '\0';
return ret;
}
diff --git a/fitz/dev_draw.c b/fitz/dev_draw.c
index 02930d8b..439c4115 100644
--- a/fitz/dev_draw.c
+++ b/fitz/dev_draw.c
@@ -544,8 +544,8 @@ fz_smoothtransformpixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx,
{
/* Unrotated or X flip or Yflip or XYflip */
scaled = fz_smoothscalepixmap(image, ctm->e, ctm->f, ctm->a, ctm->d);
- if (scaled == NULL)
- return NULL;
+ if (scaled == nil)
+ return nil;
ctm->a = scaled->w;
ctm->d = scaled->h;
ctm->e = scaled->x;
@@ -556,8 +556,8 @@ fz_smoothtransformpixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx,
{
/* Other orthogonal flip/rotation cases */
scaled = fz_smoothscalepixmap(image, ctm->f, ctm->e, ctm->b, ctm->c);
- if (scaled == NULL)
- return NULL;
+ if (scaled == nil)
+ return nil;
ctm->b = scaled->w;
ctm->c = scaled->h;
ctm->f = scaled->x;
@@ -570,7 +570,7 @@ fz_smoothtransformpixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx,
scaled = fz_smoothscalepixmap(image, 0, 0, (float)dx, (float)dy);
return scaled;
}
- return NULL;
+ return nil;
}
static void
@@ -604,7 +604,7 @@ fz_drawfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
if (dx < image->w && dy < image->h)
{
scaled = fz_smoothtransformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
- if (scaled == NULL)
+ if (scaled == nil)
{
if (dx < 1)
dx = 1;
@@ -612,7 +612,7 @@ fz_drawfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
dy = 1;
scaled = fz_smoothscalepixmap(image, image->x, image->y, dx, dy);
}
- if (scaled != NULL)
+ if (scaled != nil)
image = scaled;
}
#else
@@ -652,7 +652,7 @@ fz_drawfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
if (dx < image->w && dy < image->h)
{
scaled = fz_smoothtransformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
- if (scaled == NULL)
+ if (scaled == nil)
{
if (dx < 1)
dx = 1;
@@ -660,7 +660,7 @@ fz_drawfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
dy = 1;
scaled = fz_smoothscalepixmap(image, image->x, image->y, dx, dy);
}
- if (scaled != NULL)
+ if (scaled != nil)
image = scaled;
}
#else
@@ -723,7 +723,7 @@ fz_drawclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
if (dx < image->w && dy < image->h)
{
scaled = fz_smoothtransformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
- if (scaled == NULL)
+ if (scaled == nil)
{
if (dx < 1)
dx = 1;
@@ -731,7 +731,7 @@ fz_drawclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
dy = 1;
scaled = fz_smoothscalepixmap(image, image->x, image->y, dx, dy);
}
- if (scaled != NULL)
+ if (scaled != nil)
image = scaled;
}
#else
diff --git a/fitz/res_colorspace.c b/fitz/res_colorspace.c
index 9d4d7bc6..ca3cdeb8 100644
--- a/fitz/res_colorspace.c
+++ b/fitz/res_colorspace.c
@@ -9,10 +9,10 @@ fz_newcolorspace(char *name, int n)
cs->refs = 1;
fz_strlcpy(cs->name, name, sizeof cs->name);
cs->n = n;
- cs->toxyz = NULL;
- cs->fromxyz = NULL;
- cs->freedata = NULL;
- cs->data = NULL;
+ cs->toxyz = nil;
+ cs->fromxyz = nil;
+ cs->freedata = nil;
+ cs->data = nil;
return cs;
}
diff --git a/fitz/res_font.c b/fitz/res_font.c
index 26d7267f..eb5e4ef9 100644
--- a/fitz/res_font.c
+++ b/fitz/res_font.c
@@ -314,7 +314,7 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
return nil;
}
- glyph = fz_newpixmap(NULL,
+ glyph = fz_newpixmap(nil,
face->glyph->bitmap_left,
face->glyph->bitmap_top - face->glyph->bitmap.rows,
face->glyph->bitmap.width,
@@ -404,7 +404,7 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
}
bitmap = (FT_BitmapGlyph)glyph;
- pix = fz_newpixmap(NULL,
+ pix = fz_newpixmap(nil,
bitmap->left,
bitmap->top - bitmap->bitmap.rows,
bitmap->bitmap.width,
@@ -461,11 +461,11 @@ fz_rendert3glyph(fz_font *font, int gid, fz_matrix trm)
fz_pixmap *result;
if (gid < 0 || gid > 255)
- return NULL;
+ return nil;
contents = font->t3procs[gid];
if (!contents)
- return NULL;
+ return nil;
ctm = fz_concat(font->t3matrix, trm);
dev = fz_newbboxdevice(&bbox);
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index 7455338a..8d207073 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -38,7 +38,7 @@ fz_newpixmapwithdata(fz_colorspace *colorspace, int x, int y, int w, int h, unsi
fz_pixmap *
fz_newpixmap(fz_colorspace *colorspace, int x, int y, int w, int h)
{
- return fz_newpixmapwithdata(colorspace, x, y, w, h, NULL);
+ return fz_newpixmapwithdata(colorspace, x, y, w, h, nil);
}
fz_pixmap *
@@ -283,7 +283,7 @@ static void putchunk(char *tag, unsigned char *data, int size, FILE *fp)
put32(size, fp);
fwrite(tag, 1, 4, fp);
fwrite(data, 1, size, fp);
- sum = crc32(0, NULL, 0);
+ sum = crc32(0, nil, 0);
sum = crc32(sum, (unsigned char*)tag, 4);
sum = crc32(sum, data, size);
put32(sum, fp);
diff --git a/mupdf/pdf_store.c b/mupdf/pdf_store.c
index 1364bb86..d6be2088 100644
--- a/mupdf/pdf_store.c
+++ b/mupdf/pdf_store.c
@@ -128,7 +128,7 @@ pdf_removeitem(pdf_store *store, void *dropfunc, fz_obj *key)
}
else
{
- prev = NULL;
+ prev = nil;
for (item = store->root; item; item = next)
{
next = item->next;
@@ -169,7 +169,7 @@ pdf_agestore(pdf_store *store, int maxage)
}
}
- prev = NULL;
+ prev = nil;
for (item = store->root; item; item = next)
{
next = item->next;
diff --git a/mupdf/pdf_xref.c b/mupdf/pdf_xref.c
index 61b0c80a..7c457899 100644
--- a/mupdf/pdf_xref.c
+++ b/mupdf/pdf_xref.c
@@ -550,7 +550,7 @@ pdf_openxrefwithstream(pdf_xref **xrefp, fz_stream *file, char *password)
if (xref->table)
{
fz_free(xref->table);
- xref->table = NULL;
+ xref->table = nil;
xref->len = 0;
}
error = pdf_repairxref(xref, xref->scratch, sizeof xref->scratch);