From a21d593e202cbef9a0641d0123917ac3b8d73ee6 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 5 Feb 2018 18:28:38 +0000 Subject: Add FPDFAnnotationDeleter for use with std::unique_ptr. Use it in existing code where appropriate. BUG=chromium:808269 Change-Id: I55b67db05267f4f05a98c9bf8bbd43f6524cbc65 Reviewed-on: https://pdfium-review.googlesource.com/25210 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- public/cpp/fpdf_deleters.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'public/cpp/fpdf_deleters.h') diff --git a/public/cpp/fpdf_deleters.h b/public/cpp/fpdf_deleters.h index 238ef30e62..51e7cba7f8 100644 --- a/public/cpp/fpdf_deleters.h +++ b/public/cpp/fpdf_deleters.h @@ -5,6 +5,7 @@ #ifndef PUBLIC_CPP_FPDF_DELETERS_H_ #define PUBLIC_CPP_FPDF_DELETERS_H_ +#include "public/fpdf_annot.h" #include "public/fpdf_dataavail.h" #include "public/fpdf_edit.h" #include "public/fpdf_formfill.h" @@ -14,6 +15,10 @@ // Custom deleters for using FPDF_* types with std::unique_ptr<>. +struct FPDFAnnotationDeleter { + inline void operator()(FPDF_ANNOTATION annot) { FPDFPage_CloseAnnot(annot); } +}; + struct FPDFAvailDeleter { inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); } }; -- cgit v1.2.3