Mercurial > hg > svcore
comparison plugin/DSSIPluginFactory.cpp @ 1582:70e172e6cc59 fix-static-analysis
Use nullptr throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 14:33:41 +0000 |
parents | 5ac102155409 |
children | 5f8fbbde08ff |
comparison
equal
deleted
inserted
replaced
1581:ad5f892c0c4d | 1582:70e172e6cc59 |
---|---|
43 | 43 |
44 DSSIPluginFactory::DSSIPluginFactory() : | 44 DSSIPluginFactory::DSSIPluginFactory() : |
45 LADSPAPluginFactory() | 45 LADSPAPluginFactory() |
46 { | 46 { |
47 m_hostDescriptor.DSSI_API_Version = 2; | 47 m_hostDescriptor.DSSI_API_Version = 2; |
48 m_hostDescriptor.request_transport_information = NULL; | 48 m_hostDescriptor.request_transport_information = nullptr; |
49 m_hostDescriptor.request_midi_send = DSSIPluginInstance::requestMidiSend; | 49 m_hostDescriptor.request_midi_send = DSSIPluginInstance::requestMidiSend; |
50 m_hostDescriptor.request_non_rt_thread = DSSIPluginInstance::requestNonRTThread; | 50 m_hostDescriptor.request_non_rt_thread = DSSIPluginInstance::requestNonRTThread; |
51 m_hostDescriptor.midi_send = DSSIPluginInstance::midiSend; | 51 m_hostDescriptor.midi_send = DSSIPluginInstance::midiSend; |
52 } | 52 } |
53 | 53 |
132 m_instances.insert(instance); | 132 m_instances.insert(instance); |
133 | 133 |
134 return instance; | 134 return instance; |
135 } | 135 } |
136 | 136 |
137 return 0; | 137 return nullptr; |
138 } | 138 } |
139 | 139 |
140 const DSSI_Descriptor * | 140 const DSSI_Descriptor * |
141 DSSIPluginFactory::getDSSIDescriptor(QString identifier) | 141 DSSIPluginFactory::getDSSIDescriptor(QString identifier) |
142 { | 142 { |
149 if (descriptor) { | 149 if (descriptor) { |
150 descriptor->receive_host_descriptor(&m_hostDescriptor); | 150 descriptor->receive_host_descriptor(&m_hostDescriptor); |
151 } | 151 } |
152 return descriptor; | 152 return descriptor; |
153 } else { | 153 } else { |
154 return 0; | 154 return nullptr; |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 bool firstInLibrary = false; | 158 bool firstInLibrary = false; |
159 | 159 |
160 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { | 160 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { |
161 loadLibrary(soname); | 161 loadLibrary(soname); |
162 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { | 162 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { |
163 cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: loadLibrary failed for " << soname << endl; | 163 cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: loadLibrary failed for " << soname << endl; |
164 return 0; | 164 return nullptr; |
165 } | 165 } |
166 firstInLibrary = true; | 166 firstInLibrary = true; |
167 } | 167 } |
168 | 168 |
169 void *libraryHandle = m_libraryHandles[soname]; | 169 void *libraryHandle = m_libraryHandles[soname]; |
171 DSSI_Descriptor_Function fn = (DSSI_Descriptor_Function) | 171 DSSI_Descriptor_Function fn = (DSSI_Descriptor_Function) |
172 DLSYM(libraryHandle, "dssi_descriptor"); | 172 DLSYM(libraryHandle, "dssi_descriptor"); |
173 | 173 |
174 if (!fn) { | 174 if (!fn) { |
175 cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No descriptor function in library " << soname << endl; | 175 cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No descriptor function in library " << soname << endl; |
176 return 0; | 176 return nullptr; |
177 } | 177 } |
178 | 178 |
179 const DSSI_Descriptor *descriptor = 0; | 179 const DSSI_Descriptor *descriptor = nullptr; |
180 | 180 |
181 int index = 0; | 181 int index = 0; |
182 while ((descriptor = fn(index))) { | 182 while ((descriptor = fn(index))) { |
183 if (descriptor->LADSPA_Plugin->Label == label) { | 183 if (descriptor->LADSPA_Plugin->Label == label) { |
184 if (firstInLibrary && (descriptor->DSSI_API_Version >= 2)) { | 184 if (firstInLibrary && (descriptor->DSSI_API_Version >= 2)) { |
189 ++index; | 189 ++index; |
190 } | 190 } |
191 | 191 |
192 cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No such plugin as " << label << " in library " << soname << endl; | 192 cerr << "WARNING: DSSIPluginFactory::getDSSIDescriptor: No such plugin as " << label << " in library " << soname << endl; |
193 | 193 |
194 return 0; | 194 return nullptr; |
195 } | 195 } |
196 | 196 |
197 const LADSPA_Descriptor * | 197 const LADSPA_Descriptor * |
198 DSSIPluginFactory::getLADSPADescriptor(QString identifier) | 198 DSSIPluginFactory::getLADSPADescriptor(QString identifier) |
199 { | 199 { |
200 const DSSI_Descriptor *dssiDescriptor = getDSSIDescriptor(identifier); | 200 const DSSI_Descriptor *dssiDescriptor = getDSSIDescriptor(identifier); |
201 if (dssiDescriptor) return dssiDescriptor->LADSPA_Plugin; | 201 if (dssiDescriptor) return dssiDescriptor->LADSPA_Plugin; |
202 else return 0; | 202 else return nullptr; |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 std::vector<QString> | 206 std::vector<QString> |
207 DSSIPluginFactory::getPluginPath() | 207 DSSIPluginFactory::getPluginPath() |
306 if (!fn) { | 306 if (!fn) { |
307 cerr << "WARNING: DSSIPluginFactory::discoverPlugins: No descriptor function in " << soname << endl; | 307 cerr << "WARNING: DSSIPluginFactory::discoverPlugins: No descriptor function in " << soname << endl; |
308 return; | 308 return; |
309 } | 309 } |
310 | 310 |
311 const DSSI_Descriptor *descriptor = 0; | 311 const DSSI_Descriptor *descriptor = nullptr; |
312 | 312 |
313 int index = 0; | 313 int index = 0; |
314 while ((descriptor = fn(index))) { | 314 while ((descriptor = fn(index))) { |
315 | 315 |
316 const LADSPA_Descriptor *ladspaDescriptor = descriptor->LADSPA_Plugin; | 316 const LADSPA_Descriptor *ladspaDescriptor = descriptor->LADSPA_Plugin; |
335 | 335 |
336 QString identifier = PluginIdentifier::createIdentifier | 336 QString identifier = PluginIdentifier::createIdentifier |
337 ("dssi", soname, ladspaDescriptor->Label); | 337 ("dssi", soname, ladspaDescriptor->Label); |
338 | 338 |
339 #ifdef HAVE_LRDF | 339 #ifdef HAVE_LRDF |
340 char *def_uri = 0; | 340 char *def_uri = nullptr; |
341 lrdf_defaults *defs = 0; | 341 lrdf_defaults *defs = nullptr; |
342 | 342 |
343 QString category = m_taxonomy[identifier]; | 343 QString category = m_taxonomy[identifier]; |
344 | 344 |
345 if (category == "" && m_lrdfTaxonomy[ladspaDescriptor->UniqueID] != "") { | 345 if (category == "" && m_lrdfTaxonomy[ladspaDescriptor->UniqueID] != "") { |
346 m_taxonomy[identifier] = m_lrdfTaxonomy[ladspaDescriptor->UniqueID]; | 346 m_taxonomy[identifier] = m_lrdfTaxonomy[ladspaDescriptor->UniqueID]; |