diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 04:50:13 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:17:14 -0500 |
commit | a57d15158113cb7f10e662e6df07f445c986a12d (patch) | |
tree | 14bb731f73657583a364f381a3d58ad211b93cb4 /sound/synth | |
parent | cb432379eff40d5656ca9f24afc435b4df353d13 (diff) |
[ALSA] emux - Avoid cast of function pointers
Modules: Common EMU synth
Pass the proper functions instead of cast of function pointers, which
can be dangerous with compiler optimizations.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth')
-rw-r--r-- | sound/synth/emux/emux.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index 9e2b4c0c8a8a..2aacd8a884e5 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c | |||
@@ -66,6 +66,29 @@ int snd_emux_new(snd_emux_t **remu) | |||
66 | 66 | ||
67 | /* | 67 | /* |
68 | */ | 68 | */ |
69 | static int sf_sample_new(void *private_data, snd_sf_sample_t *sp, | ||
70 | snd_util_memhdr_t *hdr, | ||
71 | const void __user *buf, long count) | ||
72 | { | ||
73 | snd_emux_t *emu = private_data; | ||
74 | return emu->ops.sample_new(emu, sp, hdr, buf, count); | ||
75 | |||
76 | } | ||
77 | |||
78 | static int sf_sample_free(void *private_data, snd_sf_sample_t *sp, | ||
79 | snd_util_memhdr_t *hdr) | ||
80 | { | ||
81 | snd_emux_t *emu = private_data; | ||
82 | return emu->ops.sample_free(emu, sp, hdr); | ||
83 | |||
84 | } | ||
85 | |||
86 | static void sf_sample_reset(void *private_data) | ||
87 | { | ||
88 | snd_emux_t *emu = private_data; | ||
89 | emu->ops.sample_reset(emu); | ||
90 | } | ||
91 | |||
69 | int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) | 92 | int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) |
70 | { | 93 | { |
71 | int err; | 94 | int err; |
@@ -85,9 +108,12 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name) | |||
85 | /* create soundfont list */ | 108 | /* create soundfont list */ |
86 | memset(&sf_cb, 0, sizeof(sf_cb)); | 109 | memset(&sf_cb, 0, sizeof(sf_cb)); |
87 | sf_cb.private_data = emu; | 110 | sf_cb.private_data = emu; |
88 | sf_cb.sample_new = (snd_sf_sample_new_t)emu->ops.sample_new; | 111 | if (emu->ops.sample_new) |
89 | sf_cb.sample_free = (snd_sf_sample_free_t)emu->ops.sample_free; | 112 | sf_cb.sample_new = sf_sample_new; |
90 | sf_cb.sample_reset = (snd_sf_sample_reset_t)emu->ops.sample_reset; | 113 | if (emu->ops.sample_free) |
114 | sf_cb.sample_free = sf_sample_free; | ||
115 | if (emu->ops.sample_reset) | ||
116 | sf_cb.sample_reset = sf_sample_reset; | ||
91 | emu->sflist = snd_sf_new(&sf_cb, emu->memhdr); | 117 | emu->sflist = snd_sf_new(&sf_cb, emu->memhdr); |
92 | if (emu->sflist == NULL) | 118 | if (emu->sflist == NULL) |
93 | return -ENOMEM; | 119 | return -ENOMEM; |