# HG changeset patch # User Chris Cannam # Date 1410276981 -3600 # Node ID 6e6da0636e5e4f143daeebac0c003f1dbe316436 # Parent 35b05cac32d0cb96080316cc36f852c83cc3bb18# Parent c598b1d880f2a58282a64e27248cc0313a4605cd Merge from default branch diff -r 35b05cac32d0 -r 6e6da0636e5e base/Clipboard.cpp --- 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), diff -r 35b05cac32d0 -r 6e6da0636e5e base/Debug.cpp --- 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()); } diff -r 35b05cac32d0 -r 6e6da0636e5e base/RealTime.cpp --- 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) { diff -r 35b05cac32d0 -r 6e6da0636e5e base/ResizeableBitset.h --- 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), m_size(size) { m_bits->assign((size >> 3) + 1, 0); diff -r 35b05cac32d0 -r 6e6da0636e5e base/ResourceFinder.cpp --- 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 ""; } diff -r 35b05cac32d0 -r 6e6da0636e5e data/fft/FFTMemoryCache.cpp --- 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; diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/CSVFileReader.cpp --- 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); } diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/FileSource.cpp --- 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; } } diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/MIDIFileReader.cpp --- 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()" diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/MIDIFileWriter.cpp --- 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"; diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/MP3FileReader.cpp --- 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 (...) { diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/MatchFileReader.cpp --- 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) { } diff -r 35b05cac32d0 -r 6e6da0636e5e data/fileio/test/AudioFileReaderTest.h --- 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; } diff -r 35b05cac32d0 -r 6e6da0636e5e data/model/FFTModel.cpp --- 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); diff -r 35b05cac32d0 -r 6e6da0636e5e data/model/IntervalModel.h --- 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; } diff -r 35b05cac32d0 -r 6e6da0636e5e data/model/SparseModel.h --- 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(); } diff -r 35b05cac32d0 -r 6e6da0636e5e data/model/WaveFileModel.cpp --- 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), diff -r 35b05cac32d0 -r 6e6da0636e5e data/osc/OSCMessage.h --- 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; } diff -r 35b05cac32d0 -r 6e6da0636e5e plugin/DSSIPluginFactory.cpp --- 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) { diff -r 35b05cac32d0 -r 6e6da0636e5e plugin/DSSIPluginInstance.cpp --- 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(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) { diff -r 35b05cac32d0 -r 6e6da0636e5e plugin/FeatureExtractionPluginFactory.cpp --- 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); } diff -r 35b05cac32d0 -r 6e6da0636e5e plugin/LADSPAPluginFactory.cpp --- 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"; diff -r 35b05cac32d0 -r 6e6da0636e5e plugin/LADSPAPluginInstance.cpp --- 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(m_factory); + if (!f) return list; for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { diff -r 35b05cac32d0 -r 6e6da0636e5e transform/FeatureExtractionModelTransformer.cpp --- 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 diff -r 35b05cac32d0 -r 6e6da0636e5e transform/RealTimeEffectModelTransformer.cpp --- 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]; + } } } } diff -r 35b05cac32d0 -r 6e6da0636e5e transform/TransformDescription.h --- 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, diff -r 35b05cac32d0 -r 6e6da0636e5e transform/TransformFactory.cpp --- 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) { }