aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--audio/audio_int.h4
-rw-r--r--audio/audio_template.h18
2 files changed, 10 insertions, 12 deletions
diff --git a/audio/audio_int.h b/audio/audio_int.h
index 4632cdf..ce2d6bf 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -151,8 +151,8 @@ struct audio_driver {
int can_be_default;
int max_voices_out;
int max_voices_in;
- int voice_size_out;
- int voice_size_in;
+ size_t voice_size_out;
+ size_t voice_size_in;
QLIST_ENTRY(audio_driver) next;
};
diff --git a/audio/audio_template.h b/audio/audio_template.h
index dfa440f..592866f 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -40,7 +40,7 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioState *s,
struct audio_driver *drv)
{
int max_voices = glue (drv->max_voices_, TYPE);
- int voice_size = glue (drv->voice_size_, TYPE);
+ size_t voice_size = glue(drv->voice_size_, TYPE);
if (glue (s->nb_hw_voices_, TYPE) > max_voices) {
if (!max_voices) {
@@ -63,8 +63,8 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioState *s,
}
if (audio_bug(__func__, voice_size && !max_voices)) {
- dolog ("drv=`%s' voice_size=%d max_voices=0\n",
- drv->name, voice_size);
+ dolog("drv=`%s' voice_size=%zu max_voices=0\n",
+ drv->name, voice_size);
}
}
@@ -273,13 +273,11 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s,
return NULL;
}
- hw = audio_calloc(__func__, 1, glue(drv->voice_size_, TYPE));
- if (!hw) {
- dolog ("Can not allocate voice `%s' size %d\n",
- drv->name, glue (drv->voice_size_, TYPE));
- return NULL;
- }
-
+ /*
+ * Since glue(s->nb_hw_voices_, TYPE) is != 0, glue(drv->voice_size_, TYPE)
+ * is guaranteed to be != 0. See the audio_init_nb_voices_* functions.
+ */
+ hw = g_malloc0(glue(drv->voice_size_, TYPE));
hw->s = s;
hw->pcm_ops = drv->pcm_ops;