On Thu, Dec 27, 2018 at 09:22:31PM +0100, Matthias Kilian wrote:
> Hi,
>
> this fixes build with poppler-0.72.0 for me (at least on i386).
>
> It would be nice if someone could try wether it also build with our old
> poppler (0.61.1), so the fix could go in before the poppler update.
Builds fine with old poppler (0.61.1) on amd64.
>
> Ciao,
> Kili
>
> Index: patches/patch-pdf-backend_cc
> ===================================================================
> RCS file: patches/patch-pdf-backend_cc
> diff -N patches/patch-pdf-backend_cc
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-pdf-backend_cc 27 Dec 2018 20:20:31 -0000
> @@ -0,0 +1,49 @@
> +$OpenBSD$
> +
> +Fix with newer poppler.
> +
> +From upstream commit 82699eee6b071c1f80682987d6842f4b61d024be.
> +
> +Index: pdf-backend.cc
> +--- pdf-backend.cc.orig
> ++++ pdf-backend.cc
> +@@ -226,7 +226,7 @@ const std::string pdf::Document::get_xmp()
> + mstring.reset(this->readMetadata());
> + if (mstring.get() == nullptr)
> + return "";
> +- const char *cstring = mstring->getCString();
> ++ const char *cstring = pdf::get_c_string(*mstring);
> + if (strncmp(cstring, "<?xpacket begin=", 16) != 0)
> + return "";
> + cstring += 16;
> +@@ -393,7 +393,7 @@ pdf::Metadata::Metadata(pdf::Document &document)
> + char tzs = 0; int tzh = 0, tzm = 0;
> + if (!pdf::dict_lookup(info_dict, field.first, &object)->isString())
> + continue;
> +- const char *input = object.getString()->getCString();
> ++ const char *input = pdf::get_c_string(object.getString());
> + if (input[0] == 'D' && input[1] == ':')
> + input += 2;
> + int year = scan_date_digits(input, 4);
> +@@ -617,6 +617,21 @@ namespace pdf
> + }
> + return stream;
> + }
> ++}
> ++
> ++template<typename S> static auto get_c_string_impl(const S &str) -> decltype(str.c_str())
> ++{
> ++ return str.c_str();
> ++}
> ++
> ++template<typename S> static auto get_c_string_impl(const S &str) -> decltype(str.getCString())
> ++{
> ++ return str.getCString();
> ++}
> ++
> ++const char * pdf::get_c_string(const pdf::String &str)
> ++{
> ++ return get_c_string_impl<pdf::String>(str);
> + }
> +
> + // vim:ts=2 sts=2 sw=2 et
> Index: patches/patch-pdf-backend_hh
> ===================================================================
> RCS file: patches/patch-pdf-backend_hh
> diff -N patches/patch-pdf-backend_hh
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-pdf-backend_hh 27 Dec 2018 20:20:31 -0000
> @@ -0,0 +1,24 @@
> +$OpenBSD$
> +
> +Fix with newer poppler.
> +
> +From upstream commit 82699eee6b071c1f80682987d6842f4b61d024be.
> +
> +Index: pdf-backend.hh
> +--- pdf-backend.hh.orig
> ++++ pdf-backend.hh
> +@@ -433,6 +433,14 @@ namespace pdf
> +
> + double get_path_area(pdf::splash::Path &path);
> +
> ++ const char * get_c_string(const pdf::String &str);
> ++
> ++ inline const char * get_c_string(const pdf::String *str)
> ++ {
> ++ return get_c_string(*str);
> ++ }
> ++
> ++
> + }
> +
> +
No comments:
Post a Comment