summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2012-08-06 14:26:03 +0200
committerSebastian Rasmussen <sebras@gmail.com>2012-08-06 14:26:03 +0200
commit2f9a718a565195f3bd28a283ab372be8b4430f00 (patch)
treeb5686c587f37f0887c543e19f407c05dffd0c703 /pdf
parent1ce75e79683b5df7046bdddbc0dad4b11805a73b (diff)
downloadmupdf-2f9a718a565195f3bd28a283ab372be8b4430f00.tar.xz
Remove old error mesages turned into comments when adding exceptions
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_cmap_parse.c19
-rw-r--r--pdf/pdf_colorspace.c4
-rw-r--r--pdf/pdf_font.c9
-rw-r--r--pdf/pdf_function.c9
-rw-r--r--pdf/pdf_image.c11
-rw-r--r--pdf/pdf_interpret.c28
-rw-r--r--pdf/pdf_parse.c10
-rw-r--r--pdf/pdf_repair.c5
-rw-r--r--pdf/pdf_shade.c3
-rw-r--r--pdf/pdf_stream.c8
-rw-r--r--pdf/pdf_unicode.c2
-rw-r--r--pdf/pdf_xref.c3
12 files changed, 8 insertions, 103 deletions
diff --git a/pdf/pdf_cmap_parse.c b/pdf/pdf_cmap_parse.c
index b78a36ec..7f2587ec 100644
--- a/pdf/pdf_cmap_parse.c
+++ b/pdf/pdf_cmap_parse.c
@@ -53,8 +53,6 @@ pdf_lex_cmap(fz_stream *file, pdf_lexbuf *buf)
{
int tok = pdf_lex(file, buf);
- /* RJW: Lost debugging here: "cannot parse cmap token" */
-
if (tok == PDF_TOK_KEYWORD)
tok = pdf_cmap_token_from_keyword(buf->scratch);
@@ -67,7 +65,6 @@ pdf_parse_cmap_name(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
int tok;
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok == PDF_TOK_NAME)
fz_strlcpy(cmap->cmap_name, buf->scratch, sizeof(cmap->cmap_name));
@@ -81,7 +78,6 @@ pdf_parse_wmode(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf *bu
int tok;
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok == PDF_TOK_INT)
pdf_set_cmap_wmode(ctx, cmap, buf->i);
@@ -98,7 +94,6 @@ pdf_parse_codespace_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_
while (1)
{
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok == TOK_END_CODESPACE_RANGE)
return;
@@ -107,7 +102,6 @@ pdf_parse_codespace_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_
{
lo = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok == PDF_TOK_STRING)
{
hi = pdf_code_from_string(buf->scratch, buf->len);
@@ -131,7 +125,6 @@ pdf_parse_cid_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
while (1)
{
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok == TOK_END_CID_RANGE)
return;
@@ -142,14 +135,12 @@ pdf_parse_cid_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
lo = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok != PDF_TOK_STRING)
fz_throw(ctx, "expected string");
hi = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: Lost debugging: "syntaxerror in cmap" */
if (tok != PDF_TOK_INT)
fz_throw(ctx, "expected integer");
@@ -168,7 +159,6 @@ pdf_parse_cid_char(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
while (1)
{
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
if (tok == TOK_END_CID_CHAR)
return;
@@ -179,8 +169,6 @@ pdf_parse_cid_char(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
src = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
-
if (tok != PDF_TOK_INT)
fz_throw(ctx, "expected integer");
@@ -200,7 +188,6 @@ pdf_parse_bf_range_array(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_l
while (1)
{
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
if (tok == PDF_TOK_CLOSE_ARRAY)
return;
@@ -230,7 +217,6 @@ pdf_parse_bf_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
while (1)
{
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
if (tok == TOK_END_BF_RANGE)
return;
@@ -241,14 +227,12 @@ pdf_parse_bf_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
lo = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
if (tok != PDF_TOK_STRING)
fz_throw(ctx, "expected string");
hi = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
if (tok == PDF_TOK_STRING)
{
@@ -280,7 +264,6 @@ pdf_parse_bf_range(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf
else if (tok == PDF_TOK_OPEN_ARRAY)
{
pdf_parse_bf_range_array(ctx, cmap, file, buf, lo, hi);
- /* RJW: "cannot map bfrange" */
}
else
@@ -301,7 +284,6 @@ pdf_parse_bf_char(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf *
while (1)
{
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
if (tok == TOK_END_BF_CHAR)
return;
@@ -312,7 +294,6 @@ pdf_parse_bf_char(fz_context *ctx, pdf_cmap *cmap, fz_stream *file, pdf_lexbuf *
src = pdf_code_from_string(buf->scratch, buf->len);
tok = pdf_lex_cmap(file, buf);
- /* RJW: "syntaxerror in cmap" */
/* Note: does not handle /dstName */
if (tok != PDF_TOK_STRING)
fz_throw(ctx, "expected string");
diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c
index 7a3835dd..7ebda6cf 100644
--- a/pdf/pdf_colorspace.c
+++ b/pdf/pdf_colorspace.c
@@ -115,7 +115,6 @@ load_separation(pdf_document *xref, pdf_obj *array)
fz_throw(ctx, "too many components in colorspace");
base = pdf_load_colorspace(xref, baseobj);
- /* RJW: "cannot load base colorspace (%d %d R)", pdf_to_num(baseobj), pdf_to_gen(baseobj) */
fz_try(ctx)
{
@@ -234,7 +233,6 @@ load_indexed(pdf_document *xref, pdf_obj *array)
fz_try(ctx)
{
base = pdf_load_colorspace(xref, baseobj);
- /* "cannot load base colorspace (%d %d R)", pdf_to_num(baseobj), pdf_to_gen(baseobj) */
idx = fz_malloc_struct(ctx, struct indexed);
idx->lookup = NULL;
@@ -340,7 +338,6 @@ pdf_load_colorspace_imp(pdf_document *xref, pdf_obj *obj)
}
return pdf_load_colorspace(xref, obj);
- /* RJW: "cannot load pattern (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
}
else if (!strcmp(pdf_to_name(name), "G"))
@@ -399,7 +396,6 @@ pdf_load_colorspace(pdf_document *xref, pdf_obj *obj)
}
cs = pdf_load_colorspace_imp(xref, obj);
- /* RJW: "cannot load colorspace (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
pdf_store_item(ctx, obj, cs, cs->size);
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index 4f630184..d92b67d8 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -186,7 +186,6 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname)
fz_throw(ctx, "cannot find builtin font: '%s'", fontname);
fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1);
- /* RJW: "cannot load freetype font from memory" */
if (!strcmp(fontname, "Symbol") || !strcmp(fontname, "ZapfDingbats"))
fontdesc->flags |= PDF_FD_SYMBOLIC;
@@ -203,7 +202,6 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontnam
fz_throw(ctx, "cannot find substitute font");
fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1);
- /* RJW: "cannot load freetype font from memory" */
fontdesc->font->ft_substitute = 1;
fontdesc->font->ft_bold = bold && !ft_is_bold(fontdesc->font->ft_face);
@@ -222,7 +220,6 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fon
/* a glyph bbox cache is too big for droid sans fallback (51k glyphs!) */
fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 0);
- /* RJW: "cannot load builtin CJK font" */
fontdesc->font->ft_substitute = 1;
}
@@ -462,7 +459,6 @@ pdf_load_simple_font(pdf_document *xref, pdf_obj *dict)
fontdesc->encoding = pdf_load_system_cmap(ctx, "GBK-EUC-H");
fontdesc->to_unicode = pdf_load_system_cmap(ctx, "Adobe-GB1-UCS2");
fontdesc->to_ttf_cmap = pdf_load_system_cmap(ctx, "Adobe-GB1-UCS2");
- /* RJW: "cannot load font" */
face = fontdesc->font->ft_face;
kind = ft_kind(face);
@@ -865,12 +861,10 @@ load_cid_font(pdf_document *xref, pdf_obj *dict, pdf_obj *encoding, pdf_obj *to_
fontdesc->to_ttf_cmap = pdf_load_system_cmap(ctx, "Adobe-Japan2-UCS2");
else if (!strcmp(collection, "Adobe-Korea1"))
fontdesc->to_ttf_cmap = pdf_load_system_cmap(ctx, "Adobe-Korea1-UCS2");
- /* RJW: "cannot load system cmap %s", collection */
}
}
pdf_load_to_unicode(xref, fontdesc, NULL, collection, to_unicode);
- /* RJW: "cannot load to_unicode" */
/* Horizontal */
@@ -999,7 +993,7 @@ pdf_load_type0_font(pdf_document *xref, pdf_obj *dict)
return load_cid_font(xref, dfont, encoding, to_unicode);
else
fz_throw(xref->ctx, "syntaxerror: unknown cid font type");
- /* RJW: "cannot load descendant font (%d %d R)", pdf_to_num(dfont), pdf_to_gen(dfont) */
+
return NULL; /* Stupid MSVC */
}
@@ -1144,7 +1138,6 @@ pdf_load_font(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict)
fz_warn(ctx, "unknown font format, guessing type1 or truetype.");
fontdesc = pdf_load_simple_font(xref, dict);
}
- /* RJW: "cannot load font (%d %d R)", pdf_to_num(dict), pdf_to_gen(dict) */
/* Save the widths to stretch non-CJK substitute fonts */
if (fontdesc->font->ft_substitute && !fontdesc->to_ttf_cmap)
diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c
index 90789ee7..c9bbc5b5 100644
--- a/pdf/pdf_function.c
+++ b/pdf/pdf_function.c
@@ -711,7 +711,6 @@ parse_code(pdf_function *func, fz_stream *stream, int *codeptr, pdf_lexbuf *buf)
while (1)
{
tok = pdf_lex(stream, buf);
- /* RJW: "calculator function lexical error" */
switch(tok)
{
@@ -754,19 +753,15 @@ parse_code(pdf_function *func, fz_stream *stream, int *codeptr, pdf_lexbuf *buf)
ifptr = *codeptr;
parse_code(func, stream, codeptr, buf);
- /* RJW: "error in 'if' branch" */
tok = pdf_lex(stream, buf);
- /* RJW: "calculator function syntax error" */
if (tok == PDF_TOK_OPEN_BRACE)
{
elseptr = *codeptr;
parse_code(func, stream, codeptr, buf);
- /* RJW: "error in 'else' branch" */
tok = pdf_lex(stream, buf);
- /* RJW: "calculator function syntax error" */
}
else
{
@@ -861,7 +856,6 @@ load_postscript_func(pdf_function *func, pdf_document *xref, pdf_obj *dict, int
fz_try(ctx)
{
stream = pdf_open_stream(xref, num, gen);
- /* RJW: "cannot open calculator function stream" */
tok = pdf_lex(stream, &buf);
if (tok != PDF_TOK_OPEN_BRACE)
@@ -997,7 +991,6 @@ load_sample_func(pdf_function *func, pdf_document *xref, pdf_obj *dict, int num,
func->size += samplecount * sizeof(float);
stream = pdf_open_stream(xref, num, gen);
- /* RJW: "cannot open samples stream (%d %d R)", num, gen */
/* read samples */
for (i = 0; i < samplecount; i++)
@@ -1255,7 +1248,7 @@ load_stitching_func(pdf_function *func, pdf_document *xref, pdf_obj *dict)
{
sub = pdf_array_get(obj, i);
funcs[i] = pdf_load_function(xref, sub, 1, func->n);
- /* RJW: "cannot load sub function %d (%d %d R)", i, pdf_to_num(sub), pdf_to_gen(sub) */
+
func->size += pdf_function_size(funcs[i]);
func->u.st.k ++;
diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index 873aeb08..249e2c65 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -317,7 +317,7 @@ pdf_load_image_imp(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict, fz_stream *c
if (pdf_is_jpx_image(ctx, dict))
{
pdf_load_jpx(xref, dict, image);
- /* RJW: "cannot load jpx image" */
+
if (forcemask)
{
fz_pixmap *mask_pixmap;
@@ -368,7 +368,6 @@ pdf_load_image_imp(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict, fz_stream *c
}
image->base.colorspace = pdf_load_colorspace(xref, obj);
- /* RJW: "cannot load image colorspace" */
if (!strcmp(image->base.colorspace->name, "Indexed"))
indexed = 1;
@@ -400,7 +399,6 @@ pdf_load_image_imp(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict, fz_stream *c
if (!cstm)
{
mask = (fz_image *)pdf_load_image_imp(xref, rdb, obj, NULL, 1);
- /* RJW: "cannot load image mask/softmask" */
}
}
else if (pdf_is_array(obj))
@@ -449,7 +447,6 @@ pdf_load_image_imp(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict, fz_stream *c
else
{
stm = pdf_open_stream(xref, pdf_to_num(dict), pdf_to_gen(dict));
- /* RJW: "cannot open image data stream (%d 0 R)", pdf_to_num(dict) */
}
image->tile = decomp_image_from_stream(ctx, stm, image, cstm != NULL, indexed, 1, 0);
@@ -466,7 +463,6 @@ fz_image *
pdf_load_inline_image(pdf_document *xref, pdf_obj *rdb, pdf_obj *dict, fz_stream *file)
{
return (fz_image *)pdf_load_image_imp(xref, rdb, dict, file, 0);
- /* RJW: "cannot load inline image" */
}
int
@@ -500,7 +496,6 @@ pdf_load_jpx(pdf_document *xref, pdf_obj *dict, pdf_image *image)
fz_var(colorspace);
buf = pdf_load_stream(xref, pdf_to_num(dict), pdf_to_gen(dict));
- /* RJW: "cannot load jpx image data" */
/* FIXME: We can't handle decode arrays for indexed images currently */
fz_try(ctx)
@@ -509,12 +504,10 @@ pdf_load_jpx(pdf_document *xref, pdf_obj *dict, pdf_image *image)
if (obj)
{
colorspace = pdf_load_colorspace(xref, obj);
- /* RJW: "cannot load image colorspace" */
indexed = !strcmp(colorspace->name, "Indexed");
}
img = fz_load_jpx(ctx, buf->data, buf->len, colorspace, indexed);
- /* RJW: "cannot load jpx image" */
if (img && colorspace == NULL)
colorspace = fz_keep_colorspace(ctx, img->colorspace);
@@ -526,7 +519,6 @@ pdf_load_jpx(pdf_document *xref, pdf_obj *dict, pdf_image *image)
if (pdf_is_dict(obj))
{
image->base.mask = (fz_image *)pdf_load_image_imp(xref, NULL, obj, NULL, 1);
- /* RJW: "cannot load image mask/softmask" */
}
obj = pdf_dict_getsa(dict, "Decode", "D");
@@ -584,7 +576,6 @@ pdf_load_image(pdf_document *xref, pdf_obj *dict)
}
image = pdf_load_image_imp(xref, NULL, dict, NULL, 0);
- /* RJW: "cannot load image (%d 0 R)", pdf_to_num(dict) */
pdf_store_item(ctx, dict, image, pdf_image_size(ctx, image));
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c
index ad4a6cac..704f6e78 100644
--- a/pdf/pdf_interpret.c
+++ b/pdf/pdf_interpret.c
@@ -319,7 +319,7 @@ pdf_begin_group(pdf_csi *csi, fz_rect bbox)
fz_begin_mask(csi->dev, bbox, gstate->luminosity,
softmask->colorspace, gstate->softmask_bc);
pdf_run_xobject(csi, NULL, softmask, fz_identity);
- /* RJW: "cannot run softmask" */
+
fz_end_mask(csi->dev);
gstate->softmask = softmask;
@@ -1296,7 +1296,6 @@ pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what)
csi->top_ctm = gstate->ctm;
pdf_gsave(csi);
pdf_run_contents_object(csi, pat->resources, pat->contents);
- /* RJW: "cannot render pattern tile" */
pdf_grestore(csi);
while (oldtop < csi->gtop)
pdf_grestore(csi);
@@ -1378,7 +1377,6 @@ pdf_run_xobject(pdf_csi *csi, pdf_obj *resources, pdf_xobject *xobj, fz_matrix t
fz_begin_mask(csi->dev, bbox, gstate->luminosity,
softmask->colorspace, gstate->softmask_bc);
pdf_run_xobject(csi, resources, softmask, fz_identity);
- /* RJW: "cannot run softmask" */
fz_end_mask(csi->dev);
pdf_drop_xobject(ctx, softmask);
@@ -1412,7 +1410,6 @@ pdf_run_xobject(pdf_csi *csi, pdf_obj *resources, pdf_xobject *xobj, fz_matrix t
resources = xobj->resources;
pdf_run_contents_object(csi, resources, xobj->contents);
- /* RJW: "cannot interpret XObject stream" */
}
fz_always(ctx)
{
@@ -1472,7 +1469,6 @@ pdf_run_extgstate(pdf_csi *csi, pdf_obj *rdb, pdf_obj *extgstate)
}
gstate->font = pdf_load_font(csi->xref, rdb, font);
- /* RJW: "cannot load font (%d %d R)", pdf_to_num(font), pdf_to_gen(font) */
if (!gstate->font)
fz_throw(ctx, "cannot find font in store");
gstate->size = pdf_to_real(pdf_array_get(val, 1));
@@ -1554,7 +1550,6 @@ pdf_run_extgstate(pdf_csi *csi, pdf_obj *rdb, pdf_obj *extgstate)
if (!group)
fz_throw(ctx, "cannot load softmask xobject (%d %d R)", pdf_to_num(val), pdf_to_gen(val));
xobj = pdf_load_xobject(csi->xref, group);
- /* RJW: "cannot load xobject (%d %d R)", pdf_to_num(val), pdf_to_gen(val) */
colorspace = xobj->colorspace;
if (!colorspace)
@@ -1637,7 +1632,6 @@ static void pdf_run_BI(pdf_csi *csi, pdf_obj *rdb, fz_stream *file)
pdf_obj *obj;
obj = pdf_parse_dict(csi->xref, file, &csi->xref->lexbuf.base);
- /* RJW: "cannot parse inline image dictionary" */
/* read whitespace after ID keyword */
ch = fz_read_byte(file);
@@ -1655,7 +1649,6 @@ static void pdf_run_BI(pdf_csi *csi, pdf_obj *rdb, fz_stream *file)
}
fz_catch(ctx)
{
- /* RJW: "cannot load inline image" */
fz_rethrow(ctx);
}
@@ -1732,7 +1725,6 @@ static void pdf_run_cs_imp(pdf_csi *csi, pdf_obj *rdb, int what)
if (!obj)
fz_throw(ctx, "cannot find colorspace resource '%s'", csi->name);
colorspace = pdf_load_colorspace(csi->xref, obj);
- /* RJW: "cannot load colorspace (%d 0 R)", pdf_to_num(obj) */
}
pdf_set_colorspace(csi, what, colorspace);
@@ -1746,7 +1738,6 @@ static void pdf_run_CS(pdf_csi *csi, pdf_obj *rdb)
csi->dev->flags &= ~FZ_DEVFLAG_STROKECOLOR_UNDEFINED;
pdf_run_cs_imp(csi, rdb, PDF_STROKE);
- /* RJW: "cannot set colorspace" */
}
static void pdf_run_cs(pdf_csi *csi, pdf_obj *rdb)
@@ -1754,7 +1745,6 @@ static void pdf_run_cs(pdf_csi *csi, pdf_obj *rdb)
csi->dev->flags &= ~FZ_DEVFLAG_FILLCOLOR_UNDEFINED;
pdf_run_cs_imp(csi, rdb, PDF_FILL);
- /* RJW: "cannot set colorspace" */
}
static void pdf_run_DP(pdf_csi *csi)
@@ -1791,7 +1781,6 @@ static void pdf_run_Do(pdf_csi *csi, pdf_obj *rdb)
pdf_xobject *xobj;
xobj = pdf_load_xobject(csi->xref, obj);
- /* RJW: "cannot load xobject (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
/* Inherit parent resources, in case this one was empty XXX check where it's loaded */
if (!xobj->resources)
@@ -1816,7 +1805,7 @@ static void pdf_run_Do(pdf_csi *csi, pdf_obj *rdb)
if ((csi->dev->hints & FZ_IGNORE_IMAGE) == 0)
{
fz_image *img = pdf_load_image(csi->xref, obj);
- /* RJW: "cannot load image (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
+
fz_try(ctx)
{
pdf_show_image(csi, img);
@@ -1955,7 +1944,6 @@ static void pdf_run_SC_imp(pdf_csi *csi, pdf_obj *rdb, int what, pdf_material *m
{
pdf_pattern *pat;
pat = pdf_load_pattern(csi->xref, obj);
- /* RJW: "cannot load pattern (%d 0 R)", pdf_to_num(obj) */
pdf_set_pattern(csi, what, pat, csi->top > 0 ? csi->stack : NULL);
pdf_drop_pattern(ctx, pat);
}
@@ -1963,7 +1951,6 @@ static void pdf_run_SC_imp(pdf_csi *csi, pdf_obj *rdb, int what, pdf_material *m
{
fz_shade *shd;
shd = pdf_load_shading(csi->xref, obj);
- /* RJW: "cannot load shading (%d 0 R)", pdf_to_num(obj) */
pdf_set_shade(csi, what, shd);
fz_drop_shade(ctx, shd);
}
@@ -1983,7 +1970,6 @@ static void pdf_run_SC(pdf_csi *csi, pdf_obj *rdb)
pdf_gstate *gstate = csi->gstate + csi->gtop;
csi->dev->flags &= ~FZ_DEVFLAG_STROKECOLOR_UNDEFINED;
pdf_run_SC_imp(csi, rdb, PDF_STROKE, &gstate->stroke);
- /* RJW: "cannot set color and colorspace" */
}
static void pdf_run_sc(pdf_csi *csi, pdf_obj *rdb)
@@ -1991,7 +1977,6 @@ static void pdf_run_sc(pdf_csi *csi, pdf_obj *rdb)
pdf_gstate *gstate = csi->gstate + csi->gtop;
csi->dev->flags &= ~FZ_DEVFLAG_FILLCOLOR_UNDEFINED;
pdf_run_SC_imp(csi, rdb, PDF_FILL, &gstate->fill);
- /* RJW: "cannot set color and colorspace" */
}
static void pdf_run_Tc(pdf_csi *csi)
@@ -2041,7 +2026,6 @@ static void pdf_run_Tf(pdf_csi *csi, pdf_obj *rdb)
fz_throw(ctx, "cannot find font resource: '%s'", csi->name);
gstate->font = pdf_load_font(csi->xref, rdb, obj);
- /* RJW: "cannot load font (%d 0 R)", pdf_to_num(obj) */
}
static void pdf_run_Tr(pdf_csi *csi)
@@ -2224,7 +2208,6 @@ static void pdf_run_gs(pdf_csi *csi, pdf_obj *rdb)
fz_throw(ctx, "cannot find extgstate resource '%s'", csi->name);
pdf_run_extgstate(csi, rdb, obj);
- /* RJW: "cannot set ExtGState (%d 0 R)", pdf_to_num(obj) */
}
static void pdf_run_h(pdf_csi *csi)
@@ -2328,7 +2311,7 @@ static void pdf_run_sh(pdf_csi *csi, pdf_obj *rdb)
if ((csi->dev->hints & FZ_IGNORE_SHADE) == 0)
{
shd = pdf_load_shading(csi->xref, obj);
- /* RJW: "cannot load shading (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
+
fz_try(ctx)
{
pdf_show_shade(csi, shd);
@@ -2437,7 +2420,6 @@ pdf_run_keyword(pdf_csi *csi, pdf_obj *rdb, fz_stream *file, char *buf)
case C('B','D','C'): pdf_run_BDC(csi, rdb); break;
case B('B','I'):
pdf_run_BI(csi, rdb, file);
- /* RJW: "cannot draw inline image" */
break;
case C('B','M','C'): pdf_run_BMC(csi); break;
case B('B','T'): pdf_run_BT(csi); break;
@@ -2590,7 +2572,6 @@ pdf_run_stream(pdf_csi *csi, pdf_obj *rdb, fz_stream *file, pdf_lexbuf *buf)
}
tok = pdf_lex(file, buf);
- /* RJW: "lexical error in content stream" */
if (in_array)
{
@@ -2636,7 +2617,6 @@ pdf_run_stream(pdf_csi *csi, pdf_obj *rdb, fz_stream *file, pdf_lexbuf *buf)
if (!csi->in_text)
{
csi->obj = pdf_parse_array(csi->xref, file, buf);
- /* RJW: "cannot parse array" */
}
else
{
@@ -2646,7 +2626,6 @@ pdf_run_stream(pdf_csi *csi, pdf_obj *rdb, fz_stream *file, pdf_lexbuf *buf)
case PDF_TOK_OPEN_DICT:
csi->obj = pdf_parse_dict(csi->xref, file, buf);
- /* RJW: "cannot parse dictionary" */
break;
case PDF_TOK_NAME:
@@ -2688,7 +2667,6 @@ pdf_run_stream(pdf_csi *csi, pdf_obj *rdb, fz_stream *file, pdf_lexbuf *buf)
{
tok = PDF_TOK_EOF;
}
- /* RJW: "cannot run keyword" */
pdf_clear_stack(csi);
break;
diff --git a/pdf/pdf_parse.c b/pdf/pdf_parse.c
index 4ed6b6f1..6f27099f 100644
--- a/pdf/pdf_parse.c
+++ b/pdf/pdf_parse.c
@@ -429,16 +429,13 @@ pdf_parse_stm_obj(pdf_document *xref, fz_stream *file, pdf_lexbuf *buf)
fz_context *ctx = file->ctx;
tok = pdf_lex(file, buf);
- /* RJW: "cannot parse token in object stream") */
switch (tok)
{
case PDF_TOK_OPEN_ARRAY:
return pdf_parse_array(xref, file, buf);
- /* RJW: "cannot parse object stream" */
case PDF_TOK_OPEN_DICT:
return pdf_parse_dict(xref, file, buf);
- /* RJW: "cannot parse object stream" */
case PDF_TOK_NAME: return fz_new_name(ctx, buf->scratch); break;
case PDF_TOK_REAL: return pdf_new_real(ctx, buf->f); break;
case PDF_TOK_STRING: return pdf_new_string(ctx, buf->scratch, buf->len); break;
@@ -475,23 +472,19 @@ pdf_parse_ind_obj(pdf_document *xref,
gen = buf->i;
tok = pdf_lex(file, buf);
- /* RJW: "cannot parse indirect object (%d %d R)", num, gen */
if (tok != PDF_TOK_OBJ)
fz_throw(ctx, "expected 'obj' keyword (%d %d ?)", num, gen);
tok = pdf_lex(file, buf);
- /* RJW: "cannot parse indirect object (%d %d R)", num, gen */
switch (tok)
{
case PDF_TOK_OPEN_ARRAY:
obj = pdf_parse_array(xref, file, buf);
- /* RJW: "cannot parse indirect object (%d %d R)", num, gen */
break;
case PDF_TOK_OPEN_DICT:
obj = pdf_parse_dict(xref, file, buf);
- /* RJW: "cannot parse indirect object (%d %d R)", num, gen */
break;
case PDF_TOK_NAME: obj = fz_new_name(ctx, buf->scratch); break;
@@ -504,7 +497,7 @@ pdf_parse_ind_obj(pdf_document *xref,
case PDF_TOK_INT:
a = buf->i;
tok = pdf_lex(file, buf);
- /* "cannot parse indirect object (%d %d R)", num, gen */
+
if (tok == PDF_TOK_STREAM || tok == PDF_TOK_ENDOBJ)
{
obj = pdf_new_int(ctx, a);
@@ -514,7 +507,6 @@ pdf_parse_ind_obj(pdf_document *xref,
{
b = buf->i;
tok = pdf_lex(file, buf);
- /* RJW: "cannot parse indirect object (%d %d R)", num, gen); */
if (tok == PDF_TOK_R)
{
obj = pdf_new_indirect(ctx, a, b, xref);
diff --git a/pdf/pdf_repair.c b/pdf/pdf_repair.c
index 8250ebf4..a3efa030 100644
--- a/pdf/pdf_repair.c
+++ b/pdf/pdf_repair.c
@@ -29,7 +29,7 @@ pdf_repair_obj(fz_stream *file, pdf_lexbuf *buf, int *stmofsp, int *stmlenp, pdf
stm_len = 0;
tok = pdf_lex(file, buf);
- /* RJW: "cannot parse object" */
+
if (tok == PDF_TOK_OPEN_DICT)
{
pdf_obj *dict, *obj;
@@ -80,7 +80,6 @@ pdf_repair_obj(fz_stream *file, pdf_lexbuf *buf, int *stmofsp, int *stmlenp, pdf
tok != PDF_TOK_INT )
{
tok = pdf_lex(file, buf);
- /* RJW: "cannot scan for endobj or stream token" */
}
if (tok == PDF_TOK_INT)
@@ -134,7 +133,6 @@ pdf_repair_obj(fz_stream *file, pdf_lexbuf *buf, int *stmofsp, int *stmlenp, pdf
atobjend:
tok = pdf_lex(file, buf);
- /* RJW: "cannot scan for endobj token" */
if (tok != PDF_TOK_ENDOBJ)
fz_warn(ctx, "object missing 'endobj' token");
}
@@ -412,7 +410,6 @@ pdf_repair_xref(pdf_document *xref, pdf_lexbuf *buf)
if (list[i].stm_len >= 0)
{
dict = pdf_load_object(xref, list[i].num, list[i].gen);
- /* RJW: "cannot load stream object (%d %d R)", list[i].num, list[i].gen */
length = pdf_new_int(ctx, list[i].stm_len);
pdf_dict_puts(dict, "Length", length);
diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c
index 9e056c14..39e71626 100644
--- a/pdf/pdf_shade.c
+++ b/pdf/pdf_shade.c
@@ -1019,7 +1019,6 @@ pdf_load_shading_dict(pdf_document *xref, pdf_obj *dict, fz_matrix transform)
if (!obj)
fz_throw(ctx, "shading colorspace is missing");
shade->colorspace = pdf_load_colorspace(xref, obj);
- /* RJW: "cannot load colorspace (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
obj = pdf_dict_gets(dict, "Background");
if (obj)
@@ -1143,14 +1142,12 @@ pdf_load_shading(pdf_document *xref, pdf_obj *dict)
fz_throw(ctx, "syntaxerror: missing shading dictionary");
shade = pdf_load_shading_dict(xref, obj, mat);
- /* RJW: "cannot load shading dictionary (%d %d R)", pdf_to_num(obj), pdf_to_gen(obj) */
}
/* Naked shading dictionary */
else
{
shade = pdf_load_shading_dict(xref, dict, fz_identity);
- /* RJW: "cannot load shading dictionary (%d %d R)", pdf_to_num(dict), pdf_to_gen(dict) */
}
pdf_store_item(ctx, dict, shade, fz_shade_size(shade));
diff --git a/pdf/pdf_stream.c b/pdf/pdf_stream.c
index a4af8e39..00552ff4 100644
--- a/pdf/pdf_stream.c
+++ b/pdf/pdf_stream.c
@@ -11,7 +11,6 @@ pdf_is_stream(pdf_document *xref, int num, int gen)
return 0;
pdf_cache_object(xref, num, gen);
- /* RJW: "cannot load object, ignoring error" */
return xref->table[num].stm_ofs != 0 || xref->table[num].stm_buf;
}
@@ -326,7 +325,6 @@ pdf_open_raw_renumbered_stream(pdf_document *xref, int num, int gen, int orig_nu
x = xref->table + num;
pdf_cache_object(xref, num, gen);
- /* RJW: "cannot load stream object (%d %d R)", num, gen */
if (x->stm_ofs == 0)
fz_throw(xref->ctx, "object is not a stream");
@@ -356,7 +354,6 @@ pdf_open_image_stream(pdf_document *xref, int num, int gen, int orig_num, int or
x = xref->table + num;
pdf_cache_object(xref, num, gen);
- /* RJW: "cannot load stream object (%d %d R)", num, gen */
if (x->stm_ofs == 0 && x->stm_buf == NULL)
fz_throw(xref->ctx, "object is not a stream");
@@ -438,17 +435,14 @@ pdf_load_raw_renumbered_stream(pdf_document *xref, int num, int gen, int orig_nu
return fz_keep_buffer(xref->ctx, xref->table[num].stm_buf);
dict = pdf_load_object(xref, num, gen);
- /* RJW: "cannot load stream dictionary (%d %d R)", num, gen */
len = pdf_to_int(pdf_dict_gets(dict, "Length"));
pdf_drop_obj(dict);
stm = pdf_open_raw_renumbered_stream(xref, num, gen, orig_num, orig_gen);
- /* RJW: "cannot open raw stream (%d %d R)", num, gen */
buf = fz_read_all(stm, len);
- /* RJW: "cannot read raw stream (%d %d R)", num, gen */
fz_close(stm);
return buf;
@@ -500,7 +494,6 @@ pdf_load_image_stream(pdf_document *xref, int num, int gen, int orig_num, int or
return fz_keep_buffer(xref->ctx, xref->table[num].stm_buf);
dict = pdf_load_object(xref, num, gen);
- /* RJW: "cannot load stream dictionary (%d %d R)", num, gen */
len = pdf_to_int(pdf_dict_gets(dict, "Length"));
obj = pdf_dict_gets(dict, "Filter");
@@ -512,7 +505,6 @@ pdf_load_image_stream(pdf_document *xref, int num, int gen, int orig_num, int or
pdf_drop_obj(dict);
stm = pdf_open_image_stream(xref, num, gen, orig_num, orig_gen, params);
- /* RJW: "cannot open stream (%d %d R)", num, gen */
fz_try(ctx)
{
diff --git a/pdf/pdf_unicode.c b/pdf/pdf_unicode.c
index c94a6683..a6e14d9b 100644
--- a/pdf/pdf_unicode.c
+++ b/pdf/pdf_unicode.c
@@ -17,7 +17,6 @@ pdf_load_to_unicode(pdf_document *xref, pdf_font_desc *font,
if (pdf_is_stream(xref, pdf_to_num(cmapstm), pdf_to_gen(cmapstm)))
{
cmap = pdf_load_embedded_cmap(xref, cmapstm);
- /* RJW: "cannot load embedded cmap (%d %d R)", pdf_to_num(cmapstm), pdf_to_gen(cmapstm) */
font->to_unicode = pdf_new_cmap(ctx);
@@ -52,7 +51,6 @@ pdf_load_to_unicode(pdf_document *xref, pdf_font_desc *font,
font->to_unicode = pdf_load_system_cmap(ctx, "Adobe-Korea1-UCS2");
return;
- /* RJW: "cannot load ToUnicode system cmap %s-UCS2", collection */
}
if (strings)
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index de91db51..050a6f53 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -363,12 +363,10 @@ pdf_read_new_xref(pdf_document *xref, pdf_lexbuf *buf)
index = pdf_dict_gets(trailer, "Index");
stm = pdf_open_stream_with_offset(xref, num, gen, trailer, stm_ofs);
- /* RJW: Ensure pdf_open_stream does fz_throw(ctx, "cannot open compressed xref stream (%d %d R)", num, gen); */
if (!index)
{
pdf_read_new_xref_section(xref, stm, 0, size, w0, w1, w2);
- /* RJW: Ensure above does fz_throw(ctx, "cannot read xref stream (%d %d R)", num, gen); */
}
else
{
@@ -931,7 +929,6 @@ pdf_load_obj_stm(pdf_document *xref, int num, int gen, pdf_lexbuf *buf)
fz_seek(stm, first + ofsbuf[i], 0);
obj = pdf_parse_stm_obj(xref, stm, buf);
- /* RJW: Ensure above does fz_throw(ctx, "cannot parse object %d in stream (%d %d R)", i, num, gen); */
if (numbuf[i] < 1 || numbuf[i] >= xref->len)
{