changeset 980:6e6da0636e5e tonioni

Merge from default branch
author Chris Cannam
date Tue, 09 Sep 2014 16:36:21 +0100
parents 35b05cac32d0 (current diff) c598b1d880f2 (diff)
children ba404199345f
files
diffstat 27 files changed, 55 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/base/Clipboard.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/base/Clipboard.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -19,7 +19,9 @@
     m_haveFrame(true),
     m_frame(frame),
     m_haveValue(false),
+    m_value(0),
     m_haveDuration(false),
+    m_duration(0),
     m_haveLabel(true),
     m_label(label),
     m_haveLevel(false),
@@ -35,6 +37,7 @@
     m_haveValue(true),
     m_value(value),
     m_haveDuration(false),
+    m_duration(0),
     m_haveLabel(true),
     m_label(label),
     m_haveLevel(false),
--- a/base/Debug.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/base/Debug.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -45,6 +45,7 @@
     if (!prefix) {
         prefix = new char[20];
         sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid());
+        //!!! what to do if mkpath fails?
 	if (!logdir.exists()) logdir.mkpath(logdir.path());
     }
 
--- a/base/RealTime.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/base/RealTime.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -208,7 +208,7 @@
 RealTime::fromString(std::string s)
 {
     bool negative = false;
-    bool section = 0;
+    int section = 0;
     std::string ssec, snsec;
 
     for (size_t i = 0; i < s.length(); ++i) {
--- a/base/ResizeableBitset.h	Tue Sep 02 16:23:48 2014 +0100
+++ b/base/ResizeableBitset.h	Tue Sep 09 16:36:21 2014 +0100
@@ -24,7 +24,7 @@
 class ResizeableBitset {
 
 public:
-    ResizeableBitset() : m_bits(0) {
+    ResizeableBitset() : m_bits(0), m_size(0) {
     }
     ResizeableBitset(size_t size) : m_bits(new std::vector<uint8_t>), m_size(size) {
         m_bits->assign((size >> 3) + 1, 0);
--- a/base/ResourceFinder.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/base/ResourceFinder.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -218,7 +218,7 @@
         QString save = QString("%1%2").arg(user).arg(resourceCat);
         QDir saveDir(save);
         if (!saveDir.exists()) {
-            if (!userDir.mkpath(save)) {
+            if (!saveDir.mkpath(save)) {
                 cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << save << "\"" << endl;
                 return "";
             }
--- a/data/fft/FFTMemoryCache.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fft/FFTMemoryCache.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -205,10 +205,12 @@
 
     case FFTCache::Compact:
         sz = (height * 2 + 1) * width * sizeof(uint16_t);
+        break;
 
     case FFTCache::Polar:
     case FFTCache::Rectangular:
         sz = (height * 2 + 1) * width * sizeof(float);
+        break;
     }
 
     return sz;
--- a/data/fileio/CSVFileReader.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/CSVFileReader.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -430,7 +430,7 @@
         }
     }
 
-    if (modelType == CSVFormat::ThreeDimensionalModel) {
+    if (model3) {
 	model3->setMinimumLevel(min);
 	model3->setMaximumLevel(max);
     }
--- a/data/fileio/FileSource.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/FileSource.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -857,7 +857,7 @@
 #ifdef DEBUG_FILE_SOURCE
         cerr << "FileSource::createCacheFile: ERROR: Failed to create temporary directory: " << f.what() << endl;
 #endif
-        return "";
+        return false;
     }
 
     QString filepart = m_url.path().section('/', -1, -1,
@@ -915,7 +915,7 @@
                       << m_url.toString() << "\" (or file already exists)" << endl;
 #endif
 
-            return "";
+            return false;
         }
     }
 
--- a/data/fileio/MIDIFileReader.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/MIDIFileReader.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -629,13 +629,6 @@
                 m_midiComposition[trackNum].push_back(midiEvent);
                 break;
 
-            case MIDI_END_OF_EXCLUSIVE:
-#ifdef MIDI_DEBUG
-                SVDEBUG << "MIDIFileReader::parseTrack() - "
-                          << "Found a stray MIDI_END_OF_EXCLUSIVE" << endl;
-#endif
-                break;
-
             default:
 #ifdef MIDI_DEBUG
                 SVDEBUG << "MIDIFileReader::parseTrack()" 
--- a/data/fileio/MIDIFileWriter.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/MIDIFileWriter.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -41,7 +41,8 @@
     m_path(path),
     m_exportable(exportable),
     m_sampleRate(sampleRate),
-    m_tempo(tempo)
+    m_tempo(tempo),
+    m_midiFile(0)
 {
     if (!convert()) {
         m_error = "Conversion from model to internal MIDI format failed";
--- a/data/fileio/MP3FileReader.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/MP3FileReader.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -63,6 +63,10 @@
 
     m_fileSize = stat.st_size;
 
+    m_filebuffer = 0;
+    m_samplebuffer = 0;
+    m_samplebuffersize = 0;
+
     int fd = -1;
     if ((fd = ::open(m_path.toLocal8Bit().data(), O_RDONLY
 #ifdef _WIN32
@@ -73,10 +77,6 @@
 	return;
     }	
 
-    m_filebuffer = 0;
-    m_samplebuffer = 0;
-    m_samplebuffersize = 0;
-
     try {
         m_filebuffer = new unsigned char[m_fileSize];
     } catch (...) {
--- a/data/fileio/MatchFileReader.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/MatchFileReader.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -23,7 +23,8 @@
 
 Alignment::Alignment() :
     thisHopTime(0.0),
-    refHopTime(0.0)
+    refHopTime(0.0),
+    m_mainModel(0)
 {
 }
 
--- a/data/fileio/test/AudioFileReaderTest.h	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/fileio/test/AudioFileReaderTest.h	Tue Sep 09 16:36:21 2014 +0100
@@ -169,7 +169,7 @@
 		totdiff += diff;
                 // in edge areas, record this only if it exceeds edgeLimit
                 if (i < edgeSize || i + edgeSize >= read - offset) {
-                    if (diff > edgeLimit) {
+                    if (diff > edgeLimit && diff > maxdiff) {
                         maxdiff = diff;
                         maxAt = i;
                     }
--- a/data/model/FFTModel.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/model/FFTModel.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -381,7 +381,7 @@
     if (bin == 0) return 3;
 
     int fftSize = m_server->getFFTSize() >> m_yshift;
-    float binfreq = (sampleRate * bin) / fftSize;
+    float binfreq = (float(sampleRate) * bin) / fftSize;
     float hifreq = Pitch::getFrequencyForPitch(73, 0, binfreq);
 
     int hibin = lrintf((hifreq * fftSize) / sampleRate);
--- a/data/model/IntervalModel.h	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/model/IntervalModel.h	Tue Sep 09 16:36:21 2014 +0100
@@ -106,7 +106,7 @@
         command->deletePoint(point);
 
         switch (column) {
-        case 0: case 1: point.frame = value.toInt(); break; 
+        // column cannot be 0 or 1, those cases were handled above
         case 2: point.value = value.toDouble(); break;
         case 3: point.duration = value.toInt(); break;
         }
--- a/data/model/SparseModel.h	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/model/SparseModel.h	Tue Sep 09 16:36:21 2014 +0100
@@ -363,9 +363,9 @@
             
     virtual Command *getRemoveRowCommand(int row)
     {
-        EditCommand *command = new EditCommand(this, tr("Delete Data Point"));
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return 0;
+        EditCommand *command = new EditCommand(this, tr("Delete Data Point"));
         command->deletePoint(*i);
         return command->finish();
     }
--- a/data/model/WaveFileModel.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/model/WaveFileModel.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -40,6 +40,7 @@
 WaveFileModel::WaveFileModel(FileSource source, int targetRate) :
     m_source(source),
     m_path(source.getLocation()),
+    m_reader(0),
     m_myReader(true),
     m_startFrame(0),
     m_fillThread(0),
@@ -67,6 +68,7 @@
 WaveFileModel::WaveFileModel(FileSource source, AudioFileReader *reader) :
     m_source(source),
     m_path(source.getLocation()),
+    m_reader(0),
     m_myReader(false),
     m_startFrame(0),
     m_fillThread(0),
--- a/data/osc/OSCMessage.h	Tue Sep 02 16:23:48 2014 +0100
+++ b/data/osc/OSCMessage.h	Tue Sep 09 16:36:21 2014 +0100
@@ -32,7 +32,7 @@
 class OSCMessage
 {
 public:
-    OSCMessage() { }
+    OSCMessage() : m_target(0), m_targetData(0) { }
     ~OSCMessage();
 
     void setTarget(const int &target) { m_target = target; }
--- a/plugin/DSSIPluginFactory.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/plugin/DSSIPluginFactory.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -346,8 +346,8 @@
             category = m_taxonomy[identifier];
         }
 
-	if (category == "" && ladspaDescriptor->Name != 0) {
-	    std::string name = ladspaDescriptor->Name;
+	if (category == "") {
+	    std::string name = rtd->name;
 	    if (name.length() > 4 &&
 		name.substr(name.length() - 4) == " VST") {
 		if (descriptor->run_synth || descriptor->run_multiple_synths) {
--- a/plugin/DSSIPluginInstance.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/plugin/DSSIPluginInstance.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -64,6 +64,7 @@
     RealTimePluginInstance(factory, identifier),
     m_client(clientId),
     m_position(position),
+    m_instanceHandle(0),
     m_descriptor(descriptor),
     m_programCacheValid(false),
     m_eventBuffer(EVENT_BUFFER_SIZE),
@@ -146,6 +147,7 @@
 {
     ParameterList list;
     LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
+    if (!f) return list;
     
     for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
         
@@ -988,7 +990,7 @@
     if (count == 0) count = m_blockSize;
 
     bool needLock = false;
-    if (m_descriptor->select_program) needLock = true;
+    if (m_descriptor && m_descriptor->select_program) needLock = true;
 
     if (needLock) {
 	if (!m_processLock.tryLock()) {
@@ -1007,7 +1009,7 @@
     if (!m_descriptor || !m_descriptor->run_synth) {
 	m_eventBuffer.skip(m_eventBuffer.getReadSpace());
 	m_haveLastEventSendTime = false;
-	if (m_descriptor->LADSPA_Plugin->run) {
+	if (m_descriptor && m_descriptor->LADSPA_Plugin->run) {
 	    m_descriptor->LADSPA_Plugin->run(m_instanceHandle, count);
 	} else {
 	    for (size_t ch = 0; ch < m_audioPortsOut.size(); ++ch) {
--- a/plugin/FeatureExtractionPluginFactory.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -48,6 +48,8 @@
     Vamp::Plugin *p = m_plugin;
     delete m_plugin;
     m_plugin = 0;
+    // acceptable use after free here, as pluginDeleted uses p only as
+    // pointer key and does not deref it
     if (m_factory) m_factory->pluginDeleted(p);
 }
 
--- a/plugin/LADSPAPluginFactory.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/plugin/LADSPAPluginFactory.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -730,8 +730,8 @@
 
 	QString category = m_taxonomy[identifier];
 	
-	if (category == "" && descriptor->Name != 0) {
-	    std::string name = descriptor->Name;
+	if (category == "") {
+	    std::string name = rtd->name;
 	    if (name.length() > 4 &&
 		name.substr(name.length() - 4) == " VST") {
 		category = "VST effects";
--- a/plugin/LADSPAPluginInstance.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/plugin/LADSPAPluginInstance.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -123,6 +123,7 @@
 {
     ParameterList list;
     LADSPAPluginFactory *f = dynamic_cast<LADSPAPluginFactory *>(m_factory);
+    if (!f) return list;
     
     for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
         
--- a/transform/FeatureExtractionModelTransformer.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/transform/FeatureExtractionModelTransformer.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -741,6 +741,11 @@
         delete[] reals;
         delete[] imaginaries;
     }
+
+    for (int ch = 0; ch < channelCount; ++ch) {
+        delete[] buffers[ch];
+    }
+    delete[] buffers;
 }
 
 void
--- a/transform/RealTimeEffectModelTransformer.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/transform/RealTimeEffectModelTransformer.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -196,10 +196,10 @@
                 while (got < blockSize) {
                     inbufs[0][got++] = 0.0;
                 }          
-            }
-            for (int ch = 1; ch < (int)m_plugin->getAudioInputCount(); ++ch) {
-                for (long i = 0; i < blockSize; ++i) {
-                    inbufs[ch][i] = inbufs[0][i];
+                for (int ch = 1; ch < (int)m_plugin->getAudioInputCount(); ++ch) {
+                    for (long i = 0; i < blockSize; ++i) {
+                        inbufs[ch][i] = inbufs[0][i];
+                    }
                 }
             }
 	} else {
@@ -213,10 +213,10 @@
                     }
                     ++got;
                 }
-            }
-            for (int ch = channelCount; ch < (int)m_plugin->getAudioInputCount(); ++ch) {
-                for (long i = 0; i < blockSize; ++i) {
-                    inbufs[ch][i] = inbufs[ch % channelCount][i];
+                for (int ch = channelCount; ch < (int)m_plugin->getAudioInputCount(); ++ch) {
+                    for (long i = 0; i < blockSize; ++i) {
+                        inbufs[ch][i] = inbufs[ch % channelCount][i];
+                    }
                 }
             }
 	}
--- a/transform/TransformDescription.h	Tue Sep 02 16:23:48 2014 +0100
+++ b/transform/TransformDescription.h	Tue Sep 09 16:36:21 2014 +0100
@@ -53,7 +53,8 @@
         UnknownType
     };
 
-    TransformDescription() { }
+    TransformDescription() : 
+        type(UnknownType), configurable(false) { }
     TransformDescription(Type _type, QString _category,
                          TransformId _identifier, QString _name,
                          QString _friendlyName, QString _description,
--- a/transform/TransformFactory.cpp	Tue Sep 02 16:23:48 2014 +0100
+++ b/transform/TransformFactory.cpp	Tue Sep 09 16:36:21 2014 +0100
@@ -60,7 +60,8 @@
     m_transformsPopulated(false),
     m_uninstalledTransformsPopulated(false),
     m_thread(0),
-    m_exiting(false)
+    m_exiting(false),
+    m_populatingSlowly(false)
 {
 }