ref: b271dae70cca6b6434f717e4a24c97b0d3735084
parent: dd7b0dac3ba85cda7e314eaa867b4f0d716c9ac4
author: Gregory Maxwell <[email protected]>
date: Sat Jun 29 16:25:55 EDT 2013
Brace a number of if statements instead of one-lining them.
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -937,7 +937,9 @@
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;
@@ -944,7 +946,9 @@
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,7 +967,9 @@
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;
@@ -970,7 +976,9 @@
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,7 +988,9 @@
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;
@@ -987,7 +997,9 @@
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;
@@ -994,7 +1006,9 @@
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;
--- 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,7 +1990,9 @@
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;
@@ -1995,7 +1999,9 @@
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;
@@ -2002,7 +2008,9 @@
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;
@@ -2009,7 +2017,9 @@
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,7 +2033,9 @@
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;
@@ -2030,7 +2042,9 @@
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,7 +2058,9 @@
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;
@@ -2051,7 +2067,9 @@
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;
@@ -2058,7 +2076,9 @@
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;
@@ -2065,7 +2085,9 @@
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,7 +2095,9 @@
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;
@@ -2080,7 +2104,9 @@
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;
@@ -2087,7 +2113,9 @@
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;
@@ -2094,7 +2122,9 @@
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,7 +2132,9 @@
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;
@@ -2109,7 +2141,9 @@
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,7 +2151,9 @@
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;
@@ -2124,7 +2160,9 @@
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;
@@ -2131,7 +2169,9 @@
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;
@@ -2138,7 +2178,9 @@
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;
@@ -2145,7 +2187,9 @@
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;
@@ -2152,7 +2196,9 @@
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;
@@ -2159,7 +2205,9 @@
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;
@@ -2166,7 +2214,9 @@
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,7 +2225,9 @@
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;
@@ -2182,7 +2234,9 @@
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;
@@ -2189,7 +2243,9 @@
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;
@@ -2196,7 +2252,9 @@
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;
--- 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)
--- 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;