summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-03-20 16:12:48 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-03-22 14:58:18 +0100
commitd92590ee1467880f327b2e688ae8bc353bdadb18 (patch)
tree51d446bc0fd746a8ac4fd31c229dec40c911c4ad /source
parente0c0500042bf90193c5deb196dafa5cdb64ec0dc (diff)
downloadmupdf-d92590ee1467880f327b2e688ae8bc353bdadb18.tar.xz
Use pdf_add_new_dict family of functions.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-font.c12
-rw-r--r--source/pdf/pdf-image.c2
-rw-r--r--source/pdf/pdf-xref.c8
-rw-r--r--source/tools/pdfportfolio.c2
4 files changed, 11 insertions, 13 deletions
diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c
index ebefde78..26a5cb9d 100644
--- a/source/pdf/pdf-font.c
+++ b/source/pdf/pdf-font.c
@@ -1695,7 +1695,7 @@ pdf_add_cid_font_widths(fz_context *ctx, pdf_document *doc, pdf_obj *fobj, fz_fo
fz_var(run_obj);
- fw = pdf_add_object_drop(ctx, doc, pdf_new_array(ctx, doc, 10));
+ fw = pdf_add_new_array(ctx, doc, 10);
fz_try(ctx)
{
prev_code = 0;
@@ -2025,7 +2025,7 @@ pdf_add_cid_font(fz_context *ctx, pdf_document *doc, fz_font *font)
if (fref)
return fref;
- fobj = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 10));
+ fobj = pdf_add_new_dict(ctx, doc, 10);
fz_try(ctx)
{
pdf_dict_put(ctx, fobj, PDF_NAME_Type, PDF_NAME_Font);
@@ -2110,7 +2110,7 @@ pdf_add_simple_font(fz_context *ctx, pdf_document *doc, fz_font *font, int encod
case PDF_SIMPLE_ENCODING_CYRILLIC: enc = pdf_glyph_name_from_koi8u; break;
}
- fobj = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 10));
+ fobj = pdf_add_new_dict(ctx, doc, 10);
fz_try(ctx)
{
pdf_dict_put(ctx, fobj, PDF_NAME_Type, PDF_NAME_Font);
@@ -2209,7 +2209,7 @@ pdf_add_cjk_font(fz_context *ctx, pdf_document *doc, fz_font *fzfont, int script
if (fref)
return fref;
- font = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 5));
+ font = pdf_add_new_dict(ctx, doc, 5);
fz_try(ctx)
{
pdf_dict_put(ctx, font, PDF_NAME_Type, PDF_NAME_Font);
@@ -2217,13 +2217,13 @@ pdf_add_cjk_font(fz_context *ctx, pdf_document *doc, fz_font *fzfont, int script
pdf_dict_put_name(ctx, font, PDF_NAME_BaseFont, basefont);
pdf_dict_put_name(ctx, font, PDF_NAME_Encoding, encoding);
dfonts = pdf_dict_put_array(ctx, font, PDF_NAME_DescendantFonts, 1);
- pdf_array_push_drop(ctx, dfonts, pdf_add_object_drop(ctx, doc, subfont = pdf_new_dict(ctx, doc, 5)));
+ pdf_array_push_drop(ctx, dfonts, subfont = pdf_add_new_dict(ctx, doc, 5));
{
pdf_dict_put(ctx, subfont, PDF_NAME_Type, PDF_NAME_Font);
pdf_dict_put(ctx, subfont, PDF_NAME_Subtype, PDF_NAME_CIDFontType0);
pdf_dict_put_name(ctx, subfont, PDF_NAME_BaseFont, basefont);
pdf_add_cid_system_info(ctx, doc, subfont, "Adobe", ordering, supplement);
- fontdesc = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 8));
+ fontdesc = pdf_add_new_dict(ctx, doc, 8);
pdf_dict_put_drop(ctx, subfont, PDF_NAME_FontDescriptor, fontdesc);
{
pdf_dict_put(ctx, fontdesc, PDF_NAME_Type, PDF_NAME_FontDescriptor);
diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c
index 35eff099..02e7ddf7 100644
--- a/source/pdf/pdf-image.c
+++ b/source/pdf/pdf-image.c
@@ -323,7 +323,7 @@ pdf_add_image(fz_context *ctx, pdf_document *doc, fz_image *image, int mask)
if (imref)
return imref;
- imobj = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 3));
+ imobj = pdf_add_new_dict(ctx, doc, 3);
fz_try(ctx)
{
dp = pdf_dict_put_dict(ctx, imobj, PDF_NAME_DecodeParms, 3);
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 2f3741d0..c48cf83f 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -2694,7 +2694,7 @@ pdf_add_stream(fz_context *ctx, pdf_document *doc, fz_buffer *buf, pdf_obj *obj,
{
pdf_obj *ind;
if (!obj)
- ind = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 4));
+ ind = pdf_add_new_dict(ctx, doc, 4);
else
ind = pdf_add_object(ctx, doc, obj);
fz_try(ctx)
@@ -2730,11 +2730,9 @@ pdf_document *pdf_create_document(fz_context *ctx)
trailer = pdf_new_dict(ctx, doc, 2);
pdf_dict_put_int(ctx, trailer, PDF_NAME_Size, 3);
- root = pdf_new_dict(ctx, doc, 2);
- pdf_dict_put_drop(ctx, trailer, PDF_NAME_Root, pdf_add_object_drop(ctx, doc, root));
+ pdf_dict_put_drop(ctx, trailer, PDF_NAME_Root, root = pdf_add_new_dict(ctx, doc, 2));
pdf_dict_put(ctx, root, PDF_NAME_Type, PDF_NAME_Catalog);
- pages = pdf_new_dict(ctx, doc, 3);
- pdf_dict_put_drop(ctx, root, PDF_NAME_Pages, pdf_add_object_drop(ctx, doc, pages));
+ pdf_dict_put_drop(ctx, root, PDF_NAME_Pages, pages = pdf_add_new_dict(ctx, doc, 3));
pdf_dict_put(ctx, pages, PDF_NAME_Type, PDF_NAME_Pages);
pdf_dict_put_int(ctx, pages, PDF_NAME_Count, 0);
pdf_dict_put_array(ctx, pages, PDF_NAME_Kids, 1);
diff --git a/source/tools/pdfportfolio.c b/source/tools/pdfportfolio.c
index 8e252d43..a5830149 100644
--- a/source/tools/pdfportfolio.c
+++ b/source/tools/pdfportfolio.c
@@ -258,7 +258,7 @@ int pdfportfolio_main(int argc, char **argv)
font_obj = pdf_add_simple_font(ctx, doc, font, PDF_SIMPLE_ENCODING_LATIN);
fz_drop_font(ctx, font);
- resources = pdf_add_object_drop(ctx, doc, pdf_new_dict(ctx, doc, 1));
+ resources = pdf_add_new_dict(ctx, doc, 1);
pdf_dict_putp_drop(ctx, resources, "Font/Tm", font_obj);
contents = fz_new_buffer_from_shared_data(ctx, (const unsigned char *)template, strlen(template));