Subject: Re: bug#75451: scratch/igc: Enable CHECK_STRUCTS

From: Stefan Kangas <[email-masked]>
Date: Mon, 20 Jan 2025 12:23:12 -0800

Pip Cet <[email-masked]> writes:

> svg_css_length_to_pixels doesn't handle the RSVG_UNIT_CH case.  I don't
> know at which version rsvg started to offer this unit; it's not

It seems to have been added in 2.58:

https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/enum.Unit.html

I will create a new bug report to track this.

> indicated in the header file.  The default case:
>
>     default:
>       /* We should never reach this.  */
>       value = 0;
>
> contains an incorrect comment (the header file warns that the enum is
> incomplete and will be expanded), and incorrect code (0 is not a good
> default value, and we should warn or return an error).

We would have detected this bug sooner with the below patch, no?

diff --git a/src/image.c b/src/image.c
index b8405d81111..7fda2684460 100644
--- a/src/image.c
+++ b/src/image.c
@@ -12008,9 +12008,6 @@ svg_css_length_to_pixels (RsvgLength length,
double dpi, int font_size)
 	 what size we make the image.  */
       value = 0;
       break;
-    default:
-      /* We should never reach this.  */
-      value = 0;
     }

   return value;