comparison data/fileio/CSVFileReader.cpp @ 1582:70e172e6cc59 fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:33:41 +0000
parents 954d0cf29ca7
children 7a23dfe65d66
comparison
equal deleted inserted replaced
1581:ad5f892c0c4d 1582:70e172e6cc59
45 45
46 CSVFileReader::CSVFileReader(QString path, CSVFormat format, 46 CSVFileReader::CSVFileReader(QString path, CSVFormat format,
47 sv_samplerate_t mainModelSampleRate, 47 sv_samplerate_t mainModelSampleRate,
48 ProgressReporter *reporter) : 48 ProgressReporter *reporter) :
49 m_format(format), 49 m_format(format),
50 m_device(0), 50 m_device(nullptr),
51 m_ownDevice(true), 51 m_ownDevice(true),
52 m_warnings(0), 52 m_warnings(0),
53 m_mainModelSampleRate(mainModelSampleRate), 53 m_mainModelSampleRate(mainModelSampleRate),
54 m_fileSize(0), 54 m_fileSize(0),
55 m_readCount(0), 55 m_readCount(0),
105 } 105 }
106 106
107 bool 107 bool
108 CSVFileReader::isOK() const 108 CSVFileReader::isOK() const
109 { 109 {
110 return (m_device != 0); 110 return (m_device != nullptr);
111 } 111 }
112 112
113 QString 113 QString
114 CSVFileReader::getError() const 114 CSVFileReader::getError() const
115 { 115 {
170 } 170 }
171 171
172 Model * 172 Model *
173 CSVFileReader::load() const 173 CSVFileReader::load() const
174 { 174 {
175 if (!m_device) return 0; 175 if (!m_device) return nullptr;
176 176
177 CSVFormat::ModelType modelType = m_format.getModelType(); 177 CSVFormat::ModelType modelType = m_format.getModelType();
178 CSVFormat::TimingType timingType = m_format.getTimingType(); 178 CSVFormat::TimingType timingType = m_format.getTimingType();
179 CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits(); 179 CSVFormat::TimeUnits timeUnits = m_format.getTimeUnits();
180 sv_samplerate_t sampleRate = m_format.getSampleRate(); 180 sv_samplerate_t sampleRate = m_format.getSampleRate();
195 timeUnits == CSVFormat::TimeMilliseconds) { 195 timeUnits == CSVFormat::TimeMilliseconds) {
196 sampleRate = m_mainModelSampleRate; 196 sampleRate = m_mainModelSampleRate;
197 } 197 }
198 } 198 }
199 199
200 SparseOneDimensionalModel *model1 = 0; 200 SparseOneDimensionalModel *model1 = nullptr;
201 SparseTimeValueModel *model2 = 0; 201 SparseTimeValueModel *model2 = nullptr;
202 RegionModel *model2a = 0; 202 RegionModel *model2a = nullptr;
203 NoteModel *model2b = 0; 203 NoteModel *model2b = nullptr;
204 EditableDenseThreeDimensionalModel *model3 = 0; 204 EditableDenseThreeDimensionalModel *model3 = nullptr;
205 WritableWaveFileModel *modelW = 0; 205 WritableWaveFileModel *modelW = nullptr;
206 Model *model = 0; 206 Model *model = nullptr;
207 207
208 QTextStream in(m_device); 208 QTextStream in(m_device);
209 209
210 unsigned int warnings = 0, warnLimit = 10; 210 unsigned int warnings = 0, warnLimit = 10;
211 unsigned int lineno = 0; 211 unsigned int lineno = 0;
229 ++valueColumns; 229 ++valueColumns;
230 } 230 }
231 } 231 }
232 232
233 int audioChannels = 0; 233 int audioChannels = 0;
234 float **audioSamples = 0; 234 float **audioSamples = nullptr;
235 float sampleShift = 0.f; 235 float sampleShift = 0.f;
236 float sampleScale = 1.f; 236 float sampleScale = 1.f;
237 237
238 if (modelType == CSVFormat::WaveFileModel) { 238 if (modelType == CSVFormat::WaveFileModel) {
239 239
368 if (!model || !model->isOK()) { 368 if (!model || !model->isOK()) {
369 SVCERR << "Failed to create model to load CSV file into" 369 SVCERR << "Failed to create model to load CSV file into"
370 << endl; 370 << endl;
371 if (model) { 371 if (model) {
372 delete model; 372 delete model;
373 model = 0; 373 model = nullptr;
374 model1 = 0; model2 = 0; model2a = 0; model2b = 0; 374 model1 = nullptr; model2 = nullptr; model2a = nullptr; model2b = nullptr;
375 model3 = 0; modelW = 0; 375 model3 = nullptr; modelW = nullptr;
376 } 376 }
377 abandoned = true; 377 abandoned = true;
378 break; 378 break;
379 } 379 }
380 380