shithub: opus

Download patch

ref: 679f5cc6754f19674b79d2b0d444ca0dd5b4c8a5
parent: 92518982cc3537594b10f40f00e3ba2d606108b3
author: Jean-Marc Valin <[email protected]>
date: Thu Mar 13 13:39:55 EDT 2008

Enabling warnings and restricting symbol visibility

--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@
 AM_CONFIG_HEADER([config.h])
 
 CELT_MAJOR_VERSION=0
-CELT_MINOR_VERSION=2
+CELT_MINOR_VERSION=3
 CELT_MICRO_VERSION=0
 CELT_EXTRA_VERSION=
 CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION
@@ -108,6 +108,9 @@
   AC_DEFINE([STATIC_MODES], , [Static modes])
 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"
+fi
 
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -140,7 +140,7 @@
    celt_free(st);
 }
 
-inline celt_int16_t SIG2INT16(celt_sig_t x)
+static inline celt_int16_t SIG2INT16(celt_sig_t x)
 {
    x = PSHR32(x, SIG_SHIFT);
    if (x>32767)
@@ -155,7 +155,7 @@
 }
 
 /** Apply window and compute the MDCT for all sub-frames and all channels in a frame */
-static celt_word32_t compute_mdcts(const mdct_lookup *mdct_lookup, const celt_word16_t *window, celt_sig_t *in, celt_sig_t *out, int N, int overlap, int B, int C)
+static celt_word32_t compute_mdcts(const mdct_lookup *lookup, const celt_word16_t *window, celt_sig_t *in, celt_sig_t *out, int N, int overlap, int B, int C)
 {
    int i, c, N4;
    celt_word32_t E = 0;
@@ -184,7 +184,7 @@
          }
          for (j=0;j<2*N;j++)
             E += MULT16_16(EXTRACT16(SHR32(x[j],SIG_SHIFT+4)),EXTRACT16(SHR32(x[j],SIG_SHIFT+4)));
-         mdct_forward(mdct_lookup, x, tmp);
+         mdct_forward(lookup, x, tmp);
          /* Interleaving the sub-frames */
          for (j=0;j<N;j++)
             out[C*B*j+C*i+c] = tmp[j];
@@ -195,7 +195,7 @@
 }
 
 /** Compute the IMDCT and apply window for all sub-frames and all channels in a frame */
-static void compute_inv_mdcts(const mdct_lookup *mdct_lookup, const celt_word16_t *window, celt_sig_t *X, celt_sig_t *out_mem, celt_sig_t *mdct_overlap, int N, int overlap, int B, int C)
+static void compute_inv_mdcts(const mdct_lookup *lookup, const celt_word16_t *window, celt_sig_t *X, celt_sig_t *out_mem, celt_sig_t *mdct_overlap, int N, int overlap, int B, int C)
 {
    int i, c, N4;
    VARDECL(celt_word32_t, x);
@@ -212,7 +212,7 @@
          /* De-interleaving the sub-frames */
          for (j=0;j<N;j++)
             tmp[j] = X[C*B*j+C*i+c];
-         mdct_backward(mdct_lookup, tmp, x);
+         mdct_backward(lookup, tmp, x);
          /* The first and last part would need to be set to zero if we actually
             wanted to use them. */
          for (j=0;j<overlap;j++)
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -152,7 +152,7 @@
 
 #endif /* !STATIC_MODES */
 
-int bits2pulses(const CELTMode *m, int band, int bits)
+static int bits2pulses(const CELTMode *m, int band, int bits)
 {
    int lo, hi;
    lo = 0;
@@ -172,7 +172,7 @@
       return hi;
 }
 
-int vec_bits2pulses(const CELTMode *m, int *bits, int *pulses, int len)
+static int vec_bits2pulses(const CELTMode *m, int *bits, int *pulses, int len)
 {
    int i;
    int sum=0;
@@ -186,7 +186,7 @@
    return sum;
 }
 
-int interp_bits2pulses(const CELTMode *m, int *bits1, int *bits2, int total, int *pulses, int len)
+static int interp_bits2pulses(const CELTMode *m, int *bits1, int *bits2, int total, int *pulses, int len)
 {
    int lo, hi, out;
    int j;