Fix building of pdf2djvu with poppler-0.20.x

Resolves: #822407
This commit is contained in:
Marek Kasik 2012-07-02 15:37:31 +02:00
parent 43c686e611
commit 51ece1b3f4
2 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,75 @@
--- pdf2djvu-0.7.4/pdf2djvu.cc 2010-06-12 22:20:36.000000000 +0200
+++ pdf2djvu-0.7.4/pdf2djvu.cc 2012-07-02 15:22:37.000000000 +0200
@@ -1334,15 +1334,27 @@ static int xmain(int argc, char * const
doc.reset(new pdf::Document(config.file_name));
assert(out1.get() == NULL);
out1.reset(new pdf::Renderer(paper_color, config.monochrome));
+#if POPPLER_VERSION < 1900
out1->startDoc(doc->getXRef());
+#else
+ out1->startDoc(doc.get());
+#endif
assert(outm.get() == NULL);
outm.reset(new MutedRenderer(paper_color, config.monochrome, *page_files));
+#if POPPLER_VERSION < 1900
outm->startDoc(doc->getXRef());
+#else
+ outm->startDoc(doc.get());
+#endif
assert(outs.get() == NULL);
if (!config.monochrome)
{
outs.reset(new MutedRenderer(paper_color, config.monochrome, *page_files));
+#if POPPLER_VERSION < 1900
outs->startDoc(doc->getXRef());
+#else
+ outs->startDoc(doc.get());
+#endif
}
}
assert(doc.get() != NULL);
--- pdf2djvu-0.7.4/pdf-backend.cc 2010-06-12 22:20:36.000000000 +0200
+++ pdf2djvu-0.7.4/pdf-backend.cc 2012-07-02 15:24:39.000000000 +0200
@@ -32,6 +32,7 @@
* ======================
*/
+#if POPPLER_VERSION < 1900
static void poppler_error_handler(int pos, char *message, va_list args)
{
std::string format;
@@ -49,6 +50,22 @@ static void poppler_error_handler(int po
}
error_log << std::endl;
}
+#else
+static void poppler_error_handler(void *data, ErrorCategory category, int pos, char *msg)
+{
+ if (pos >= 0)
+ {
+ error_log <<
+ string_printf(_("PDF error (%d): %s"), pos, msg);
+ }
+ else
+ {
+ error_log <<
+ string_printf(_("PDF error: %s"), msg);
+ }
+ error_log << std::endl;
+}
+#endif
pdf::Environment::Environment(const char *argv0)
{
@@ -61,7 +78,11 @@ pdf::Environment::Environment(const char
Cwd cwd(argv0_dir_name);
#endif
globalParams = new GlobalParams();
+#if POPPLER_VERSION < 1900
setErrorFunction(poppler_error_handler);
+#else
+ setErrorCallback(poppler_error_handler, NULL);
+#endif
}
void pdf::Environment::set_antialias(bool value)

View File

@ -1,6 +1,6 @@
Name: pdf2djvu
Version: 0.7.4
Release: 14%{?dist}
Release: 15%{?dist}
Summary: PDF to DjVu converter
Group: Applications/Publishing
License: GPLv2+
@ -8,6 +8,7 @@ URL: http://pdf2djvu.googlecode.com/
Source0: http://pdf2djvu.googlecode.com/files/%{name}_%{version}.tar.gz
Patch1: throw-specifier.patch
Patch2: annot-link.patch
Patch3: pdf2djvu-0.7.4-poppler-0.20.0.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -29,6 +30,7 @@ metadata.
%patch1 -p1 -b .throw-specifier
%patch2 -p1 -b .annot-link
%patch3 -p1 -b .poppler-0.20
%build
%configure
@ -52,6 +54,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Mon Jul 2 2012 Marek Kasik <mkasik@redhat.com> - 0.7.4-15
- Fix building of pdf2djvu with poppler-0.20.x
- Resolves: #822407
* Mon Jul 2 2012 Marek Kasik <mkasik@redhat.com> - 0.7.4-14
- Rebuild (poppler-0.20.1)