AyatanaIndicators / ayatana-indicator-sound

Ayatana Indicator Sound Applet
GNU General Public License v3.0
2 stars 7 forks source link

src, tests: fix -Wint-to-pointer-cast and a chance of test crash #99

Closed peat-psuwit closed 10 months ago

peat-psuwit commented 10 months ago

Turns the constructor of VolumeControl and VolumeWarning from internal to protected. This makes Vala emits C declaration of constructors, which is required by the test's mocks extending these classes, in the external header.

Without them, the mocks' C code would then consider them "implicitly declared", and will assume they return int instead of a pointer. If the returned address happened to be higher than INT_MAX, the code will consider the returned address negative and sign-extend it when casting to a pointer, corrupting it.

As for "unprivating" these constructors, this is an internal static library anyway. No libraries or headers are installed from this package. This change is invisible from outside.