shithub: sox

Download patch

ref: 1a66892cd84917b0ae0b2771de5c595cb1d6b681
parent: e12fc13a9796bdae8a1da32714b5639e99ad9685
author: cbagwell <cbagwell>
date: Sun Dec 20 20:24:50 EST 2009

Clean up some warnings.

--- a/src/mp3-util.h
+++ b/src/mp3-util.h
@@ -42,25 +42,25 @@
 
   /* Note: id3tag_set_fieldvalue is not present in LAME 3.97, so we're using
      the 3.97-compatible methods for all of the tags that 3.97 supported. */
-  if (comment = sox_find_comment(ft->oob.comments, "Title"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Title")))
     p->id3tag_set_title(p->gfp, comment);
-  if (comment = sox_find_comment(ft->oob.comments, "Artist"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Artist")))
     p->id3tag_set_artist(p->gfp, comment);
-  if (comment = sox_find_comment(ft->oob.comments, "Album"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Album")))
     p->id3tag_set_album(p->gfp, comment);
-  if (comment = sox_find_comment(ft->oob.comments, "Tracknumber"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Tracknumber")))
     p->id3tag_set_track(p->gfp, comment);
-  if (comment = sox_find_comment(ft->oob.comments, "Year"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Year")))
     p->id3tag_set_year(p->gfp, comment);
-  if (comment = sox_find_comment(ft->oob.comments, "Comment"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Comment")))
     p->id3tag_set_comment(p->gfp, comment);
-  if (comment = sox_find_comment(ft->oob.comments, "Genre"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Genre")))
   {
     if (p->id3tag_set_genre(p->gfp, comment))
       lsx_warn("\"%s\" is not a recognized ID3v1 genre.", comment);
   }
 
-  if (comment = sox_find_comment(ft->oob.comments, "Discnumber"))
+  if ((comment = sox_find_comment(ft->oob.comments, "Discnumber")))
   {
     char* id3tag_buf = lsx_malloc(strlen(comment) + 6);
     if (id3tag_buf)
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -564,8 +564,6 @@
 
 static void id3tag_init_stub(lame_global_flags * gfp UNUSED)
   { return; }
-static void id3tag_pad_v2_stub(lame_global_flags * gfp UNUSED)
-  { return; }
 static void id3tag_set_title_stub(lame_global_flags * gfp UNUSED, const char* title UNUSED)
   { return; }
 static void id3tag_set_artist_stub(lame_global_flags * gfp UNUSED, const char* artist UNUSED)
@@ -591,13 +589,12 @@
 
 static int get_id3v2_tag_size(sox_format_t * ft)
 {
-  priv_t *p = (priv_t *)ft->priv;
   FILE *fp = ft->fp;
   size_t bytes_read;
   int id3v2_size;
   unsigned char id3v2_header[10];
 
-  if (fseeko(fp, 0, SEEK_SET) != 0) {
+  if (fseeko(fp, (off_t)0, SEEK_SET) != 0) {
     lsx_warn("cannot update id3 tag - failed to seek to beginning");
     return SOX_EOF;
   }
@@ -625,11 +622,11 @@
   return id3v2_size;
 }
 
-static void rewrite_id3v2_tag(sox_format_t * ft, int id3v2_size, unsigned long num_samples)
+static void rewrite_id3v2_tag(sox_format_t * ft, size_t id3v2_size, size_t num_samples)
 {
   priv_t *p = (priv_t *)ft->priv;
   FILE *fp = ft->fp;
-  int new_size;
+  size_t new_size;
   unsigned char * buffer;
 
   if (LSX_DLFUNC_IS_STUB(p, lame_get_id3v2_tag))
@@ -649,7 +646,7 @@
   }
 
   p->lame_set_num_samples(p->gfp, num_samples);
-  lsx_debug("updated MP3 TLEN to %lu samples", num_samples);
+  lsx_debug("updated MP3 TLEN to %d samples", num_samples);
 
   new_size = p->lame_get_id3v2_tag(p->gfp, buffer, id3v2_size);
 
@@ -669,7 +666,7 @@
     else
       lsx_warn("cannot update track length info - failed to adjust tag size");
   } else {
-    fseeko(fp, 0, SEEK_SET);
+    fseeko(fp, (off_t)0, SEEK_SET);
     /* Overwrite the Id3v2 tag (this time TLEN should be accurate) */
     if (fwrite(buffer, id3v2_size, 1, fp) != 1) {
       lsx_debug("Rewrote Id3v2 tag (%d bytes)", id3v2_size);
@@ -685,9 +682,9 @@
   FILE *fp = ft->fp;
 
   off_t file_size;
-  int id3v2_size;
+  size_t id3v2_size;
 
-  if (fseeko(fp, 0, SEEK_END)) {
+  if (fseeko(fp, (off_t)0, SEEK_END)) {
     lsx_warn("cannot update tags - seek to end failed");
     return;
   }
@@ -701,9 +698,7 @@
   }
 
   id3v2_size = get_id3v2_tag_size(ft);
-  if (id3v2_size < 0) {
-    return;
-  } else if (id3v2_size > 0 && num_samples != p->num_samples) {
+  if (id3v2_size > 0 && num_samples != p->num_samples) {
     rewrite_id3v2_tag(ft, id3v2_size, num_samples);
   }
 
@@ -711,7 +706,7 @@
     unsigned int lametag_size;
     uint8_t buffer[MAXFRAMESIZE];
 
-    if (fseeko(fp, id3v2_size, SEEK_SET)) {
+    if (fseeko(fp, (off_t)id3v2_size, SEEK_SET)) {
       lsx_warn("cannot write VBR tag - seek to tag block failed");
       return;
     }
@@ -908,7 +903,7 @@
 {
     priv_t *p = (priv_t *)ft->priv;
     size_t new_buffer_size;
-    float *buffer_l, *buffer_r;
+    float *buffer_l, *buffer_r = NULL;
     int nsamples = samp/ft->signal.channels;
     int i,j;
     size_t written;
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -222,7 +222,7 @@
   { "xi",       SF_FORMAT_XI }
 };
 
-static int sf_stop_stub(SNDFILE *sndfile)
+static int sf_stop_stub(SNDFILE *sndfile UNUSED)
 {
     return 1;
 }
--- a/src/testall.sh
+++ b/src/testall.sh
@@ -2,7 +2,11 @@
 srcdir="."
 effect=""
 
-EXEEXT=
+if [ -f ./sox.exe ] ; then
+  EXEEXT=".exe"
+else
+  EXEEXXT=""
+fi
 
 # Allow user to override paths.  Useful for testing an installed
 # sox.
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -5,7 +5,12 @@
 bindir="."
 builddir="."
 srcdir="."
-EXEEXT=
+
+if [ -f ./sox.exe ] ; then 
+  EXEEXT=".exe"
+else
+  EXEEXT=""
+fi
 
 # Set options & allow user to override paths.  Useful for testing an
 # installed sox.
--- a/src/util.h
+++ b/src/util.h
@@ -147,6 +147,9 @@
 #define dB_to_linear(x) exp((x) * M_LN10 * 0.05)
 #define linear_to_dB(x) (log10(x) * 20)
 
+extern int lsx_strcasecmp(const char *s1, const char *st);
+extern int lsx_strncasecmp(char const *s1, char const *s2, size_t n);
+
 #ifndef HAVE_STRCASECMP
 #define strcasecmp(s1, s2) lsx_strcasecmp((s1), (s2))
 #define strncasecmp(s1, s2, n) lsx_strncasecmp((s1), (s2), (n))
--- a/src/waveaudio.c
+++ b/src/waveaudio.c
@@ -73,9 +73,9 @@
     sizeof(message) / sizeof(message[0]),
     NULL);
   if (formatMessageOk)
-    lsx_fail_errno(ft, SOX_EOF, "WaveAudio %s failed with code %d: %s", context, code, message);
+    lsx_fail_errno(ft, SOX_EOF, "WaveAudio %s failed with code %d: %s", context, (int)code, message);
   else
-    lsx_fail_errno(ft, SOX_EOF, "WaveAudio %s failed with unrecognized MMSYSERR code %d.", context, code);
+    lsx_fail_errno(ft, SOX_EOF, "WaveAudio %s failed with unrecognized MMSYSERR code %d.", context, (int)code);
 }
 
 static int stop(sox_format_t* ft)