File 0004-pdf-backend-simplify-Poppler-22.03-compat-code.patch of Package pdf2djvu

From 0b9bb9a67211c7b23d2323ce4585f8a3dafd73d8 Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@jwilk.net>
Date: Wed, 2 Mar 2022 10:40:37 +0000
Subject: [PATCH 3/3] pdf-backend: simplify Poppler 22.03 compat code.

---
 pdf-backend.cc | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/pdf-backend.cc b/pdf-backend.cc
index ba85da2..8fab764 100644
--- a/pdf-backend.cc
+++ b/pdf-backend.cc
@@ -129,27 +129,12 @@ void pdf::Environment::set_antialias(bool value)
  * ===================
  */
 
-template <typename T>
-class unique_ptr_adapter
-{
-protected:
-  std::unique_ptr<T> uptr;
-public:
-  unique_ptr_adapter(T *ptr)
-  : uptr(ptr)
-  { }
-  operator std::unique_ptr<T> ()
-  {
-    return std::move(this->uptr);
-  }
-  operator T* ()
-  {
-    return this->uptr.release();
-  }
-};
-
 pdf::Document::Document(const std::string &file_name)
-: ::PDFDoc(unique_ptr_adapter<pdf::String>(new pdf::String(file_name.c_str())))
+#if POPPLER_VERSION >= 220300
+: ::PDFDoc(std::make_unique<pdf::String>(file_name.c_str()))
+#else
+: ::PDFDoc(new pdf::String(file_name.c_str()))
+#endif
 {
   if (!this->isOk())
     throw LoadError();
-- 
2.35.1

openSUSE Build Service is sponsored by