Mercurial > hg > svcore
changeset 1582:70e172e6cc59 fix-static-analysis
Use nullptr throughout
line wrap: on
line diff
--- a/base/Debug.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/Debug.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -24,8 +24,8 @@ #include <stdexcept> -static SVDebug *svdebug = 0; -static SVCerr *svcerr = 0; +static SVDebug *svdebug = nullptr; +static SVCerr *svcerr = nullptr; static QMutex mutex; SVDebug &getSVDebug() { @@ -53,7 +53,7 @@ bool SVCerr::m_silenced = false; SVDebug::SVDebug() : - m_prefix(0), + m_prefix(nullptr), m_ok(false), m_eol(true) {
--- a/base/PlayParameterRepository.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/PlayParameterRepository.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -92,7 +92,7 @@ PlayParameters * PlayParameterRepository::getPlayParameters(const Playable *playable) { - if (m_playParameters.find(playable) == m_playParameters.end()) return 0; + if (m_playParameters.find(playable) == m_playParameters.end()) return nullptr; return m_playParameters.find(playable)->second; }
--- a/base/Preferences.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/Preferences.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -25,7 +25,7 @@ #include <QSettings> Preferences * -Preferences::m_instance = 0; +Preferences::m_instance = nullptr; Preferences * Preferences::getInstance()
--- a/base/Profiler.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/Profiler.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -29,7 +29,7 @@ #include <set> #include <map> -Profiles* Profiles::m_instance = 0; +Profiles* Profiles::m_instance = nullptr; Profiles* Profiles::getInstance() {
--- a/base/PropertyContainer.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/PropertyContainer.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -68,7 +68,7 @@ RangeMapper * PropertyContainer::getNewPropertyRangeMapper(const PropertyName &) const { - return 0; + return nullptr; } void @@ -80,8 +80,8 @@ Command * PropertyContainer::getSetPropertyCommand(const PropertyName &name, int value) { - int currentValue = getPropertyRangeAndValue(name, 0, 0, 0); - if (value == currentValue) return 0; + int currentValue = getPropertyRangeAndValue(name, nullptr, nullptr, nullptr); + if (value == currentValue) return nullptr; return new SetPropertyCommand(this, name, value); } @@ -110,7 +110,7 @@ << nameString << "\", \"" << valueString << "\"): Name and value conversion failed" << endl; - return 0; + return nullptr; } return getSetPropertyCommand(name, value); } @@ -181,7 +181,7 @@ case ColourMapProperty: { int min, max; - getPropertyRangeAndValue(name, &min, &max, 0); + getPropertyRangeAndValue(name, &min, &max, nullptr); for (int i = min; i <= max; ++i) { if (valueString == getPropertyValueLabel(name, i)) { value = i; @@ -206,7 +206,7 @@ if (success) return true; int min, max; - getPropertyRangeAndValue(name, &min, &max, 0); + getPropertyRangeAndValue(name, &min, &max, nullptr); bool ok = false; int i = valueString.toInt(&ok); @@ -235,7 +235,7 @@ void PropertyContainer::SetPropertyCommand::execute() { - m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, 0, 0, 0); + m_oldValue = m_pc->getPropertyRangeAndValue(m_pn, nullptr, nullptr, nullptr); m_pc->setProperty(m_pn, m_value); }
--- a/base/RealTimeSV.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/RealTimeSV.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -118,7 +118,7 @@ } double value = 0.0; - char *eptr = 0; + char *eptr = nullptr; if (isdigit(s[i]) || s[i] == '.') { value = strtod(&s[i], &eptr);
--- a/base/TempDirectory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/base/TempDirectory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -110,7 +110,7 @@ QString suffix; int padlen = 6, attempts = 100; - unsigned int r = (unsigned int)(time(0) ^ getpid()); + unsigned int r = (unsigned int)(time(nullptr) ^ getpid()); for (int i = 0; i < padlen; ++i) { suffix += "X";
--- a/data/fileio/AudioFileReaderFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/AudioFileReaderFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -68,15 +68,15 @@ if (!source.isOK()) { SVCERR << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << endl; - return 0; + return nullptr; } if (!source.isAvailable()) { SVCERR << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl; - return 0; + return nullptr; } - AudioFileReader *reader = 0; + AudioFileReader *reader = nullptr; sv_samplerate_t targetRate = params.targetRate; bool normalised = (params.normalisation == Normalisation::Peak);
--- a/data/fileio/AudioFileSizeEstimator.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/AudioFileSizeEstimator.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -51,7 +51,7 @@ } delete reader; - reader = 0; + reader = nullptr; if (estimate == 0) {
--- a/data/fileio/BZipFileDevice.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/BZipFileDevice.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -31,8 +31,8 @@ BZipFileDevice::BZipFileDevice(QString fileName) : m_fileName(fileName), m_qfile(fileName), - m_file(0), - m_bzFile(0), + m_file(nullptr), + m_bzFile(nullptr), m_atEnd(true), m_ok(true) { @@ -120,7 +120,7 @@ if (!m_bzFile) { fclose(m_file); - m_file = 0; + m_file = nullptr; m_qfile.close(); setErrorString(tr("Failed to open bzip2 stream for writing")); m_ok = false; @@ -150,11 +150,11 @@ } int bzError = BZ_OK; - m_bzFile = BZ2_bzReadOpen(&bzError, m_file, 0, 0, NULL, 0); + m_bzFile = BZ2_bzReadOpen(&bzError, m_file, 0, 0, nullptr, 0); if (!m_bzFile) { fclose(m_file); - m_file = 0; + m_file = nullptr; m_qfile.close(); setErrorString(tr("Failed to open bzip2 stream for reading")); m_ok = false; @@ -195,8 +195,8 @@ } fclose(m_file); m_qfile.close(); - m_bzFile = 0; - m_file = 0; + m_bzFile = nullptr; + m_file = nullptr; m_ok = false; return; } @@ -208,8 +208,8 @@ } fclose(m_file); m_qfile.close(); - m_bzFile = 0; - m_file = 0; + m_bzFile = nullptr; + m_file = nullptr; m_ok = false; return; }
--- a/data/fileio/CSVFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/CSVFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -47,7 +47,7 @@ sv_samplerate_t mainModelSampleRate, ProgressReporter *reporter) : m_format(format), - m_device(0), + m_device(nullptr), m_ownDevice(true), m_warnings(0), m_mainModelSampleRate(mainModelSampleRate), @@ -107,7 +107,7 @@ bool CSVFileReader::isOK() const { - return (m_device != 0); + return (m_device != nullptr); } QString @@ -172,7 +172,7 @@ Model * CSVFileReader::load() const { - if (!m_device) return 0; + if (!m_device) return nullptr; CSVFormat::ModelType modelType = m_format.getModelType(); CSVFormat::TimingType timingType = m_format.getTimingType(); @@ -197,13 +197,13 @@ } } - SparseOneDimensionalModel *model1 = 0; - SparseTimeValueModel *model2 = 0; - RegionModel *model2a = 0; - NoteModel *model2b = 0; - EditableDenseThreeDimensionalModel *model3 = 0; - WritableWaveFileModel *modelW = 0; - Model *model = 0; + SparseOneDimensionalModel *model1 = nullptr; + SparseTimeValueModel *model2 = nullptr; + RegionModel *model2a = nullptr; + NoteModel *model2b = nullptr; + EditableDenseThreeDimensionalModel *model3 = nullptr; + WritableWaveFileModel *modelW = nullptr; + Model *model = nullptr; QTextStream in(m_device); @@ -231,7 +231,7 @@ } int audioChannels = 0; - float **audioSamples = 0; + float **audioSamples = nullptr; float sampleShift = 0.f; float sampleScale = 1.f; @@ -370,9 +370,9 @@ << endl; if (model) { delete model; - model = 0; - model1 = 0; model2 = 0; model2a = 0; model2b = 0; - model3 = 0; modelW = 0; + model = nullptr; + model1 = nullptr; model2 = nullptr; model2a = nullptr; model2b = nullptr; + model3 = nullptr; modelW = nullptr; } abandoned = true; break;
--- a/data/fileio/CodedAudioFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/CodedAudioFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -36,15 +36,15 @@ bool normalised) : m_cacheMode(cacheMode), m_initialised(false), - m_serialiser(0), + m_serialiser(nullptr), m_fileRate(0), - m_cacheFileWritePtr(0), - m_cacheFileReader(0), - m_cacheWriteBuffer(0), + m_cacheFileWritePtr(nullptr), + m_cacheFileReader(nullptr), + m_cacheWriteBuffer(nullptr), m_cacheWriteBufferIndex(0), m_cacheWriteBufferFrames(65536), - m_resampler(0), - m_resampleBuffer(0), + m_resampler(nullptr), + m_resampleBuffer(nullptr), m_resampleBufferFrames(0), m_fileFrameCount(0), m_normalised(normalised), @@ -119,7 +119,7 @@ SVDEBUG << "CodedAudioFileReader(" << this << ")::endSerialised: id = " << (m_serialiser ? m_serialiser->getId() : "(none)") << endl; delete m_serialiser; - m_serialiser = 0; + m_serialiser = nullptr; } void @@ -218,7 +218,7 @@ if (!m_cacheFileReader->isOK()) { SVDEBUG << "ERROR: CodedAudioFileReader::initialiseDecodeCache: Failed to construct WAV file reader for temporary file: " << m_cacheFileReader->getError() << endl; delete m_cacheFileReader; - m_cacheFileReader = 0; + m_cacheFileReader = nullptr; m_cacheMode = CacheInMemory; sf_close(m_cacheFileWritePtr); } @@ -331,18 +331,18 @@ pushCacheWriteBufferMaybe(true); delete[] m_cacheWriteBuffer; - m_cacheWriteBuffer = 0; + m_cacheWriteBuffer = nullptr; delete[] m_resampleBuffer; - m_resampleBuffer = 0; + m_resampleBuffer = nullptr; delete m_resampler; - m_resampler = 0; + m_resampler = nullptr; if (m_cacheMode == CacheInTemporaryFile) { sf_close(m_cacheFileWritePtr); - m_cacheFileWritePtr = 0; + m_cacheFileWritePtr = nullptr; if (m_cacheFileReader) m_cacheFileReader->updateFrameCount(); } else { @@ -471,7 +471,7 @@ case CacheInTemporaryFile: if (sf_writef_float(m_cacheFileWritePtr, buffer, sz) < sz) { sf_close(m_cacheFileWritePtr); - m_cacheFileWritePtr = 0; + m_cacheFileWritePtr = nullptr; throw InsufficientDiscSpace(TempDirectory::getInstance()->getPath()); } break;
--- a/data/fileio/DataFileReaderFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/DataFileReaderFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -37,7 +37,7 @@ { QString err; - DataFileReader *reader = 0; + DataFileReader *reader = nullptr; if (!csv) { reader = new MIDIFileReader(path, @@ -59,7 +59,7 @@ delete reader; } - return 0; + return nullptr; } DataFileReader * @@ -76,7 +76,7 @@ (path, true, acquirer, CSVFormat(path), mainModelSampleRate, reporter); if (reader) return reader; - return 0; + return nullptr; } Model * @@ -89,7 +89,7 @@ acquirer, mainModelSampleRate, reporter); - if (!reader) return NULL; + if (!reader) return nullptr; try { Model *model = reader->load(); @@ -112,7 +112,7 @@ CSVFormat(), mainModelSampleRate, reporter); - if (!reader) return NULL; + if (!reader) return nullptr; try { Model *model = reader->load(); @@ -129,10 +129,10 @@ sv_samplerate_t mainModelSampleRate, ProgressReporter *reporter) { - DataFileReader *reader = createReader(path, true, 0, format, + DataFileReader *reader = createReader(path, true, nullptr, format, mainModelSampleRate, reporter); - if (!reader) return NULL; + if (!reader) return nullptr; try { Model *model = reader->load();
--- a/data/fileio/DecodingWavFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/DecodingWavFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -35,9 +35,9 @@ m_cancelled(false), m_processed(0), m_completion(0), - m_original(0), + m_original(nullptr), m_reporter(reporter), - m_decodeThread(0) + m_decodeThread(nullptr) { SVDEBUG << "DecodingWavFileReader: local path: \"" << m_path << "\", decode mode: " << decodeMode << " (" @@ -90,7 +90,7 @@ if (m_reporter) m_reporter->setProgress(100); delete m_original; - m_original = 0; + m_original = nullptr; } else { @@ -147,7 +147,7 @@ m_reader->endSerialised(); delete m_reader->m_original; - m_reader->m_original = 0; + m_reader->m_original = nullptr; } void
--- a/data/fileio/FileSource.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/FileSource.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -91,8 +91,8 @@ QString preferredContentType) : m_rawFileOrUrl(fileOrUrl), m_url(fileOrUrl, QUrl::StrictMode), - m_localFile(0), - m_reply(0), + m_localFile(nullptr), + m_reply(nullptr), m_preferredContentType(preferredContentType), m_ok(false), m_cancelled(false), @@ -182,8 +182,8 @@ FileSource::FileSource(QUrl url, ProgressReporter *reporter) : m_url(url), - m_localFile(0), - m_reply(0), + m_localFile(nullptr), + m_reply(nullptr), m_ok(false), m_cancelled(false), m_lastStatus(0), @@ -215,8 +215,8 @@ FileSource::FileSource(const FileSource &rf) : QObject(), m_url(rf.m_url), - m_localFile(0), - m_reply(0), + m_localFile(nullptr), + m_reply(nullptr), m_ok(rf.m_ok), m_cancelled(rf.m_cancelled), m_lastStatus(rf.m_lastStatus), @@ -385,7 +385,7 @@ qint64 written = m_localFile->write(ba); m_localFile->close(); delete m_localFile; - m_localFile = 0; + m_localFile = nullptr; if (written != ba.size()) { #ifdef DEBUG_FILE_SOURCE @@ -502,13 +502,13 @@ { if (m_done) { delete m_localFile; // does not actually delete the file - m_localFile = 0; + m_localFile = nullptr; } m_done = true; if (m_reply) { QNetworkReply *r = m_reply; - disconnect(r, 0, this, 0); - m_reply = 0; + disconnect(r, nullptr, this, nullptr); + m_reply = nullptr; // Can only call abort() when there are no errors. if (r->error() == QNetworkReply::NoError) { r->abort(); @@ -517,7 +517,7 @@ } if (m_localFile) { delete m_localFile; // does not actually delete the file - m_localFile = 0; + m_localFile = nullptr; } } @@ -693,7 +693,7 @@ incCount(newUrl.toString()); #endif m_url = newUrl; - m_localFile = 0; + m_localFile = nullptr; m_lastStatus = 0; m_done = false; m_refCounted = false;
--- a/data/fileio/MIDIFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/MIDIFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -69,7 +69,7 @@ m_trackByteCount(0), m_decrementCount(false), m_path(path), - m_midiFile(0), + m_midiFile(nullptr), m_fileSize(0), m_mainModelSampleRate(mainModelSampleRate), m_acquirer(acquirer) @@ -291,7 +291,7 @@ m_error = "File not found or not readable."; m_format = MIDI_FILE_BAD_FORMAT; delete m_midiFile; - m_midiFile = 0; + m_midiFile = nullptr; return false; } @@ -801,14 +801,14 @@ Model * MIDIFileReader::load() const { - if (!isOK()) return 0; + if (!isOK()) return nullptr; if (m_loadableTracks.empty()) { if (m_acquirer) { m_acquirer->showError (tr("MIDI file \"%1\" has no notes in any track").arg(m_path)); } - return 0; + return nullptr; } std::set<unsigned int> tracksToLoad; @@ -859,7 +859,7 @@ pref = MIDIFileImportPreferenceAcquirer::MergeAllTracks; } - if (pref == MIDIFileImportPreferenceAcquirer::ImportNothing) return 0; + if (pref == MIDIFileImportPreferenceAcquirer::ImportNothing) return nullptr; if (pref == MIDIFileImportPreferenceAcquirer::MergeAllTracks || pref == MIDIFileImportPreferenceAcquirer::MergeAllNonPercussionTracks) { @@ -891,10 +891,10 @@ } } - if (tracksToLoad.empty()) return 0; + if (tracksToLoad.empty()) return nullptr; int n = int(tracksToLoad.size()), count = 0; - Model *model = 0; + Model *model = nullptr; for (std::set<unsigned int>::iterator i = tracksToLoad.begin(); i != tracksToLoad.end(); ++i) { @@ -921,10 +921,10 @@ int progressAmount) const { if (m_midiComposition.find(trackToLoad) == m_midiComposition.end()) { - return 0; + return nullptr; } - NoteModel *model = 0; + NoteModel *model = nullptr; if (existingModel) { model = dynamic_cast<NoteModel *>(existingModel);
--- a/data/fileio/MIDIFileWriter.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/MIDIFileWriter.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -46,7 +46,7 @@ m_exportable(exportable), m_sampleRate(sampleRate), m_tempo(tempo), - m_midiFile(0) + m_midiFile(nullptr) { if (!convert()) { m_error = "Conversion from model to internal MIDI format failed"; @@ -288,7 +288,7 @@ if (!(*m_midiFile)) { m_error = "Can't open file for writing."; delete m_midiFile; - m_midiFile = 0; + m_midiFile = nullptr; return false; } @@ -304,7 +304,7 @@ m_midiFile->close(); delete m_midiFile; - m_midiFile = 0; + m_midiFile = nullptr; if (!retOK) { m_error = "MIDI file write failed";
--- a/data/fileio/MP3FileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/MP3FileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -58,7 +58,7 @@ m_path(source.getLocalFilename()), m_gaplessMode(gaplessMode), m_decodeErrorShown(false), - m_decodeThread(0) + m_decodeThread(nullptr) { SVDEBUG << "MP3FileReader: local path: \"" << m_path << "\", decode mode: " << decodeMode << " (" @@ -82,10 +82,10 @@ m_fileSize = 0; - m_fileBuffer = 0; + m_fileBuffer = nullptr; m_fileBufferSize = 0; - m_sampleBuffer = 0; + m_sampleBuffer = nullptr; m_sampleBufferSize = 0; QFile qfile(m_path); @@ -142,11 +142,11 @@ delete[] m_sampleBuffer[c]; } delete[] m_sampleBuffer; - m_sampleBuffer = 0; + m_sampleBuffer = nullptr; } delete[] m_fileBuffer; - m_fileBuffer = 0; + m_fileBuffer = nullptr; if (isDecodeCacheInitialised()) finishDecodeCache(); endSerialised(); @@ -292,14 +292,14 @@ } delete[] m_reader->m_fileBuffer; - m_reader->m_fileBuffer = 0; + m_reader->m_fileBuffer = nullptr; if (m_reader->m_sampleBuffer) { for (int c = 0; c < m_reader->m_channelCount; ++c) { delete[] m_reader->m_sampleBuffer[c]; } delete[] m_reader->m_sampleBuffer; - m_reader->m_sampleBuffer = 0; + m_reader->m_sampleBuffer = nullptr; } if (m_reader->isDecodeCacheInitialised()) m_reader->finishDecodeCache(); @@ -324,11 +324,11 @@ mad_decoder_init(&decoder, // decoder to initialise &data, // our own data block for callbacks input_callback, // provides (entire) input to mad - 0, // checks header + nullptr, // checks header filter_callback, // filters frame before decoding output_callback, // receives decoded output error_callback, // handles decode errors - 0); // "message_func" + nullptr); // "message_func" mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC); mad_decoder_finish(&decoder); @@ -540,7 +540,7 @@ if (!m_sampleBuffer) { m_sampleBuffer = new float *[channels]; for (int c = 0; c < channels; ++c) { - m_sampleBuffer[c] = 0; + m_sampleBuffer[c] = nullptr; } } for (int c = 0; c < channels; ++c) {
--- a/data/fileio/OggVorbisFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/OggVorbisFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -40,17 +40,17 @@ CodedAudioFileReader(mode, targetRate, normalised), m_source(source), m_path(source.getLocalFilename()), - m_qfile(0), - m_ffile(0), - m_oggz(0), - m_fishSound(0), + m_qfile(nullptr), + m_ffile(nullptr), + m_oggz(nullptr), + m_fishSound(nullptr), m_reporter(reporter), m_fileSize(0), m_bytesRead(0), m_commentsRead(false), m_cancelled(false), m_completion(0), - m_decodeThread(0) + m_decodeThread(nullptr) { SVDEBUG << "OggVorbisFileReader: local path: \"" << m_path << "\", decode mode: " << decodeMode << " (" @@ -72,7 +72,7 @@ m_error = QString("Failed to open file %1 for reading.").arg(m_path); SVDEBUG << "OggVorbisFileReader: " << m_error << endl; delete m_qfile; - m_qfile = 0; + m_qfile = nullptr; return; } @@ -83,16 +83,16 @@ m_error = QString("Failed to open file pointer for file %1").arg(m_path); SVDEBUG << "OggVorbisFileReader: " << m_error << endl; delete m_qfile; - m_qfile = 0; + m_qfile = nullptr; return; } if (!(m_oggz = oggz_open_stdio(m_ffile, OGGZ_READ))) { m_error = QString("File %1 is not an OGG file.").arg(m_path); fclose(m_ffile); - m_ffile = 0; + m_ffile = nullptr; delete m_qfile; - m_qfile = 0; + m_qfile = nullptr; return; } @@ -113,9 +113,9 @@ while (oggz_read(m_oggz, 1024) > 0); fish_sound_delete(m_fishSound); - m_fishSound = 0; + m_fishSound = nullptr; oggz_close(m_oggz); - m_oggz = 0; + m_oggz = nullptr; if (isDecodeCacheInitialised()) finishDecodeCache(); endSerialised(); @@ -145,7 +145,7 @@ if (m_qfile) { // don't fclose m_ffile; oggz_close did that delete m_qfile; - m_qfile = 0; + m_qfile = nullptr; } } @@ -166,15 +166,15 @@ while (oggz_read(m_reader->m_oggz, 1024) > 0); fish_sound_delete(m_reader->m_fishSound); - m_reader->m_fishSound = 0; + m_reader->m_fishSound = nullptr; oggz_close(m_reader->m_oggz); - m_reader->m_oggz = 0; + m_reader->m_oggz = nullptr; // don't fclose m_ffile; oggz_close did that delete m_reader->m_qfile; - m_reader->m_qfile = 0; + m_reader->m_qfile = nullptr; if (m_reader->isDecodeCacheInitialised()) m_reader->finishDecodeCache(); m_reader->m_completion = 100;
--- a/data/fileio/PlaylistFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/PlaylistFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -25,7 +25,7 @@ PlaylistFileReader::PlaylistFileReader(QString path) : m_source(path), - m_file(0) + m_file(nullptr) { if (!m_source.isAvailable()) { m_error = QFile::tr("File or URL \"%1\" could not be retrieved") @@ -37,7 +37,7 @@ PlaylistFileReader::PlaylistFileReader(FileSource source) : m_source(source), - m_file(0) + m_file(nullptr) { if (!m_source.isAvailable()) { m_error = QFile::tr("File or URL \"%1\" could not be retrieved") @@ -83,14 +83,14 @@ if (!good) { delete m_file; - m_file = 0; + m_file = nullptr; } } bool PlaylistFileReader::isOK() const { - return (m_file != 0); + return (m_file != nullptr); } QString
--- a/data/fileio/WavFileReader.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/WavFileReader.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -28,7 +28,7 @@ WavFileReader::WavFileReader(FileSource source, bool fileUpdating, Normalisation normalisation) : - m_file(0), + m_file(nullptr), m_source(source), m_path(source.getLocalFilename()), m_seekable(false), @@ -270,7 +270,7 @@ { int count; - if (sf_command(0, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof(count))) { + if (sf_command(nullptr, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof(count))) { extensions.insert("wav"); extensions.insert("aiff"); extensions.insert("aifc"); @@ -281,7 +281,7 @@ SF_FORMAT_INFO info; for (int i = 0; i < count; ++i) { info.format = i; - if (!sf_command(0, SFC_GET_FORMAT_MAJOR, &info, sizeof(info))) { + if (!sf_command(nullptr, SFC_GET_FORMAT_MAJOR, &info, sizeof(info))) { QString ext = QString(info.extension).toLower(); extensions.insert(ext); if (ext == "oga") {
--- a/data/fileio/WavFileWriter.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/fileio/WavFileWriter.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -39,8 +39,8 @@ m_path(path), m_sampleRate(sampleRate), m_channels(channels), - m_temp(0), - m_file(0) + m_temp(nullptr), + m_file(nullptr) { SF_INFO fileInfo; @@ -73,13 +73,13 @@ .arg(writePath); if (m_temp) { delete m_temp; - m_temp = 0; + m_temp = nullptr; } } } catch (FileOperationFailed &f) { m_error = f.what(); - m_temp = 0; - m_file = 0; + m_temp = nullptr; + m_file = nullptr; } } @@ -218,12 +218,12 @@ { if (m_file) { sf_close(m_file); - m_file = 0; + m_file = nullptr; } if (m_temp) { m_temp->moveToTarget(); delete m_temp; - m_temp = 0; + m_temp = nullptr; } return true; }
--- a/data/midi/MIDIInput.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/midi/MIDIInput.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -20,7 +20,7 @@ #include "system/System.h" MIDIInput::MIDIInput(QString name, FrameTimer *timer) : - m_rtmidi(0), + m_rtmidi(nullptr), m_frameTimer(timer), m_buffer(1023) { @@ -47,7 +47,7 @@ SVDEBUG << "NOTE: MIDIInput: No input ports available" << endl; delete m_rtmidi; - m_rtmidi = 0; + m_rtmidi = nullptr; } else { @@ -67,7 +67,7 @@ } catch (const RtMidiError &e) { SVCERR << "ERROR: RtMidi error: " << e.getMessage() << endl; delete m_rtmidi; - m_rtmidi = 0; + m_rtmidi = nullptr; } }
--- a/data/model/AlignmentModel.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/AlignmentModel.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -27,8 +27,8 @@ m_aligned(aligned), m_inputModel(inputModel), m_rawPath(path), - m_path(0), - m_reversePath(0), + m_path(nullptr), + m_reversePath(nullptr), m_pathBegun(false), m_pathComplete(false) { @@ -129,7 +129,7 @@ const ZoomConstraint * AlignmentModel::getZoomConstraint() const { - return 0; + return nullptr; } const Model * @@ -177,7 +177,7 @@ cerr << "AlignmentModel: deleting raw path model" << endl; if (m_rawPath) m_rawPath->aboutToDelete(); delete m_rawPath; - m_rawPath = 0; + m_rawPath = nullptr; } } @@ -214,7 +214,7 @@ if (m_inputModel) m_inputModel->aboutToDelete(); delete m_inputModel; - m_inputModel = 0; + m_inputModel = nullptr; } }
--- a/data/model/Dense3DModelPeakCache.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/Dense3DModelPeakCache.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -74,7 +74,7 @@ void Dense3DModelPeakCache::sourceModelAboutToBeDeleted() { - m_source = 0; + m_source = nullptr; } bool
--- a/data/model/FFTModel.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/FFTModel.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -75,7 +75,7 @@ { if (m_model) { SVDEBUG << "FFTModel[" << this << "]::sourceModelAboutToBeDeleted(" << m_model << ")" << endl; - m_model = 0; + m_model = nullptr; } }
--- a/data/model/Model.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/Model.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -94,7 +94,7 @@ void Model::sourceModelAboutToBeDeleted() { - m_sourceModel = 0; + m_sourceModel = nullptr; } void @@ -124,7 +124,7 @@ { if (!m_alignment) { if (m_sourceModel) return m_sourceModel->getAlignmentReference(); - return 0; + return nullptr; } return m_alignment->getReferenceModel(); }
--- a/data/model/ModelDataTableModel.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/ModelDataTableModel.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -122,7 +122,7 @@ QModelIndex ModelDataTableModel::index(int row, int column, const QModelIndex &) const { - return createIndex(row, column, (void *)0); + return createIndex(row, column, (void *)nullptr); } QModelIndex @@ -153,7 +153,7 @@ { if (!m_model) return createIndex(0, 0); int row = m_model->getRowForFrame(frame); - return createIndex(getSorted(row), 0, (void *)0); + return createIndex(getSorted(row), 0, (void *)nullptr); } sv_frame_t @@ -200,7 +200,7 @@ int current = getCurrentRow(); if (current != prevCurrent) { // cerr << "Current row changed from " << prevCurrent << " to " << current << " for underlying row " << m_currentRow << endl; - emit currentChanged(createIndex(current, 0, (void *)0)); + emit currentChanged(createIndex(current, 0, (void *)nullptr)); } emit layoutChanged(); } @@ -232,10 +232,10 @@ int row0 = ix0.row(); int row1 = ix1.row(); if (row0 > 0) { - ix0 = createIndex(row0 - 1, ix0.column(), (void *)0); + ix0 = createIndex(row0 - 1, ix0.column(), (void *)nullptr); } if (row1 + 1 < rowCount()) { - ix1 = createIndex(row1 + 1, ix1.column(), (void *)0); + ix1 = createIndex(row1 + 1, ix1.column(), (void *)nullptr); } SVDEBUG << "emitting dataChanged from row " << ix0.row() << " to " << ix1.row() << endl; emit dataChanged(ix0, ix1); @@ -246,7 +246,7 @@ void ModelDataTableModel::modelAboutToBeDeleted() { - m_model = 0; + m_model = nullptr; emit modelRemoved(); }
--- a/data/model/ReadOnlyWaveFileModel.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/ReadOnlyWaveFileModel.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -42,11 +42,11 @@ ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, sv_samplerate_t targetRate) : m_source(source), m_path(source.getLocation()), - m_reader(0), + m_reader(nullptr), m_myReader(true), m_startFrame(0), - m_fillThread(0), - m_updateTimer(0), + m_fillThread(nullptr), + m_updateTimer(nullptr), m_lastFillExtent(0), m_prevCompletion(0), m_exiting(false), @@ -90,11 +90,11 @@ ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, AudioFileReader *reader) : m_source(source), m_path(source.getLocation()), - m_reader(0), + m_reader(nullptr), m_myReader(false), m_startFrame(0), - m_fillThread(0), - m_updateTimer(0), + m_fillThread(nullptr), + m_updateTimer(nullptr), m_lastFillExtent(0), m_prevCompletion(0), m_exiting(false) @@ -113,7 +113,7 @@ m_exiting = true; if (m_fillThread) m_fillThread->wait(); if (m_myReader) delete m_reader; - m_reader = 0; + m_reader = nullptr; SVDEBUG << "ReadOnlyWaveFileModel: Destructor exiting; we had caches of " << (m_cache[0].size() * sizeof(Range)) << " and " @@ -597,9 +597,9 @@ { m_mutex.lock(); delete m_fillThread; - m_fillThread = 0; + m_fillThread = nullptr; delete m_updateTimer; - m_updateTimer = 0; + m_updateTimer = nullptr; auto prevFillExtent = m_lastFillExtent; m_lastFillExtent = getEndFrame(); m_mutex.unlock();
--- a/data/model/WritableWaveFileModel.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/model/WritableWaveFileModel.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -40,10 +40,10 @@ sv_samplerate_t sampleRate, int channels, Normalisation norm) : - m_model(0), - m_temporaryWriter(0), - m_targetWriter(0), - m_reader(0), + m_model(nullptr), + m_temporaryWriter(nullptr), + m_targetWriter(nullptr), + m_reader(nullptr), m_normalisation(norm), m_sampleRate(sampleRate), m_channels(channels), @@ -57,10 +57,10 @@ WritableWaveFileModel::WritableWaveFileModel(sv_samplerate_t sampleRate, int channels, Normalisation norm) : - m_model(0), - m_temporaryWriter(0), - m_targetWriter(0), - m_reader(0), + m_model(nullptr), + m_temporaryWriter(nullptr), + m_targetWriter(nullptr), + m_reader(nullptr), m_normalisation(norm), m_sampleRate(sampleRate), m_channels(channels), @@ -73,10 +73,10 @@ WritableWaveFileModel::WritableWaveFileModel(sv_samplerate_t sampleRate, int channels) : - m_model(0), - m_temporaryWriter(0), - m_targetWriter(0), - m_reader(0), + m_model(nullptr), + m_temporaryWriter(nullptr), + m_targetWriter(nullptr), + m_reader(nullptr), m_normalisation(Normalisation::None), m_sampleRate(sampleRate), m_channels(channels), @@ -150,7 +150,7 @@ if (!m_model->isOK()) { SVCERR << "WritableWaveFileModel: Error in creating wave file model" << endl; delete m_model; - m_model = 0; + m_model = nullptr; return; } m_model->setStartFrame(m_startFrame); @@ -291,7 +291,7 @@ m_targetWriter->close(); delete m_temporaryWriter; - m_temporaryWriter = 0; + m_temporaryWriter = nullptr; QFile::remove(m_temporaryPath); }
--- a/data/osc/OSCQueue.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/data/osc/OSCQueue.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -91,16 +91,16 @@ OSCQueue::OSCQueue() : #ifdef HAVE_LIBLO - m_thread(0), + m_thread(nullptr), #endif m_buffer(OSC_MESSAGE_QUEUE_SIZE) { Profiler profiler("OSCQueue::OSCQueue"); #ifdef HAVE_LIBLO - m_thread = lo_server_thread_new(NULL, oscError); + m_thread = lo_server_thread_new(nullptr, oscError); - lo_server_thread_add_method(m_thread, NULL, NULL, + lo_server_thread_add_method(m_thread, nullptr, nullptr, oscMessageHandler, this); lo_server_thread_start(m_thread); @@ -127,7 +127,7 @@ OSCQueue::isOK() const { #ifdef HAVE_LIBLO - return (m_thread != 0); + return (m_thread != nullptr); #else return false; #endif
--- a/plugin/DSSIPluginFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/DSSIPluginFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -45,7 +45,7 @@ LADSPAPluginFactory() { m_hostDescriptor.DSSI_API_Version = 2; - m_hostDescriptor.request_transport_information = NULL; + m_hostDescriptor.request_transport_information = nullptr; m_hostDescriptor.request_midi_send = DSSIPluginInstance::requestMidiSend; m_hostDescriptor.request_non_rt_thread = DSSIPluginInstance::requestNonRTThread; m_hostDescriptor.midi_send = DSSIPluginInstance::midiSend; @@ -134,7 +134,7 @@ return instance; } - return 0; + return nullptr; } const DSSI_Descriptor * @@ -151,7 +151,7 @@ } return descriptor; } else { - return 0; + return nullptr; } } @@ -161,7 +161,7 @@ loadLibrary(soname); if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: loadLibrary failed for " << soname << endl; - return 0; + return nullptr; } firstInLibrary = true; } @@ -173,10 +173,10 @@ if (!fn) { cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No descriptor function in library " << soname << endl; - return 0; + return nullptr; } - const DSSI_Descriptor *descriptor = 0; + const DSSI_Descriptor *descriptor = nullptr; int index = 0; while ((descriptor = fn(index))) { @@ -191,7 +191,7 @@ cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No such plugin as " << label << " in library " << soname << endl; - return 0; + return nullptr; } const LADSPA_Descriptor * @@ -199,7 +199,7 @@ { const DSSI_Descriptor *dssiDescriptor = getDSSIDescriptor(identifier); if (dssiDescriptor) return dssiDescriptor->LADSPA_Plugin; - else return 0; + else return nullptr; } @@ -308,7 +308,7 @@ return; } - const DSSI_Descriptor *descriptor = 0; + const DSSI_Descriptor *descriptor = nullptr; int index = 0; while ((descriptor = fn(index))) { @@ -337,8 +337,8 @@ ("dssi", soname, ladspaDescriptor->Label); #ifdef HAVE_LRDF - char *def_uri = 0; - lrdf_defaults *defs = 0; + char *def_uri = nullptr; + lrdf_defaults *defs = nullptr; QString category = m_taxonomy[identifier];
--- a/plugin/DSSIPluginInstance.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/DSSIPluginInstance.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -47,7 +47,7 @@ #endif DSSIPluginInstance::GroupMap DSSIPluginInstance::m_groupMap; -snd_seq_event_t **DSSIPluginInstance::m_groupLocalEventBuffers = 0; +snd_seq_event_t **DSSIPluginInstance::m_groupLocalEventBuffers = nullptr; size_t DSSIPluginInstance::m_groupLocalEventBufferCount = 0; Scavenger<ScavengerArrayWrapper<snd_seq_event_t *> > DSSIPluginInstance::m_bufferScavenger(2, 10); std::map<LADSPA_Handle, std::set<DSSIPluginInstance::NonRTPluginThread *> > DSSIPluginInstance::m_threads; @@ -64,14 +64,14 @@ RealTimePluginInstance(factory, identifier), m_client(clientId), m_position(position), - m_instanceHandle(0), + m_instanceHandle(nullptr), m_descriptor(descriptor), m_programCacheValid(false), m_eventBuffer(EVENT_BUFFER_SIZE), m_blockSize(blockSize), m_idealChannelCount(idealChannelCount), m_sampleRate(sampleRate), - m_latencyPort(0), + m_latencyPort(nullptr), m_run(false), m_bypassed(false), m_grouped(false), @@ -300,7 +300,7 @@ void DSSIPluginInstance::silence() { - if (m_instanceHandle != 0) { + if (m_instanceHandle != nullptr) { deactivate(); activate(); } @@ -325,7 +325,7 @@ return; } - if (m_instanceHandle != 0) { + if (m_instanceHandle != nullptr) { deactivate(); } @@ -350,7 +350,7 @@ connectPorts(); } - if (m_instanceHandle != 0) { + if (m_instanceHandle != nullptr) { activate(); } } @@ -423,7 +423,7 @@ detachFromGroup(); - if (m_instanceHandle != 0) { + if (m_instanceHandle != nullptr) { deactivate(); } @@ -1340,7 +1340,7 @@ } m_descriptor->LADSPA_Plugin->cleanup(m_instanceHandle); - m_instanceHandle = 0; + m_instanceHandle = nullptr; #ifdef DEBUG_DSSI SVDEBUG << "DSSIPluginInstance::cleanup " << m_identifier << " done" << endl; #endif
--- a/plugin/FeatureExtractionPluginFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/FeatureExtractionPluginFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -26,7 +26,7 @@ FeatureExtractionPluginFactory::instance() { static QMutex mutex; - static FeatureExtractionPluginFactory *instance = 0; + static FeatureExtractionPluginFactory *instance = nullptr; QMutexLocker locker(&mutex);
--- a/plugin/LADSPAPluginFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/LADSPAPluginFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -53,7 +53,7 @@ { for (std::set<RealTimePluginInstance *>::iterator i = m_instances.begin(); i != m_instances.end(); ++i) { - (*i)->setFactory(0); + (*i)->setFactory(nullptr); delete *i; } m_instances.clear(); @@ -148,7 +148,7 @@ return i->second; } - return 0; + return nullptr; } float @@ -363,7 +363,7 @@ return instance; } - return 0; + return nullptr; } void @@ -423,7 +423,7 @@ loadLibrary(soname); if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; - return 0; + return nullptr; } } @@ -434,10 +434,10 @@ if (!fn) { SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; - return 0; + return nullptr; } - const LADSPA_Descriptor *descriptor = 0; + const LADSPA_Descriptor *descriptor = nullptr; int index = 0; while ((descriptor = fn(index))) { @@ -447,7 +447,7 @@ SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << endl; - return 0; + return nullptr; } void @@ -702,7 +702,7 @@ return; } - const LADSPA_Descriptor *descriptor = 0; + const LADSPA_Descriptor *descriptor = nullptr; int index = 0; while ((descriptor = fn(index))) { @@ -723,8 +723,8 @@ ("ladspa", soname, descriptor->Label); #ifdef HAVE_LRDF - char *def_uri = 0; - lrdf_defaults *defs = 0; + char *def_uri = nullptr; + lrdf_defaults *defs = nullptr; if (m_lrdfTaxonomy[descriptor->UniqueID] != "") { m_taxonomy[identifier] = m_lrdfTaxonomy[descriptor->UniqueID]; @@ -868,7 +868,7 @@ #ifdef HAVE_LRDF lrdf_uris *uris = lrdf_get_instances(uri.toStdString().c_str()); - if (uris != NULL) { + if (uris != nullptr) { for (unsigned int i = 0; i < uris->count; ++i) { m_lrdfTaxonomy[lrdf_get_uid(uris->items[i])] = base; } @@ -877,7 +877,7 @@ uris = lrdf_get_subclasses(uri.toStdString().c_str()); - if (uris != NULL) { + if (uris != nullptr) { for (unsigned int i = 0; i < uris->count; ++i) { char *label = lrdf_get_label(uris->items[i]); generateTaxonomy(uris->items[i],
--- a/plugin/LADSPAPluginInstance.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/LADSPAPluginInstance.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -48,20 +48,20 @@ m_descriptor(descriptor), m_blockSize(blockSize), m_sampleRate(sampleRate), - m_latencyPort(0), + m_latencyPort(nullptr), m_run(false), m_bypassed(false) { init(idealChannelCount); if (m_audioPortsIn.size() == 0) { - m_inputBuffers = 0; + m_inputBuffers = nullptr; } else { m_inputBuffers = new sample_t*[m_instanceCount * m_audioPortsIn.size()]; } if (m_audioPortsOut.size() == 0) { - m_outputBuffers = 0; + m_outputBuffers = nullptr; } else { m_outputBuffers = new sample_t*[m_instanceCount * m_audioPortsOut.size()]; }
--- a/plugin/NativeVampPluginFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/NativeVampPluginFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -54,7 +54,7 @@ // see notes in vamp-sdk/hostext/PluginLoader.cpp from which this is drawn Vamp::Plugin *p = m_plugin; delete m_plugin; - m_plugin = 0; + m_plugin = nullptr; // 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); @@ -147,7 +147,7 @@ cerr << "NativeVampPluginFactory::getPluginIdentifiers: Vamp descriptor found" << endl; #endif - const VampPluginDescriptor *descriptor = 0; + const VampPluginDescriptor *descriptor = nullptr; int index = 0; map<string, int> known; @@ -293,10 +293,10 @@ { Profiler profiler("NativeVampPluginFactory::instantiatePlugin"); - Vamp::Plugin *rv = 0; - Vamp::PluginHostAdapter *plugin = 0; + Vamp::Plugin *rv = nullptr; + Vamp::PluginHostAdapter *plugin = nullptr; - const VampPluginDescriptor *descriptor = 0; + const VampPluginDescriptor *descriptor = nullptr; int index = 0; QString type, soname, label; @@ -305,14 +305,14 @@ #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE cerr << "NativeVampPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type << endl; #endif - return 0; + return nullptr; } QString found = findPluginFile(soname); if (found == "") { SVDEBUG << "NativeVampPluginFactory::instantiatePlugin: Failed to find library file " << soname << endl; - return 0; + return nullptr; } else if (found != soname) { #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE @@ -328,7 +328,7 @@ if (!libraryHandle) { SVDEBUG << "NativeVampPluginFactory::instantiatePlugin: Failed to load library " << soname << ": " << DLERROR() << endl; - return 0; + return nullptr; } VampGetPluginDescriptorFunction fn = (VampGetPluginDescriptorFunction)
--- a/plugin/PiperVampPluginFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/PiperVampPluginFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -174,12 +174,12 @@ if (m_origins.find(identifier) == m_origins.end()) { SVCERR << "ERROR: No known server for identifier " << identifier << endl; - return 0; + return nullptr; } auto psd = getPluginStaticData(identifier); if (psd.pluginKey == "") { - return 0; + return nullptr; } SVDEBUG << "PiperVampPluginFactory: Creating PiperAutoPlugin for server " @@ -194,7 +194,7 @@ if (!ap->isOK()) { delete ap; - return 0; + return nullptr; } return ap;
--- a/plugin/PluginScan.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/PluginScan.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -39,7 +39,7 @@ PluginScan *PluginScan::getInstance() { static QMutex mutex; - static PluginScan *m_instance = 0; + static PluginScan *m_instance = nullptr; mutex.lock(); if (!m_instance) m_instance = new PluginScan(); mutex.unlock();
--- a/plugin/RealTimePluginFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/RealTimePluginFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -32,8 +32,8 @@ sv_samplerate_t RealTimePluginFactory::m_sampleRate = 48000; -static LADSPAPluginFactory *_ladspaInstance = 0; -static LADSPAPluginFactory *_dssiInstance = 0; +static LADSPAPluginFactory *_ladspaInstance = nullptr; +static LADSPAPluginFactory *_dssiInstance = nullptr; RealTimePluginFactory::~RealTimePluginFactory() { @@ -58,7 +58,7 @@ return _dssiInstance; } - else return 0; + else return nullptr; } RealTimePluginFactory *
--- a/plugin/plugins/SamplePlayer.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/plugin/plugins/SamplePlayer.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -93,13 +93,13 @@ ports, portNames, hints, - 0, // Implementation data + nullptr, // Implementation data instantiate, connectPort, activate, run, - 0, // Run adding - 0, // Set run adding gain + nullptr, // Run adding + nullptr, // Set run adding gain deactivate, cleanup }; @@ -114,31 +114,31 @@ selectProgram, getMidiController, runSynth, - 0, // Run synth adding - 0, // Run multiple synths - 0, // Run multiple synths adding + nullptr, // Run synth adding + nullptr, // Run multiple synths + nullptr, // Run multiple synths adding receiveHostDescriptor }; const DSSI_Host_Descriptor * -SamplePlayer::hostDescriptor = 0; +SamplePlayer::hostDescriptor = nullptr; const DSSI_Descriptor * SamplePlayer::getDescriptor(unsigned long index) { if (index == 0) return &dssiDescriptor; - return 0; + return nullptr; } SamplePlayer::SamplePlayer(int sampleRate) : - m_output(0), - m_retune(0), - m_basePitch(0), - m_concertA(0), - m_sustain(0), - m_release(0), - m_sampleData(0), + m_output(nullptr), + m_retune(nullptr), + m_basePitch(nullptr), + m_concertA(nullptr), + m_sustain(nullptr), + m_release(nullptr), + m_sampleData(nullptr), m_sampleCount(0), m_sampleRate(sampleRate), m_sampleNo(0), @@ -158,7 +158,7 @@ { if (!hostDescriptor || !hostDescriptor->request_non_rt_thread) { SVDEBUG << "SamplePlayer::instantiate: Host does not provide request_non_rt_thread, not instantiating" << endl; - return 0; + return nullptr; } SamplePlayer *player = new SamplePlayer(int(rate)); @@ -167,7 +167,7 @@ if (hostDescriptor->request_non_rt_thread(player, workThreadCallback)) { SVDEBUG << "SamplePlayer::instantiate: Host rejected request_non_rt_thread call, not instantiating" << endl; delete player; - return 0; + return nullptr; } return player; @@ -209,7 +209,7 @@ void SamplePlayer::run(LADSPA_Handle handle, unsigned long samples) { - runSynth(handle, samples, 0, 0); + runSynth(handle, samples, nullptr, 0); } void @@ -243,7 +243,7 @@ player->searchSamples(); } - return 0; + return nullptr; } else { char *buffer = (char *)malloc(strlen(value) + 80); @@ -266,7 +266,7 @@ player->searchSamples(); } } - if (program >= player->m_samples.size()) return 0; + if (program >= player->m_samples.size()) return nullptr; static DSSI_Program_Descriptor descriptor; static char name[60]; @@ -419,7 +419,7 @@ sf_readf_float(file, tmpFrames, info.frames); sf_close(file); - tmpResamples = 0; + tmpResamples = nullptr; if (info.samplerate != m_sampleRate) {
--- a/rdf/PluginRDFIndexer.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/rdf/PluginRDFIndexer.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -51,7 +51,7 @@ using Dataquay::RDFDuplicateImportException; PluginRDFIndexer * -PluginRDFIndexer::m_instance = 0; +PluginRDFIndexer::m_instance = nullptr; PluginRDFIndexer * PluginRDFIndexer::getInstance() @@ -271,7 +271,7 @@ if (FileSource::isRemote(urlString) && FileSource::canHandleScheme(urlString)) { - CachedFile cf(urlString, 0, "application/rdf+xml"); + CachedFile cf(urlString, nullptr, "application/rdf+xml"); if (!cf.isOK()) { return false; }
--- a/rdf/RDFImporter.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/rdf/RDFImporter.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -617,7 +617,7 @@ if (values.size() == 1) dimensions = 2; else if (values.size() > 1) dimensions = 3; - Model *model = 0; + Model *model = nullptr; if (modelMap[timeline][type][dimensions].find(haveDuration) == modelMap[timeline][type][dimensions].end()) { @@ -809,7 +809,7 @@ bool haveAnnotations = false; bool haveRDF = false; - BasicStore *store = 0; + BasicStore *store = nullptr; // This is not expected to return anything useful, but if it does // anything at all then we know we have RDF
--- a/system/System.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/system/System.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -301,12 +301,12 @@ #endif /* !_WIN32 */ -static char *startupLocale = 0; +static char *startupLocale = nullptr; void StoreStartupLocale() { - char *loc = setlocale(LC_ALL, 0); + char *loc = setlocale(LC_ALL, nullptr); if (!loc) return; if (startupLocale) free(startupLocale); startupLocale = strdup(loc);
--- a/transform/CSVFeatureWriter.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/transform/CSVFeatureWriter.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -174,7 +174,7 @@ writeFeature(tt, stream, features[i], - m_forceEnd ? &features[i+1] : 0, + m_forceEnd ? &features[i+1] : nullptr, summaryType); } }
--- a/transform/FeatureExtractionModelTransformer.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/transform/FeatureExtractionModelTransformer.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -45,7 +45,7 @@ FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in, const Transform &transform) : ModelTransformer(in, transform), - m_plugin(0), + m_plugin(nullptr), m_haveOutputs(false) { SVDEBUG << "FeatureExtractionModelTransformer::FeatureExtractionModelTransformer: plugin " << m_transforms.begin()->getPluginIdentifier() << ", outputName " << m_transforms.begin()->getOutput() << endl; @@ -54,7 +54,7 @@ FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(Input in, const Transforms &transforms) : ModelTransformer(in, transforms), - m_plugin(0), + m_plugin(nullptr), m_haveOutputs(false) { if (m_transforms.empty()) { @@ -271,7 +271,7 @@ SVCERR << "FeatureExtractionModelTransformer: caught exception while deleting plugin: " << e.what() << endl; m_message = e.what(); } - m_plugin = 0; + m_plugin = nullptr; for (int j = 0; j < (int)m_descriptors.size(); ++j) { delete m_descriptors[j]; @@ -354,7 +354,7 @@ bool preDurationPlugin = (m_plugin->getVampApiVersion() < 2); - Model *out = 0; + Model *out = nullptr; if (binCount == 0 && (preDurationPlugin || !m_descriptors[n]->hasDuration)) { @@ -589,17 +589,17 @@ if (binNo == 0) { std::cerr << "Internal error: binNo == 0 in getAdditionalModel (should be using primary model)" << std::endl; - return 0; + return nullptr; } - if (!m_needAdditionalModels[n]) return 0; - if (!isOutput<SparseTimeValueModel>(n)) return 0; + if (!m_needAdditionalModels[n]) return nullptr; + if (!isOutput<SparseTimeValueModel>(n)) return nullptr; if (m_additionalModels[n][binNo]) return m_additionalModels[n][binNo]; std::cerr << "getAdditionalModel(" << n << ", " << binNo << "): creating" << std::endl; SparseTimeValueModel *baseModel = getConformingOutput<SparseTimeValueModel>(n); - if (!baseModel) return 0; + if (!baseModel) return nullptr; std::cerr << "getAdditionalModel(" << n << ", " << binNo << "): (from " << baseModel << ")" << std::endl; @@ -739,8 +739,8 @@ setCompletion(j, 0); } - float *reals = 0; - float *imaginaries = 0; + float *reals = nullptr; + float *imaginaries = nullptr; if (frequencyDomain) { reals = new float[blockSize/2 + 1]; imaginaries = new float[blockSize/2 + 1];
--- a/transform/FileFeatureWriter.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/transform/FileFeatureWriter.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -32,7 +32,7 @@ FileFeatureWriter::FileFeatureWriter(int support, QString extension) : - m_prevstream(0), + m_prevstream(nullptr), m_support(support), m_extension(extension), m_manyFiles(false), @@ -284,7 +284,7 @@ QString filename = createOutputFilename(trackId, transformId); if (filename == "") { // stdout or failure - return 0; + return nullptr; } SVDEBUG << "FileFeatureWriter: NOTE: Using output filename \"" @@ -303,7 +303,7 @@ SVCERR << "FileFeatureWriter: ERROR: Failed to open output file \"" << filename << "\" for writing" << endl; delete file; - m_files[key] = 0; + m_files[key] = nullptr; throw FailedToOpenFile(filename); } @@ -320,7 +320,7 @@ { QFile *file = getOutputFile(trackId, transformId); if (!file && !m_stdout) { - return 0; + return nullptr; } if (m_streams.find(file) == m_streams.end()) { @@ -372,6 +372,6 @@ } m_files.erase(m_files.begin()); } - m_prevstream = 0; + m_prevstream = nullptr; }
--- a/transform/ModelTransformerFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/transform/ModelTransformerFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -59,7 +59,7 @@ sv_frame_t duration, UserConfigurator *configurator) { - ModelTransformer::Input input(0); + ModelTransformer::Input input(nullptr); if (candidateInputModels.empty()) return input; @@ -91,7 +91,7 @@ SVDEBUG << "ModelTransformer: last configuration for identifier " << transform.getIdentifier() << ": " << configurationXml << endl; - Vamp::PluginBase *plugin = 0; + Vamp::PluginBase *plugin = nullptr; if (RealTimePluginFactory::instanceFor(id)) { @@ -171,7 +171,7 @@ ModelTransformerFactory::createTransformer(const Transforms &transforms, const ModelTransformer::Input &input) { - ModelTransformer *transformer = 0; + ModelTransformer *transformer = nullptr; QString id = transforms[0].getPluginIdentifier(); @@ -201,7 +201,7 @@ Transforms transforms; transforms.push_back(transform); vector<Model *> mm = transformMultiple(transforms, input, message, handler); - if (mm.empty()) return 0; + if (mm.empty()) return nullptr; else return mm[0]; }
--- a/transform/RealTimeEffectModelTransformer.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/transform/RealTimeEffectModelTransformer.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -32,7 +32,7 @@ RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(Input in, const Transform &t) : ModelTransformer(in, t), - m_plugin(0) + m_plugin(nullptr) { Transform transform(t); if (!transform.getBlockSize()) {
--- a/transform/TransformFactory.cpp Mon Nov 26 13:51:36 2018 +0000 +++ b/transform/TransformFactory.cpp Mon Nov 26 14:33:41 2018 +0000 @@ -55,13 +55,13 @@ { SVDEBUG << "TransformFactory::deleteInstance called" << endl; delete m_instance; - m_instance = 0; + m_instance = nullptr; } TransformFactory::TransformFactory() : m_transformsPopulated(false), m_uninstalledTransformsPopulated(false), - m_thread(0), + m_thread(nullptr), m_exiting(false), m_populatingSlowly(false) { @@ -790,7 +790,7 @@ if (rate == 0) rate = 44100.0; QString pluginId = t.getPluginIdentifier(); - Vamp::PluginBase *plugin = 0; + Vamp::PluginBase *plugin = nullptr; if (t.getType() == Transform::FeatureExtraction) {