shithub: sox

Download patch

ref: ccae7ed955ff10cf4b08b06bcea9d892b950e7f4
parent: 0d55513674072f1f7a3d28b686df231505d00b6d
author: cbagwell <cbagwell>
date: Tue Oct 19 16:54:48 EDT 2004

Fix a couple of references to rand() without calling srand() first.

--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,8 @@
     and patches for sunaudio driver on openbsd.
   o Default volume for soxmix wrongly set to 0 instead
     of 1/#_input_files (float rounding error).
+  o Guentcho Skordev pointed out ogg vorbis files were using
+    the same value for serial numbers each time.
 
 sox-12.17.6
 -----------
--- a/src/synth.c
+++ b/src/synth.c
@@ -429,6 +429,8 @@
     synth_t synth = (synth_t) effp->priv;
     char *usstr=USSTR;
 
+    st_initrand();
+
     if (synth->length_str)
     {
         if (st_parsesamples(effp->ininfo.rate, synth->length_str,
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -367,13 +367,14 @@
 
         vorbis_analysis_init(&ve->vd, &ve->vi);
         vorbis_block_init(&ve->vd, &ve->vb);
-        
+       
+        st_initrand();
         ogg_stream_init(&ve->os, rand()); /* Random serial number */
         
         if (write_vorbis_header(ft, ve) == HEADER_ERROR)
         {
             st_fail_errno(ft,ST_EHDR,
-                          "Error writing headre for Ogg Vorbis audio stream");
+                          "Error writing header for Ogg Vorbis audio stream");
             return (ST_EOF);
         }