Mercurial > hg > svcore
comparison plugin/LADSPAPluginFactory.cpp @ 1582:70e172e6cc59 fix-static-analysis
Use nullptr throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 14:33:41 +0000 |
parents | 850bc66d6a70 |
children | 5f8fbbde08ff |
comparison
equal
deleted
inserted
replaced
1581:ad5f892c0c4d | 1582:70e172e6cc59 |
---|---|
51 | 51 |
52 LADSPAPluginFactory::~LADSPAPluginFactory() | 52 LADSPAPluginFactory::~LADSPAPluginFactory() |
53 { | 53 { |
54 for (std::set<RealTimePluginInstance *>::iterator i = m_instances.begin(); | 54 for (std::set<RealTimePluginInstance *>::iterator i = m_instances.begin(); |
55 i != m_instances.end(); ++i) { | 55 i != m_instances.end(); ++i) { |
56 (*i)->setFactory(0); | 56 (*i)->setFactory(nullptr); |
57 delete *i; | 57 delete *i; |
58 } | 58 } |
59 m_instances.clear(); | 59 m_instances.clear(); |
60 unloadUnusedLibraries(); | 60 unloadUnusedLibraries(); |
61 | 61 |
146 | 146 |
147 if (i != m_rtDescriptors.end()) { | 147 if (i != m_rtDescriptors.end()) { |
148 return i->second; | 148 return i->second; |
149 } | 149 } |
150 | 150 |
151 return 0; | 151 return nullptr; |
152 } | 152 } |
153 | 153 |
154 float | 154 float |
155 LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port) | 155 LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port) |
156 { | 156 { |
361 #endif | 361 #endif |
362 | 362 |
363 return instance; | 363 return instance; |
364 } | 364 } |
365 | 365 |
366 return 0; | 366 return nullptr; |
367 } | 367 } |
368 | 368 |
369 void | 369 void |
370 LADSPAPluginFactory::releasePlugin(RealTimePluginInstance *instance, | 370 LADSPAPluginFactory::releasePlugin(RealTimePluginInstance *instance, |
371 QString identifier) | 371 QString identifier) |
421 | 421 |
422 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { | 422 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { |
423 loadLibrary(soname); | 423 loadLibrary(soname); |
424 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { | 424 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { |
425 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; | 425 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; |
426 return 0; | 426 return nullptr; |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 void *libraryHandle = m_libraryHandles[soname]; | 430 void *libraryHandle = m_libraryHandles[soname]; |
431 | 431 |
432 LADSPA_Descriptor_Function fn = (LADSPA_Descriptor_Function) | 432 LADSPA_Descriptor_Function fn = (LADSPA_Descriptor_Function) |
433 DLSYM(libraryHandle, "ladspa_descriptor"); | 433 DLSYM(libraryHandle, "ladspa_descriptor"); |
434 | 434 |
435 if (!fn) { | 435 if (!fn) { |
436 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; | 436 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; |
437 return 0; | 437 return nullptr; |
438 } | 438 } |
439 | 439 |
440 const LADSPA_Descriptor *descriptor = 0; | 440 const LADSPA_Descriptor *descriptor = nullptr; |
441 | 441 |
442 int index = 0; | 442 int index = 0; |
443 while ((descriptor = fn(index))) { | 443 while ((descriptor = fn(index))) { |
444 if (descriptor->Label == label) return descriptor; | 444 if (descriptor->Label == label) return descriptor; |
445 ++index; | 445 ++index; |
446 } | 446 } |
447 | 447 |
448 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << endl; | 448 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << endl; |
449 | 449 |
450 return 0; | 450 return nullptr; |
451 } | 451 } |
452 | 452 |
453 void | 453 void |
454 LADSPAPluginFactory::loadLibrary(QString soName) | 454 LADSPAPluginFactory::loadLibrary(QString soName) |
455 { | 455 { |
700 if (!fn) { | 700 if (!fn) { |
701 cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: No descriptor function in " << soname << endl; | 701 cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: No descriptor function in " << soname << endl; |
702 return; | 702 return; |
703 } | 703 } |
704 | 704 |
705 const LADSPA_Descriptor *descriptor = 0; | 705 const LADSPA_Descriptor *descriptor = nullptr; |
706 | 706 |
707 int index = 0; | 707 int index = 0; |
708 while ((descriptor = fn(index))) { | 708 while ((descriptor = fn(index))) { |
709 | 709 |
710 RealTimePluginDescriptor *rtd = new RealTimePluginDescriptor; | 710 RealTimePluginDescriptor *rtd = new RealTimePluginDescriptor; |
721 | 721 |
722 QString identifier = PluginIdentifier::createIdentifier | 722 QString identifier = PluginIdentifier::createIdentifier |
723 ("ladspa", soname, descriptor->Label); | 723 ("ladspa", soname, descriptor->Label); |
724 | 724 |
725 #ifdef HAVE_LRDF | 725 #ifdef HAVE_LRDF |
726 char *def_uri = 0; | 726 char *def_uri = nullptr; |
727 lrdf_defaults *defs = 0; | 727 lrdf_defaults *defs = nullptr; |
728 | 728 |
729 if (m_lrdfTaxonomy[descriptor->UniqueID] != "") { | 729 if (m_lrdfTaxonomy[descriptor->UniqueID] != "") { |
730 m_taxonomy[identifier] = m_lrdfTaxonomy[descriptor->UniqueID]; | 730 m_taxonomy[identifier] = m_lrdfTaxonomy[descriptor->UniqueID]; |
731 // cerr << "set id \"" << identifier << "\" to cat \"" << m_taxonomy[identifier] << "\" from LRDF" << endl; | 731 // cerr << "set id \"" << identifier << "\" to cat \"" << m_taxonomy[identifier] << "\" from LRDF" << endl; |
732 // cout << identifier << "::" << m_taxonomy[identifier] << endl; | 732 // cout << identifier << "::" << m_taxonomy[identifier] << endl; |
866 LADSPAPluginFactory::generateTaxonomy(QString uri, QString base) | 866 LADSPAPluginFactory::generateTaxonomy(QString uri, QString base) |
867 { | 867 { |
868 #ifdef HAVE_LRDF | 868 #ifdef HAVE_LRDF |
869 lrdf_uris *uris = lrdf_get_instances(uri.toStdString().c_str()); | 869 lrdf_uris *uris = lrdf_get_instances(uri.toStdString().c_str()); |
870 | 870 |
871 if (uris != NULL) { | 871 if (uris != nullptr) { |
872 for (unsigned int i = 0; i < uris->count; ++i) { | 872 for (unsigned int i = 0; i < uris->count; ++i) { |
873 m_lrdfTaxonomy[lrdf_get_uid(uris->items[i])] = base; | 873 m_lrdfTaxonomy[lrdf_get_uid(uris->items[i])] = base; |
874 } | 874 } |
875 lrdf_free_uris(uris); | 875 lrdf_free_uris(uris); |
876 } | 876 } |
877 | 877 |
878 uris = lrdf_get_subclasses(uri.toStdString().c_str()); | 878 uris = lrdf_get_subclasses(uri.toStdString().c_str()); |
879 | 879 |
880 if (uris != NULL) { | 880 if (uris != nullptr) { |
881 for (unsigned int i = 0; i < uris->count; ++i) { | 881 for (unsigned int i = 0; i < uris->count; ++i) { |
882 char *label = lrdf_get_label(uris->items[i]); | 882 char *label = lrdf_get_label(uris->items[i]); |
883 generateTaxonomy(uris->items[i], | 883 generateTaxonomy(uris->items[i], |
884 base + (base.length() > 0 ? " > " : "") + label); | 884 base + (base.length() > 0 ? " > " : "") + label); |
885 } | 885 } |