From 1b99854649bb8641770cf89ea361a2674256e223 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 24 Mar 2025 20:40:04 +0100 Subject: [PATCH] Fix extern C wrapping glib headers extern C was wrapping the includes of headers which in turn included glib.h. glib 2.84 started to include C++ code in some of its headers which breaks when wrapped with extern C, see https://gitlab.gnome.org/GNOME/glib/-/issues/3631 Fix by only wrapping our own code with extern C. Fixes https://gitlab.com/inkscape/inkscape/-/issues/5615 --- src/path/splinefit/bezier-fit.cpp | 6 ++---- src/path/splinefit/splinefit.h | 5 +++++ src/path/splinefit/splinefont.h | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/path/splinefit/bezier-fit.cpp b/src/path/splinefit/bezier-fit.cpp index 111f538590..ed506da79d 100644 --- a/src/path/splinefit/bezier-fit.cpp +++ b/src/path/splinefit/bezier-fit.cpp @@ -6,10 +6,8 @@ #include <2geom/bezier-utils.h> #include <2geom/point.h> -extern "C" { - #include "splinefit.h" - #include "splinefont.h" -} +#include "splinefit.h" +#include "splinefont.h" int bezier_fit(Geom::Point bezier[4], const std::vector& data) { diff --git a/src/path/splinefit/splinefit.h b/src/path/splinefit/splinefit.h index 22e21fcdbe..89f830e548 100644 --- a/src/path/splinefit/splinefit.h +++ b/src/path/splinefit/splinefit.h @@ -32,6 +32,8 @@ // #include #include "splinefont.h" +G_BEGIN_DECLS + typedef struct fitpoint { BasePoint p; BasePoint ut; @@ -75,4 +77,7 @@ extern SplinePoint *ApproximateSplineSetFromGen(SplinePoint *from, SplinePoint * bigreal toler, int toler_is_sumsq, GenPointsP genp, void *tok, int order2); + +G_END_DECLS + #endif /* FONTFORGE_SPLINEFIT_H */ diff --git a/src/path/splinefit/splinefont.h b/src/path/splinefit/splinefont.h index 83db934cec..f8aaaa82b7 100644 --- a/src/path/splinefit/splinefont.h +++ b/src/path/splinefit/splinefont.h @@ -5,6 +5,8 @@ #include +G_BEGIN_DECLS + typedef double real; typedef double bigreal; typedef double extended; @@ -188,4 +190,6 @@ enum pconvert_flags { void SplinesRemoveBetween(SplinePoint *from, SplinePoint *to, int type); +G_END_DECLS + #endif // _SEEN_SPLINEFONT_H_ -- GitLab