[Spice-devel,v7,12/12] sound: Use memcpy instead of manually copy volume array

Submitted by Frediano Ziglio on Dec. 5, 2016, 12:07 p.m.

Details

Message ID 85e41b3ecf4c002265ab92cfe4868329657ca6a1.1480939634.git-series.fziglio@redhat.com
State Rejected
Headers show
Series "Remove DummyChannel* objects" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Dec. 5, 2016, 12:07 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/sound.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/sound.c b/server/sound.c
index de2f0b3..7b35c87 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -386,7 +386,6 @@  static int snd_playback_send_migrate(PlaybackChannelClient *client)
 static int snd_send_volume(SndChannelClient *client, uint32_t cap, int msg)
 {
     SpiceMsgAudioVolume *vol;
-    uint8_t c;
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
     SndChannel *channel = SND_CHANNEL(red_channel_client_get_channel(rcc));
@@ -400,9 +399,8 @@  static int snd_send_volume(SndChannelClient *client, uint32_t cap, int msg)
                  st->volume_nchannels * sizeof (uint16_t));
     red_channel_client_init_send_data(rcc, msg, NULL);
     vol->nchannels = st->volume_nchannels;
-    for (c = 0; c < st->volume_nchannels; ++c) {
-        vol->volume[c] = st->volume[c];
-    }
+    SPICE_VERIFY(sizeof(vol->volume[0]) == sizeof(st->volume[0]));
+    memcpy(vol->volume, st->volume, sizeof(st->volume[0] * st->volume_nchannels));
     spice_marshall_SpiceMsgAudioVolume(m, vol);
 
     red_channel_client_begin_send_message(rcc);