fix more compile errors

Avoid void * arithmetic
Do explicit casts to target type to make c++ happy
This commit is contained in:
Wim Taymans 2019-01-08 11:53:36 +01:00
parent 3fa2ad33e4
commit b0f4be5fbc
26 changed files with 175 additions and 159 deletions

View file

@ -48,7 +48,7 @@ spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_r
":", SPA_FORMAT_AUDIO_position, "?P", &position, NULL);
if (position && position->type == SPA_TYPE_Array &&
SPA_POD_ARRAY_TYPE(position) == SPA_TYPE_Id) {
uint32_t *values = SPA_POD_ARRAY_VALUES(position);
uint32_t *values = (uint32_t*)SPA_POD_ARRAY_VALUES(position);
uint32_t n_values = SPA_MIN(SPA_POD_ARRAY_N_VALUES(position), SPA_AUDIO_MAX_CHANNELS);
memcpy(info->position, values, n_values * sizeof(uint32_t));
}
@ -61,13 +61,19 @@ spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_r
static inline struct spa_pod *
spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_raw *info)
{
const struct spa_pod_id media_type = SPA_POD_Id(SPA_MEDIA_TYPE_audio);
const struct spa_pod_id media_subtype = SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw);
const struct spa_pod_id format = SPA_POD_Id(info->format);
const struct spa_pod_int rate = SPA_POD_Int(info->rate);
const struct spa_pod_int channels = SPA_POD_Int(info->channels);
spa_pod_builder_push_object(builder, SPA_TYPE_OBJECT_Format, id);
spa_pod_builder_props(builder,
SPA_FORMAT_mediaType, &SPA_POD_Id(SPA_MEDIA_TYPE_audio),
SPA_FORMAT_mediaSubtype, &SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
SPA_FORMAT_AUDIO_format, &SPA_POD_Id(info->format),
SPA_FORMAT_AUDIO_rate, &SPA_POD_Int(info->rate),
SPA_FORMAT_AUDIO_channels, &SPA_POD_Int(info->channels),
SPA_FORMAT_mediaType, &media_type,
SPA_FORMAT_mediaSubtype, &media_subtype,
SPA_FORMAT_AUDIO_format, &format,
SPA_FORMAT_AUDIO_rate, &rate,
SPA_FORMAT_AUDIO_channels, &channels,
0);
if (!SPA_FLAG_CHECK(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
@ -75,7 +81,8 @@ spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id,
info->channels, info->position);
}
return spa_pod_builder_pop(builder);
return (struct spa_pod*)spa_pod_builder_pop(builder);
}