shithub: sox

Download patch

ref: 6c97d471ef01292c9e1c6068cc06ac9611dc1eb5
parent: ff12ef77277c1bca46fab97ee9a0bb0907db92d2
author: robs <robs>
date: Thu Oct 30 01:03:25 EDT 2008

quash warnings on 64-bit

--- a/src/alsa.c
+++ b/src/alsa.c
@@ -505,7 +505,7 @@
       long n = snd_pcm_readi(alsa->pcm_handle, alsa->buf,
           (nsamp - len)/ft->signal.channels); /* ALSA takes "frame" counts. */
       if (n < 0) {
-        if (xrun_recovery(alsa->pcm_handle, n) < 0) {
+        if (xrun_recovery(alsa->pcm_handle, (int)n) < 0) {
           lsx_fail_errno(ft, SOX_EPERM, "ALSA read error");
           return 0;
         }
--- a/src/biquads.c
+++ b/src/biquads.c
@@ -334,26 +334,26 @@
       if (effp->in_signal.rate == 44100) {
         static const double zeros[] = {-0.2014898, 0.9233820};
         static const double poles[] = {0.7083149, 0.9924091};
-        make_poly_from_roots(zeros, 2, &p->b0);
-        make_poly_from_roots(poles, 2, &p->a0);
+        make_poly_from_roots(zeros, (size_t)2, &p->b0);
+        make_poly_from_roots(poles, (size_t)2, &p->a0);
       }
       else if (effp->in_signal.rate == 48000) {
         static const double zeros[] = {-0.1766069, 0.9321590};
         static const double poles[] = {0.7396325, 0.9931330};
-        make_poly_from_roots(zeros, 2, &p->b0);
-        make_poly_from_roots(poles, 2, &p->a0);
+        make_poly_from_roots(zeros, (size_t)2, &p->b0);
+        make_poly_from_roots(poles, (size_t)2, &p->a0);
       }
       else if (effp->in_signal.rate == 88200) {
         static const double zeros[] = {-0.1168735, 0.9648312};
         static const double poles[] = {0.8590646, 0.9964002};
-        make_poly_from_roots(zeros, 2, &p->b0);
-        make_poly_from_roots(poles, 2, &p->a0);
+        make_poly_from_roots(zeros, (size_t)2, &p->b0);
+        make_poly_from_roots(poles, (size_t)2, &p->a0);
       }
       else if (effp->in_signal.rate == 96000) {
         static const double zeros[] = {-0.1141486, 0.9676817};
         static const double poles[] = {0.8699137, 0.9966946};
-        make_poly_from_roots(zeros, 2, &p->b0);
-        make_poly_from_roots(poles, 2, &p->a0);
+        make_poly_from_roots(zeros, (size_t)2, &p->b0);
+        make_poly_from_roots(poles, (size_t)2, &p->a0);
       }
       else {
         lsx_fail("Sample rate must be 44.1k, 48k, 88.2k, or 96k");
--- a/src/cvsd-fmt.c
+++ b/src/cvsd-fmt.c
@@ -75,7 +75,7 @@
 
   for (i = 0; i < len; ++i) {
     if (!(p->bit_count & 7))
-      if (lsx_read_b_buf(ft, &p->byte, 1) != 1)
+      if (lsx_read_b_buf(ft, &p->byte, (size_t)1) != 1)
         break;
     ++p->bit_count;
     decode(p, p->byte & 1);
--- a/src/filter.c
+++ b/src/filter.c
@@ -199,7 +199,7 @@
         return (SOX_SUCCESS);
 }
 
-static int p2(int n)
+static int p2(long n)
 {
   int N;
   for (N = 1; n; n >>= 1, N <<= 1);
--- a/src/formats.c
+++ b/src/formats.c
@@ -321,9 +321,9 @@
 static sox_bool is_url(char const * text) /* detects only wget-supported URLs */
 {
   return !(
-      strncasecmp(text, "http:" , 5) &&
-      strncasecmp(text, "https:", 6) &&
-      strncasecmp(text, "ftp:"  , 4));
+      strncasecmp(text, "http:" , (size_t)5) &&
+      strncasecmp(text, "https:", (size_t)6) &&
+      strncasecmp(text, "ftp:"  , (size_t)4));
 }
 
 static int xfclose(FILE * file, lsx_io_type io_type)
--- a/src/loudness.c
+++ b/src/loudness.c
@@ -79,7 +79,7 @@
   }
   fs[i + 1] = log(100000.);
   spl[i + 1] = spl[0];
-  lsx_prepare_spline3(fs, spl, LEN, HUGE_VAL, HUGE_VAL, d);
+  lsx_prepare_spline3(fs, spl, (int)LEN, HUGE_VAL, HUGE_VAL, d);
 
   for (work_len = 8192; work_len < rate / 2; work_len <<= 1);
   work = lsx_calloc(work_len, sizeof(*work));
@@ -87,7 +87,7 @@
 
   for (i = 1; i <= work_len / 2; ++i) {
     double f = rate * i / work_len;
-    double spl1 = f < 1? spl[0] : lsx_spline3(fs, spl, d, LEN, log(f));
+    double spl1 = f < 1? spl[0] : lsx_spline3(fs, spl, d, (int)LEN, log(f));
     work[i < work_len / 2 ? 2 * i : 1] = dB_to_linear(spl1);
   }
   lsx_safe_rdft(work_len, -1, work);
--- a/src/sox-fmt.c
+++ b/src/sox-fmt.c
@@ -53,8 +53,8 @@
   }
 
   if (comments_bytes) {
-    char * buf = lsx_calloc(1, comments_bytes + 1); /* ensure nul-terminated */
-    if (lsx_readchars(ft, buf, comments_bytes) != SOX_SUCCESS) {
+    char * buf = lsx_calloc(1, (size_t)comments_bytes + 1); /* ensure nul-terminated */
+    if (lsx_readchars(ft, buf, (size_t)comments_bytes) != SOX_SUCCESS) {
       free(buf);
       return SOX_EOF;
     }
@@ -83,7 +83,7 @@
   ||lsx_writeqw(ft, size)
   ||lsx_writedf(ft, ft->signal.rate)
   ||lsx_writedw(ft, ft->signal.channels)
-  ||lsx_writedw(ft, comments_len)
+  ||lsx_writedw(ft, (unsigned)comments_len)
   ||lsx_writechars(ft, comments, comments_len)
   ||lsx_padbytes(ft, comments_bytes - comments_len);
   free(comments);