From 44d1dbc898e57b10a126391ee6f34736e5cc081a Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Wed, 16 Feb 2022 10:19:16 +0100 Subject: [PATCH] main: rename. --- Makefile | 2 +- Makefile.dep | 40 ++++++++++++++++++++-------------------- pdf2djvu.cc => main.cc | 0 3 files changed, 21 insertions(+), 21 deletions(-) rename pdf2djvu.cc => main.cc (100%) diff --git a/Makefile b/Makefile index 740eca2..7a9eee0 100644 --- a/Makefile +++ b/Makefile @@ -35,11 +35,11 @@ $(exe): debug.o $(exe): djvu-outline.o $(exe): i18n.o $(exe): image-filter.o +$(exe): main.o $(exe): pdf-backend.o $(exe): pdf-document-map.o $(exe): pdf-dpi.o $(exe): pdf-unicode.o -$(exe): pdf2djvu.o $(exe): sexpr.o $(exe): string-format.o $(exe): string-printf.o diff --git a/Makefile.dep b/Makefile.dep index 1779063..96360a1 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -29,6 +29,26 @@ image-filter.o: image-filter.hh image-filter.o: pdf-backend.hh image-filter.o: rle.hh image-filter.o: string-format.hh +main.o: autoconf.hh +main.o: config.hh +main.o: debug.hh +main.o: djvu-const.hh +main.o: djvu-outline.hh +main.o: i18n.hh +main.o: image-filter.hh +main.o: main.cc +main.o: paths.hh +main.o: pdf-backend.hh +main.o: pdf-document-map.hh +main.o: pdf-dpi.hh +main.o: pdf-unicode.hh +main.o: sexpr.hh +main.o: string-format.hh +main.o: string-printf.hh +main.o: string-utils.hh +main.o: system.hh +main.o: version.hh +main.o: xmp.hh pdf-backend.o: autoconf.hh pdf-backend.o: debug.hh pdf-backend.o: i18n.hh @@ -54,26 +74,6 @@ pdf-unicode.o: i18n.hh pdf-unicode.o: pdf-backend.hh pdf-unicode.o: pdf-unicode.cc pdf-unicode.o: pdf-unicode.hh -pdf2djvu.o: autoconf.hh -pdf2djvu.o: config.hh -pdf2djvu.o: debug.hh -pdf2djvu.o: djvu-const.hh -pdf2djvu.o: djvu-outline.hh -pdf2djvu.o: i18n.hh -pdf2djvu.o: image-filter.hh -pdf2djvu.o: paths.hh -pdf2djvu.o: pdf-backend.hh -pdf2djvu.o: pdf-document-map.hh -pdf2djvu.o: pdf-dpi.hh -pdf2djvu.o: pdf-unicode.hh -pdf2djvu.o: pdf2djvu.cc -pdf2djvu.o: sexpr.hh -pdf2djvu.o: string-format.hh -pdf2djvu.o: string-printf.hh -pdf2djvu.o: string-utils.hh -pdf2djvu.o: system.hh -pdf2djvu.o: version.hh -pdf2djvu.o: xmp.hh sexpr.o: sexpr.cc sexpr.o: sexpr.hh string-format.o: autoconf.hh diff --git a/pdf2djvu.cc b/main.cc similarity index 100% rename from pdf2djvu.cc rename to main.cc -- 2.33.0 From e170ad557d5f13daeeac047dfaa79347bbe5062f Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Wed, 16 Feb 2022 09:08:11 +0000 Subject: [PATCH] pdf-backend: fix compat with Poppler > 22.02. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: pdf-backend.cc: In constructor ‘pdf::Document::Document(const string&)’: pdf-backend.cc:133:64: error: no matching function for call to ‘PDFDoc::PDFDoc(pdf::String*, std::nullptr_t, std::nullptr_t)’ https://cgit.freedesktop.org/poppler/poppler/commit/?id=07889cdfd8a261dc --- pdf-backend.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pdf-backend.cc b/pdf-backend.cc index 3c871b1..c74053d 100644 --- a/pdf-backend.cc +++ b/pdf-backend.cc @@ -129,8 +129,27 @@ void pdf::Environment::set_antialias(bool value) * =================== */ +template +class unique_ptr_adapter +{ +protected: + std::unique_ptr uptr; +public: + unique_ptr_adapter(T *ptr) + : uptr(ptr) + { } + operator std::unique_ptr () + { + return std::move(this->uptr); + } + operator T* () + { + return this->uptr.release(); + } +}; + pdf::Document::Document(const std::string &file_name) -: ::PDFDoc(new pdf::String(file_name.c_str()), nullptr, nullptr) +: ::PDFDoc(unique_ptr_adapter(new pdf::String(file_name.c_str())), nullptr, nullptr) { if (!this->isOk()) throw LoadError(); -- 2.33.0 From 956fedc7e0831126b9006efedad5519c14201c52 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Thu, 17 Feb 2022 00:26:41 +0100 Subject: [PATCH 1/5] pdf-backend: fix compat with Poppler > 22.02. Fixes: pdf-backend.cc:152:3: error: no matching constructor for initialization of '::PDFDoc' /usr/include/poppler/PDFDoc.h:132:14: note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const std::optional' for 2nd argument https://cgit.freedesktop.org/poppler/poppler/commit/?id=4f2abd3efa1ee013 --- pdf-backend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdf-backend.cc b/pdf-backend.cc index c74053d..ba85da2 100644 --- a/pdf-backend.cc +++ b/pdf-backend.cc @@ -149,7 +149,7 @@ public: }; pdf::Document::Document(const std::string &file_name) -: ::PDFDoc(unique_ptr_adapter(new pdf::String(file_name.c_str())), nullptr, nullptr) +: ::PDFDoc(unique_ptr_adapter(new pdf::String(file_name.c_str()))) { if (!this->isOk()) throw LoadError(); -- 2.33.0 From 81b635e014ebd0240a8719cc39b6a1b759cc6a98 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Wed, 16 Feb 2022 09:10:28 +0000 Subject: [PATCH] main: use pdf::link::Destination copy constructor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: main.cc: In function ‘int get_page_for_goto_link(pdf::link::GoTo*, pdf::Catalog*)’: main.cc:92:27: error: ‘const Destination’ {aka ‘const class LinkDest’} has no member named ‘copy’ https://cgit.freedesktop.org/poppler/poppler/commit/?id=7a429c3cf9fba67e --- main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cc b/main.cc index 2b42d16..bb5fd57 100644 --- a/main.cc +++ b/main.cc @@ -89,7 +89,7 @@ static int get_page_for_goto_link(pdf::link::GoTo *goto_link, pdf::Catalog *cata #endif } else - dest.reset(orig_dest->copy()); + dest.reset(new pdf::link::Destination(*orig_dest)); if (dest.get() != nullptr) { int page; -- 2.33.0