Fix compilation with -Werror=float-conversion

Better make the conversions explicit so that we don't get any surprises.

Fixes #4065
This commit is contained in:
Wim Taymans 2024-06-18 12:17:56 +02:00
parent 50870aac57
commit 1ae4374ccf
71 changed files with 286 additions and 284 deletions

View file

@ -1335,7 +1335,7 @@ static void mixer_volume_init(pa_card *impl, pa_alsa_device *dev)
pa_log_info("Using hardware volume control. Hardware dB scale %s.",
dev->mixer_path->has_dB ? "supported" : "not supported");
}
dev->device.base_volume = pa_sw_volume_to_linear(dev->base_volume);
dev->device.base_volume = (float)pa_sw_volume_to_linear(dev->base_volume);
dev->device.volume_step = 1.0f / dev->n_volume_steps;
if (impl->soft_mixer || !dev->mixer_path || !dev->mixer_path->has_mute) {
@ -2022,7 +2022,7 @@ static int get_volume(pa_cvolume *v, float *volume, uint32_t n_volume)
if (v->channels == 0)
return -EIO;
for (i = 0; i < n_volume; i++)
volume[i] = pa_sw_volume_to_linear(v->values[i % v->channels]);
volume[i] = (float)pa_sw_volume_to_linear(v->values[i % v->channels]);
return 0;
}

View file

@ -1147,7 +1147,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
int rounding;
if (e->volume_limit >= 0 && value > (e->max_dB * 100))
value = e->max_dB * 100;
value = (long) (e->max_dB * 100);
if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
/* If we call set_playback_volume() without checking first

View file

@ -1206,7 +1206,7 @@ static unsigned devset_playback_priority(pa_idxset *devices, bool invert) {
}
if (priority > 0 && invert)
return 1.0 / priority;
return (unsigned)(1.0 / priority);
return (unsigned) priority;
}
@ -1224,7 +1224,7 @@ static unsigned devset_capture_priority(pa_idxset *devices, bool invert) {
}
if (priority > 0 && invert)
return 1.0 / priority;
return (unsigned)(1.0 / priority);
return (unsigned) priority;
}