From a614bdb580d65653dbfe5c9925940797a065deac Mon Sep 17 00:00:00 2001 From: Federico <19206300+quaqo@users.noreply.github.com> Date: Sun, 8 Jan 2023 14:12:51 +0100 Subject: [PATCH] Fix build with Leptonica >=1.83 From leptonica 1.83 release notes: * Use stdatomic.h to make cloning string safe. Remove all *GetRefcount() and *ChangeRefcount() accessors. * Remove information about fields in many structs from the public interface allheaders.h, instead putting them in internal files pix_internal.h, array_internal.h and ccbord_internal.h. --- src/jbig2.cc | 3 +++ src/jbig2enc.cc | 8 ++++++++ src/jbig2sym.cc | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/src/jbig2.cc b/src/jbig2.cc index 0bddb90..baf62ea 100644 --- a/src/jbig2.cc +++ b/src/jbig2.cc @@ -29,6 +29,9 @@ #endif #include +#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1 +#include "leptonica/pix_internal.h" +#endif #include "jbig2enc.h" diff --git a/src/jbig2enc.cc b/src/jbig2enc.cc index 7603696..524b26f 100644 --- a/src/jbig2enc.cc +++ b/src/jbig2enc.cc @@ -24,6 +24,10 @@ #include #include +#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1 +#include "leptonica/pix_internal.h" +#include "leptonica/array_internal.h" +#endif #include #if defined(sun) @@ -206,7 +210,11 @@ unite_templates(struct jbig2ctx *ctx, numaSetValue(ctx->classer->naclass, i, new_representant); } } +#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1 + ctx->classer->pixat->pix[new_representant]->refcount += ctx->classer->pixat->pix[second_template]->refcount; +#else pixChangeRefcount(ctx->classer->pixat->pix[new_representant],pixGetRefcount(ctx->classer->pixat->pix[second_template])); +#endif } return 0; } diff --git a/src/jbig2sym.cc b/src/jbig2sym.cc index b419b71..43d2ff9 100644 --- a/src/jbig2sym.cc +++ b/src/jbig2sym.cc @@ -29,6 +29,10 @@ #include #include +#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1 +#include "leptonica/pix_internal.h" +#include "leptonica/array_internal.h" +#endif #include