From 89d5afca5e0f5cb798db2efc16be6cd31c24d0a4 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 16 Aug 2026 10:43:19 +0000 Subject: [PATCH 1/7] css: Rename the internal RsvgLength to RsvgInternalLength librsvg 2.46 added a public RsvgLength struct carrying an RsvgUnit, which collides with the internal one in rsvg-private.h. Rename the internal type out of the way so the public name is free. Mechanical; no behaviour change. --- rsvg-css.c | 8 ++++---- rsvg-filter.c | 6 +++--- rsvg-filter.h | 2 +- rsvg-image.h | 2 +- rsvg-marker.h | 2 +- rsvg-mask.h | 2 +- rsvg-paint-server.c | 2 +- rsvg-paint-server.h | 6 +++--- rsvg-private.h | 8 ++++---- rsvg-shapes.c | 8 ++++---- rsvg-structure.h | 4 ++-- rsvg-styles.h | 8 ++++---- rsvg-text.c | 2 +- tests/styles.c | 4 ++-- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/rsvg-css.c b/rsvg-css.c index 3f3403f6f..a397ee6fc 100644 --- a/rsvg-css.c +++ b/rsvg-css.c @@ -179,10 +179,10 @@ rsvg_css_parse_raw_length (const char *str, gboolean * in, return length; } -RsvgLength +RsvgInternalLength _rsvg_css_parse_length (const char *str) { - RsvgLength out; + RsvgInternalLength out; gboolean percent, em, ex, in; RelativeSize relative_size = RELATIVE_SIZE_NORMAL; percent = em = ex = in = FALSE; @@ -231,7 +231,7 @@ _rsvg_css_normalize_font_size (RsvgState * state, RsvgDrawingCtx * ctx) } double -_rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx, char dir) +_rsvg_css_normalize_length (const RsvgInternalLength * in, RsvgDrawingCtx * ctx, char dir) { if (in->factor == '\0') return in->length; @@ -287,7 +287,7 @@ _rsvg_css_accumulate_baseline_shift (RsvgState * state, RsvgDrawingCtx * ctx) double -_rsvg_css_hand_normalize_length (const RsvgLength * in, gdouble pixels_per_inch, +_rsvg_css_hand_normalize_length (const RsvgInternalLength * in, gdouble pixels_per_inch, gdouble width_or_height, gdouble font_size) { if (in->factor == '\0') diff --git a/rsvg-filter.c b/rsvg-filter.c index caf8efaee..ac65155d7 100644 --- a/rsvg-filter.c +++ b/rsvg-filter.c @@ -94,7 +94,7 @@ typedef struct _RsvgFilterPrimitive RsvgFilterPrimitive; */ struct _RsvgFilterPrimitive { RsvgNode super; - RsvgLength x, y, width, height; + RsvgInternalLength x, y, width, height; GString *in; GString *result; @@ -1976,7 +1976,7 @@ typedef struct _RsvgFilterPrimitiveOffset RsvgFilterPrimitiveOffset; struct _RsvgFilterPrimitiveOffset { RsvgFilterPrimitive super; - RsvgLength dx, dy; + RsvgInternalLength dx, dy; }; static void @@ -4334,7 +4334,7 @@ struct _RsvgNodeLightSource { lightType type; gdouble azimuth; gdouble elevation; - RsvgLength x, y, z, pointsAtX, pointsAtY, pointsAtZ; + RsvgInternalLength x, y, z, pointsAtX, pointsAtY, pointsAtZ; gdouble specularExponent; gdouble limitingconeAngle; }; diff --git a/rsvg-filter.h b/rsvg-filter.h index da7ffebd0..72e1e90c2 100644 --- a/rsvg-filter.h +++ b/rsvg-filter.h @@ -39,7 +39,7 @@ typedef RsvgCoordUnits RsvgFilterUnits; struct _RsvgFilter { RsvgNode super; - RsvgLength x, y, width, height; + RsvgInternalLength x, y, width, height; RsvgFilterUnits filterunits; RsvgFilterUnits primitiveunits; }; diff --git a/rsvg-image.h b/rsvg-image.h index 9f291d0aa..bc85facac 100644 --- a/rsvg-image.h +++ b/rsvg-image.h @@ -44,7 +44,7 @@ typedef struct _RsvgNodeImage RsvgNodeImage; struct _RsvgNodeImage { RsvgNode super; gint preserve_aspect_ratio; - RsvgLength x, y, w, h; + RsvgInternalLength x, y, w, h; cairo_surface_t *surface; /* a cairo image surface */ }; diff --git a/rsvg-marker.h b/rsvg-marker.h index e4e6726aa..7453b211e 100644 --- a/rsvg-marker.h +++ b/rsvg-marker.h @@ -35,7 +35,7 @@ typedef struct _RsvgMarker RsvgMarker; struct _RsvgMarker { RsvgNode super; gboolean bbox; - RsvgLength refX, refY, width, height; + RsvgInternalLength refX, refY, width, height; double orient; gint preserve_aspect_ratio; gboolean orientAuto; diff --git a/rsvg-mask.h b/rsvg-mask.h index fae18620f..ffdda0b2a 100644 --- a/rsvg-mask.h +++ b/rsvg-mask.h @@ -40,7 +40,7 @@ typedef struct _RsvgMask RsvgMask; struct _RsvgMask { RsvgNode super; - RsvgLength x, y, width, height; + RsvgInternalLength x, y, width, height; RsvgMaskUnits maskunits; RsvgMaskUnits contentunits; }; diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c index 641a0bdd8..984125585 100644 --- a/rsvg-paint-server.c +++ b/rsvg-paint-server.c @@ -160,7 +160,7 @@ rsvg_stop_set_atts (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts) if (rsvg_property_bag_size (atts)) { if ((value = rsvg_property_bag_lookup (atts, "offset"))) { /* either a number [0,1] or a percentage */ - RsvgLength length = _rsvg_css_parse_length (value); + RsvgInternalLength length = _rsvg_css_parse_length (value); offset = _rsvg_css_hand_normalize_length (&length, rsvg_dpi_percentage (ctx), 1., 0.); if (offset < 0.) diff --git a/rsvg-paint-server.h b/rsvg-paint-server.h index 59f7210a0..9379a162d 100644 --- a/rsvg-paint-server.h +++ b/rsvg-paint-server.h @@ -55,7 +55,7 @@ struct _RsvgLinearGradient { gboolean obj_bbox; cairo_matrix_t affine; /* user space to actual at time of gradient def */ cairo_extend_t spread; - RsvgLength x1, y1, x2, y2; + RsvgInternalLength x1, y1, x2, y2; guint32 current_color; gboolean has_current_color; unsigned int hasx1:1; @@ -73,7 +73,7 @@ struct _RsvgRadialGradient { gboolean obj_bbox; cairo_matrix_t affine; /* user space to actual at time of gradient def */ cairo_extend_t spread; - RsvgLength cx, cy, r, fx, fy; + RsvgInternalLength cx, cy, r, fx, fy; guint32 current_color; gboolean has_current_color; unsigned int hascx:1; @@ -92,7 +92,7 @@ struct _RsvgPattern { gboolean obj_cbbox; gboolean obj_bbox; cairo_matrix_t affine; /* user space to actual at time of gradient def */ - RsvgLength x, y, width, height; + RsvgInternalLength x, y, width, height; RsvgViewBox vbox; unsigned int preserve_aspect_ratio; unsigned int hasx:1; diff --git a/rsvg-private.h b/rsvg-private.h index 205c0346f..9e3b5f66c 100644 --- a/rsvg-private.h +++ b/rsvg-private.h @@ -258,7 +258,7 @@ _rsvg_render_check_type (RsvgRender *render, typedef struct { double length; char factor; -} RsvgLength; +} RsvgInternalLength; typedef struct { cairo_rectangle_t rect; @@ -406,15 +406,15 @@ void rsvg_bbox_insert (RsvgBbox * dst, RsvgBbox * src); G_GNUC_INTERNAL void rsvg_bbox_clip (RsvgBbox * dst, RsvgBbox * src); G_GNUC_INTERNAL -double _rsvg_css_normalize_length (const RsvgLength * in, RsvgDrawingCtx * ctx, char dir); +double _rsvg_css_normalize_length (const RsvgInternalLength * in, RsvgDrawingCtx * ctx, char dir); G_GNUC_INTERNAL -double _rsvg_css_hand_normalize_length (const RsvgLength * in, gdouble pixels_per_inch, +double _rsvg_css_hand_normalize_length (const RsvgInternalLength * in, gdouble pixels_per_inch, gdouble width_or_height, gdouble font_size); double _rsvg_css_normalize_font_size (RsvgState * state, RsvgDrawingCtx * ctx); G_GNUC_INTERNAL double _rsvg_css_accumulate_baseline_shift (RsvgState * state, RsvgDrawingCtx * ctx); G_GNUC_INTERNAL -RsvgLength _rsvg_css_parse_length (const char *str); +RsvgInternalLength _rsvg_css_parse_length (const char *str); G_GNUC_INTERNAL void _rsvg_push_view_box (RsvgDrawingCtx * ctx, double w, double h); G_GNUC_INTERNAL diff --git a/rsvg-shapes.c b/rsvg-shapes.c index e3cd3d0f7..6eefdfe51 100644 --- a/rsvg-shapes.c +++ b/rsvg-shapes.c @@ -235,7 +235,7 @@ rsvg_new_polyline (void) struct _RsvgNodeLine { RsvgNode super; - RsvgLength x1, x2, y1, y2; + RsvgInternalLength x1, x2, y1, y2; }; typedef struct _RsvgNodeLine RsvgNodeLine; @@ -301,7 +301,7 @@ rsvg_new_line (void) struct _RsvgNodeRect { RsvgNode super; - RsvgLength x, y, w, h, rx, ry; + RsvgInternalLength x, y, w, h, rx, ry; gboolean got_rx, got_ry; }; @@ -490,7 +490,7 @@ rsvg_new_rect (void) struct _RsvgNodeCircle { RsvgNode super; - RsvgLength cx, cy, r; + RsvgInternalLength cx, cy, r; }; typedef struct _RsvgNodeCircle RsvgNodeCircle; @@ -578,7 +578,7 @@ rsvg_new_circle (void) struct _RsvgNodeEllipse { RsvgNode super; - RsvgLength cx, cy, rx, ry; + RsvgInternalLength cx, cy, rx, ry; }; typedef struct _RsvgNodeEllipse RsvgNodeEllipse; diff --git a/rsvg-structure.h b/rsvg-structure.h index 9d45cbd57..9c8cb9bd3 100644 --- a/rsvg-structure.h +++ b/rsvg-structure.h @@ -68,13 +68,13 @@ struct _RsvgNodeSymbol { struct _RsvgNodeUse { RsvgNode super; char *link; - RsvgLength x, y, w, h; + RsvgInternalLength x, y, w, h; }; struct _RsvgNodeSvg { RsvgNode super; gint preserve_aspect_ratio; - RsvgLength x, y, w, h; + RsvgInternalLength x, y, w, h; RsvgViewBox vbox; }; diff --git a/rsvg-styles.h b/rsvg-styles.h index 2da0621df..ec7c92095 100644 --- a/rsvg-styles.h +++ b/rsvg-styles.h @@ -66,7 +66,7 @@ typedef enum { typedef struct _RsvgVpathDash RsvgVpathDash; struct _RsvgVpathDash { - RsvgLength offset; + RsvgInternalLength offset; int n_dash; double *dash; }; @@ -101,7 +101,7 @@ struct _RsvgState { gboolean has_stroke_server; guint8 stroke_opacity; /* 0..255 */ gboolean has_stroke_opacity; - RsvgLength stroke_width; + RsvgInternalLength stroke_width; gboolean has_stroke_width; double miter_limit; gboolean has_miter_limit; @@ -111,7 +111,7 @@ struct _RsvgState { cairo_line_join_t join; gboolean has_join; - RsvgLength font_size; + RsvgInternalLength font_size; gboolean has_font_size; char *font_family; gboolean has_font_family; @@ -135,7 +135,7 @@ struct _RsvgState { gboolean has_unicode_bidi; TextAnchor text_anchor; gboolean has_text_anchor; - RsvgLength letter_spacing; + RsvgInternalLength letter_spacing; gboolean has_letter_spacing; guint text_offset; diff --git a/rsvg-text.c b/rsvg-text.c index 6f63dff14..ee87991bf 100644 --- a/rsvg-text.c +++ b/rsvg-text.c @@ -40,7 +40,7 @@ typedef struct _RsvgNodeText RsvgNodeText; struct _RsvgNodeText { RsvgNode super; - RsvgLength x, y, dx, dy; + RsvgInternalLength x, y, dx, dy; }; typedef struct _RsvgNodeTref RsvgNodeTref; diff --git a/tests/styles.c b/tests/styles.c index ff7694d58..e421d0689 100644 --- a/tests/styles.c +++ b/tests/styles.c @@ -11,7 +11,7 @@ union Expected { guint color; - RsvgLength length; + RsvgInternalLength length; }; typedef struct _FixtureData @@ -31,7 +31,7 @@ assert_equal_color (guint expected, guint actual) } static void -assert_equal_length (RsvgLength *expected, RsvgLength *actual) +assert_equal_length (RsvgInternalLength *expected, RsvgInternalLength *actual) { g_assert_cmpfloat (expected->length, ==, actual->length); g_assert_cmpint (expected->factor, ==, actual->factor); -- 2.43.0