diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-12-08 23:36:20 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-12-08 23:36:20 +0100 |
commit | 2af3baffb58f22ddf3ac5944d2677b981763e03d (patch) | |
tree | 70d1dfc4ea490b053072b2ea68ad250b8a96972e /pdf | |
parent | 62ff8552500694c96b998d2aac6fbc47ab2d9395 (diff) | |
download | mupdf-2af3baffb58f22ddf3ac5944d2677b981763e03d.tar.xz |
Stylistic changes when testing pointer values for NULL.
Also: use 'cannot' instead of 'failed to' in error messages.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_annot.c | 4 | ||||
-rw-r--r-- | pdf/pdf_crypt.c | 2 | ||||
-rw-r--r-- | pdf/pdf_font.c | 2 | ||||
-rw-r--r-- | pdf/pdf_interpret.c | 8 | ||||
-rw-r--r-- | pdf/pdf_shade.c | 2 | ||||
-rw-r--r-- | pdf/pdf_store.c | 2 | ||||
-rw-r--r-- | pdf/pdf_xobject.c | 2 | ||||
-rw-r--r-- | pdf/pdf_xref.c | 24 |
8 files changed, 23 insertions, 23 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index 2a569e5c..9cfb8f93 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -14,7 +14,7 @@ pdf_free_link(fz_context *ctx, pdf_link *link) fz_free(ctx, link); link = next; } - while(link != NULL); + while(link); } static fz_obj * @@ -166,7 +166,7 @@ pdf_free_annot(fz_context *ctx, pdf_annot *annot) fz_free(ctx, annot); annot = next; } - while (annot != NULL); + while (annot); } static void diff --git a/pdf/pdf_crypt.c b/pdf/pdf_crypt.c index 692ed09e..940d966a 100644 --- a/pdf/pdf_crypt.c +++ b/pdf/pdf_crypt.c @@ -266,7 +266,7 @@ pdf_parse_crypt_filter(fz_context *ctx, pdf_crypt_filter *cf, fz_obj *cf_obj, ch cf->method = PDF_CRYPT_NONE; cf->length = defaultlength; - if (cf_obj == NULL) + if (!cf_obj) { cf->method = (is_identity ? PDF_CRYPT_NONE : PDF_CRYPT_RC4); return; diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c index d4d26f79..dfd4782c 100644 --- a/pdf/pdf_font.c +++ b/pdf/pdf_font.c @@ -745,7 +745,7 @@ load_cid_font(pdf_xref *xref, fz_obj *dict, fz_obj *encoding, fz_obj *to_unicode fontdesc = pdf_new_font_desc(ctx); descriptor = fz_dict_gets(dict, "FontDescriptor"); - if (descriptor == NULL) + if (!descriptor) fz_throw(ctx, "syntaxerror: missing font descriptor"); pdf_load_font_descriptor(fontdesc, xref, descriptor, collection, basefont); diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index b82b4297..b6089ca0 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -112,7 +112,7 @@ ocg_intents_include(pdf_ocg_descriptor *desc, char *name) return 1; /* In the absence of a specified intent, it's 'View' */ - if (desc->intent == NULL) + if (!desc->intent) return (strcmp(name, "View") == 0); if (fz_is_name(desc->intent)) @@ -146,7 +146,7 @@ pdf_is_hidden_ocg(fz_obj *ocg, pdf_csi *csi, fz_obj *rdb) pdf_ocg_descriptor *desc = csi->xref->ocg; /* If no ocg descriptor, everything is visible */ - if (desc == NULL) + if (!desc) return 0; /* If we've been handed a name, look it up in the properties. */ @@ -155,7 +155,7 @@ pdf_is_hidden_ocg(fz_obj *ocg, pdf_csi *csi, fz_obj *rdb) ocg = fz_dict_gets(fz_dict_gets(rdb, "Properties"), fz_to_name(ocg)); } /* If we haven't been given an ocg at all, then we're visible */ - if (ocg == NULL) + if (!ocg) return 0; fz_strlcpy(event_state, csi->event, sizeof event_state); @@ -1469,7 +1469,7 @@ static void pdf_run_BDC(pdf_csi *csi, fz_obj *rdb) } ocg = fz_dict_gets(fz_dict_gets(rdb, "Properties"), csi->name); - if (ocg == NULL) + if (!ocg) { /* No Properties array, or name not found in the properties * means visible. */ diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c index 3803f77e..e0a2804b 100644 --- a/pdf/pdf_shade.c +++ b/pdf/pdf_shade.c @@ -1033,7 +1033,7 @@ pdf_load_shading_dict(pdf_xref *xref, fz_obj *dict, fz_matrix transform) for (i = 0; i < funcs; i++) { func[i] = pdf_load_function(xref, fz_array_get(obj, i)); - if (func[i] == NULL) + if (!func[i]) fz_throw(ctx, "cannot load shading function (%d %d R)", fz_to_num(obj), fz_to_gen(obj)); } } diff --git a/pdf/pdf_store.c b/pdf/pdf_store.c index 4d20e859..26a2ad9b 100644 --- a/pdf/pdf_store.c +++ b/pdf/pdf_store.c @@ -74,7 +74,7 @@ pdf_find_item(fz_context *ctx, pdf_store *store, pdf_store_drop_fn *drop_func, f if (!store) return NULL; - if (key == NULL) + if (!key) return NULL; if (fz_is_indirect(key)) diff --git a/pdf/pdf_xobject.c b/pdf/pdf_xobject.c index 81ef52fa..b4c03b8b 100644 --- a/pdf/pdf_xobject.c +++ b/pdf/pdf_xobject.c @@ -51,7 +51,7 @@ pdf_load_xobject(pdf_xref *xref, fz_obj *dict) if (obj) { form->colorspace = pdf_load_colorspace(xref, obj); - if (form->colorspace == NULL) + if (!form->colorspace) fz_throw(ctx, "cannot load xobject colorspace"); } } diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 65c695f6..c27e9d75 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -480,7 +480,7 @@ pdf_ocg_set_config(pdf_xref *xref, int config) char *name; obj = fz_dict_gets(fz_dict_gets(xref->trailer, "Root"), "OCProperties"); - if (obj == NULL) + if (!obj) { if (config == 0) return; @@ -490,20 +490,20 @@ pdf_ocg_set_config(pdf_xref *xref, int config) if (config == 0) { cobj = fz_dict_gets(obj, "D"); - if (cobj == NULL) + if (!cobj) fz_throw(xref->ctx, "No default OCG config"); } else { cobj = fz_array_get(fz_dict_gets(obj, "Configs"), config); - if (cobj == NULL) + if (!cobj) fz_throw(xref->ctx, "Illegal OCG config"); } - if (desc->intent != NULL) + if (desc->intent) fz_drop_obj(desc->intent); desc->intent = fz_dict_gets(cobj, "Intent"); - if (desc->intent != NULL) + if (desc->intent) fz_keep_obj(desc->intent); len = desc->len; @@ -587,10 +587,10 @@ pdf_read_ocg(pdf_xref *xref) fz_var(desc); obj = fz_dict_gets(fz_dict_gets(xref->trailer, "Root"), "OCProperties"); - if (obj == NULL) + if (!obj) return; ocg = fz_dict_gets(obj, "OCGs"); - if (ocg == NULL || !fz_is_array(ocg)) + if (!ocg || !fz_is_array(ocg)) /* Not ever supposed to happen, but live with it. */ return; len = fz_array_len(ocg); @@ -611,7 +611,7 @@ pdf_read_ocg(pdf_xref *xref) } fz_catch(ctx) { - if (desc != NULL) + if (desc) fz_free(ctx, desc->ocgs); fz_free(ctx, desc); fz_rethrow(ctx); @@ -623,7 +623,7 @@ pdf_read_ocg(pdf_xref *xref) static void pdf_free_ocg(fz_context *ctx, pdf_ocg_descriptor *desc) { - if (desc == NULL) + if (!desc) return; if (desc->intent) @@ -707,8 +707,8 @@ pdf_open_xref_with_stream(fz_stream *file, char *password) pdf_repair_obj_stms(xref); } - hasroot = fz_dict_gets(xref->trailer, "Root") != NULL; - hasinfo = fz_dict_gets(xref->trailer, "Info") != NULL; + hasroot = fz_dict_gets(xref->trailer, "Root"); + hasinfo = fz_dict_gets(xref->trailer, "Info"); for (i = 1; i < xref->len; i++) { @@ -779,7 +779,7 @@ pdf_free_xref(pdf_xref *xref) int i; fz_context *ctx; - if (xref == NULL) + if (!xref) return; ctx = xref->ctx; |