All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Zhang Han <zhanghan64@huawei.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [PULL 24/30] audio: Add braces for statements/fix braces' position
Date: Fri, 15 Jan 2021 14:21:40 +0100	[thread overview]
Message-ID: <20210115132146.1443592-25-kraxel@redhat.com> (raw)
In-Reply-To: <20210115132146.1443592-1-kraxel@redhat.com>

From: Zhang Han <zhanghan64@huawei.com>

Fix problems about braces:
-braces are necessary for all arms of if/for/while statements
-else should follow close brace '}'

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-2-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 audio/audio_template.h | 12 ++++--------
 audio/alsaaudio.c      | 15 +++++----------
 audio/audio.c          | 26 ++++++++++++--------------
 audio/coreaudio.c      |  3 +--
 audio/dsoundaudio.c    |  9 +++------
 audio/ossaudio.c       | 12 ++++--------
 6 files changed, 29 insertions(+), 48 deletions(-)

diff --git a/audio/audio_template.h b/audio/audio_template.h
index 434df5d5e750..f77210e40435 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -47,8 +47,7 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioState *s,
 #ifdef DAC
             dolog ("Driver `%s' does not support " NAME "\n", drv->name);
 #endif
-        }
-        else {
+        } else {
             dolog ("Driver `%s' does not support %d " NAME " voices, max %d\n",
                    drv->name,
                    glue (s->nb_hw_voices_, TYPE),
@@ -387,8 +386,7 @@ static SW *glue(audio_pcm_create_voice_pair_, TYPE)(
 
     if (pdo->fixed_settings) {
         hw_as = audiodev_to_audsettings(pdo);
-    }
-    else {
+    } else {
         hw_as = *as;
     }
 
@@ -498,8 +496,7 @@ SW *glue (AUD_open_, TYPE) (
         if (glue (audio_pcm_sw_init_, TYPE) (sw, hw, name, as)) {
             goto fail;
         }
-    }
-    else {
+    } else {
         sw = glue(audio_pcm_create_voice_pair_, TYPE)(s, name, as);
         if (!sw) {
             dolog ("Failed to create voice `%s'\n", name);
@@ -553,8 +550,7 @@ uint64_t glue (AUD_get_elapsed_usec_, TYPE) (SW *sw, QEMUAudioTimeStamp *ts)
 
     if (cur_ts >= old_ts) {
         delta = cur_ts - old_ts;
-    }
-    else {
+    } else {
         delta = UINT64_MAX - old_ts + cur_ts;
     }
 
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 5a871aaf6b48..fcc2f62864fb 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -278,32 +278,28 @@ static snd_pcm_format_t aud_to_alsafmt (AudioFormat fmt, int endianness)
     case AUDIO_FORMAT_S16:
         if (endianness) {
             return SND_PCM_FORMAT_S16_BE;
-        }
-        else {
+        } else {
             return SND_PCM_FORMAT_S16_LE;
         }
 
     case AUDIO_FORMAT_U16:
         if (endianness) {
             return SND_PCM_FORMAT_U16_BE;
-        }
-        else {
+        } else {
             return SND_PCM_FORMAT_U16_LE;
         }
 
     case AUDIO_FORMAT_S32:
         if (endianness) {
             return SND_PCM_FORMAT_S32_BE;
-        }
-        else {
+        } else {
             return SND_PCM_FORMAT_S32_LE;
         }
 
     case AUDIO_FORMAT_U32:
         if (endianness) {
             return SND_PCM_FORMAT_U32_BE;
-        }
-        else {
+        } else {
             return SND_PCM_FORMAT_U32_LE;
         }
 
@@ -722,8 +718,7 @@ static int alsa_voice_ctl (snd_pcm_t *handle, const char *typ, int ctl)
             alsa_logerr (err, "Could not stop %s\n", typ);
             return -1;
         }
-    }
-    else {
+    } else {
         err = snd_pcm_prepare (handle);
         if (err < 0) {
             alsa_logerr (err, "Could not prepare handle for %s\n", typ);
diff --git a/audio/audio.c b/audio/audio.c
index 34c9cb918279..6734c8af708c 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -344,8 +344,7 @@ void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len)
 
     if (info->is_signed || info->is_float) {
         memset(buf, 0x00, len * info->bytes_per_frame);
-    }
-    else {
+    } else {
         switch (info->bits) {
         case 8:
             memset(buf, 0x80, len * info->bytes_per_frame);
@@ -584,8 +583,7 @@ static size_t audio_pcm_sw_get_rpos_in(SWVoiceIn *sw)
     rpos = hw->conv_buf->pos - live;
     if (rpos >= 0) {
         return rpos;
-    }
-    else {
+    } else {
         return hw->conv_buf->size + rpos;
     }
 }
@@ -788,10 +786,14 @@ static int audio_is_timer_needed(AudioState *s)
     HWVoiceOut *hwo = NULL;
 
     while ((hwo = audio_pcm_hw_find_any_enabled_out(s, hwo))) {
-        if (!hwo->poll_mode) return 1;
+        if (!hwo->poll_mode) {
+            return 1;
+        }
     }
     while ((hwi = audio_pcm_hw_find_any_enabled_in(s, hwi))) {
-        if (!hwi->poll_mode) return 1;
+        if (!hwi->poll_mode) {
+            return 1;
+        }
     }
     return 0;
 }
@@ -908,8 +910,7 @@ void AUD_set_active_out (SWVoiceOut *sw, int on)
                     audio_reset_timer (s);
                 }
             }
-        }
-        else {
+        } else {
             if (hw->enabled) {
                 int nb_active = 0;
 
@@ -956,8 +957,7 @@ void AUD_set_active_in (SWVoiceIn *sw, int on)
                 }
             }
             sw->total_hw_samples_acquired = hw->total_samples_captured;
-        }
-        else {
+        } else {
             if (hw->enabled) {
                 int nb_active = 0;
 
@@ -1532,8 +1532,7 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv,
         audio_init_nb_voices_in(s, drv);
         s->drv = drv;
         return 0;
-    }
-    else {
+    } else {
         if (msg) {
             dolog("Could not init `%s' audio driver\n", drv->name);
         }
@@ -1848,8 +1847,7 @@ CaptureVoiceOut *AUD_add_capture(
     if (cap) {
         QLIST_INSERT_HEAD (&cap->cb_head, cb, entries);
         return cap;
-    }
-    else {
+    } else {
         HWVoiceOut *hw;
         CaptureVoiceOut *cap;
 
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 79a9d40bf8ef..408b5871261c 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -524,8 +524,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct audsettings *as,
     } else if (frameRange.mMaximum < frames) {
         core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMaximum;
         dolog ("warning: Downsizing Buffer Frames to %f\n", frameRange.mMaximum);
-    }
-    else {
+    } else {
         core->audioDevicePropertyBufferFrameSize = frames;
     }
 
diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c
index d3695f3af653..e59bd83dc717 100644
--- a/audio/dsoundaudio.c
+++ b/audio/dsoundaudio.c
@@ -404,8 +404,7 @@ static void dsound_enable_out(HWVoiceOut *hw, bool enable)
                 dsound_logerr (hr, "Could not stop playing buffer\n");
                 return;
             }
-        }
-        else {
+        } else {
             dolog ("warning: Voice is not playing\n");
         }
     }
@@ -509,8 +508,7 @@ static void dsound_enable_in(HWVoiceIn *hw, bool enable)
                 dsound_logerr (hr, "Could not stop capturing\n");
                 return;
             }
-        }
-        else {
+        } else {
             dolog ("warning: Voice is not capturing\n");
         }
     }
@@ -659,8 +657,7 @@ static void *dsound_audio_init(Audiodev *dev)
         );
     if (FAILED (hr)) {
         dsound_logerr (hr, "Could not create DirectSoundCapture instance\n");
-    }
-    else {
+    } else {
         hr = IDirectSoundCapture_Initialize (s->dsound_capture, NULL);
         if (FAILED (hr)) {
             dsound_logerr (hr, "Could not initialize DirectSoundCapture\n");
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index c1db89f23300..60eff66424b9 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -142,16 +142,14 @@ static int aud_to_ossfmt (AudioFormat fmt, int endianness)
     case AUDIO_FORMAT_S16:
         if (endianness) {
             return AFMT_S16_BE;
-        }
-        else {
+        } else {
             return AFMT_S16_LE;
         }
 
     case AUDIO_FORMAT_U16:
         if (endianness) {
             return AFMT_U16_BE;
-        }
-        else {
+        } else {
             return AFMT_U16_LE;
         }
 
@@ -542,16 +540,14 @@ static int oss_init_out(HWVoiceOut *hw, struct audsettings *as,
             int trig = 0;
             if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
                 oss_logerr (errno, "SNDCTL_DSP_SETTRIGGER 0 failed\n");
-            }
-            else {
+            } else {
                 trig = PCM_ENABLE_OUTPUT;
                 if (ioctl (fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
                     oss_logerr (
                         errno,
                         "SNDCTL_DSP_SETTRIGGER PCM_ENABLE_OUTPUT failed\n"
                         );
-                }
-                else {
+                } else {
                     oss->mmapped = 1;
                 }
             }
-- 
2.29.2



  parent reply	other threads:[~2021-01-15 14:10 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 13:21 [PULL 00/30] Audio 20210115 patches Gerd Hoffmann
2021-01-15 13:21 ` [PULL 01/30] sdlaudio: remove leftover SDL1.2 code Gerd Hoffmann
2021-01-15 13:21 ` [PULL 02/30] audio: fix bit-rotted code Gerd Hoffmann
2021-01-15 13:21 ` [PULL 03/30] sdlaudio: add -audiodev sdl,out.buffer-count option Gerd Hoffmann
2021-01-15 13:21 ` [PULL 04/30] sdlaudio: don't start playback in init routine Gerd Hoffmann
2021-01-15 13:21 ` [PULL 05/30] sdlaudio: always clear the sample buffer Gerd Hoffmann
2021-01-15 13:21 ` [PULL 06/30] sdlaudio: fill remaining sample buffer with silence Gerd Hoffmann
2021-01-15 13:21 ` [PULL 07/30] sdlaudio: replace legacy functions with modern ones Gerd Hoffmann
2021-01-15 13:21 ` [PULL 08/30] audio: split pcm_ops function get_buffer_in Gerd Hoffmann
2021-01-15 13:21 ` [PULL 09/30] sdlaudio: add recording functions Gerd Hoffmann
2021-01-15 13:21 ` [PULL 10/30] audio: break generic buffer dependency on mixing-engine Gerd Hoffmann
2021-01-15 13:21 ` [PULL 11/30] sdlaudio: enable (in|out).mixing-engine=off Gerd Hoffmann
2021-01-15 13:21 ` [PULL 12/30] audio: remove remaining unused plive code Gerd Hoffmann
2021-01-15 13:21 ` [PULL 13/30] paaudio: avoid to clip samples multiple times Gerd Hoffmann
2021-01-15 13:21 ` [PULL 14/30] paaudio: wait for PA_STREAM_READY in qpa_write() Gerd Hoffmann
2021-01-15 13:21 ` [PULL 15/30] paaudio: wait until the playback stream is ready Gerd Hoffmann
2021-01-15 13:21 ` [PULL 16/30] paaudio: remove unneeded code Gerd Hoffmann
2021-01-15 13:21 ` [PULL 17/30] paaudio: comment bugs in functions qpa_init_* Gerd Hoffmann
2021-01-15 13:21 ` [PULL 18/30] paaudio: limit minreq to 75% of audio timer_rate Gerd Hoffmann
2021-01-15 13:21 ` [PULL 19/30] paaudio: send recorded data in smaller chunks Gerd Hoffmann
2021-01-15 13:21 ` [PULL 20/30] dsoundaudio: replace GetForegroundWindow() Gerd Hoffmann
2021-01-15 13:21 ` [PULL 21/30] dsoundaudio: rename dsound_open() Gerd Hoffmann
2021-01-15 13:21 ` [PULL 22/30] dsoundaudio: enable f32 audio sample format Gerd Hoffmann
2021-01-15 13:21 ` [PULL 23/30] dsoundaudio: fix log message Gerd Hoffmann
2021-01-15 13:21 ` Gerd Hoffmann [this message]
2021-01-15 13:21 ` [PULL 25/30] audio: Add spaces around operator/delete redundant spaces Gerd Hoffmann
2021-01-15 13:21 ` [PULL 26/30] audio: foo* bar" should be "foo *bar" Gerd Hoffmann
2021-01-15 13:21 ` [PULL 27/30] audio: Fix lines over 90 characters Gerd Hoffmann
2021-01-15 13:21 ` [PULL 28/30] audio: Don't use '%#' in format strings Gerd Hoffmann
2021-01-15 13:21 ` [PULL 29/30] audio: Suspect code indent for conditional statements Gerd Hoffmann
2021-01-15 13:21 ` [PULL 30/30] audio: space prohibited between function name and parenthesis'(' Gerd Hoffmann
2021-01-15 14:24 ` [PULL 00/30] Audio 20210115 patches no-reply
2021-01-16 12:56 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210115132146.1443592-25-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhanghan64@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.