Mercurial > hg > svapp
diff framework/Document.cpp @ 636:e2715204feaa fix-static-analysis
Use nullptr throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 14:34:06 +0000 |
parents | 4612d44ae753 |
children | 3168deb50199 e19c609a7bec |
line wrap: on
line diff
--- a/framework/Document.cpp Mon Nov 26 13:53:57 2018 +0000 +++ b/framework/Document.cpp Mon Nov 26 14:34:06 2018 +0000 @@ -49,7 +49,7 @@ //!!! still need to handle command history, documentRestored/documentModified Document::Document() : - m_mainModel(0), + m_mainModel(nullptr), m_autoAlignment(false), m_align(new Align()), m_isIncomplete(false) @@ -115,7 +115,7 @@ emit modelAboutToBeDeleted(m_mainModel); } - emit mainModelChanged(0); + emit mainModelChanged(nullptr); delete m_mainModel; } @@ -123,7 +123,7 @@ Document::createLayer(LayerFactory::LayerType type) { Layer *newLayer = LayerFactory::getInstance()->createLayer(type); - if (!newLayer) return 0; + if (!newLayer) return nullptr; newLayer->setObjectName(getUniqueLayerName(newLayer->objectName())); @@ -143,7 +143,7 @@ Document::createMainModelLayer(LayerFactory::LayerType type) { Layer *newLayer = createLayer(type); - if (!newLayer) return 0; + if (!newLayer) return nullptr; setModel(newLayer, m_mainModel); return newLayer; } @@ -156,14 +156,14 @@ if (types.empty()) { cerr << "WARNING: Document::importLayer: no valid display layer for model" << endl; - return 0; + return nullptr; } //!!! for now, just use the first suitable layer type LayerFactory::LayerType type = *types.begin(); Layer *newLayer = LayerFactory::getInstance()->createLayer(type); - if (!newLayer) return 0; + if (!newLayer) return nullptr; newLayer->setObjectName(getUniqueLayerName(newLayer->objectName())); @@ -187,16 +187,16 @@ Layer * Document::createEmptyLayer(LayerFactory::LayerType type) { - if (!m_mainModel) return 0; + if (!m_mainModel) return nullptr; Model *newModel = LayerFactory::getInstance()->createEmptyModel(type, m_mainModel); - if (!newModel) return 0; + if (!newModel) return nullptr; Layer *newLayer = createLayer(type); if (!newLayer) { delete newModel; - return 0; + return nullptr; } addImportedModel(newModel); @@ -210,7 +210,7 @@ TransformId transform) { Layer *newLayer = createLayer(type); - if (!newLayer) return 0; + if (!newLayer) return nullptr; newLayer->setObjectName(getUniqueLayerName (TransformFactory::getInstance()-> @@ -226,7 +226,7 @@ Transforms transforms; transforms.push_back(transform); vector<Layer *> layers = createDerivedLayers(transforms, input); - if (layers.empty()) return 0; + if (layers.empty()) return nullptr; else return layers[0]; } @@ -235,7 +235,7 @@ const ModelTransformer::Input &input) { QString message; - vector<Model *> newModels = addDerivedModels(transforms, input, message, 0); + vector<Model *> newModels = addDerivedModels(transforms, input, message, nullptr); if (newModels.empty()) { //!!! This identifier may be wrong! @@ -640,7 +640,7 @@ } ModelRecord rec; - rec.source = 0; + rec.source = nullptr; rec.channel = 0; rec.refcount = 0; rec.additional = false; @@ -676,7 +676,7 @@ } ModelRecord rec; - rec.source = 0; + rec.source = nullptr; rec.channel = 0; rec.refcount = 0; rec.additional = true; @@ -732,8 +732,8 @@ Transforms tt; tt.push_back(transform); - vector<Model *> mm = addDerivedModels(tt, input, message, 0); - if (mm.empty()) return 0; + vector<Model *> mm = addDerivedModels(tt, input, message, nullptr); + if (mm.empty()) return nullptr; else return mm[0]; } @@ -783,7 +783,7 @@ void Document::releaseModel(Model *model) // Will _not_ release main model! { - if (model == 0) { + if (model == nullptr) { return; } @@ -818,7 +818,7 @@ for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) { if (i->second.source == model) { ++sourceCount; - i->second.source = 0; + i->second.source = nullptr; } } @@ -1101,7 +1101,7 @@ // unaligned model just by looking at the model itself, // without also knowing what the main model is SVDEBUG << "Document::alignModel(" << model << "): is main model, setting appropriately" << endl; - rm->setAlignment(new AlignmentModel(model, model, 0, 0)); + rm->setAlignment(new AlignmentModel(model, model, nullptr, nullptr)); return; }