Fix minor issues reported by scan-build
authorPhilip J├Ągenstedt <philip@foolip.org>
Thu, 11 Oct 2012 09:27:12 +0000 (11:27 +0200)
committerGregory Maxwell <greg@xiph.org>
Thu, 11 Oct 2012 13:21:44 +0000 (09:21 -0400)
celt/celt.c
silk/dec_API.c
silk/enc_API.c
tests/test_opus_api.c

index f7a2eee..4ddba9e 100644 (file)
@@ -1187,7 +1187,6 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
       pre[0] = _pre;
       pre[1] = _pre + (N+COMBFILTER_MAXPERIOD);
 
-      silence = 1;
       c=0; do {
          int count = 0;
          const opus_val16 * OPUS_RESTRICT pcmp = pcm+c;
index 68403b7..58b6b2b 100644 (file)
@@ -97,6 +97,8 @@ opus_int silk_Decode(                                   /* O    Returns error co
     opus_int stereo_to_mono;
     SAVE_STACK;
 
+    silk_assert( decControl->nChannelsInternal == 1 || decControl->nChannelsInternal == 2 );
+
     /**********************************/
     /* Test if first frame in payload */
     /**********************************/
index ec7915c..325e16a 100644 (file)
@@ -191,9 +191,8 @@ opus_int silk_Encode(                                   /* O    Returns error co
     if( prefillFlag ) {
         /* Only accept input length of 10 ms */
         if( nBlocksOf10ms != 1 ) {
-            ret = SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
             silk_assert( 0 );
-            return ret;
+            return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
         }
         /* Reset Encoder */
         for( n = 0; n < encControl->nChannelsInternal; n++ ) {
@@ -212,15 +211,13 @@ opus_int silk_Encode(                                   /* O    Returns error co
     } else {
         /* Only accept input lengths that are a multiple of 10 ms */
         if( nBlocksOf10ms * encControl->API_sampleRate != 100 * nSamplesIn || nSamplesIn < 0 ) {
-            ret = SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
             silk_assert( 0 );
-            return ret;
+            return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
         }
         /* Make sure no more than one packet can be produced */
         if( 1000 * (opus_int32)nSamplesIn > encControl->payloadSize_ms * encControl->API_sampleRate ) {
-            ret = SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
             silk_assert( 0 );
-            return ret;
+            return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
         }
     }
 
index cae8a75..187d8c3 100644 (file)
@@ -987,7 +987,7 @@ opus_int32 test_parse(void)
       }
    }
    fprintf(stdout,"    code 3 padding (%2d cases) ............... OK.\n",cfgs);
-   cfgs_total+=cfgs;cfgs=0;
+   cfgs_total+=cfgs;
    fprintf(stdout,"    opus_packet_parse ............................ OK.\n");
    fprintf(stdout,"                      All packet parsing tests passed\n");
    fprintf(stdout,"                          (%d API invocations)\n",cfgs_total);