rebuild for poppler 0.59.0

epel9
David Tardon 8 years ago
parent e0b1e90839
commit a272a4e963

@ -0,0 +1,193 @@
From 45cca81d842779203d21a5ddf390c272b7056d42 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 6 Sep 2017 16:37:16 +0200
Subject: [PATCH] adapt to poppler 0.58
---
Applications/Cxx/CMakeLists.txt | 6 ++++++
Applications/Cxx/gdcminfo.cxx | 22 ++++++++++++++++++++++
Applications/Cxx/gdcmpdf.cxx | 20 ++++++++++++++++++++
3 files changed, 48 insertions(+)
diff --git a/Applications/Cxx/CMakeLists.txt b/Applications/Cxx/CMakeLists.txt
index 9b42682..2843fd5 100644
--- a/Applications/Cxx/CMakeLists.txt
+++ b/Applications/Cxx/CMakeLists.txt
@@ -84,6 +84,12 @@ if(GDCM_USE_SYSTEM_POPPLER)
if(LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT)
list(APPEND libpoppler_flags -DLIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT)
endif()
+ CHECK_CXX_SOURCE_COMPILES(
+ "\#include <poppler/Object.h>\nint main() { Object o(42); }"
+ LIBPOPPLER_NEW_OBJECT_API)
+if(LIBPOPPLER_NEW_OBJECT_API)
+ list(APPEND libpoppler_flags -DLIBPOPPLER_NEW_OBJECT_API)
+ endif()
if(libpoppler_flags)
string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}")
set_source_files_properties(
diff --git a/Applications/Cxx/gdcminfo.cxx b/Applications/Cxx/gdcminfo.cxx
index 6e2b50d..8d2a137 100644
--- a/Applications/Cxx/gdcminfo.cxx
+++ b/Applications/Cxx/gdcminfo.cxx
@@ -193,7 +193,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
//char buf[256];
std::string out;
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ if ((obj = infoDict->lookup((char*)key)).isString())
+#else
if (infoDict->lookup((char*)key, &obj)->isString())
+#endif
{
s = obj.getString()->getCString();
if (s[0] == 'D' && s[1] == ':')
@@ -241,7 +245,9 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
out = date;
}
}
+#ifndef LIBPOPPLER_NEW_OBJECT_API
obj.free();
+#endif
return out;
}
@@ -255,7 +261,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
int i, n;
std::string out;
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ if ((obj = infoDict->lookup((char*)key)).isString())
+#else
if (infoDict->lookup((char*)key, &obj)->isString())
+#endif
{
s1 = obj.getString();
if ((s1->getChar(0) & 0xff) == 0xfe &&
@@ -287,7 +297,9 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
out.append( std::string(buf, n) );
}
}
+#ifndef LIBPOPPLER_NEW_OBJECT_API
obj.free();
+#endif
return out;
}
#endif
@@ -434,7 +446,11 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
MemStream *appearStream;
appearStream = new MemStream((char*)bv->GetPointer(), 0,
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ bv->GetLength(), std::move(appearDict));
+#else
bv->GetLength(), &appearDict);
+#endif
GooString *ownerPW, *userPW;
ownerPW = NULL;
userPW = NULL;
@@ -462,7 +478,11 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
Object info;
if (doc->isOk())
{
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ info = doc->getDocInfo();
+#else
doc->getDocInfo(&info);
+#endif
if (info.isDict())
{
title = getInfoString(info.getDict(), "Title", uMap);
@@ -473,7 +493,9 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
producer = getInfoString(info.getDict(), "Producer", uMap);
creationdate = getInfoDate( info.getDict(), "CreationDate" );
moddate = getInfoDate( info.getDict(), "ModDate" );
+#ifndef LIBPOPPLER_NEW_OBJECT_API
info.free();
+#endif
}
#ifdef LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT
const char *tagged = doc->getStructTreeRoot() ? "yes" : "no";
diff --git a/Applications/Cxx/gdcmpdf.cxx b/Applications/Cxx/gdcmpdf.cxx
index 4c7a7bb..92caad7 100644
--- a/Applications/Cxx/gdcmpdf.cxx
+++ b/Applications/Cxx/gdcmpdf.cxx
@@ -43,7 +43,11 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
//char buf[256];
std::string out;
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ if ((obj = infoDict->lookup((char*)key)).isString())
+#else
if (infoDict->lookup((char*)key, &obj)->isString())
+#endif
{
s = obj.getString()->getCString();
if (s[0] == 'D' && s[1] == ':')
@@ -91,7 +95,9 @@ static std::string getInfoDate(Dict *infoDict, const char *key)
out = date;
}
}
+#ifndef LIBPOPPLER_NEW_OBJECT_API
obj.free();
+#endif
return out;
}
@@ -105,7 +111,11 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
int i, n;
std::string out;
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ if ((obj = infoDict->lookup((char*)key)).isString())
+#else
if (infoDict->lookup((char*)key, &obj)->isString())
+#endif
{
s1 = obj.getString();
if ((s1->getChar(0) & 0xff) == 0xfe &&
@@ -137,7 +147,9 @@ static std::string getInfoString(Dict *infoDict, const char *key, UnicodeMap *uM
out.append( std::string(buf, n) );
}
}
+#ifndef LIBPOPPLER_NEW_OBJECT_API
obj.free();
+#endif
unicode = unicode || isUnicode;
return out;
}
@@ -340,7 +352,9 @@ int main (int argc, char *argv[])
//ownerPW = new GooString( "toto" );
Object obj;
+#ifndef LIBPOPPLER_NEW_OBJECT_API
obj.initNull();
+#endif
doc = new PDFDoc(fileName, ownerPW, userPW);
if (doc->isEncrypted())
@@ -386,7 +400,11 @@ http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx
GBool isUnicode = gFalse;
if (doc->isOk())
{
+#ifdef LIBPOPPLER_NEW_OBJECT_API
+ info = doc->getDocInfo();
+#else
doc->getDocInfo(&info);
+#endif
if (info.isDict())
{
title = getInfoString(info.getDict(), "Title", uMap, isUnicode);
@@ -397,7 +415,9 @@ http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx
producer = getInfoString(info.getDict(), "Producer", uMap, isUnicode);
creationdate = getInfoDate( info.getDict(), "CreationDate" );
moddate = getInfoDate( info.getDict(), "ModDate" );
+#ifndef LIBPOPPLER_NEW_OBJECT_API
info.free();
+#endif
}
}
--
2.13.5

@ -6,7 +6,7 @@
Name: gdcm
Version: 2.6.5
Release: 15%{?dist}
Release: 16%{?dist}
Summary: Grassroots DiCoM is a C++ library to parse DICOM medical files
Group: System Environment/Libraries
License: BSD
@ -21,6 +21,7 @@ Patch3: gdcm-2.4.0-no-versioned-dir.patch
#Patch4: gdcm-0005-support-vtk6.patch
Patch5: gdcm-2.4.0-find-python27.patch
Patch6: gdcm-2.6-fix-cmake-config-paths.patch
Patch7: 0001-adapt-to-poppler-0.58.patch
BuildRequires: CharLS-devel >= 1.0
BuildRequires: cmake
@ -125,6 +126,7 @@ used this library with python
%patch2 -p 1
%patch3 -p 1
%patch6 -p 1
%patch7 -p 1
# Fix cmake command
sed -i.backup 's/add_dependency/add_dependencies/' Utilities/doxygen/CMakeLists.txt
@ -295,6 +297,9 @@ make test -C %{_target_platform} || exit 0
%{python3_sitearch}/*
%changelog
* Fri Sep 08 2017 David Tardon <dtardon@redhat.com> - 2.6.5-16
- rebuild for poppler 0.59.0
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.6.5-15
- Add Provides for the old name without %%_isa

Loading…
Cancel
Save