diff options
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-graft.c | 6 | ||||
-rw-r--r-- | source/pdf/pdf-object.c | 19 | ||||
-rw-r--r-- | source/pdf/pdf-pkcs7.c | 15 |
3 files changed, 17 insertions, 23 deletions
diff --git a/source/pdf/pdf-graft.c b/source/pdf/pdf-graft.c index d7cb8b42..64072eb0 100644 --- a/source/pdf/pdf-graft.c +++ b/source/pdf/pdf-graft.c @@ -33,15 +33,13 @@ pdf_new_graft_map(fz_context *ctx, pdf_document *src) pdf_graft_map * fz_keep_graft_map(fz_context *ctx, pdf_graft_map *map) { - if (map) - ++map->refs; - return map; + return fz_keep_imp(ctx, map, &map->refs); } void pdf_drop_graft_map(fz_context *ctx, pdf_graft_map *map) { - if (map && --map->refs == 0) + if (fz_drop_imp(ctx, map, &map->refs)) { fz_drop_document(ctx, (fz_document*)map->src); fz_free(ctx, map->dst_from_src); diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index b189a125..2ac8ae85 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -204,7 +204,7 @@ pdf_keep_obj(fz_context *ctx, pdf_obj *obj) if (obj >= PDF_OBJ__LIMIT) { (void)Memento_takeRef(obj); - obj->refs ++; + (void)fz_keep_imp16(ctx, obj, &obj->refs); } return obj; } @@ -1732,14 +1732,15 @@ pdf_drop_obj(fz_context *ctx, pdf_obj *obj) if (obj >= PDF_OBJ__LIMIT) { (void)Memento_dropRef(obj); - if (--obj->refs) - return; - if (obj->kind == PDF_ARRAY) - pdf_drop_array(ctx, obj); - else if (obj->kind == PDF_DICT) - pdf_drop_dict(ctx, obj); - else - fz_free(ctx, obj); + if (fz_drop_imp16(ctx, obj, &obj->refs)) + { + if (obj->kind == PDF_ARRAY) + pdf_drop_array(ctx, obj); + else if (obj->kind == PDF_DICT) + pdf_drop_dict(ctx, obj); + else + fz_free(ctx, obj); + } } } diff --git a/source/pdf/pdf-pkcs7.c b/source/pdf/pdf-pkcs7.c index aaa18300..64938fb3 100644 --- a/source/pdf/pdf-pkcs7.c +++ b/source/pdf/pdf-pkcs7.c @@ -507,21 +507,16 @@ pdf_signer *pdf_read_pfx(fz_context *ctx, const char *pfile, const char *pw) pdf_signer *pdf_keep_signer(fz_context *ctx, pdf_signer *signer) { - if (signer) - signer->refs++; - return signer; + return fz_keep_imp(ctx, signer, &signer->refs); } void pdf_drop_signer(fz_context *ctx, pdf_signer *signer) { - if (signer) + if (fz_drop_imp(ctx, signer, &signer->refs)) { - if (--signer->refs == 0) - { - X509_free(signer->x509); - EVP_PKEY_free(signer->pkey); - fz_free(ctx, signer); - } + X509_free(signer->x509); + EVP_PKEY_free(signer->pkey); + fz_free(ctx, signer); } } |