Brace a number of if statements instead of one-lining them.
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index 13a910f..dbdf49f 100644
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -937,14 +937,18 @@
case OPUS_GET_BANDWIDTH_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->bandwidth;
}
break;
case OPUS_GET_FINAL_RANGE_REQUEST:
{
opus_uint32 *value = va_arg(ap, opus_uint32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->rangeFinal;
}
break;
@@ -963,14 +967,18 @@
case OPUS_GET_SAMPLE_RATE_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->Fs;
}
break;
case OPUS_GET_PITCH_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
if (st->prev_mode == MODE_CELT_ONLY)
celt_decoder_ctl(celt_dec, OPUS_GET_PITCH(value));
else
@@ -980,21 +988,27 @@
case OPUS_GET_GAIN_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->decode_gain;
}
break;
case OPUS_SET_GAIN_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if (value<-32768 || value>32767) goto bad_arg;
+ if (value<-32768 || value>32767) {
+ goto bad_arg;
+ }
st->decode_gain = value;
}
break;
case OPUS_GET_LAST_PACKET_DURATION_REQUEST:
{
opus_uint32 *value = va_arg(ap, opus_uint32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->last_packet_duration;
}
break;
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index c361d0b..0df2b61 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1966,7 +1966,9 @@
case OPUS_GET_APPLICATION_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->application;
}
break;
@@ -1988,28 +1990,36 @@
case OPUS_GET_BITRATE_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = user_bitrate_to_bitrate(st, st->prev_framesize, 1276);
}
break;
case OPUS_SET_FORCE_CHANNELS_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if((value<1 || value>st->channels) && value != OPUS_AUTO) goto bad_arg;
+ if((value<1 || value>st->channels) && value != OPUS_AUTO) {
+ goto bad_arg;
+ }
st->force_channels = value;
}
break;
case OPUS_GET_FORCE_CHANNELS_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->force_channels;
}
break;
case OPUS_SET_MAX_BANDWIDTH_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if (value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) goto bad_arg;
+ if (value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) {
+ goto bad_arg;
+ }
st->max_bandwidth = value;
if (st->max_bandwidth == OPUS_BANDWIDTH_NARROWBAND) {
st->silk_mode.maxInternalSampleRate = 8000;
@@ -2023,14 +2033,18 @@
case OPUS_GET_MAX_BANDWIDTH_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->max_bandwidth;
}
break;
case OPUS_SET_BANDWIDTH_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if ((value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) && value != OPUS_AUTO) goto bad_arg;
+ if ((value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) && value != OPUS_AUTO) {
+ goto bad_arg;
+ }
st->user_bandwidth = value;
if (st->user_bandwidth == OPUS_BANDWIDTH_NARROWBAND) {
st->silk_mode.maxInternalSampleRate = 8000;
@@ -2044,28 +2058,36 @@
case OPUS_GET_BANDWIDTH_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->bandwidth;
}
break;
case OPUS_SET_DTX_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if(value<0 || value>1) goto bad_arg;
+ if(value<0 || value>1) {
+ goto bad_arg;
+ }
st->silk_mode.useDTX = value;
}
break;
case OPUS_GET_DTX_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->silk_mode.useDTX;
}
break;
case OPUS_SET_COMPLEXITY_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if(value<0 || value>10) goto bad_arg;
+ if(value<0 || value>10) {
+ goto bad_arg;
+ }
st->silk_mode.complexity = value;
celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(value));
}
@@ -2073,28 +2095,36 @@
case OPUS_GET_COMPLEXITY_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->silk_mode.complexity;
}
break;
case OPUS_SET_INBAND_FEC_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if(value<0 || value>1) goto bad_arg;
+ if(value<0 || value>1) {
+ goto bad_arg;
+ }
st->silk_mode.useInBandFEC = value;
}
break;
case OPUS_GET_INBAND_FEC_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->silk_mode.useInBandFEC;
}
break;
case OPUS_SET_PACKET_LOSS_PERC_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if (value < 0 || value > 100) goto bad_arg;
+ if (value < 0 || value > 100) {
+ goto bad_arg;
+ }
st->silk_mode.packetLossPercentage = value;
celt_encoder_ctl(celt_enc, OPUS_SET_PACKET_LOSS_PERC(value));
}
@@ -2102,14 +2132,18 @@
case OPUS_GET_PACKET_LOSS_PERC_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->silk_mode.packetLossPercentage;
}
break;
case OPUS_SET_VBR_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if(value<0 || value>1) goto bad_arg;
+ if(value<0 || value>1) {
+ goto bad_arg;
+ }
st->use_vbr = value;
st->silk_mode.useCBR = 1-value;
}
@@ -2117,56 +2151,72 @@
case OPUS_GET_VBR_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->use_vbr;
}
break;
case OPUS_SET_VOICE_RATIO_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if (value<-1 || value>100) goto bad_arg;
+ if (value<-1 || value>100) {
+ goto bad_arg;
+ }
st->voice_ratio = value;
}
break;
case OPUS_GET_VOICE_RATIO_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->voice_ratio;
}
break;
case OPUS_SET_VBR_CONSTRAINT_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if(value<0 || value>1) goto bad_arg;
+ if(value<0 || value>1) {
+ goto bad_arg;
+ }
st->vbr_constraint = value;
}
break;
case OPUS_GET_VBR_CONSTRAINT_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->vbr_constraint;
}
break;
case OPUS_SET_SIGNAL_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if(value!=OPUS_AUTO && value!=OPUS_SIGNAL_VOICE && value!=OPUS_SIGNAL_MUSIC) goto bad_arg;
+ if(value!=OPUS_AUTO && value!=OPUS_SIGNAL_VOICE && value!=OPUS_SIGNAL_MUSIC) {
+ goto bad_arg;
+ }
st->signal_type = value;
}
break;
case OPUS_GET_SIGNAL_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->signal_type;
}
break;
case OPUS_GET_LOOKAHEAD_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->Fs/400;
if (st->application != OPUS_APPLICATION_RESTRICTED_LOWDELAY)
*value += st->delay_compensation;
@@ -2175,28 +2225,36 @@
case OPUS_GET_SAMPLE_RATE_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->Fs;
}
break;
case OPUS_GET_FINAL_RANGE_REQUEST:
{
opus_uint32 *value = va_arg(ap, opus_uint32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->rangeFinal;
}
break;
case OPUS_SET_LSB_DEPTH_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if (value<8 || value>24) goto bad_arg;
+ if (value<8 || value>24) {
+ goto bad_arg;
+ }
st->lsb_depth=value;
}
break;
case OPUS_GET_LSB_DEPTH_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->lsb_depth;
}
break;
@@ -2216,7 +2274,9 @@
case OPUS_GET_EXPERT_FRAME_DURATION_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->variable_duration;
}
break;
@@ -2244,7 +2304,9 @@
case OPUS_SET_FORCE_MODE_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if ((value < MODE_SILK_ONLY || value > MODE_CELT_ONLY) && value != OPUS_AUTO) goto bad_arg;
+ if ((value < MODE_SILK_ONLY || value > MODE_CELT_ONLY) && value != OPUS_AUTO) {
+ goto bad_arg;
+ }
st->user_forced_mode = value;
}
break;
@@ -2258,7 +2320,9 @@
case OPUS_SET_ENERGY_SAVE_REQUEST:
{
opus_val16 *value = va_arg(ap, opus_val16*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
ret = celt_encoder_ctl(celt_enc, OPUS_SET_ENERGY_SAVE(value));
}
break;
@@ -2273,7 +2337,9 @@
case CELT_GET_MODE_REQUEST:
{
const CELTMode ** value = va_arg(ap, const CELTMode**);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
ret = celt_encoder_ctl(celt_enc, CELT_GET_MODE(value));
}
break;
diff --git a/src/opus_multistream_decoder.c b/src/opus_multistream_decoder.c
index 51fe5ed..ebec6a7 100644
--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -400,7 +400,9 @@
int s;
opus_uint32 *value = va_arg(ap, opus_uint32*);
opus_uint32 tmp;
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = 0;
for (s=0;s<st->layout.nb_streams;s++)
{
@@ -443,7 +445,9 @@
if (stream_id<0 || stream_id >= st->layout.nb_streams)
ret = OPUS_BAD_ARG;
value = va_arg(ap, OpusDecoder**);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
for (s=0;s<stream_id;s++)
{
if (s < st->layout.nb_coupled_streams)
diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c
index 30ece34..81ea484 100644
--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -852,8 +852,9 @@
case OPUS_SET_BITRATE_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
- if (value<0 && value!=OPUS_AUTO && value!=OPUS_BITRATE_MAX)
+ if (value<0 && value!=OPUS_AUTO && value!=OPUS_BITRATE_MAX) {
goto bad_arg;
+ }
st->bitrate_bps = value;
}
break;
@@ -861,7 +862,9 @@
{
int s;
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = 0;
for (s=0;s<st->layout.nb_streams;s++)
{
@@ -904,7 +907,9 @@
int s;
opus_uint32 *value = va_arg(ap, opus_uint32*);
opus_uint32 tmp;
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value=0;
for (s=0;s<st->layout.nb_streams;s++)
{
@@ -960,7 +965,9 @@
if (stream_id<0 || stream_id >= st->layout.nb_streams)
ret = OPUS_BAD_ARG;
value = va_arg(ap, OpusEncoder**);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
for (s=0;s<stream_id;s++)
{
if (s < st->layout.nb_coupled_streams)
@@ -980,7 +987,9 @@
case OPUS_GET_EXPERT_FRAME_DURATION_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
- if (!value) goto bad_arg;
+ if (!value) {
+ goto bad_arg;
+ }
*value = st->variable_duration;
}
break;