shithub: sox

Download patch

ref: a39f4b1023444254f8b039eea1198a0ab8cef629
parent: ae9950f6d0523d17328ead6766650a608432a9ed
author: robs <robs>
date: Thu Feb 14 14:59:47 EST 2008

Fix crash on 64-bit arch with tempo & key effects.  (Sami Liedes)
Sami's fix is valid but the use of sox_size_t at all needs to be
investigated.

--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,7 @@
 Bug fixes:
 
   o Fix [1864216] comments mangled when writing ogg-vorbis.  (robs)
+  o Fix crash on 64-bit arch with tempo & key effects.  (Sami Liedes)
 
 Internal improvements:
 
--- a/src/flac.c
+++ b/src/flac.c
@@ -249,7 +249,7 @@
 
 
 
-static FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], unsigned const bytes, unsigned const samples, unsigned const current_frame, void * const client_data)
+static FLAC__StreamEncoderWriteStatus flac_stream_encoder_write_callback(FLAC__StreamEncoder const * const flac, const FLAC__byte buffer[], size_t const bytes, unsigned const samples, unsigned const current_frame, void * const client_data)
 {
   sox_format_t * const ft = (sox_format_t *) client_data;
   (void) flac, (void) samples, (void) current_frame;
--- a/src/tempo.c
+++ b/src/tempo.c
@@ -247,7 +247,9 @@
                 sox_sample_t * obuf, sox_size_t * isamp, sox_size_t * osamp)
 {
   priv_t * p = (priv_t *) effp->priv;
-  sox_size_t i, odone = *osamp /= effp->ininfo.channels;
+  sox_size_t i;
+  /* odone must be size_t 'cos tempo_output arg. is. (!= sox_size_t on amd64) */
+  size_t odone = *osamp /= effp->ininfo.channels;
   float const * s = tempo_output(p->tempo, NULL, &odone);
 
   for (i = 0; i < odone * effp->ininfo.channels; ++i)