From 41c2b5c21de5a3774f0bbb54de3999eaccc7de70 Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Wed, 29 Nov 2023 00:42:50 +0700 Subject: src, tests: fix -Wint-to-pointer-cast and a chance of test crash 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. --- src/volume-control.vala | 2 +- src/volume-warning.vala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/volume-control.vala b/src/volume-control.vala index f4244b4..a8ba3c7 100644 --- a/src/volume-control.vala +++ b/src/volume-control.vala @@ -54,7 +54,7 @@ public abstract class VolumeControl : Object protected IndicatorSound.Options _options = null; - internal VolumeControl(IndicatorSound.Options options) { + protected VolumeControl(IndicatorSound.Options options) { _options = options; } diff --git a/src/volume-warning.vala b/src/volume-warning.vala index b43e90f..6cfab41 100644 --- a/src/volume-warning.vala +++ b/src/volume-warning.vala @@ -44,7 +44,7 @@ public abstract class VolumeWarning : Object } } - internal VolumeWarning (IndicatorSound.Options options) { + protected VolumeWarning (IndicatorSound.Options options) { _options = options; -- cgit v1.2.3