[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/30] audio: Add braces for statements/fix braces' position
From: |
Gerd Hoffmann |
Subject: |
[PULL 24/30] audio: Add braces for statements/fix braces' position |
Date: |
Fri, 15 Jan 2021 14:21:40 +0100 |
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
- [PULL 04/30] sdlaudio: don't start playback in init routine, (continued)
- [PULL 04/30] sdlaudio: don't start playback in init routine, Gerd Hoffmann, 2021/01/15
- [PULL 12/30] audio: remove remaining unused plive code, Gerd Hoffmann, 2021/01/15
- [PULL 15/30] paaudio: wait until the playback stream is ready, Gerd Hoffmann, 2021/01/15
- [PULL 21/30] dsoundaudio: rename dsound_open(), Gerd Hoffmann, 2021/01/15
- [PULL 09/30] sdlaudio: add recording functions, Gerd Hoffmann, 2021/01/15
- [PULL 07/30] sdlaudio: replace legacy functions with modern ones, Gerd Hoffmann, 2021/01/15
- [PULL 27/30] audio: Fix lines over 90 characters, Gerd Hoffmann, 2021/01/15
- [PULL 06/30] sdlaudio: fill remaining sample buffer with silence, Gerd Hoffmann, 2021/01/15
- [PULL 28/30] audio: Don't use '%#' in format strings, Gerd Hoffmann, 2021/01/15
- [PULL 23/30] dsoundaudio: fix log message, Gerd Hoffmann, 2021/01/15
- [PULL 24/30] audio: Add braces for statements/fix braces' position,
Gerd Hoffmann <=
- [PULL 13/30] paaudio: avoid to clip samples multiple times, Gerd Hoffmann, 2021/01/15
- [PULL 14/30] paaudio: wait for PA_STREAM_READY in qpa_write(), Gerd Hoffmann, 2021/01/15
- [PULL 25/30] audio: Add spaces around operator/delete redundant spaces, Gerd Hoffmann, 2021/01/15
- [PULL 29/30] audio: Suspect code indent for conditional statements, Gerd Hoffmann, 2021/01/15
- [PULL 17/30] paaudio: comment bugs in functions qpa_init_*, Gerd Hoffmann, 2021/01/15
- [PULL 19/30] paaudio: send recorded data in smaller chunks, Gerd Hoffmann, 2021/01/15
- [PULL 26/30] audio: foo* bar" should be "foo *bar"., Gerd Hoffmann, 2021/01/15
- [PULL 30/30] audio: space prohibited between function name and parenthesis'(', Gerd Hoffmann, 2021/01/15
- [PULL 16/30] paaudio: remove unneeded code, Gerd Hoffmann, 2021/01/15
- Re: [PULL 00/30] Audio 20210115 patches, no-reply, 2021/01/15