summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/pdf/pdf-colorspace.c18
-rw-r--r--source/pdf/pdf-font.c10
-rw-r--r--source/pdf/pdf-function.c42
-rw-r--r--source/pdf/pdf-parse.c22
-rw-r--r--source/pdf/pdf-shade.c16
-rw-r--r--source/pdf/pdf-type3.c6
6 files changed, 57 insertions, 57 deletions
diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c
index bfdaf6e9..be1d221f 100644
--- a/source/pdf/pdf-colorspace.c
+++ b/source/pdf/pdf-colorspace.c
@@ -23,7 +23,7 @@ load_icc_based(fz_context *ctx, pdf_document *doc, pdf_obj *dict)
if (cs_alt->n != n)
{
fz_drop_colorspace(ctx, cs_alt);
- fz_throw(ctx, FZ_ERROR_GENERIC, "ICCBased /Alternate colorspace must have %d components", n);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "ICCBased /Alternate colorspace must have %d components", n);
}
}
fz_catch(ctx)
@@ -42,7 +42,7 @@ load_icc_based(fz_context *ctx, pdf_document *doc, pdf_obj *dict)
case 4: return fz_device_cmyk(ctx);
}
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: ICCBased must have 1, 3 or 4 components");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "ICCBased must have 1, 3 or 4 components");
}
/* Lab */
@@ -94,7 +94,7 @@ load_separation(fz_context *ctx, pdf_document *doc, pdf_obj *array)
n = 1;
if (n > FZ_MAX_COLORS)
- fz_throw(ctx, FZ_ERROR_GENERIC, "too many components in colorspace");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "too many components in colorspace");
base = pdf_load_colorspace(ctx, doc, baseobj);
@@ -183,7 +183,7 @@ load_indexed(fz_context *ctx, pdf_document *doc, pdf_obj *array)
}
else
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot parse colorspace lookup table");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cannot parse colorspace lookup table");
}
cs = fz_new_indexed_colorspace(ctx, base, high, lookup);
@@ -204,7 +204,7 @@ static fz_colorspace *
pdf_load_colorspace_imp(fz_context *ctx, pdf_document *doc, pdf_obj *obj)
{
if (pdf_obj_marked(ctx, obj))
- fz_throw(ctx, FZ_ERROR_GENERIC, "Recursion in colorspace definition");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "recursion in colorspace definition");
if (pdf_is_name(ctx, obj))
{
@@ -223,7 +223,7 @@ pdf_load_colorspace_imp(fz_context *ctx, pdf_document *doc, pdf_obj *obj)
else if (pdf_name_eq(ctx, obj, PDF_NAME_DeviceCMYK))
return fz_device_cmyk(ctx);
else
- fz_throw(ctx, FZ_ERROR_GENERIC, "unknown colorspace: %s", pdf_to_name(ctx, obj));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown colorspace: %s", pdf_to_name(ctx, obj));
}
else if (pdf_is_array(ctx, obj))
@@ -259,7 +259,7 @@ pdf_load_colorspace_imp(fz_context *ctx, pdf_document *doc, pdf_obj *obj)
fz_try(ctx)
{
if (pdf_mark_obj(ctx, obj))
- fz_throw(ctx, FZ_ERROR_GENERIC, "recursive colorspace");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "recursive colorspace");
if (pdf_name_eq(ctx, name, PDF_NAME_ICCBased))
cs = load_icc_based(ctx, doc, pdf_array_get(ctx, obj, 1));
@@ -287,7 +287,7 @@ pdf_load_colorspace_imp(fz_context *ctx, pdf_document *doc, pdf_obj *obj)
cs = pdf_load_colorspace(ctx, doc, pobj);
}
else
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: unknown colorspace %s", pdf_to_name(ctx, name));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown colorspace %s", pdf_to_name(ctx, name));
}
fz_always(ctx)
{
@@ -302,7 +302,7 @@ pdf_load_colorspace_imp(fz_context *ctx, pdf_document *doc, pdf_obj *obj)
}
}
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: could not parse color space (%d 0 R)", pdf_to_num(ctx, obj));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "could not parse color space (%d 0 R)", pdf_to_num(ctx, obj));
}
fz_colorspace *
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index d993188c..27679130 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -1029,7 +1029,7 @@ load_cid_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict, pdf_obj *encodi
cidinfo = pdf_dict_get(ctx, dict, PDF_NAME_CIDSystemInfo);
if (!cidinfo)
- fz_throw(ctx, FZ_ERROR_GENERIC, "cid font is missing info");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cid font is missing info");
obj = pdf_dict_get(ctx, cidinfo, PDF_NAME_Registry);
tmplen = fz_mini(sizeof tmpstr - 1, pdf_to_str_len(ctx, obj));
@@ -1063,7 +1063,7 @@ load_cid_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict, pdf_obj *encodi
}
else
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: font missing encoding");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "font missing encoding");
}
/* Load font file */
@@ -1077,7 +1077,7 @@ load_cid_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict, pdf_obj *encodi
descriptor = pdf_dict_get(ctx, dict, PDF_NAME_FontDescriptor);
if (!descriptor)
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: missing font descriptor");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "missing font descriptor");
pdf_load_font_descriptor(ctx, doc, fontdesc, descriptor, collection, basefont, 1);
face = fontdesc->font->ft_face;
@@ -1250,7 +1250,7 @@ pdf_load_type0_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict)
dfonts = pdf_dict_get(ctx, dict, PDF_NAME_DescendantFonts);
if (!dfonts)
- fz_throw(ctx, FZ_ERROR_GENERIC, "cid font is missing descendant fonts");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cid font is missing descendant fonts");
dfont = pdf_array_get(ctx, dfonts, 0);
@@ -1262,7 +1262,7 @@ pdf_load_type0_font(fz_context *ctx, pdf_document *doc, pdf_obj *dict)
return load_cid_font(ctx, doc, dfont, encoding, to_unicode);
if (pdf_is_name(ctx, subtype) && pdf_name_eq(ctx, subtype, PDF_NAME_CIDFontType2))
return load_cid_font(ctx, doc, dfont, encoding, to_unicode);
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: unknown cid font type");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown cid font type");
}
/*
diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c
index 8dda0cb2..5d57bbb4 100644
--- a/source/pdf/pdf-function.c
+++ b/source/pdf/pdf-function.c
@@ -704,7 +704,7 @@ parse_code(fz_context *ctx, pdf_function *func, fz_stream *stream, int *codeptr,
switch (tok)
{
case PDF_TOK_EOF:
- fz_throw(ctx, FZ_ERROR_GENERIC, "truncated calculator function");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "truncated calculator function");
case PDF_TOK_INT:
resize_code(ctx, func, *codeptr);
@@ -758,12 +758,12 @@ parse_code(fz_context *ctx, pdf_function *func, fz_stream *stream, int *codeptr,
}
if (tok != PDF_TOK_KEYWORD)
- fz_throw(ctx, FZ_ERROR_GENERIC, "missing keyword in 'if-else' context");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "missing keyword in 'if-else' context");
if (!strcmp(buf->scratch, "if"))
{
if (elseptr >= 0)
- fz_throw(ctx, FZ_ERROR_GENERIC, "too many branches for 'if'");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "too many branches for 'if'");
func->u.p.code[opptr].type = PS_OPERATOR;
func->u.p.code[opptr].u.op = PS_OP_IF;
func->u.p.code[opptr+2].type = PS_BLOCK;
@@ -774,7 +774,7 @@ parse_code(fz_context *ctx, pdf_function *func, fz_stream *stream, int *codeptr,
else if (!strcmp(buf->scratch, "ifelse"))
{
if (elseptr < 0)
- fz_throw(ctx, FZ_ERROR_GENERIC, "not enough branches for 'ifelse'");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "not enough branches for 'ifelse'");
func->u.p.code[opptr].type = PS_OPERATOR;
func->u.p.code[opptr].u.op = PS_OP_IFELSE;
func->u.p.code[opptr+1].type = PS_BLOCK;
@@ -786,7 +786,7 @@ parse_code(fz_context *ctx, pdf_function *func, fz_stream *stream, int *codeptr,
}
else
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "unknown keyword in 'if-else' context: '%s'", buf->scratch);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown keyword in 'if-else' context: '%s'", buf->scratch);
}
break;
@@ -813,11 +813,11 @@ parse_code(fz_context *ctx, pdf_function *func, fz_stream *stream, int *codeptr,
a = b = mid;
}
if (cmp != 0)
- fz_throw(ctx, FZ_ERROR_GENERIC, "unknown operator: '%s'", buf->scratch);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown operator: '%s'", buf->scratch);
if (a == PS_OP_IFELSE)
- fz_throw(ctx, FZ_ERROR_GENERIC, "illegally positioned ifelse operator in function");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "illegally positioned ifelse operator in function");
if (a == PS_OP_IF)
- fz_throw(ctx, FZ_ERROR_GENERIC, "illegally positioned if operator in function");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "illegally positioned if operator in function");
resize_code(ctx, func, *codeptr);
func->u.p.code[*codeptr].type = PS_OPERATOR;
@@ -826,7 +826,7 @@ parse_code(fz_context *ctx, pdf_function *func, fz_stream *stream, int *codeptr,
break;
default:
- fz_throw(ctx, FZ_ERROR_GENERIC, "calculator function syntax error");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "calculator function syntax error");
}
}
}
@@ -852,7 +852,7 @@ load_postscript_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf
tok = pdf_lex(ctx, stream, &buf);
if (tok != PDF_TOK_OPEN_BRACE)
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "stream is not a calculator function");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "stream is not a calculator function");
}
func->u.p.code = NULL;
@@ -919,7 +919,7 @@ load_sample_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_obj
obj = pdf_dict_get(ctx, dict, PDF_NAME_Size);
if (pdf_array_len(ctx, obj) < func->base.m)
- fz_throw(ctx, FZ_ERROR_GENERIC, "too few sample function dimension sizes");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "too few sample function dimension sizes");
if (pdf_array_len(ctx, obj) > func->base.m)
fz_warn(ctx, "too many sample function dimension sizes");
for (i = 0; i < func->base.m; i++)
@@ -978,7 +978,7 @@ load_sample_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_obj
samplecount *= func->u.sa.size[i];
if (samplecount > MAX_SAMPLE_FUNCTION_SIZE)
- fz_throw(ctx, FZ_ERROR_GENERIC, "sample function too large");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "sample function too large");
func->u.sa.samples = fz_malloc_array(ctx, samplecount, sizeof(float));
func->base.size += samplecount * sizeof(float);
@@ -993,7 +993,7 @@ load_sample_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_obj
float s;
if (fz_is_eof_bits(ctx, stream))
- fz_throw(ctx, FZ_ERROR_GENERIC, "truncated sample function stream");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "truncated sample function stream");
switch (bps)
{
@@ -1005,7 +1005,7 @@ load_sample_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_obj
case 16: s = fz_read_uint16(ctx, stream) / 65535.0f; break;
case 24: s = fz_read_uint24(ctx, stream) / 16777215.0f; break;
case 32: s = fz_read_uint32(ctx, stream) / 4294967295.0f; break;
- default: fz_throw(ctx, FZ_ERROR_GENERIC, "sample stream bit depth %d unsupported", bps);
+ default: fz_throw(ctx, FZ_ERROR_SYNTAX, "sample stream bit depth %d unsupported", bps);
}
func->u.sa.samples[i] = s;
@@ -1215,12 +1215,12 @@ load_stitching_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_
obj = pdf_dict_get(ctx, dict, PDF_NAME_Functions);
if (!pdf_is_array(ctx, obj))
- fz_throw(ctx, FZ_ERROR_GENERIC, "stitching function has no input functions");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "stitching function has no input functions");
fz_try(ctx)
{
if (pdf_mark_obj(ctx, obj))
- fz_throw(ctx, FZ_ERROR_GENERIC, "recursive function");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "recursive function");
k = pdf_array_len(ctx, obj);
func->u.st.funcs = fz_malloc_array(ctx, k, sizeof(fz_function*));
@@ -1253,10 +1253,10 @@ load_stitching_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_
obj = pdf_dict_get(ctx, dict, PDF_NAME_Bounds);
if (!pdf_is_array(ctx, obj))
- fz_throw(ctx, FZ_ERROR_GENERIC, "stitching function has no bounds");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "stitching function has no bounds");
{
if (pdf_array_len(ctx, obj) < k - 1)
- fz_throw(ctx, FZ_ERROR_GENERIC, "too few subfunction boundaries");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "too few subfunction boundaries");
if (pdf_array_len(ctx, obj) > k)
fz_warn(ctx, "too many subfunction boundaries");
@@ -1265,7 +1265,7 @@ load_stitching_func(fz_context *ctx, pdf_document *doc, pdf_function *func, pdf_
num = pdf_array_get(ctx, obj, i);
func->u.st.bounds[i] = pdf_to_real(ctx, num);
if (i && func->u.st.bounds[i - 1] > func->u.st.bounds[i])
- fz_throw(ctx, FZ_ERROR_GENERIC, "subfunction %d boundary out of range", i);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "subfunction %d boundary out of range", i);
}
if (k > 1 && (func->domain[0][0] > func->u.st.bounds[0] ||
@@ -1610,7 +1610,7 @@ pdf_load_function(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int in, int
int i;
if (pdf_obj_marked(ctx, dict))
- fz_throw(ctx, FZ_ERROR_GENERIC, "Recursion in function definition");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "Recursion in function definition");
if ((func = pdf_find_item(ctx, pdf_drop_function_imp, dict)) != NULL)
return (fz_function *)func;
@@ -1677,7 +1677,7 @@ pdf_load_function(fz_context *ctx, pdf_document *doc, pdf_obj *dict, int in, int
break;
default:
- fz_throw(ctx, FZ_ERROR_GENERIC, "unknown function type (%d 0 R)", pdf_to_num(ctx, dict));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown function type (%d 0 R)", pdf_to_num(ctx, dict));
}
pdf_store_item(ctx, dict, func, func->base.size);
diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c
index 665802ea..7e67171b 100644
--- a/source/pdf/pdf-parse.c
+++ b/source/pdf/pdf-parse.c
@@ -378,7 +378,7 @@ pdf_parse_array(fz_context *ctx, pdf_document *doc, fz_stream *file, pdf_lexbuf
case PDF_TOK_R:
if (n != 2)
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot parse indirect reference in array");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cannot parse indirect reference in array");
obj = pdf_new_indirect(ctx, doc, a, b);
pdf_array_push(ctx, ary, obj);
pdf_drop_obj(ctx, obj);
@@ -438,7 +438,7 @@ pdf_parse_array(fz_context *ctx, pdf_document *doc, fz_stream *file, pdf_lexbuf
break;
default:
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot parse token in array");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cannot parse token in array");
}
}
end:
@@ -481,7 +481,7 @@ pdf_parse_dict(fz_context *ctx, pdf_document *doc, fz_stream *file, pdf_lexbuf *
break;
if (tok != PDF_TOK_NAME)
- fz_throw(ctx, FZ_ERROR_GENERIC, "invalid key in dict");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "invalid key in dict");
key = pdf_new_name(ctx, doc, buf->scratch);
@@ -529,10 +529,10 @@ pdf_parse_dict(fz_context *ctx, pdf_document *doc, fz_stream *file, pdf_lexbuf *
break;
}
}
- fz_throw(ctx, FZ_ERROR_GENERIC, "invalid indirect reference in dict");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "invalid indirect reference in dict");
default:
- fz_throw(ctx, FZ_ERROR_GENERIC, "unknown token in dict");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown token in dict");
}
pdf_dict_put(ctx, dict, key, val);
@@ -572,7 +572,7 @@ pdf_parse_stm_obj(fz_context *ctx, pdf_document *doc, fz_stream *file, pdf_lexbu
case PDF_TOK_FALSE: return pdf_new_bool(ctx, doc, 0); break;
case PDF_TOK_NULL: return pdf_new_null(ctx, doc); break;
case PDF_TOK_INT: return pdf_new_int_offset(ctx, doc, buf->i); break;
- default: fz_throw(ctx, FZ_ERROR_GENERIC, "unknown token in object stream");
+ default: fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown token in object stream");
}
}
@@ -594,7 +594,7 @@ pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc,
{
if (try_repair)
*try_repair = 1;
- fz_throw(ctx, FZ_ERROR_GENERIC, "expected object number");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "expected object number");
}
num = buf->i;
@@ -603,7 +603,7 @@ pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc,
{
if (try_repair)
*try_repair = 1;
- fz_throw(ctx, FZ_ERROR_GENERIC, "expected generation number (%d ? obj)", num);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "expected generation number (%d ? obj)", num);
}
gen = buf->i;
@@ -612,7 +612,7 @@ pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc,
{
if (try_repair)
*try_repair = 1;
- fz_throw(ctx, FZ_ERROR_GENERIC, "expected 'obj' keyword (%d %d ?)", num, gen);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "expected 'obj' keyword (%d %d ?)", num, gen);
}
tok = pdf_lex(ctx, file, buf);
@@ -653,14 +653,14 @@ pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc,
break;
}
}
- fz_throw(ctx, FZ_ERROR_GENERIC, "expected 'R' keyword (%d %d R)", num, gen);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "expected 'R' keyword (%d %d R)", num, gen);
case PDF_TOK_ENDOBJ:
obj = pdf_new_null(ctx, doc);
goto skip;
default:
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntax error in object (%d %d R)", num, gen);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "syntax error in object (%d %d R)", num, gen);
}
fz_try(ctx)
diff --git a/source/pdf/pdf-shade.c b/source/pdf/pdf-shade.c
index 1689fcfc..1b275379 100644
--- a/source/pdf/pdf-shade.c
+++ b/source/pdf/pdf-shade.c
@@ -331,7 +331,7 @@ pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const f
obj = pdf_dict_get(ctx, dict, PDF_NAME_ColorSpace);
if (!obj)
- fz_throw(ctx, FZ_ERROR_GENERIC, "shading colorspace is missing");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "shading colorspace is missing");
shade->colorspace = pdf_load_colorspace(ctx, doc, obj);
n = fz_colorspace_n(ctx, shade->colorspace);
@@ -360,7 +360,7 @@ pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const f
func[0] = pdf_load_function(ctx, doc, obj, in, out);
if (!func[0])
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load shading function (%d 0 R)", pdf_to_num(ctx, obj));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cannot load shading function (%d 0 R)", pdf_to_num(ctx, obj));
}
else if (pdf_is_array(ctx, obj))
{
@@ -368,12 +368,12 @@ pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const f
if (funcs != 1 && funcs != n)
{
funcs = 0;
- fz_throw(ctx, FZ_ERROR_GENERIC, "incorrect number of shading functions");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "incorrect number of shading functions");
}
if (funcs > FZ_MAX_COLORS)
{
funcs = 0;
- fz_throw(ctx, FZ_ERROR_GENERIC, "too many shading functions");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "too many shading functions");
}
if (type == 1)
@@ -386,13 +386,13 @@ pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const f
{
func[i] = pdf_load_function(ctx, doc, pdf_array_get(ctx, obj, i), in, out);
if (!func[i])
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load shading function (%d 0 R)", pdf_to_num(ctx, obj));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cannot load shading function (%d 0 R)", pdf_to_num(ctx, obj));
}
}
else if (type < 4)
{
/* Functions are compulsory for types 1,2,3 */
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load shading function (%d 0 R)", pdf_to_num(ctx, obj));
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "cannot load shading function (%d 0 R)", pdf_to_num(ctx, obj));
}
shade->type = type;
@@ -406,7 +406,7 @@ pdf_load_shading_dict(fz_context *ctx, pdf_document *doc, pdf_obj *dict, const f
case 6: pdf_load_type6_shade(ctx, doc, shade, dict, funcs, func); break;
case 7: pdf_load_type7_shade(ctx, doc, shade, dict, funcs, func); break;
default:
- fz_throw(ctx, FZ_ERROR_GENERIC, "unknown shading type: %d", type);
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "unknown shading type: %d", type);
}
}
fz_always(ctx)
@@ -464,7 +464,7 @@ pdf_load_shading(fz_context *ctx, pdf_document *doc, pdf_obj *dict)
obj = pdf_dict_get(ctx, dict, PDF_NAME_Shading);
if (!obj)
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: missing shading dictionary");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "missing shading dictionary");
shade = pdf_load_shading_dict(ctx, doc, obj, &mat);
}
diff --git a/source/pdf/pdf-type3.c b/source/pdf/pdf-type3.c
index 3eeff1f8..bc61b289 100644
--- a/source/pdf/pdf-type3.c
+++ b/source/pdf/pdf-type3.c
@@ -74,7 +74,7 @@ pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *d
encoding = pdf_dict_get(ctx, dict, PDF_NAME_Encoding);
if (!encoding)
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: Type3 font missing Encoding");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "Type3 font missing Encoding");
}
if (pdf_is_name(ctx, encoding))
@@ -122,7 +122,7 @@ pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *d
widths = pdf_dict_get(ctx, dict, PDF_NAME_Widths);
if (!widths)
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: Type3 font missing Widths");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "Type3 font missing Widths");
}
for (i = first; i <= last; i++)
@@ -154,7 +154,7 @@ pdf_load_type3_font(fz_context *ctx, pdf_document *doc, pdf_obj *rdb, pdf_obj *d
charprocs = pdf_dict_get(ctx, dict, PDF_NAME_CharProcs);
if (!charprocs)
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "syntaxerror: Type3 font missing CharProcs");
+ fz_throw(ctx, FZ_ERROR_SYNTAX, "Type3 font missing CharProcs");
}
for (i = 0; i < 256; i++)