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

@ -868,7 +868,7 @@ int format_info_to_spec(const struct format_info *info, struct sample_spec *ss,
if (spa_json_is_float(val, len)) {
if (spa_json_parse_float(val, len, &f) <= 0)
return -EINVAL;
ss->channels = f;
ss->channels = (uint8_t)f;
} else if (spa_json_is_array(val, len)) {
return -ENOTSUP;
} else if (spa_json_is_object(val, len)) {

View file

@ -636,7 +636,7 @@ int message_put(struct message *m, ...)
write_dict(m, va_arg(va, struct spa_dict*), true);
break;
case TAG_VOLUME:
write_volume(m, va_arg(va, double));
write_volume(m, (float)va_arg(va, double));
break;
case TAG_FORMAT_INFO:
write_format_info(m, va_arg(va, struct format_info*));

View file

@ -4559,7 +4559,7 @@ static int do_update_stream_sample_rate(struct client *client, uint32_t command,
stream->rate = rate;
corr = (double)rate/(double)stream->ss.rate;
corr = (float)rate/(float)stream->ss.rate;
pw_stream_set_control(stream->stream, SPA_PROP_rate, 1, &corr, NULL);
return reply_simple_ack(client, tag);

View file

@ -79,7 +79,7 @@ int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bo
{
float step;
if (spa_pod_get_float(&prop->value, &step) >= 0)
info->steps = 0x10000u * step;
info->steps = (uint32_t)(0x10000u * step);
break;
}
case SPA_PROP_channelMap: