shithub: sox

Download patch

ref: 8e4694505723ed0728d4b8452959670bbe29d908
parent: 7f87d3a3b4a2ba597964254bb4929fc9b0e45d2c
author: robs <robs>
date: Sat Nov 3 13:42:33 EDT 2007

warning quashing

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
 RM = rm -f 
 
 AM_CPPFLAGS = -DLADSPA_PATH="\"@LADSPA_PATH@\"" -DPKGLIBDIR="\"$(pkglibdir)\""
-AM_CFLAGS = -Wconversion
+AM_CFLAGS = #-Wconversion
 
 # Pass flags from --enable-silent-libtool
 LIBTOOL = @LIBTOOL@ @LIBTOOLFLAGS@
--- a/src/adpcm.c
+++ b/src/adpcm.c
@@ -311,7 +311,7 @@
         unsigned char *p;
 
         sox_debug("AdpcmMashI(chans %d, ip %p, n %d, st %p, obuff %p, bA %d)\n",
-                                                                 chans, ip, n, st, obuff, blockAlign);
+            chans, (void *)ip, n, (void *)st, obuff, blockAlign);
 
         for (p=obuff+7*chans; p<obuff+blockAlign; p++) *p=0;
 
--- a/src/au.c
+++ b/src/au.c
@@ -102,7 +102,7 @@
             *size = SOX_SIZE_32BIT;
             break;
     default:
-            sox_debug("encoding: 0x%lx", sun_encoding);
+            sox_debug("encoding: 0x%x", sun_encoding);
             return(SOX_EOF);
     }
     return(SOX_SUCCESS);
--- a/src/auto.c
+++ b/src/auto.c
@@ -19,7 +19,7 @@
 
 static int sox_autostartread(sox_format_t * ft)
 {
-    char *type = NULL;
+    char const * type = NULL;
     char header[256];
     int rc, loop;
 
--- a/src/effects.c
+++ b/src/effects.c
@@ -184,7 +184,7 @@
                                    &effp->obuf[effp->oend], &idone, &obeg);
   else {                 /* Run effect on each channel individually */
     sox_sample_t *obuf = &effp->obuf[effp->oend];
-    sox_size_t idone_last, odone_last;
+    sox_size_t idone_last = 0, odone_last = 0; /* Initialised to prevent warning */
 
     ibuf = &effp1->obuf[effp1->obeg];
     for (i = 0; i < idone; i += effp->flows)
@@ -246,7 +246,7 @@
     effstatus = effp->handler.drain(effp, &effp->obuf[effp->oend], &obeg);
   else {                         /* Run effect on each channel individually */
     sox_sample_t *obuf = &effp->obuf[effp->oend];
-    sox_size_t odone_last;
+    sox_size_t odone_last = 0; /* Initialised to prevent warning */
 
     for (f = 0; f < effp->flows; ++f) {
       sox_size_t odonec = obeg / effp->flows;
--- a/src/filter.c
+++ b/src/filter.c
@@ -86,7 +86,7 @@
         if ((n >= 3) && !sscanf(argv[2], "%lf", &f->beta))
           return sox_usage(effp);
 
-        sox_debug("filter opts: %d-%d, window-len %d, beta %f", f->freq0, f->freq1, f->Nwin, f->beta);
+        sox_debug("filter opts: %d-%d, window-len %ld, beta %f", f->freq0, f->freq1, f->Nwin, f->beta);
         return (SOX_SUCCESS);
 }
 
@@ -205,7 +205,7 @@
                 *osamp = 0;
                 return (SOX_SUCCESS);
         }
-        sox_debug("flow Nproc %d",Nproc);
+        sox_debug("flow Nproc %ld",Nproc);
         FiltWin(f, Nproc);
 
         /* Copy back portion of input signal that must be re-used */
@@ -230,7 +230,7 @@
         long isamp_res, osamp_res;
         sox_sample_t *Obuf;
 
-        sox_debug("Xh %d, Xt %d  <--- DRAIN",f->Xh, f->Xt);
+        sox_debug("Xh %ld, Xt %ld  <--- DRAIN",f->Xh, f->Xt);
 
         /* stuff end with Xh zeros */
         isamp_res = f->Xh;
@@ -250,7 +250,7 @@
         *osamp -= osamp_res;
         /* sox_debug("DRAIN osamp %d", *osamp); */
         if (isamp_res)
-                sox_warn("drain overran obuf by %d", isamp_res);
+                sox_warn("drain overran obuf by %ld", isamp_res);
         /* FIXME: This is very picky. osamp better be big enough to grab
          * all remaining samples or they will be discarded.
          */
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -1280,4 +1280,6 @@
 }
 
 #endif /* TEST */
+#else
+void dummy(void); /* To suppress empty file warning */
 #endif /* HAVE_GETOPT_LONG */
--- a/src/getopt1.c
+++ b/src/getopt1.c
@@ -198,4 +198,6 @@
 }
 
 #endif /* TEST */
+#else
+void dummy(void); /* To suppress empty file warning */
 #endif /* HAVE_GETOPT_LONG */
--- a/src/ladspa.c
+++ b/src/ladspa.c
@@ -111,7 +111,7 @@
   }
 
   /* Get descriptor function */
-  if ((l_fn = lt_dlsym(l_st->lth, "ladspa_descriptor")) == NULL) {
+  if ((l_fn = (LADSPA_Descriptor_Function)lt_dlsym(l_st->lth, "ladspa_descriptor")) == NULL) {
     sox_fail("could not find ladspa_descriptor");
     return SOX_EOF;
   }
@@ -146,10 +146,10 @@
     /* Check port is well specified. All control ports should be
        inputs, but don't bother checking, as we never rely on this. */
     if (LADSPA_IS_PORT_INPUT(port) && LADSPA_IS_PORT_OUTPUT(port)) {
-      sox_fail("port %d is both input and output", i);
+      sox_fail("port %lu is both input and output", i);
       return SOX_EOF;
     } else if (LADSPA_IS_PORT_CONTROL(port) && LADSPA_IS_PORT_AUDIO(port)) {
-      sox_fail("port %d is both audio and control", i);
+      sox_fail("port %lu is both audio and control", i);
       return SOX_EOF;
     }
                
@@ -174,12 +174,12 @@
           return SOX_EOF;
         }
         l_st->control[i] = ladspa_default(&(l_st->desc->PortRangeHints[i]));
-        sox_debug("default argument for port %d is %f", i, l_st->control[i]);
+        sox_debug("default argument for port %lu is %f", i, l_st->control[i]);
       } else {
         if (!sscanf(argv[0], "%lf", &arg))
           return sox_usage(effp);
         l_st->control[i] = (LADSPA_Data)arg;
-        sox_debug("argument for port %d is %f", i, l_st->control[i]);
+        sox_debug("argument for port %lu is %f", i, l_st->control[i]);
         n--; argv++;
       }
     }
--- a/src/mp3-duration.h
+++ b/src/mp3-duration.h
@@ -82,7 +82,8 @@
   struct mad_header   mad_header;
   struct mad_frame    mad_frame;
   mad_timer_t         time = mad_timer_zero;
-  sox_size_t          initial_bitrate, tagsize = 0, consumed = 0, frames = 0;
+  sox_size_t          initial_bitrate = 0; /* Initialised to prevent warning */
+  sox_size_t          tagsize = 0, consumed = 0, frames = 0;
   sox_bool            vbr = sox_false, depadded = sox_false;
 
 #if HAVE_ID3TAG && HAVE_UNISTD_H
--- a/src/polyphas.c
+++ b/src/polyphas.c
@@ -265,7 +265,7 @@
   int N1;
 
   if(buffer == NULL || length <= 0)
-    sox_fail("Illegal buffer %p or length %d to nuttall.", buffer, length);
+    sox_fail("Illegal buffer %p or length %d to nuttall.", (void *)buffer, length);
 
   /* Initial variable setups. */
   N = length;
@@ -288,7 +288,7 @@
     int N1;
 
     if(buffer == NULL || length <= 0)
-      sox_fail("Illegal buffer %p or length %d to hamming.",buffer,length);
+      sox_fail("Illegal buffer %p or length %d to hamming.",(void *)buffer,length);
 
     N1 = length/2;
     for(j=0;j<length;j++)
@@ -314,7 +314,7 @@
     double sum;
 
     if(buffer == NULL || length < 0 || cutoff < 0 || cutoff > M_PI)
-      sox_fail("Illegal buffer %p, length %d, or cutoff %f.",buffer,length,cutoff);
+      sox_fail("Illegal buffer %p, length %d, or cutoff %f.",(void *)buffer,length,cutoff);
 
     /* Use the user-option of window type */
     if (rate->win_type == 0)
--- a/src/prc.c
+++ b/src/prc.c
@@ -148,10 +148,10 @@
   sox_readb(ft, &byte);   /* Unused and seems always zero */
 
   sox_readdw(ft, &repgap); /* Time between repeats in usec */
-  sox_debug("Time between repeats (usec): %ld", repgap);
+  sox_debug("Time between repeats (usec): %u", repgap);
 
   sox_readdw(ft, &listlen); /* Length of samples list */
-  sox_debug("Number of bytes in samples list: %ld", listlen);
+  sox_debug("Number of bytes in samples list: %u", listlen);
 
   if (ft->signal.rate != 0 && ft->signal.rate != 8000)
     sox_report("PRC only supports 8 kHz; overriding.");
--- a/src/rate.c
+++ b/src/rate.c
@@ -12,7 +12,8 @@
   static sox_effect_handler_t handler;
   handler = *sox_resample_effect_fn();
   handler.name = "rate";
-  handler.usage = handler.getopts = NULL;
+  handler.usage = NULL;
+  handler.getopts = NULL;
   handler.flags |= SOX_EFF_DEPRECATED;
   return &handler;
 }
--- a/src/resample.c
+++ b/src/resample.c
@@ -258,7 +258,7 @@
 
   r->Xsize = 2 * Xoff + i / (1.0 + r->Factor);
   r->Ysize = BUFFSIZE - r->Xsize;
-  sox_debug("Xsize %d, Ysize %d, Xoff %d", r->Xsize, r->Ysize, r->Xoff);
+  sox_debug("Xsize %li, Ysize %li, Xoff %li", r->Xsize, r->Ysize, r->Xoff);
 
   r->X = (double *) xmalloc(sizeof(double) * (BUFFSIZE));
   r->Y = r->X + r->Xsize;
@@ -279,7 +279,7 @@
         resample_t r = (resample_t) effp->priv;
         long i, last, Nout, Nx, Nproc;
 
-        sox_debug_more("Xp %d, Xread %d, isamp %d, ",r->Xp, r->Xread,*isamp);
+        sox_debug_more("Xp %li, Xread %li, isamp %d, ",r->Xp, r->Xread,*isamp);
 
         /* constrain amount we actually process */
         Nproc = r->Xsize - r->Xp;
@@ -291,12 +291,12 @@
         Nx = Nproc - r->Xread; /* space for right-wing future-data */
         if (Nx <= 0)
         {
-                sox_fail("Can not handle this sample rate change. Nx not positive: %d", Nx);
+                sox_fail("Can not handle this sample rate change. Nx not positive: %li", Nx);
                 return (SOX_EOF);
         }
         if ((unsigned long)Nx > *isamp)
                 Nx = *isamp;
-        sox_debug_more("Nx %d",Nx);
+        sox_debug_more("Nx %li",Nx);
 
         if (ibuf == NULL) {
                 for(i = r->Xread; i < Nx + r->Xread  ; i++) 
@@ -318,7 +318,7 @@
         if (r->quadr < 0) { /* exact coeff's method */
                 long creep; 
                 Nout = SrcEX(r, Nproc);
-                sox_debug_more("Nproc %d --> %d",Nproc,Nout);
+                sox_debug_more("Nproc %li --> %li",Nproc,Nout);
                 /* Move converter Nproc samples back in time */
                 r->t -= Nproc * r->b;
                 /* Advance by number of samples processed */
@@ -334,7 +334,7 @@
         } else { /* approx coeff's method */
                 long creep; 
                 Nout = SrcUD(r, Nproc);
-                sox_debug_more("Nproc %d --> %d",Nproc,Nout);
+                sox_debug_more("Nproc %li --> %li",Nproc,Nout);
                 /* Move converter Nproc samples back in time */
                 r->Time -= Nproc;
                 /* Advance by number of samples processed */
@@ -353,7 +353,7 @@
         long i,k;
         /* Copy back portion of input signal that must be re-used */
         k = r->Xp - r->Xoff;
-        sox_debug_more("k %d, last %d",k,last);
+        sox_debug_more("k %li, last %li",k,last);
         for (i=0; i<last - k; i++) 
             r->X[i] = r->X[i+k];
 
@@ -385,7 +385,7 @@
         sox_sample_t *Obuf;
         int rc;
 
-        sox_debug("Xoff %d  <--- DRAIN",r->Xoff);
+        sox_debug("Xoff %li  <--- DRAIN",r->Xoff);
 
         /* stuff end with Xoff zeros */
         isamp_res = r->Xoff;
@@ -398,7 +398,7 @@
                 rc = flow(effp, NULL, Obuf, (sox_size_t *)&Isamp, (sox_size_t *)&Osamp);
                 if (rc)
                     return rc;
-                sox_debug("DRAIN isamp,osamp  (%d,%d) -> (%d,%d)",
+                sox_debug("DRAIN isamp,osamp  (%li,%li) -> (%d,%d)",
                          isamp_res,osamp_res,Isamp,Osamp);
                 Obuf += Osamp;
                 osamp_res -= Osamp;
@@ -407,7 +407,7 @@
         *osamp -= osamp_res;
         sox_debug("DRAIN osamp %d", *osamp);
         if (isamp_res)
-                sox_warn("drain overran obuf by %d", isamp_res);
+                sox_warn("drain overran obuf by %li", isamp_res);
         /* FIXME: This is very picky.  IF obuf is not big enough to
          * drain remaining samples, they will be lost.
          */
@@ -506,7 +506,7 @@
    sox_debug_more("Factor %f, dt %f, ",Factor,dt);
    sox_debug_more("Time %f, ",r->Time);
    /* (Xh * dhb)>>La is max index into Imp[] */
-   sox_debug_more("ct=%.2f %d",(double)r->Nwing*Na/r->dhb, r->Xh);
+   sox_debug_more("ct=%.2f %li",(double)r->Nwing*Na/r->dhb, r->Xh);
    sox_debug_more("ct=%ld, T=%.6f, dhb=%6f, dt=%.6f",
                          r->Xh, time-floor(time),(double)r->dhb/Na,dt);
    Ystart = Y = r->Y;
--- a/src/skeleff.c
+++ b/src/skeleff.c
@@ -33,9 +33,9 @@
  * initialization now: effp->ininfo & effp->outinfo are not
  * yet filled in.
  */
-static int getopts(sox_effect_t * effp, int n, char **argv)
+static int getopts(sox_effect_t * effp, int n, char UNUSED **argv)
 {
-  skeleff_t skeleff = (skeleff_t)effp->priv;
+  skeleff_t UNUSED skeleff = (skeleff_t)effp->priv;
 
   if (n && n != 1)
     return sox_usage(effp);
@@ -64,7 +64,7 @@
 static int flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t *obuf, 
                            sox_size_t *isamp, sox_size_t *osamp)
 {
-  skeleff_t skeleff = (skeleff_t)effp->priv;
+  skeleff_t UNUSED skeleff = (skeleff_t)effp->priv;
   sox_size_t len, done;
 
   switch (effp->outinfo.channels) {
@@ -94,7 +94,7 @@
 /*
  * Drain out remaining samples if the effect generates any.
  */
-static int drain(sox_effect_t * effp, sox_sample_t *obuf, sox_size_t *osamp)
+static int drain(sox_effect_t UNUSED * effp, sox_sample_t UNUSED *obuf, sox_size_t *osamp)
 {
   *osamp = 0;
   /* Return SOX_EOF when drain
@@ -107,7 +107,7 @@
 /*
  * Do anything required when you stop reading samples.  
  */
-static int stop(sox_effect_t * effp)
+static int stop(sox_effect_t UNUSED * effp)
 {
   return SOX_SUCCESS;
 }
@@ -116,7 +116,7 @@
  * Do anything required when you kill an effect.  
  *      (free allocated memory, etc.)
  */
-static int kill(sox_effect_t * effp)
+static int kill(sox_effect_t UNUSED * effp)
 {
   return SOX_SUCCESS;
 }
@@ -144,6 +144,7 @@
  * Function returning effect descriptor. This should be the only
  * externally visible object.
  */
+const sox_effect_handler_t *sox_skel_effect_fn(void);
 const sox_effect_handler_t *sox_skel_effect_fn(void)
 {
   return &sox_skel_effect;
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -86,7 +86,7 @@
  */
 static sox_size_t read(sox_format_t * ft, sox_sample_t *buf, sox_size_t len)
 {
-  skelform_t sk = (skelform_t)ft->priv;
+  skelform_t UNUSED sk = (skelform_t)ft->priv;
   sox_size_t done;
   unsigned char sample;
 
@@ -118,7 +118,7 @@
  * Do anything required when you stop reading samples.
  * Don't close input file!
  */
-static int stopread(sox_format_t * ft)
+static int stopread(sox_format_t UNUSED * ft)
 {
   return SOX_SUCCESS;
 }
@@ -125,7 +125,7 @@
 
 static int startwrite(sox_format_t * ft)
 {
-  skelform_t sk = (skelform_t)ft->priv;
+  skelform_t UNUSED sk = (skelform_t)ft->priv;
 
   /* If you have to seek around the output file. */
   /* If header contains a length value then seeking will be
@@ -161,7 +161,7 @@
  */
 static sox_size_t write(sox_format_t * ft, const sox_sample_t *buf, sox_size_t len)
 {
-  skelform_t sk = (skelform_t)ft->priv;
+  skelform_t UNUSED sk = (skelform_t)ft->priv;
 
   switch (ft->signal.size) {
   case SOX_SIZE_BYTE:
@@ -186,7 +186,7 @@
   return len;
 }
 
-static int stopwrite(sox_format_t * ft)
+static int stopwrite(sox_format_t UNUSED * ft)
 {
   /* All samples are already written out. */
   /* If file header needs fixing up, for example it needs the number
@@ -194,7 +194,7 @@
   return SOX_SUCCESS;
 }
 
-static int seek(sox_format_t * ft, sox_size_t offset)
+static int seek(sox_format_t UNUSED * ft, sox_size_t UNUSED offset)
 {
   /* Seek relative to current position. */
   return SOX_SUCCESS;
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -39,7 +39,7 @@
     int ret = snprintf(fnname, MAX_NAME_LEN, "sox_%.*s_format_fn", end - start, start);
     if (ret > 0 && ret < MAX_NAME_LEN) {
       sox_format_fns[sox_formats].fn = (sox_format_fn_t)lt_dlsym(lth, fnname);
-      sox_debug("opening format plugin `%s': library %p, entry point %p\n", fnname, lth, sox_format_fns[sox_formats].fn);
+      sox_debug("opening format plugin `%s': library %p, entry point %p\n", fnname, (void *)lth, (void *)sox_format_fns[sox_formats].fn);
       if (sox_format_fns[sox_formats].fn)
         sox_formats++;
     }
--- a/src/voc.c
+++ b/src/voc.c
@@ -571,7 +571,7 @@
                           if ((v->rate != -1) && (uc != v->rate))
                           {
                             sox_fail_errno(ft,SOX_EFMT,
-                              "sample rate codes differ: %d != %d", v->rate, uc);
+                              "sample rate codes differ: %ld != %d", v->rate, uc);
                             return(SOX_EOF);
                           }
                           v->rate = uc;
@@ -600,7 +600,7 @@
                         if ((v->rate != -1) && ((long)new_rate_32 != v->rate))
                         {
                             sox_fail_errno(ft,SOX_EFMT,
-                              "sample rate codes differ: %d != %d",
+                              "sample rate codes differ: %ld != %d",
                                 v->rate, new_rate_32);
                             return(SOX_EOF);
                         }
@@ -705,7 +705,7 @@
                         if ((v->rate != -1) && (new_rate_16 != v->rate))
                         {
                            sox_fail_errno(ft,SOX_EFMT,
-                             "sample rate codes differ: %d != %d",
+                             "sample rate codes differ: %ld != %d",
                                         v->rate, new_rate_16);
                            return(SOX_EOF);
                         }
--- a/src/wav.c
+++ b/src/wav.c
@@ -1524,7 +1524,7 @@
         sox_debug("Finished writing Wave file, %u data bytes %u samples",
                 dwDataLength,wav->numSamples);
         if (wFormatTag == WAVE_FORMAT_GSM610){
-            sox_debug("GSM6.10 format: %u blocks %u padded samples %u padded data bytes",
+            sox_debug("GSM6.10 format: %li blocks %u padded samples %u padded data bytes",
                     blocksWritten, dwSamplesWritten, dwDataLength);
             if (wav->gsmbytecount != dwDataLength)
                 sox_warn("help ! internal inconsistency - data_written %u gsmbytecount %u",