[Spice-devel] [PATCH] spice-common: Fix -Wunused-variable

Victor Toso vtosodec at redhat.com
Thu Oct 23 05:22:25 PDT 2014


Fix a few warnings from unused variables when compiling spice-common
without OPUS or celt051.
---
 common/snd_codec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/snd_codec.c b/common/snd_codec.c
index e4809b4..9738311 100644
--- a/common/snd_codec.c
+++ b/common/snd_codec.c
@@ -310,7 +310,9 @@ void snd_codec_destroy(SndCodec *codec)
  */
 int snd_codec_frame_size(SndCodec codec)
 {
+#if defined(HAVE_CELT051) || defined(HAVE_OPUS)
     SndCodecInternal *c = (SndCodecInternal *) codec;
+#endif
 #if HAVE_CELT051
     if (c && c->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1)
         return SND_CODEC_CELT_FRAME_SIZE;
@@ -342,7 +344,9 @@ int snd_codec_frame_size(SndCodec codec)
 */
 int snd_codec_encode(SndCodec codec, uint8_t *in_ptr, int in_size, uint8_t *out_ptr, int *out_size)
 {
+#if defined(HAVE_CELT051) || defined(HAVE_OPUS)
     SndCodecInternal *c = (SndCodecInternal *) codec;
+#endif
 #if HAVE_CELT051
     if (c && c->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
         /* The output buffer size in celt determines the compression,
@@ -379,7 +383,9 @@ int snd_codec_encode(SndCodec codec, uint8_t *in_ptr, int in_size, uint8_t *out_
 */
 int snd_codec_decode(SndCodec codec, uint8_t *in_ptr, int in_size, uint8_t *out_ptr, int *out_size)
 {
+#if defined(HAVE_CELT051) || defined(HAVE_OPUS)
     SndCodecInternal *c = (SndCodecInternal *) codec;
+#endif
 #if HAVE_CELT051
     if (c && c->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1)
         return snd_codec_decode_celt051(c, in_ptr, in_size, out_ptr, out_size);
-- 
2.1.0



More information about the Spice-devel mailing list