summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-06-26 13:48:31 +0200
committerTor Andersson <tor.andersson@artifex.com>2013-06-26 13:49:05 +0200
commitc6764044e9cd9e1fd0817448bd43bc77d06eba23 (patch)
tree91e1f59ad7a953d11003f54b328689f308e9b961 /source/pdf
parenta9e56e9f94515c109a912a50b4bc80466a11b075 (diff)
downloadmupdf-c6764044e9cd9e1fd0817448bd43bc77d06eba23.tar.xz
Silence compiler warnings.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/js/pdf-js.c2
-rw-r--r--source/pdf/js/pdf-util.js1
-rw-r--r--source/pdf/pdf-annot.c1
-rw-r--r--source/pdf/pdf-device.c7
-rw-r--r--source/pdf/pdf-nametree.c2
-rw-r--r--source/pdf/pdf-pkcs7.c15
-rw-r--r--source/pdf/pdf-write.c5
7 files changed, 6 insertions, 27 deletions
diff --git a/source/pdf/js/pdf-js.c b/source/pdf/js/pdf-js.c
index 5ea9872f..26c6d6f8 100644
--- a/source/pdf/js/pdf-js.c
+++ b/source/pdf/js/pdf-js.c
@@ -243,9 +243,7 @@ static pdf_jsimp_obj *field_getDisplay(void *jsctx, void *obj)
static void field_setDisplay(void *jsctx, void *obj, pdf_jsimp_obj *val)
{
pdf_js *js = (pdf_js *)jsctx;
- fz_context *ctx = js->doc->ctx;
pdf_obj *field = (pdf_obj *)obj;
-
if (field)
pdf_field_set_display(js->doc, field, (int)pdf_jsimp_to_number(js->imp, val));
}
diff --git a/source/pdf/js/pdf-util.js b/source/pdf/js/pdf-util.js
index 06f4874b..0104f5e4 100644
--- a/source/pdf/js/pdf-util.js
+++ b/source/pdf/js/pdf-util.js
@@ -862,7 +862,6 @@ function AFRange_Validate(lowerCheck, lowerLimit, upperCheck, upperLimit)
event.rc = false;
}
-
if (!event.rc)
{
if (lowerCheck && upperCheck)
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c
index 453e9bfb..b66cdba0 100644
--- a/source/pdf/pdf-annot.c
+++ b/source/pdf/pdf-annot.c
@@ -879,7 +879,6 @@ quadpoints(pdf_document *doc, pdf_obj *annot, int *nout)
void
pdf_set_markup_annot_quadpoints(pdf_document *doc, pdf_annot *annot, fz_point *qp, int n)
{
- fz_context *ctx = doc->ctx;
fz_matrix ctm;
pdf_obj *arr = pdf_new_array(doc, n*2);
int i;
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index cf06a7a1..41776ee5 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -115,7 +115,6 @@ send_image(pdf_device *pdev, fz_image *image, int mask, int smask)
int i, num;
fz_md5 state;
unsigned char digest[16];
- int bpc = 8;
fz_colorspace *colorspace = image->colorspace;
pdf_document *doc = pdev->doc;
@@ -245,7 +244,6 @@ send_image(pdf_device *pdev, fz_image *image, int mask, int smask)
case FZ_IMAGE_JBIG2:
/* FIXME - jbig2globals */
cp->type = FZ_IMAGE_UNKNOWN;
- /* bpc = 1; */
break;
case FZ_IMAGE_FLATE:
if (cp->u.flate.columns)
@@ -254,8 +252,6 @@ send_image(pdf_device *pdev, fz_image *image, int mask, int smask)
pdf_dict_puts(imobj, "Colors", pdf_new_int(doc, cp->u.flate.colors));
if (cp->u.flate.predictor)
pdf_dict_puts(imobj, "Predictor", pdf_new_int(doc, cp->u.flate.predictor));
- if (cp->u.flate.bpc)
- bpc = cp->u.flate.bpc;
pdf_dict_puts(imobj, "Filter", pdf_new_name(doc, "FlateDecode"));
pdf_dict_puts_drop(imobj, "BitsPerComponent", pdf_new_int(doc, image->bpc));
break;
@@ -266,8 +262,6 @@ send_image(pdf_device *pdev, fz_image *image, int mask, int smask)
pdf_dict_puts(imobj, "Colors", pdf_new_int(doc, cp->u.lzw.colors));
if (cp->u.lzw.predictor)
pdf_dict_puts(imobj, "Predictor", pdf_new_int(doc, cp->u.lzw.predictor));
- if (cp->u.lzw.bpc)
- bpc = cp->u.lzw.bpc;
if (cp->u.lzw.early_change)
pdf_dict_puts(imobj, "EarlyChange", pdf_new_int(doc, cp->u.lzw.early_change));
pdf_dict_puts(imobj, "Filter", pdf_new_name(doc, "LZWDecode"));
@@ -279,7 +273,6 @@ send_image(pdf_device *pdev, fz_image *image, int mask, int smask)
if (mask)
{
pdf_dict_puts_drop(imobj, "ImageMask", pdf_new_bool(doc, 1));
- bpc = 1;
}
if (image->mask)
{
diff --git a/source/pdf/pdf-nametree.c b/source/pdf/pdf-nametree.c
index 0be9fdf2..0f7af15e 100644
--- a/source/pdf/pdf-nametree.c
+++ b/source/pdf/pdf-nametree.c
@@ -151,8 +151,6 @@ pdf_load_name_tree_imp(pdf_obj *dict, pdf_document *doc, pdf_obj *node)
pdf_obj *
pdf_load_name_tree(pdf_document *doc, char *which)
{
- fz_context *ctx = doc->ctx;
-
pdf_obj *root = pdf_dict_gets(pdf_trailer(doc), "Root");
pdf_obj *names = pdf_dict_gets(root, "Names");
pdf_obj *tree = pdf_dict_gets(names, which);
diff --git a/source/pdf/pdf-pkcs7.c b/source/pdf/pdf-pkcs7.c
index 1bc50b6e..b2f6a348 100644
--- a/source/pdf/pdf-pkcs7.c
+++ b/source/pdf/pdf-pkcs7.c
@@ -220,7 +220,7 @@ static int pk7_verify(X509_STORE *cert_store, PKCS7 *p7, BIO *detached, char *eb
{
/* there are no signatures on this data */
res = 0;
- strncpy(ebuf, "No signatures", sizeof(ebuf));
+ fz_strlcpy(ebuf, "No signatures", ebufsize);
goto exit;
}
@@ -235,16 +235,14 @@ static int pk7_verify(X509_STORE *cert_store, PKCS7 *p7, BIO *detached, char *eb
if (rc <= 0)
{
- strncpy(ebuf, ERR_error_string(ERR_get_error(), tbuf), ebufsize-1);
+ fz_strlcpy(ebuf, ERR_error_string(ERR_get_error(), tbuf), ebufsize);
}
else
{
/* Error while checking the certificate chain */
- snprintf(ebuf, ebufsize-1, "%s(%d): %s", X509_verify_cert_error_string(vctx.err), vctx.err, vctx.certdesc);
+ snprintf(ebuf, ebufsize, "%s(%d): %s", X509_verify_cert_error_string(vctx.err), vctx.err, vctx.certdesc);
}
- ebuf[ebufsize-1] = 0;
-
res = 0;
goto exit;
}
@@ -368,7 +366,7 @@ int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget,
else
{
res = 0;
- strncpy(ebuf, "Not signed", ebufsize);
+ fz_strlcpy(ebuf, "Not signed", ebufsize);
}
}
@@ -379,7 +377,7 @@ int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget,
fz_catch(ctx)
{
res = 0;
- strncpy(ebuf, fz_caught_message(ctx), ebufsize);
+ fz_strlcpy(ebuf, fz_caught_message(ctx), ebufsize);
}
if (ebufsize > 0)
@@ -392,8 +390,7 @@ int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget,
int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget, char *file, char *ebuf, int ebufsize)
{
- strncpy(ebuf, "This version of MuPDF was built without signature support", ebufsize);
-
+ fz_strlcpy(ebuf, "This version of MuPDF was built without signature support", ebufsize);
return 0;
}
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 8a41898b..1c87d2c0 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -710,7 +710,6 @@ static void compactxref(pdf_document *doc, pdf_write_options *opts)
static void renumberobj(pdf_document *doc, pdf_write_options *opts, pdf_obj *obj)
{
int i;
- fz_context *ctx = doc->ctx;
if (pdf_is_dict(obj))
{
@@ -1300,8 +1299,6 @@ lpr(pdf_document *doc, pdf_obj *node, int depth, int page)
void
pdf_localise_page_resources(pdf_document *doc)
{
- fz_context *ctx = doc->ctx;
-
if (doc->resources_localised)
return;
@@ -1485,7 +1482,6 @@ static void addhexfilter(pdf_document *doc, pdf_obj *dict)
{
pdf_obj *f, *dp, *newf, *newdp;
pdf_obj *ahx, *nullobj;
- fz_context *ctx = doc->ctx;
ahx = pdf_new_name(doc, "ASCIIHexDecode");
nullobj = pdf_new_null(doc);
@@ -2450,7 +2446,6 @@ pdf_rebuild_page_tree(pdf_document *doc)
doc->needs_page_tree_rebuild = 0;
}
-
void pdf_finish_edit(pdf_document *doc)
{
if (!doc)