From: Victor Lazzarini <victor.lazzarini@mu.ie>
Date: Tue, 25 Apr 2023 09:15:22 +0100
Subject: initialize K opcodes at init-time
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Origin: upstream
Applied-Upstream: 6329e68307e7bdcb5698d5e8d8948f3914680ed1, 4124c3560a2caa47036de1f4885347c9714a3e95, be6f60d52dfccba1b9a816767c6f9126b154327a, 84625d274360988a776bc5e6cb9a236cd5efa322, 8f304709c005f5daed90ffa2a453a608f3d1f770, c9356e4101ec2b2a9ecae1576c28b46d5b624fbf, fd1a55a2646d21d2c5c4de3c3cf419573f7cc36e
Last-Update: 2024-08-21


zmoelnig's "co-authoring" is just cherry picking all the relevant
commits and squashing them into one (dropping trailing whitespace)

Co-Authored: IOhannes m zmölnig <umlaeute@debian.org>
---
 Engine/csound_orc_compile.c   | 31 +++++++++++++++++++++-------
 Engine/csound_orc_semantics.c | 22 +++++++++++++++-----
 Engine/csound_type_system.c   |  4 ++--
 Engine/insert.c               | 10 +++++----
 Engine/symbtab.c              | 13 +++++++-----
 Opcodes/ftsamplebank.cpp      |  4 ++--
 Opcodes/sfont.c               | 48 +++++++++++++++++++++----------------------
 interfaces/CsoundFile.cpp     |  4 ++--
 util/atsa.c                   |  3 +--
 util/hetro.c                  |  6 +++---
 10 files changed, 89 insertions(+), 56 deletions(-)

diff --git a/Engine/csound_orc_compile.c b/Engine/csound_orc_compile.c
index 6bd1fb9..b223834 100644
--- a/Engine/csound_orc_compile.c
+++ b/Engine/csound_orc_compile.c
@@ -246,13 +246,13 @@ char **splitArgs(CSOUND *csound, char *argString) {
 
       if (*(t + 1) == '[') {
         char *start = t;
-        int len = 1;
+        //int len = 1;
         int j;
         t++;
 
         while (*t == '[') {
           t++;
-          len++;
+          //len++;
 
           if (UNLIKELY(*t != ']')) {
             // FIXME: needs more precise error information
@@ -263,7 +263,7 @@ char **splitArgs(CSOUND *csound, char *argString) {
           }
 
           t++;
-          len++;
+          //len++;
           dimensions++;
         }
         part = csound->Malloc(csound, sizeof(char) * (dimensions + 3));
@@ -907,15 +907,15 @@ INSTRTXT *create_instrument(CSOUND *csound, TREE *root,
              !(root->left->left != NULL &&
                root->left->left->type ==
                    UDO_ANS_TOKEN)) { /* named instrument */
-    int32 insno_priority = -1L;
+    //int32 insno_priority = -1L;
     c = root->left->value->lexeme;
 
     if (PARSER_DEBUG)
       csound->Message(csound, "create_instrument: instr name %s\n", c);
 
-    if (UNLIKELY(root->left->rate == (int)'+')) {
+    /*    if (UNLIKELY(root->left->rate == (int)'+')) {
       insno_priority--;
-    }
+      } */
 
     ip->insname = csound->Malloc(csound, strlen(c) + 1);
     strcpy(ip->insname, c);
@@ -1377,6 +1377,22 @@ void insert_opcodes(CSOUND *csound, OPCODINFO *opcodeInfo,
   }
 }
 
+
+static int inargs_check(OPCODINFO *opinfo, char *inargs) {
+  char *c = opinfo->intypes;
+  int i;
+  if(strcmp(c, inargs) != 0) {
+  for(i = 0; c[i] != 0; i++) {
+    if(c[i] != inargs[i]) {
+       if(c[i] == 'K' && inargs[i] == 'k') continue;
+       else return 1;
+     }
+  }
+  }
+  return 0;
+}
+
+
 OPCODINFO *find_opcode_info(CSOUND *csound, char *opname, char *outargs,
                             char *inargs) {
   OPCODINFO *opinfo = csound->opcodeInfo;
@@ -1387,8 +1403,9 @@ OPCODINFO *find_opcode_info(CSOUND *csound, char *opname, char *outargs,
 
   while (opinfo != NULL) {
     if (UNLIKELY(strcmp(opinfo->name, opname) == 0 &&
-                 strcmp(opinfo->intypes, inargs) == 0 &&
+                 inargs_check(opinfo, inargs) == 0 &&
                  strcmp(opinfo->outtypes, outargs) == 0)) {
+
       return opinfo;
     }
     opinfo = opinfo->prv; /* Move on: JPff suggestion */
diff --git a/Engine/csound_orc_semantics.c b/Engine/csound_orc_semantics.c
index 418848a..ba55b15 100644
--- a/Engine/csound_orc_semantics.c
+++ b/Engine/csound_orc_semantics.c
@@ -694,13 +694,19 @@ int check_array_arg(char* found, char* required) {
     return (*f == *r);
 }
 
-int check_in_arg(char* found, char* required) {
+int check_in_arg(char* found, char* req) {
     char* t;
     int i;
-    if (UNLIKELY(found == NULL || required == NULL)) {
+    char required[64];
+
+    if (UNLIKELY(found == NULL || req == NULL)) {
       return 0;
     }
 
+    if(*req != 'K')
+      strcpy(required,req);
+    else strcpy(required, "k");
+
     if (strcmp(found, required) == 0) {
       return 1;
     }
@@ -851,6 +857,13 @@ int check_out_arg(char* found, char* required) {
       return 0;
     }
 
+
+    if(required[0] == 'K' && found[0] == 'k'){
+    return 1;
+    }
+
+
+
     // constants not allowed in out args
     if (strcmp(found, "c") == 0) {
       return 0;
@@ -998,7 +1011,6 @@ OENTRY* resolve_opcode(CSOUND* csound, OENTRIES* entries,
                       Str("Found %d inputs for %s which is more than "
                           "the %d allowed\n"),
                       argsRequired(inArgTypes), temp->opname, VARGMAX);
-
             return temp;
         }
     }
@@ -1491,7 +1503,7 @@ int verify_opcode(CSOUND* csound, TREE* root, TYPE_TABLE* typeTable) {
 
     if (UNLIKELY(oentry == NULL)) {
       synterr(csound, Str("Unable to find opcode entry for \'%s\' "
-                          "with matching argument types:\n"),
+                          "with matching argument types: \n"),
               opcodeName);
       csoundMessage(csound, Str("Found: %s %s %s\n"),
                     leftArgString, root->value->lexeme, rightArgString);
@@ -1706,7 +1718,7 @@ int verify_xin_xout(CSOUND *csound, TREE *udoTree, TYPE_TABLE *typeTable) {
 
     for (i = 0; i < strlen(outArgs);i++) {
       if (outArgs[i] == 'K') {
-        outArgs[i] = 'k';
+        outArgs[i] = 'K';
       }
     }
 
diff --git a/Engine/csound_type_system.c b/Engine/csound_type_system.c
index a131d37..755170a 100644
--- a/Engine/csound_type_system.c
+++ b/Engine/csound_type_system.c
@@ -297,14 +297,14 @@ void deleteVarPoolMemory(void* csnd, CS_VAR_POOL* pool) {
 
 void initializeVarPool(void *csound, MYFLT* memBlock, CS_VAR_POOL* pool) {
     CS_VARIABLE* current = pool->head;
-    int varNum = 1;
+    //int varNum = 1;
 
     while (current != NULL) {
       if (current->initializeVariableMemory != NULL) {
         current->initializeVariableMemory(csound, current,
                                           memBlock + current->memBlockIndex);
       }
-      varNum++;
+      //x varNum++;
       current = current->next;
     }
 }
diff --git a/Engine/insert.c b/Engine/insert.c
index a7ace1e..7b44d90 100644
--- a/Engine/insert.c
+++ b/Engine/insert.c
@@ -1620,24 +1620,26 @@ int xoutset(CSOUND *csound, XOUT *p)
   CS_VARIABLE* current;
   int i;
 
+
+
   (void) csound;
   buf = (OPCOD_IOBUFS*) p->h.insdshead->opcod_iobufs;
   inm = buf->opcode_info;
+
   bufs = ((UOPCODE*) buf->uopcode_struct)->ar;
   tmp = buf->iobufp_ptrs; // this is used to record the UDO's internal vars
   // for copying at perf-time
   current = inm->out_arg_pool->head;
 
   for (i = 0; i < inm->outchns; i++) {
-    void* in = (void*)p->args[i];
+    void* in = (void*) p->args[i];
     void* out = (void*)bufs[i];
     tmp[i] = in;
     // DO NOT COPY K or A vars
     // Fsigs need to be copied for initialization purposes.
-    if (csoundGetTypeForArg(in) != &CS_VAR_TYPE_K &&
-        /*csoundGetTypeForArg(in) != &CS_VAR_TYPE_F &&*/
-        csoundGetTypeForArg(in) != &CS_VAR_TYPE_A)
+    if (inm->outtypes[i] != 'k' && csoundGetTypeForArg(in) != &CS_VAR_TYPE_A)
       current->varType->copyValue(csound, out, in);
+    //printf("%c \n",   inm->outtypes[i]);
     current = current->next;
   }
 
diff --git a/Engine/symbtab.c b/Engine/symbtab.c
index 3469946..7281335 100644
--- a/Engine/symbtab.c
+++ b/Engine/symbtab.c
@@ -254,7 +254,7 @@ static char map_udo_in_arg_type(char in) {
 
 static char map_udo_out_arg_type(char in) {
     if (in == 'K') {
-        return 'k';
+        return 'K';
     }
     return in;
 }
@@ -419,12 +419,13 @@ static int parse_opcode_args(CSOUND *csound, OENTRY *opc)
         } else {
           char c = map_udo_out_arg_type(*out_arg);
           //                printf("found arg type %s -> %c\n", out_arg, c);
-          typeSpecifier[0] = c;
+          typeSpecifier[0] = c != 'K' ? c : 'k';
+
           CS_TYPE* type =
             csoundGetTypeWithVarTypeName(csound->typePool, typeSpecifier);
 
           if (UNLIKELY(type == NULL)) {
-            synterr(csound, Str("invalid output type for opcode %s"), out_arg);
+            synterr(csound, Str("=invalid output type for opcode %s"), out_arg);
             err++;
             continue;
           }
@@ -488,6 +489,7 @@ early_exit:
       }
       csound->Free(csound, out_args);
     }
+
     return err;
 }
 
@@ -574,8 +576,9 @@ int add_udo_definition(CSOUND *csound, char *opname,
     /* store the name in a linked list (note: must use csound->Calloc) */
     inm = (OPCODINFO *) csound->Calloc(csound, sizeof(OPCODINFO));
     inm->name = cs_strdup(csound, opname);
-    inm->intypes = intypes;
-    inm->outtypes = outtypes;
+    inm->intypes = cs_strdup(csound, intypes);
+    inm->outtypes = cs_strdup(csound, outtypes);
+
     inm->in_arg_pool = csoundCreateVarPool(csound);
     inm->out_arg_pool = csoundCreateVarPool(csound);
 
diff --git a/Opcodes/ftsamplebank.cpp b/Opcodes/ftsamplebank.cpp
index 83eaa3d..fc44f31 100644
--- a/Opcodes/ftsamplebank.cpp
+++ b/Opcodes/ftsamplebank.cpp
@@ -284,7 +284,7 @@ std::vector<std::string> searchDir(CSOUND *csound, char *directory,
   if (directory) {
     DIR *dir = opendir(directory);
     std::string fileExtension(extension);
-    int noOfFiles = 0;
+    //int noOfFiles = 0;
 
     // check for valid path first
     if (dir) {
@@ -306,7 +306,7 @@ std::vector<std::string> searchDir(CSOUND *csound, char *directory,
           } else
             fullFileName << ent->d_name;
 
-          noOfFiles++;
+          //noOfFiles++;
           fileNames.push_back(fullFileName.str());
         }
       }
diff --git a/Opcodes/sfont.c b/Opcodes/sfont.c
index d711dc1..362a79b 100644
--- a/Opcodes/sfont.c
+++ b/Opcodes/sfont.c
@@ -542,7 +542,7 @@ static int32_t SfPlay(CSOUND *csound, SFPLAY *p)
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *left= p->leftlevel, *right= p->rightlevel, *attack = p->attack,
       *decr = p->decr, *decay = p->decay, *sustain= p->sustain,
-      *release = p->release, *attr = p->attr;
+      /* *release = p->release,*/ *attr = p->attr;
 
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
@@ -573,7 +573,7 @@ static int32_t SfPlay(CSOUND *csound, SFPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -598,7 +598,7 @@ static int32_t SfPlay(CSOUND *csound, SFPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     if (IS_ASIG_ARG(p->xamp)) {
@@ -633,7 +633,7 @@ static int32_t SfPlay3(CSOUND *csound, SFPLAY *p)
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *left= p->leftlevel, *right= p->rightlevel, *attack = p->attack,
           *decr = p->decr, *decay = p->decay, *sustain= p->sustain,
-          *release = p->release, *attr = p->attr;
+          /**release = p->release,*/ *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
     memset(out2, 0, nsmps*sizeof(MYFLT));
@@ -663,7 +663,7 @@ static int32_t SfPlay3(CSOUND *csound, SFPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -687,7 +687,7 @@ static int32_t SfPlay3(CSOUND *csound, SFPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
 
@@ -818,7 +818,7 @@ static int32_t SfPlayMono(CSOUND *csound, SFPLAYMONO *p)
     SHORT *mode = p->mode;
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *attenuation = p->attenuation, *attack = p->attack, *decr = p->decr,
-          *decay = p->decay, *sustain= p->sustain, *release = p->release,
+          *decay = p->decay, *sustain= p->sustain, /**release = p->release,*/
           *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
@@ -848,7 +848,7 @@ static int32_t SfPlayMono(CSOUND *csound, SFPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -873,7 +873,7 @@ static int32_t SfPlayMono(CSOUND *csound, SFPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     if (IS_ASIG_ARG(p->xamp)) {
@@ -905,7 +905,7 @@ static int32_t SfPlayMono3(CSOUND *csound, SFPLAYMONO *p)
     SHORT   *mode = p->mode;
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *attenuation = p->attenuation,*attack = p->attack, *decr = p->decr,
-          *decay = p->decay, *sustain= p->sustain, *release = p->release,
+          *decay = p->decay, *sustain= p->sustain, /**release = p->release,*/
           *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
@@ -934,7 +934,7 @@ static int32_t SfPlayMono3(CSOUND *csound, SFPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -959,7 +959,7 @@ static int32_t SfPlayMono3(CSOUND *csound, SFPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     if (IS_ASIG_ARG(p->xamp)) {
@@ -1083,7 +1083,7 @@ static int32_t SfInstrPlay(CSOUND *csound, SFIPLAY *p)
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *left= p->leftlevel, *right= p->rightlevel, *attack = p->attack,
           *decr = p->decr, *decay = p->decay, *sustain= p->sustain,
-          *release = p->release, *attr = p->attr;
+          /**release = p->release,*/ *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
     memset(out2, 0, nsmps*sizeof(MYFLT));
@@ -1113,7 +1113,7 @@ static int32_t SfInstrPlay(CSOUND *csound, SFIPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -1138,7 +1138,7 @@ static int32_t SfInstrPlay(CSOUND *csound, SFIPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
 
@@ -1174,7 +1174,7 @@ static int32_t SfInstrPlay3(CSOUND *csound, SFIPLAY *p)
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *left= p->leftlevel, *right= p->rightlevel,
       *attack = p->attack, *decr = p->decr,
-      *decay = p->decay, *sustain= p->sustain, *release = p->release,
+      *decay = p->decay, *sustain= p->sustain, /**release = p->release,*/
       *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
@@ -1205,7 +1205,7 @@ static int32_t SfInstrPlay3(CSOUND *csound, SFIPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -1230,7 +1230,7 @@ static int32_t SfInstrPlay3(CSOUND *csound, SFIPLAY *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         left++; right++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
 
@@ -1350,7 +1350,7 @@ static int32_t SfInstrPlayMono(CSOUND *csound, SFIPLAYMONO *p)
 
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *attenuation = p->attenuation, *attack = p->attack, *decr = p->decr,
-      *decay = p->decay, *sustain= p->sustain, *release = p->release,
+      *decay = p->decay, *sustain= p->sustain, /**release = p->release,*/
       *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
@@ -1380,7 +1380,7 @@ static int32_t SfInstrPlayMono(CSOUND *csound, SFIPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -1405,7 +1405,7 @@ static int32_t SfInstrPlayMono(CSOUND *csound, SFIPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     if (IS_ASIG_ARG(p->xamp)) {
@@ -1437,7 +1437,7 @@ static int32_t SfInstrPlayMono3(CSOUND *csound, SFIPLAYMONO *p)
     SHORT *mode = p->mode;
     double *sampinc = p->si, *phs = p->phs;
     MYFLT *attenuation = p->attenuation,*attack = p->attack, *decr = p->decr,
-      *decay = p->decay, *sustain= p->sustain, *release = p->release,
+      *decay = p->decay, *sustain= p->sustain, /**release = p->release,*/
       *attr = p->attr;
 
     memset(out1, 0, nsmps*sizeof(MYFLT));
@@ -1467,7 +1467,7 @@ static int32_t SfInstrPlayMono3(CSOUND *csound, SFIPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     else {
@@ -1492,7 +1492,7 @@ static int32_t SfInstrPlayMono3(CSOUND *csound, SFIPLAYMONO *p)
         }
         phs++; base++; sampinc++; endloop++; startloop++;
         attenuation++, mode++, end++; attack++; decay++; sustain++;
-        release++; tinc++; env++; attr++; decr++;
+        /*release++;*/ tinc++; env++; attr++; decr++;
       }
     }
     if (IS_ASIG_ARG(p->xamp)) {
diff --git a/interfaces/CsoundFile.cpp b/interfaces/CsoundFile.cpp
index 85a2d7b..6fcbd19 100644
--- a/interfaces/CsoundFile.cpp
+++ b/interfaces/CsoundFile.cpp
@@ -846,7 +846,7 @@ bool CsoundFile::getInstrument(int number, std::string &definition_) const
 {
   int beginDefinition = 0;
   int endDefinition = 0;
-  for(int index = 0; true; index++)
+  for(; true;)
     {
       beginDefinition = findToken(orchestra, "instr", beginDefinition);
       if(beginDefinition == -1)
@@ -921,7 +921,7 @@ std::map<int, std::string> CsoundFile::getInstrumentNames() const
   std::map<int, std::string> instrumentNames;
   int beginDefinition = 0;
   int endDefinition = 0;
-  for(int index = 0; true; index++)
+  while(true)
     {
       beginDefinition = findToken(orchestra, "instr", beginDefinition);
       if(beginDefinition == -1)
diff --git a/util/atsa.c b/util/atsa.c
index 30a138f..803f4c0 100644
--- a/util/atsa.c
+++ b/util/atsa.c
@@ -1801,7 +1801,7 @@ static void compute_residual(CSOUND *csound, mus_sample_t **fil,
                              ATS_SOUND *sound, int *win_samps,
                              int file_sampling_rate)
 {
-    int     i, frm, frm_1, frm_2, par, frames, partials, frm_samps, out_smp = 0;
+    int     i, frm, frm_1, frm_2, par, frames, partials, frm_samps;
     double  *in_buff, *synth_buff, mag, a1, a2, f1, f2, p1, p2, diff, synth;
     mus_sample_t **obuf;
     SF_INFO sfinfo;
@@ -1885,7 +1885,6 @@ static void compute_residual(CSOUND *csound, mus_sample_t **fil,
         diff = in_buff[i] - synth;
         obuf[0][i] = (mus_sample_t) diff;
         obuf[1][i] = (mus_sample_t) synth;
-        out_smp++;
       }
       atsa_sound_write_noninterleaved(sf, obuf, 2, frm_samps);
     }
diff --git a/util/hetro.c b/util/hetro.c
index 57c24aa..70c5cf7 100644
--- a/util/hetro.c
+++ b/util/hetro.c
@@ -677,7 +677,7 @@ static int32_t filedump(HET *t, CSOUND *csound)
     for (h = 0; h < t->hmax; h++) {
       int16 *mp = magout, *fp = frqout;
       int16 *lastmag, *lastfrq, pkamp = 0;
-      int32_t mpoints, fpoints, contig = 0;
+      int32_t mpoints, fpoints/*, contig = 0*/;
       *mp++ = -1;                      /* set brkpoint type codes  */
       *fp++ = -2;
       lastmag = mp;
@@ -710,7 +710,7 @@ static int32_t filedump(HET *t, CSOUND *csound)
           *fp++ = frq;
           lastmag = mp;         /* record last significant seg  */
           lastfrq = fp;
-          contig++;
+          //contig++;
         }
         else {
           if (mp > lastmag) {   /* for non-significant segments */
@@ -721,7 +721,7 @@ static int32_t filedump(HET *t, CSOUND *csound)
           *mp++ = 0;
           *fp++ = tim;
           *fp++ = frq;
-          contig = 0;
+          //contig = 0;
         }
       }
       if (lastmag < mp) {          /* if last signif not last point */
