shithub: sox

Download patch

ref: 4be080eba3673dce91fc16091930a6b70ef1d362
parent: a2ead81a9627893296fd099618b853a881535914
author: Doug Cook <idigdoug@users.sourceforge.net>
date: Tue Apr 3 17:28:46 EDT 2012

Fix VS2008 build issues
- OpenMP 2.0 requires signed integer index variable.
  Additional comment: there is no reason to use size_t for flow index.
  We should probably switch back to int for things that
  aren't address sizes, since int is designed to be the "most natural"
  integer for the system.
- UINT64_MAX isn't defined unless HAVE_STDINT.

--- a/src/effects.c
+++ b/src/effects.c
@@ -241,7 +241,7 @@
   sox_effect_t *effp1 = chain->effects[n - 1];
   sox_effect_t *effp = chain->effects[n];
   int effstatus = SOX_SUCCESS;
-  size_t f = 0;
+  int f = 0;
   size_t idone = effp1->oend - effp1->obeg;
   size_t obeg = sox_globals.bufsiz - effp->oend;
   sox_bool il_change = (effp->flows == 1) !=
@@ -272,7 +272,7 @@
     if (sox_globals.use_threads && effp->flows > 1)
     {
       #pragma omp parallel for
-      for (f = 0; f < effp->flows; ++f) {
+      for (f = 0; f < (int)effp->flows; ++f) {
         size_t idonec = idone / effp->flows;
         size_t odonec = obeg / effp->flows;
         int eff_status_c = effp->handler.flow(&chain->effects[n][f],
@@ -291,7 +291,7 @@
     else /* sox_globals.use_threads */
 #endif
     {
-      for (f = 0; f < effp->flows; ++f) {
+      for (f = 0; f < (int)effp->flows; ++f) {
         size_t idonec = idone / effp->flows;
         size_t odonec = obeg / effp->flows;
         int eff_status_c = effp->handler.flow(&chain->effects[n][f],
@@ -322,7 +322,7 @@
     effp1->obeg = effp1->oend = 0;
   else if (effp1->oend - effp1->obeg < effp->imin) { /* Need to refill? */
     size_t flow_offs = sox_globals.bufsiz/effp->flows;
-    for (f = 0; f < effp->flows; ++f)
+    for (f = 0; f < (int)effp->flows; ++f)
       memcpy(effp1->obuf + f * flow_offs,
           effp1->obuf + f * flow_offs + effp1->obeg/effp->flows,
           (effp1->oend - effp1->obeg)/effp->flows * sizeof(*effp1->obuf));
--- a/src/pad.c
+++ b/src/pad.c
@@ -42,7 +42,7 @@
     next = lsx_parsesamples(rate, p->pads[i].str, &p->pads[i].pad, 't');
     if (next == NULL) break;
     if (*next == '\0')
-      p->pads[i].start = i? UINT64_MAX : 0;
+      p->pads[i].start = i? ~(sox_uint64_t)0 : 0;
     else {
       if (*next != '@') break;
       next = lsx_parsesamples(rate, next+1, &p->pads[i].start, 't');
@@ -88,7 +88,7 @@
     /* Check that the last pad position (except for "at the end")
        is within bounds. */
     i = p->npads;
-    if (i > 0 && p->pads[i-1].start == UINT64_MAX)
+    if (i > 0 && p->pads[i-1].start == ~(sox_uint64_t)0)
       i--;
     if (i > 0 &&
         p->pads[i-1].start * effp->in_signal.channels
@@ -140,7 +140,7 @@
   priv_t * p = (priv_t *)effp->priv;
   static size_t isamp = 0;
   if (p->pads_pos != p->npads && p->in_pos != p->pads[p->pads_pos].start)
-    p->in_pos = UINT64_MAX;  /* Invoke the final pad (with no given start) */
+    p->in_pos = ~(sox_uint64_t)0;  /* Invoke the final pad (with no given start) */
   return flow(effp, 0, obuf, &isamp, osamp);
 }