diff --git a/src/opus_decoder.c b/src/opus_decoder.c index dbdf49f3c93132fe96c0b1e2b43da6fd291df64c..5b56ac1f601cde84581acfa1cc18028ec639d0d4 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -937,7 +937,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_GET_BANDWIDTH_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->bandwidth; @@ -946,7 +947,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_GET_FINAL_RANGE_REQUEST: { opus_uint32 *value = va_arg(ap, opus_uint32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->rangeFinal; @@ -967,7 +969,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_GET_SAMPLE_RATE_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->Fs; @@ -976,7 +979,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_GET_PITCH_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } if (st->prev_mode == MODE_CELT_ONLY) @@ -988,7 +992,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_GET_GAIN_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->decode_gain; @@ -997,7 +1002,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_SET_GAIN_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if (value<-32768 || value>32767) { + if (value<-32768 || value>32767) + { goto bad_arg; } st->decode_gain = value; @@ -1006,7 +1012,8 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...) case OPUS_GET_LAST_PACKET_DURATION_REQUEST: { opus_uint32 *value = va_arg(ap, opus_uint32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->last_packet_duration; diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 0df2b612a5fd5d59ef25cc92b5e6ed6d2e22c77b..cb7159c826cf2ae917b1b3e0c4e1a05c21d87653 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1966,7 +1966,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_APPLICATION_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->application; @@ -1990,7 +1991,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_BITRATE_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = user_bitrate_to_bitrate(st, st->prev_framesize, 1276); @@ -1999,7 +2001,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_FORCE_CHANNELS_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if((value<1 || value>st->channels) && value != OPUS_AUTO) { + if((value<1 || value>st->channels) && value != OPUS_AUTO) + { goto bad_arg; } st->force_channels = value; @@ -2008,7 +2011,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_FORCE_CHANNELS_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->force_channels; @@ -2017,7 +2021,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_MAX_BANDWIDTH_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if (value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) { + if (value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) + { goto bad_arg; } st->max_bandwidth = value; @@ -2033,7 +2038,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_MAX_BANDWIDTH_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->max_bandwidth; @@ -2042,7 +2048,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) 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) { + if ((value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) && value != OPUS_AUTO) + { goto bad_arg; } st->user_bandwidth = value; @@ -2058,7 +2065,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_BANDWIDTH_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->bandwidth; @@ -2067,7 +2075,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_DTX_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if(value<0 || value>1) { + if(value<0 || value>1) + { goto bad_arg; } st->silk_mode.useDTX = value; @@ -2076,7 +2085,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_DTX_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->silk_mode.useDTX; @@ -2085,7 +2095,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_COMPLEXITY_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if(value<0 || value>10) { + if(value<0 || value>10) + { goto bad_arg; } st->silk_mode.complexity = value; @@ -2095,7 +2106,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_COMPLEXITY_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->silk_mode.complexity; @@ -2104,7 +2116,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_INBAND_FEC_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if(value<0 || value>1) { + if(value<0 || value>1) + { goto bad_arg; } st->silk_mode.useInBandFEC = value; @@ -2113,7 +2126,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_INBAND_FEC_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->silk_mode.useInBandFEC; @@ -2122,7 +2136,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_PACKET_LOSS_PERC_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if (value < 0 || value > 100) { + if (value < 0 || value > 100) + { goto bad_arg; } st->silk_mode.packetLossPercentage = value; @@ -2132,7 +2147,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_PACKET_LOSS_PERC_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->silk_mode.packetLossPercentage; @@ -2141,7 +2157,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_VBR_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if(value<0 || value>1) { + if(value<0 || value>1) + { goto bad_arg; } st->use_vbr = value; @@ -2151,7 +2168,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_VBR_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->use_vbr; @@ -2160,7 +2178,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_VOICE_RATIO_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if (value<-1 || value>100) { + if (value<-1 || value>100) + { goto bad_arg; } st->voice_ratio = value; @@ -2169,7 +2188,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_VOICE_RATIO_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->voice_ratio; @@ -2178,7 +2198,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_VBR_CONSTRAINT_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if(value<0 || value>1) { + if(value<0 || value>1) + { goto bad_arg; } st->vbr_constraint = value; @@ -2187,7 +2208,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_VBR_CONSTRAINT_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->vbr_constraint; @@ -2196,7 +2218,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) 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) { + if(value!=OPUS_AUTO && value!=OPUS_SIGNAL_VOICE && value!=OPUS_SIGNAL_MUSIC) + { goto bad_arg; } st->signal_type = value; @@ -2205,7 +2228,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_SIGNAL_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->signal_type; @@ -2214,7 +2238,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_LOOKAHEAD_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->Fs/400; @@ -2225,7 +2250,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_SAMPLE_RATE_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->Fs; @@ -2234,7 +2260,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_FINAL_RANGE_REQUEST: { opus_uint32 *value = va_arg(ap, opus_uint32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->rangeFinal; @@ -2243,7 +2270,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_LSB_DEPTH_REQUEST: { opus_int32 value = va_arg(ap, opus_int32); - if (value<8 || value>24) { + if (value<8 || value>24) + { goto bad_arg; } st->lsb_depth=value; @@ -2252,7 +2280,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_LSB_DEPTH_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->lsb_depth; @@ -2264,8 +2293,9 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) if (value != OPUS_FRAMESIZE_ARG && value != OPUS_FRAMESIZE_2_5_MS && value != OPUS_FRAMESIZE_5_MS && value != OPUS_FRAMESIZE_10_MS && value != OPUS_FRAMESIZE_20_MS && value != OPUS_FRAMESIZE_40_MS && - value != OPUS_FRAMESIZE_60_MS && value != OPUS_FRAMESIZE_VARIABLE) { - goto bad_arg; + value != OPUS_FRAMESIZE_60_MS && value != OPUS_FRAMESIZE_VARIABLE) + { + goto bad_arg; } st->variable_duration = value; celt_encoder_ctl(celt_enc, OPUS_SET_EXPERT_FRAME_DURATION(value)); @@ -2274,7 +2304,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_GET_EXPERT_FRAME_DURATION_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->variable_duration; @@ -2304,7 +2335,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) 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) { + if ((value < MODE_SILK_ONLY || value > MODE_CELT_ONLY) && value != OPUS_AUTO) + { goto bad_arg; } st->user_forced_mode = value; @@ -2320,7 +2352,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case OPUS_SET_ENERGY_SAVE_REQUEST: { opus_val16 *value = va_arg(ap, opus_val16*); - if (!value) { + if (!value) + { goto bad_arg; } ret = celt_encoder_ctl(celt_enc, OPUS_SET_ENERGY_SAVE(value)); @@ -2337,7 +2370,8 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...) case CELT_GET_MODE_REQUEST: { const CELTMode ** value = va_arg(ap, const CELTMode**); - if (!value) { + if (!value) + { goto bad_arg; } ret = celt_encoder_ctl(celt_enc, CELT_GET_MODE(value)); diff --git a/src/opus_multistream_decoder.c b/src/opus_multistream_decoder.c index ebec6a7c22f0924e62d253fd8ea07d198da796b7..f3d2311e450b5c4131c0d00a0c2604a14bbbd1e0 100644 --- a/src/opus_multistream_decoder.c +++ b/src/opus_multistream_decoder.c @@ -400,7 +400,8 @@ int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) int s; opus_uint32 *value = va_arg(ap, opus_uint32*); opus_uint32 tmp; - if (!value) { + if (!value) + { goto bad_arg; } *value = 0; @@ -445,7 +446,8 @@ int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) if (stream_id<0 || stream_id >= st->layout.nb_streams) ret = OPUS_BAD_ARG; value = va_arg(ap, OpusDecoder**); - if (!value) { + if (!value) + { goto bad_arg; } for (s=0;s<stream_id;s++) diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c index 81ea48496a7ebe7c77aeaeed5bcc11783ae50269..df2b95adf19577528a6144e8a674c3977cefacbc 100644 --- a/src/opus_multistream_encoder.c +++ b/src/opus_multistream_encoder.c @@ -852,7 +852,8 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) 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; @@ -862,7 +863,8 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) { int s; opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = 0; @@ -907,7 +909,8 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) int s; opus_uint32 *value = va_arg(ap, opus_uint32*); opus_uint32 tmp; - if (!value) { + if (!value) + { goto bad_arg; } *value=0; @@ -965,7 +968,8 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) if (stream_id<0 || stream_id >= st->layout.nb_streams) ret = OPUS_BAD_ARG; value = va_arg(ap, OpusEncoder**); - if (!value) { + if (!value) + { goto bad_arg; } for (s=0;s<stream_id;s++) @@ -987,7 +991,8 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) case OPUS_GET_EXPERT_FRAME_DURATION_REQUEST: { opus_int32 *value = va_arg(ap, opus_int32*); - if (!value) { + if (!value) + { goto bad_arg; } *value = st->variable_duration;