diff options
author | Lei Zhang <thestig@chromium.org> | 2018-02-05 18:28:38 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-05 18:28:38 +0000 |
commit | a21d593e202cbef9a0641d0123917ac3b8d73ee6 (patch) | |
tree | d72c9134cdbac10de2fca436b056c596b3aa3adf /public | |
parent | 2896cfaff519136d7d770ca048b448e6b3ad9324 (diff) | |
download | pdfium-a21d593e202cbef9a0641d0123917ac3b8d73ee6.tar.xz |
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 <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'public')
-rw-r--r-- | public/cpp/fpdf_deleters.h | 5 |
1 files changed, 5 insertions, 0 deletions
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); } }; |