shithub: opus

Download patch

ref: a82dfdd240c59a7c56c43a69831545a1eb91f54e
parent: 2b35de9164477f19fc80b1c916fddc9f32a2774e
author: Jean-Marc Valin <[email protected]>
date: Thu Mar 13 19:01:55 EDT 2008

Adjusting/fixing warnings

--- a/configure.ac
+++ b/configure.ac
@@ -109,7 +109,8 @@
 fi])
 
 if test $ac_cv_c_compiler_gnu = yes ; then
-        CFLAGS="$CFLAGS -fvisibility=hidden -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wno-parentheses"
+        CFLAGS="$CFLAGS -fvisibility=hidden -W -Wstrict-prototypes -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wno-parentheses -Wno-unused-parameter -Wno-sign-compare"
+        #CFLAGS="$CFLAGS -fvisibility=hidden -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wno-parentheses"
 fi
 
 AC_CHECK_SIZEOF(short)
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -83,10 +83,10 @@
 
 static const celt_word16_t base_resolution = QCONST16(6.f,8);
 
-static void quant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int budget, ec_enc *enc)
+static void quant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, unsigned budget, ec_enc *enc)
 {
    int i;
-   int bits;
+   unsigned bits;
    celt_word16_t prev = 0;
    celt_word16_t coef = m->ePredCoef;
    celt_word16_t beta;
@@ -162,10 +162,10 @@
    RESTORE_STACK;
 }
 
-static void unquant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, int budget, ec_dec *dec)
+static void unquant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_word16_t *oldEBands, unsigned budget, ec_dec *dec)
 {
    int i;
-   int bits;
+   unsigned bits;
    celt_word16_t prev = 0;
    celt_word16_t coef = m->ePredCoef;
    /* The .7 is a heuristic */
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -243,7 +243,6 @@
 
                if (score>nbest[Lupdate-1]->score)
                {
-                  int k;
                   int id = Lupdate-1;
                   struct NBest *tmp_best;
 
@@ -376,7 +375,6 @@
 
    for (i=0;i<max_pos*B;i+=B)
    {
-      int j;
       celt_word32_t xy=0, yy=0;
       celt_word32_t score;
       for (j=0;j<N;j++)
--- a/tests/cwrs32-test.c
+++ b/tests/cwrs32-test.c
@@ -26,7 +26,6 @@
         int x2[MMAX];
         int s2[MMAX];
         int y[NMAX];
-        int j;
         int k;
         cwrsi(n,m,i,x,s);
         /*printf("%6u of %u:",i,nc);*/
--- a/tests/cwrs64-test.c
+++ b/tests/cwrs64-test.c
@@ -27,7 +27,6 @@
         int x2[MMAX];
         int s2[MMAX];
         int y[NMAX];
-        int j;
         int k;
         cwrsi64(n,m,i,x,s);
         /*printf("%llu of %llu:",i,nc);
--- a/tests/ectest.c
+++ b/tests/ectest.c
@@ -80,7 +80,7 @@
       }
       sym64=ec_dec_uint64(&dec,(ec_uint64)ft<<30);
       if(sym64!=((ec_uint64)i<<30|i)){
-        fprintf(stderr,"Decoded %lli instead of %lli with ft of %lli.\n",sym64,
+        fprintf(stderr,"Decoded %lu instead of %lu with ft of %lu.\n",sym64,
          (ec_uint64)i<<30|i,(ec_uint64)ft<<30);
         ret=-1;
       }
@@ -95,7 +95,7 @@
       }
       sym64=ec_dec_bits64(&dec,ftb+30);
       if(sym64!=((ec_uint64)i<<30|i)){
-        fprintf(stderr,"Decoded %lli instead of %lli with ftb of %i.\n",
+        fprintf(stderr,"Decoded %lu instead of %lu with ftb of %i.\n",
          sym64,(ec_uint64)i<<30|i,ftb+30);
         ret=-1;
       }
@@ -136,7 +136,7 @@
     ec_enc_done(&enc);
     if ((tell_bits+7)/8 < ec_byte_bytes(&buf))
     {
-      fprintf (stderr, "tell() lied, there's %d bytes instead of %d\n", 
+      fprintf (stderr, "tell() lied, there's %li bytes instead of %d\n", 
                ec_byte_bytes(&buf), (tell_bits+7)/8);
       ret=-1;
     }
--- a/tests/laplace-test.c
+++ b/tests/laplace-test.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include "laplace.h"
 
-int main()
+int main(void)
 {
    int i;
    int ret = 0;
--- a/tests/mathops-test.c
+++ b/tests/mathops-test.c
@@ -14,7 +14,7 @@
 
 int ret = 0;
 
-void testdiv()
+void testdiv(void)
 {
    celt_int32_t i;
    for (i=-327670;i<=327670;i++)
@@ -37,7 +37,7 @@
    }
 }
 
-void testsqrt()
+void testsqrt(void)
 {
    celt_int32_t i;
    for (i=1;i<=1000000000;i++)
@@ -55,7 +55,7 @@
    }
 }
 
-int main()
+int main(void)
 {
    testdiv();
    testsqrt();
--- a/tests/rotation-test.c
+++ b/tests/rotation-test.c
@@ -39,7 +39,7 @@
       ret = 1;
 }
 
-int main()
+int main(void)
 {
    test_rotation(15, 3);
    test_rotation(23, 5);
--- a/tests/type-test.c
+++ b/tests/type-test.c
@@ -5,7 +5,7 @@
 #include "celt_types.h"
 #include <stdio.h>
 
-int main()
+int main(void)
 {
    celt_int16_t i = 1;
    i <<= 14;
--- a/tools/celtdec.c
+++ b/tools/celtdec.c
@@ -247,7 +247,7 @@
    return fout;
 }
 
-void usage()
+void usage(void)
 {
    printf ("Usage: celtdec [options] input_file.spx [output_file]\n");
    printf ("\n");
@@ -274,13 +274,13 @@
    printf ("\n");
 }
 
-void version()
+void version(void)
 {
    printf ("celtenc (CELT encoder)\n");
    printf ("Copyright (C) 2008 Jean-Marc Valin\n");
 }
 
-void version_short()
+void version_short(void)
 {
    printf ("celtenc (CELT encoder)\n");
    printf ("Copyright (C) 2008 Jean-Marc Valin\n");
@@ -291,7 +291,7 @@
    CELTDecoder *st;
    CELTHeader header;
       
-   celt_header_from_packet((char*)op->packet, op->bytes, &header);
+   celt_header_from_packet(op->packet, op->bytes, &header);
 
    if (header.nb_channels>2 || header.nb_channels<1)
    {
@@ -348,7 +348,6 @@
    int frame_size=0, granule_frame_size=0;
    void *st=NULL;
    CELTMode *mode=NULL;
-   unsigned char bits[1000];
    int packet_count=0;
    int stream_init = 0;
    int quiet = 0;
@@ -382,7 +381,7 @@
    int rate=0;
    int extra_headers=0;
    int wav_format=0;
-   int lookahead;
+   int lookahead=0;
    int celt_serialno = -1;
    int firstpacket = 1;
 
@@ -487,7 +486,7 @@
    while (1)
    {
       char *data;
-      int i, j, nb_read;
+      int i, nb_read;
       /*Get the ogg buffer for writing*/
       data = ogg_sync_buffer(&oy, 200);
       /*Read bitstream from input file*/
--- a/tools/celtenc.c
+++ b/tools/celtenc.c
@@ -182,19 +182,19 @@
    add_fisbone_to_stream(os, &fp);
 }
 
-void version()
+void version(void)
 {
    printf ("celtenc (CELT encoder)\n");
    printf ("Copyright (C) 2008 Jean-Marc Valin\n");
 }
 
-void version_short()
+void version_short(void)
 {
    printf ("celtenc (CELT encoder)\n");
    printf ("Copyright (C) 2008 Jean-Marc Valin\n");
 }
 
-void usage()
+void usage(void)
 {
    printf ("Usage: celtenc [options] input_file output_file\n");
    printf ("\n");