shithub: sox

Download patch

ref: 069f1c520de630f1fda16f6f4f0cdec1d71d1fe2
parent: 1bd16615aff22ee3b4308dc141023b12d9503002
author: Ulrich Klauer <ulrich@chirlu.de>
date: Mon Jan 2 14:27:09 EST 2012

Fix pointer type mismatches due to 64-bit cleanup

--- a/src/delay.c
+++ b/src/delay.c
@@ -71,7 +71,7 @@
 static int start(sox_effect_t * effp)
 {
   priv_t * p = (priv_t *)effp->priv;
-  uint64_t max_delay;
+  uint64_t max_delay, temp;
 
   if (!p->max_arg)
     return SOX_EFF_NULL;
@@ -79,8 +79,10 @@
     lsx_fail("too few input channels");
     return SOX_EOF;
   }
-  if (effp->flow < p->argc)
-    lsx_parsesamples(effp->in_signal.rate, p->argv[effp->flow], &p->buffer_size, 't');
+  if (effp->flow < p->argc) {
+    lsx_parsesamples(effp->in_signal.rate, p->argv[effp->flow], &temp, 't');
+    p->buffer_size = temp;
+  }
   lsx_parsesamples(effp->in_signal.rate, p->max_arg, &max_delay, 't');
   if (effp->flow == 0)
     lsx_debug("extending audio by %" PRIu64 " samples", max_delay);
--- a/src/silence.c
+++ b/src/silence.c
@@ -80,6 +80,7 @@
 {
     priv_t *   silence = (priv_t *) effp->priv;
     int parse_count;
+    uint64_t temp;
     const char *n;
   --argc, ++argv;
 
@@ -120,9 +121,10 @@
          */
         silence->start_duration_str = lsx_strdup(argv[0]);
         /* Perform a fake parse to do error checking */
-        n = lsx_parsesamples(0.,silence->start_duration_str,&silence->start_duration,'s');
+        n = lsx_parsesamples(0.,silence->start_duration_str,&temp,'s');
         if (!n || *n)
           return lsx_usage(effp);
+        silence->start_duration = temp;
 
         parse_count = sscanf(argv[1], "%lf%c", &silence->start_threshold,
                 &silence->start_unit);
@@ -160,9 +162,10 @@
          */
         silence->stop_duration_str = lsx_strdup(argv[0]);
         /* Perform a fake parse to do error checking */
-        n = lsx_parsesamples(0.,silence->stop_duration_str,&silence->stop_duration,'s');
+        n = lsx_parsesamples(0.,silence->stop_duration_str,&temp,'s');
         if (!n || *n)
           return lsx_usage(effp);
+        silence->stop_duration = temp;
 
         parse_count = sscanf(argv[1], "%lf%c", &silence->stop_threshold,
                              &silence->stop_unit);
@@ -221,6 +224,7 @@
 static int sox_silence_start(sox_effect_t * effp)
 {
     priv_t *silence = (priv_t *)effp->priv;
+    uint64_t temp;
 
     /* When you want to remove silence, small window sizes are
      * better or else RMS will look like non-silence at
@@ -236,8 +240,9 @@
     if (silence->start)
     {
         if (lsx_parsesamples(effp->in_signal.rate, silence->start_duration_str,
-                             &silence->start_duration, 's') == NULL)
+                             &temp, 's') == NULL)
             return lsx_usage(effp);
+        silence->start_duration = temp;
         /* Align to multiple of channels */
         silence->start_duration += (silence->start_duration % 
                                     effp->in_signal.channels);
@@ -245,8 +250,9 @@
     if (silence->stop)
     {
         if (lsx_parsesamples(effp->in_signal.rate,silence->stop_duration_str,
-                             &silence->stop_duration,'s') == NULL)
+                             &temp,'s') == NULL)
             return lsx_usage(effp);
+        silence->stop_duration = temp;
         /* Align to multiple of channels */
         silence->stop_duration += (silence->stop_duration % 
                                    effp->in_signal.channels);
--- a/src/splice.c
+++ b/src/splice.c
@@ -31,13 +31,13 @@
 
 /* Find where the two segments are most alike over the overlap period. */
 static size_t best_overlap_position(sox_sample_t const * f1,
-    sox_sample_t const * f2, size_t overlap, size_t search, size_t channels)
+    sox_sample_t const * f2, uint64_t overlap, uint64_t search, size_t channels)
 {
   size_t i, best_pos = 0;
-  double diff, least_diff = difference(f2, f1, channels * overlap);
+  double diff, least_diff = difference(f2, f1, (size_t) (channels * overlap));
 
   for (i = 1; i < search; ++i) { /* linear search */
-    diff = difference(f2 + channels * i, f1, channels * overlap);
+    diff = difference(f2 + channels * i, f1, (size_t) (channels * overlap));
     if (diff < least_diff)
       least_diff = diff, best_pos = i;
   }