Skip to contentSkip to conversation

alsa: fix warning

PATCH Superseded Gerd Hoffmann 2 participants 2 messages Jun 17, 2009 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsa: fix warning

---
 audio/alsaaudio.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
audio/alsaaudio.c +2 -4
index 2f6c764..f0752bc 100644
@@ -626,8 +626,7 @@ static int alsa_init_out (HWVoiceOut *hw, struct audsettings *as)
     req.period_size = conf.period_size_out;
     req.buffer_size = conf.buffer_size_out;
     req.size_in_usec = conf.size_in_usec_out;
-    req.override_mask = !!conf.period_size_out_overridden
-        | (!!conf.buffer_size_out_overridden << 1);
+    req.override_mask = conf.period_size_out_overridden ? 0x03 : 0x00;
 
     if (alsa_open (0, &req, &obt, &handle)) {
         return -1;
@@ -706,8 +705,7 @@ static int alsa_init_in (HWVoiceIn *hw, struct audsettings *as)
     req.period_size = conf.period_size_in;
     req.buffer_size = conf.buffer_size_in;
     req.size_in_usec = conf.size_in_usec_in;
-    req.override_mask = !!conf.period_size_in_overridden
-        | (!!conf.buffer_size_in_overridden << 1);
+    req.override_mask = conf.period_size_in_overridden ? 0x03 : 0x00;
 
     if (alsa_open (1, &req, &obt, &handle)) {
         return -1;
Signature · 1 line
1.6.2.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 11 lines · Gerd Hoffmann
---
 audio/alsaaudio.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
audio/alsaaudio.c +0 -0
index 2f6c764..f0752bc 100644

audio/alsaaudio.c static int alsa_init_out (HWVoiceOut *hw, struct · line 630

Quoted 7 lines
audio/alsaaudio.c +1 -2
@@ -626,8 +626,7 @@ static int alsa_init_out (HWVoiceOut *hw, struct
 audsettings *as)
    req.period_size = conf.period_size_out;
    req.buffer_size = conf.buffer_size_out;
    req.size_in_usec = conf.size_in_usec_out;
-    req.override_mask = !!conf.period_size_out_overridden
-        | (!!conf.buffer_size_out_overridden << 1);
+    req.override_mask = conf.period_size_out_overridden ? 0x03 : 0x00;

I'm all for fixing warnings, but this changes the functionality, buffer_size_out_overridden != period_size_out_overridden. I don't think that was the intent, otherwise please state so in the patch description.

audio/alsaaudio.c static int alsa_init_in (HWVoiceIn *hw, struct · line 709

Quoted 12 lines
audio/alsaaudio.c +1 -2
    if (alsa_open (0, &req, &obt, &handle)) {
        return -1;
@@ -706,8 +705,7 @@ static int alsa_init_in (HWVoiceIn *hw, struct
 audsettings *as)
    req.period_size = conf.period_size_in;
    req.buffer_size = conf.buffer_size_in;
    req.size_in_usec = conf.size_in_usec_in;
-    req.override_mask = !!conf.period_size_in_overridden
-        | (!!conf.buffer_size_in_overridden << 1);
+    req.override_mask = conf.period_size_in_overridden ? 0x03 : 0x00;

Same here.

F.