shithub: sox

Download patch

ref: 10c6b92eb3dbd106e765942b4a868e7e9c0f2558
parent: 89e9bf4a96bc03100918df8889e3987a821a2f75
author: robs <robs>
date: Wed Sep 17 14:50:23 EDT 2008

fix crash with pitch; update (c); tweak sox help

--- a/src/biquads.c
+++ b/src/biquads.c
@@ -1,4 +1,4 @@
-/* libSoX Biquad filter effects   (c) 2006-7 robs@users.sourceforge.net
+/* libSoX Biquad filter effects   (c) 2006-8 robs@users.sourceforge.net
  *
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published by
--- a/src/pitch.c
+++ b/src/pitch.c
@@ -27,8 +27,8 @@
 static int getopts(sox_effect_t * effp, int argc, char **argv)
 {
   double d;
-  char dummy, arg[100];
-  int pos = (argc && !strcmp(*argv, "-q"))? 1 : 0;
+  char dummy, arg[100], **argv2 = malloc(argc * sizeof(*argv2));
+  int ret, pos = (argc && !strcmp(*argv, "-q"))? 1 : 0;
 
   if (argc <= pos || sscanf(argv[pos], "%lf %c", &d, &dummy) != 1)
     return lsx_usage(effp);
@@ -35,8 +35,11 @@
 
   effp->global_info->speed *= d = pow(2., d / 1200);  /* cents --> factor */
   sprintf(arg, "%g", 1 / d);
-  argv[pos] = arg;
-  return sox_tempo_effect_fn()->getopts(effp, argc, argv);
+  memcpy(argv2, argv, argc * sizeof(*argv2));
+  argv2[pos] = arg;
+  ret = sox_tempo_effect_fn()->getopts(effp, argc, argv2);
+  free(argv2);
+  return ret;
 }
 
 sox_effect_handler_t const * sox_pitch_effect_fn(void)
--- a/src/sox.c
+++ b/src/sox.c
@@ -1384,7 +1384,7 @@
     puts(lines[i]);
   display_supported_formats();
   display_supported_effects();
-  printf("effopts: depends on effect\n");
+  printf("effopts: effect dependent; see --help-effect\n");
   exit(message != NULL);
 }