From 047239d5ca229bb8ad85a2d9fcd2ae7b6f35b976 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:11:57 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: I520c7e35d539ba804da17185353317eca504a582 --- configmgr/source/access.cxx | 32 ++++++++++++------------ configmgr/source/childaccess.cxx | 12 ++++----- configmgr/source/components.cxx | 40 +++++++++++++++--------------- configmgr/source/configurationprovider.cxx | 16 ++++++------ configmgr/source/data.cxx | 28 ++++++++++----------- configmgr/source/nodemap.cxx | 2 +- configmgr/source/partial.cxx | 4 +-- configmgr/source/rootaccess.cxx | 14 +++++------ configmgr/source/services.cxx | 14 +++++------ configmgr/source/valueparser.cxx | 18 +++++++------- configmgr/source/writemodfile.cxx | 4 +-- configmgr/source/writemodfile.hxx | 2 +- configmgr/source/xcdparser.cxx | 4 +-- configmgr/source/xcsparser.cxx | 6 ++--- configmgr/source/xcuparser.cxx | 20 +++++++-------- configmgr/source/xmldata.cxx | 2 +- 16 files changed, 109 insertions(+), 109 deletions(-) (limited to 'configmgr') diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index fa2930a8cbf0..ecfbe580c620 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -153,7 +153,7 @@ void Access::markChildAsModified(rtl::Reference< ChildAccess > const & child) { if (!parent.is()) { break; } - assert(dynamic_cast< ChildAccess * >(p.get()) != 0); + assert(dynamic_cast< ChildAccess * >(p.get()) != nullptr); parent->modifiedChildren_.insert( ModifiedChildren::value_type( p->getNameInternal(), @@ -169,7 +169,7 @@ void Access::releaseChild(OUString const & name) { void Access::initBroadcaster( Modifications::Node const & modifications, Broadcaster * broadcaster) { - initBroadcasterAndChanges(modifications, broadcaster, 0); + initBroadcasterAndChanges(modifications, broadcaster, nullptr); } css::uno::Sequence< css::uno::Type > Access::getTypes() @@ -1311,7 +1311,7 @@ Access::Access(Components & components): Access::~Access() {} void Access::initDisposeBroadcaster(Broadcaster * broadcaster) { - assert(broadcaster != 0); + assert(broadcaster != nullptr); for (DisposeListeners::iterator i(disposeListeners_.begin()); i != disposeListeners_.end(); ++i) { @@ -1603,7 +1603,7 @@ void Access::insertLocalizedValueChild( OUString const & name, css::uno::Any const & value, Modifications * localModifications) { - assert(localModifications != 0); + assert(localModifications != nullptr); LocalizedPropertyNode * locprop = static_cast< LocalizedPropertyNode * >( getNode().get()); checkValue(value, locprop->getStaticType(), locprop->isNillable()); @@ -1618,7 +1618,7 @@ void Access::insertLocalizedValueChild( void Access::reportChildChanges( std::vector< css::util::ElementChange > * changes) { - assert(changes != 0); + assert(changes != nullptr); for (ModifiedChildren::iterator i(modifiedChildren_.begin()); i != modifiedChildren_.end(); ++i) { @@ -1636,7 +1636,7 @@ void Access::reportChildChanges( void Access::commitChildChanges( bool valid, Modifications * globalModifications) { - assert(globalModifications != 0); + assert(globalModifications != nullptr); while (!modifiedChildren_.empty()) { bool childValid = valid; ModifiedChildren::iterator i(modifiedChildren_.begin()); @@ -1688,7 +1688,7 @@ void Access::initBroadcasterAndChanges( Modifications::Node const & modifications, Broadcaster * broadcaster, std::vector< css::util::ElementChange > * allChanges) { - assert(broadcaster != 0); + assert(broadcaster != nullptr); std::vector< css::beans::PropertyChangeEvent > propChanges; bool collectPropChanges = !propertiesChangeListeners_.empty(); for (Modifications::Node::Children::const_iterator i( @@ -1753,7 +1753,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any())); } } - if (allChanges != 0) { + if (allChanges != nullptr) { allChanges->push_back( css::util::ElementChange( css::uno::makeAny( @@ -1786,7 +1786,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any())); //TODO: distinguish add/modify; non-void ReplacedElement } - if (allChanges != 0) { + if (allChanges != nullptr) { allChanges->push_back( css::util::ElementChange( css::uno::makeAny( @@ -1840,7 +1840,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any())); } } - if (allChanges != 0) { + if (allChanges != nullptr) { allChanges->push_back( css::util::ElementChange( css::uno::makeAny( @@ -1874,7 +1874,7 @@ void Access::initBroadcasterAndChanges( css::uno::makeAny(i->first), child->asValue(), css::uno::Any())); } - if (allChanges != 0) { + if (allChanges != nullptr) { allChanges->push_back( css::util::ElementChange( css::uno::makeAny( @@ -1913,7 +1913,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any())); //TODO: non-void ReplacedElement } - if (allChanges != 0) { + if (allChanges != nullptr) { OUStringBuffer path(getRelativePathRepresentation()); if (!path.isEmpty()) { path.append('/'); @@ -1971,7 +1971,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any())); } } - if (allChanges != 0) { + if (allChanges != nullptr) { OUStringBuffer path( getRelativePathRepresentation()); if (!path.isEmpty()) { @@ -2008,7 +2008,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement } - if (allChanges != 0) { + if (allChanges != nullptr) { OUStringBuffer path( getRelativePathRepresentation()); if (!path.isEmpty()) { @@ -2177,7 +2177,7 @@ bool Access::setChildProperty( OUString const & name, css::uno::Any const & value, Modifications * localModifications) { - assert(localModifications != 0); + assert(localModifications != nullptr); rtl::Reference< ChildAccess > child(getChild(name)); if (!child.is()) { return false; @@ -2297,7 +2297,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember( "configmgr inappropriate set element", static_cast< cppu::OWeakObject * >(this), 1); } - assert(dynamic_cast< SetNode * >(getNode().get()) != 0); + assert(dynamic_cast< SetNode * >(getNode().get()) != nullptr); if (!static_cast< SetNode * >(getNode().get())->isValidTemplate( freeAcc->getNode()->getTemplateName())) { diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index 756bc21d1f9d..a4e632f6ed2e 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -210,7 +210,7 @@ void ChildAccess::setNode(rtl::Reference< Node > const & node) { void ChildAccess::setProperty( css::uno::Any const & value, Modifications * localModifications) { - assert(localModifications != 0); + assert(localModifications != nullptr); Type type = TYPE_ERROR; bool isNillable = false; switch (node_->kind()) { @@ -256,7 +256,7 @@ void ChildAccess::setProperty( css::uno::Any ChildAccess::asValue() { - if (changedValue_.get() != 0) { + if (changedValue_.get() != nullptr) { return *changedValue_; } css::uno::Any value; @@ -298,9 +298,9 @@ bool ChildAccess::asSimpleValue(const rtl::Reference< Node > &rNode, void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) { - assert(globalModifications != 0); + assert(globalModifications != nullptr); commitChildChanges(valid, globalModifications); - if (valid && changedValue_.get() != 0) { + if (valid && changedValue_.get() != nullptr) { Path path(getAbsolutePath()); getComponents().addModification(path); globalModifications->add(path); @@ -329,7 +329,7 @@ ChildAccess::~ChildAccess() { } void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const { - assert(types != 0); + assert(types != nullptr); types->push_back(cppu::UnoType< css::container::XChild >::get()); types->push_back(cppu::UnoType< css::lang::XUnoTunnel >::get()); } @@ -337,7 +337,7 @@ void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const { void ChildAccess::addSupportedServiceNames( std::vector< OUString > * services) { - assert(services != 0); + assert(services != nullptr); services->push_back( getParentNode()->kind() == Node::KIND_GROUP ? OUString("com.sun.star.configuration.GroupElement") diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 386b272428f1..17df486e6814 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -93,10 +93,10 @@ void parseXcsFile( OUString const & url, int layer, Data & data, Partial const * partial, Modifications * modifications, Additions * additions) { - assert(partial == 0 && modifications == 0 && additions == 0); + assert(partial == nullptr && modifications == nullptr && additions == nullptr); (void) partial; (void) modifications; (void) additions; bool ok = rtl::Reference< ParseManager >( - new ParseManager(url, new XcsParser(layer, data)))->parse(0); + new ParseManager(url, new XcsParser(layer, data)))->parse(nullptr); assert(ok); (void) ok; // avoid warnings } @@ -109,7 +109,7 @@ void parseXcuFile( new ParseManager( url, new XcuParser(layer, data, partial, modifications, additions)))-> - parse(0); + parse(nullptr); assert(ok); (void) ok; // avoid warnings } @@ -173,7 +173,7 @@ Components::WriteThread::WriteThread( url_(url), data_(data) { lock_ = lock(); - assert(reference != 0); + assert(reference != nullptr); } void Components::WriteThread::execute() { @@ -257,7 +257,7 @@ void Components::initGlobalBroadcaster( Modifications::Node::Children::const_iterator k( mods->children.find(*j)); if (k == mods->children.end()) { - mods = 0; + mods = nullptr; break; } mods = &k->second; @@ -265,7 +265,7 @@ void Components::initGlobalBroadcaster( //TODO: If the complete tree of which root is a part is deleted, // or replaced, mods will be null, but some of the listeners // from within root should probably fire nonetheless: - if (mods != 0) { + if (mods != nullptr) { root->initBroadcaster(*mods, broadcaster); } } @@ -316,7 +316,7 @@ void Components::insertExtensionXcsFile( { int layer = getExtensionLayer(shared); try { - parseXcsFile(fileUri, layer, data_, 0, 0, 0); + parseXcsFile(fileUri, layer, data_, nullptr, nullptr, nullptr); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( "insertExtensionXcsFile does not exist: " + e.Message); @@ -326,11 +326,11 @@ void Components::insertExtensionXcsFile( void Components::insertExtensionXcuFile( bool shared, OUString const & fileUri, Modifications * modifications) { - assert(modifications != 0); + assert(modifications != nullptr); int layer = getExtensionLayer(shared) + 1; Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer); try { - parseXcuFile(fileUri, layer, data_, 0, modifications, adds); + parseXcuFile(fileUri, layer, data_, nullptr, modifications, adds); } catch (css::container::NoSuchElementException & e) { data_.removeExtensionXcuAdditions(fileUri); throw css::uno::RuntimeException( @@ -354,7 +354,7 @@ void Components::removeExtensionXcuFile( // item->additions records all additions of set members in textual order, // the latter check works well when iterating through item->additions in // reverse order. - assert(modifications != 0); + assert(modifications != nullptr); rtl::Reference< Data::ExtensionXcu > item( data_.removeExtensionXcuAdditions(fileUri)); if (item.is()) { @@ -396,11 +396,11 @@ void Components::insertModificationXcuFile( std::set< OUString > const & excludedPaths, Modifications * modifications) { - assert(modifications != 0); + assert(modifications != nullptr); Partial part(includedPaths, excludedPaths); try { parseFileLeniently( - &parseXcuFile, fileUri, Data::NO_LAYER, &part, modifications, 0); + &parseXcuFile, fileUri, Data::NO_LAYER, &part, modifications, nullptr); } catch (css::container::NoSuchElementException & e) { SAL_WARN( "configmgr", @@ -624,7 +624,7 @@ void Components::parseFileLeniently( Partial const * partial, Modifications * modifications, Additions * additions) { - assert(parseFile != 0); + assert(parseFile != nullptr); try { (*parseFile)(url, layer, data_, partial, modifications, additions); } catch (css::container::NoSuchElementException &) { @@ -679,7 +679,7 @@ void Components::parseFiles( if (file.endsWith(extension)) { try { parseFileLeniently( - parseFile, stat.getFileURL(), layer, 0, 0, 0); + parseFile, stat.getFileURL(), layer, nullptr, nullptr, nullptr); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( "stat'ed file does not exist: " + e.Message); @@ -696,16 +696,16 @@ void Components::parseFileList( for (sal_Int32 i = 0;;) { OUString url(urls.getToken(0, ' ', i)); if (!url.isEmpty()) { - Additions * adds = 0; + Additions * adds = nullptr; if (recordAdditions) { adds = data_.addExtensionXcuAdditions(url, layer); } try { - parseFileLeniently(parseFile, url, layer, 0, 0, adds); + parseFileLeniently(parseFile, url, layer, nullptr, nullptr, adds); } catch (css::container::NoSuchElementException & e) { SAL_WARN( "configmgr", "file does not exist: \"" << e.Message << '"'); - if (adds != 0) { + if (adds != nullptr) { data_.removeExtensionXcuAdditions(url); } } @@ -761,7 +761,7 @@ void Components::parseXcdFiles(int layer, OUString const & url) { throw css::uno::RuntimeException( "stat'ed file does not exist: " + e.Message); } - if (manager->parse(0)) { + if (manager->parse(nullptr)) { processedDeps.insert(name); } else { unres.push_back(UnresolvedListItem(name, manager)); @@ -799,7 +799,7 @@ void Components::parseXcsXcuIniLayer( // Check if ini file exists (otherwise .override would still read global // SCHEMA/DATA variables, which could interfere with unrelated environment // variables): - if (rtl::Bootstrap(url).getHandle() != 0) { + if (rtl::Bootstrap(url).getHandle() != nullptr) { OUStringBuffer prefix("${.override:"); for (sal_Int32 i = 0; i != url.getLength(); ++i) { sal_Unicode c = url[i]; @@ -839,7 +839,7 @@ void Components::parseResLayer(int layer, OUString const & url) { void Components::parseModificationLayer(int layer, OUString const & url) { try { - parseFileLeniently(&parseXcuFile, url, layer, 0, 0, 0); + parseFileLeniently(&parseXcuFile, url, layer, nullptr, nullptr, nullptr); } catch (css::container::NoSuchElementException &) { SAL_INFO( "configmgr", "user registrymodifications.xcu does not (yet) exist"); diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index 2707a4f35e0d..364642dd6a99 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -77,7 +77,7 @@ void badNodePath() { throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider expects a single," " non-empty, string nodepath argument"), - 0); + nullptr); } typedef @@ -222,7 +222,7 @@ Service::createInstanceWithArguments( throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider expects" " NamedValue or PropertyValue arguments"), - 0); + nullptr); } // For backwards compatibility, allow "nodepath" and "Locale" in any // case: @@ -239,7 +239,7 @@ Service::createInstanceWithArguments( throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider expects" " at most one, non-empty, string Locale argument"), - 0); + nullptr); } } } @@ -296,7 +296,7 @@ void Service::refresh() throw (css::uno::RuntimeException, std::exception) { //TODO cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer( cppu::UnoType< css::util::XRefreshListener >::get()); - if (cont != 0) { + if (cont != nullptr) { css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this)); cont->notifyEach(&css::util::XRefreshListener::refreshed, ev); } @@ -322,7 +322,7 @@ void Service::flush() throw (css::uno::RuntimeException, std::exception) { flushModifications(); cppu::OInterfaceContainerHelper * cont = rBHelper.getContainer( cppu::UnoType< css::util::XFlushListener >::get()); - if (cont != 0) { + if (cont != nullptr) { css::lang::EventObject ev(static_cast< cppu::OWeakObject * >(this)); cont->notifyEach(&css::util::XFlushListener::flushed, ev); } @@ -438,7 +438,7 @@ Factory::createInstanceWithArgumentsAndContext( throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider factory" " expects NamedValue or PropertyValue arguments"), - 0); + nullptr); } // For backwards compatibility, allow "Locale" and (ignored) // "EnableAsync" in any case: @@ -450,13 +450,13 @@ Factory::createInstanceWithArgumentsAndContext( ("com.sun.star.configuration.ConfigurationProvider" " factory expects at most one, non-empty, string" " Locale argument"), - 0); + nullptr); } } else if (!name.equalsIgnoreAsciiCase("enableasync")) { throw css::uno::Exception( ("com.sun.star.configuration.ConfigurationProvider factory:" " unknown argument " + name), - 0); + nullptr); } } return static_cast< cppu::OWeakObject * >(new Service(Context, locale)); diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index 0eb1fff91dcd..ac3cff0e2f1e 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -51,7 +51,7 @@ bool decode( { assert( begin >= 0 && begin <= end && end <= encoded.getLength() && - decoded != 0); + decoded != nullptr); OUStringBuffer buf; while (begin != end) { sal_Unicode c = encoded[begin++]; @@ -114,8 +114,8 @@ sal_Int32 Data::parseSegment( bool * setElement, OUString * templateName) { assert( - index >= 0 && index <= path.getLength() && name != 0 && - setElement != 0); + index >= 0 && index <= path.getLength() && name != nullptr && + setElement != nullptr); sal_Int32 i = index; while (i < path.getLength() && path[i] != '/' && path[i] != '[') { ++i; @@ -125,7 +125,7 @@ sal_Int32 Data::parseSegment( *setElement = false; return i; } - if (templateName != 0) { + if (templateName != nullptr) { if (i - index == 1 && path[index] == '*') { templateName->clear(); } else { @@ -190,14 +190,14 @@ rtl::Reference< Node > Data::resolvePathRepresentation( throw css::uno::RuntimeException( "bad path " + pathRepresentation); } - if (path != 0) { + if (path != nullptr) { path->clear(); } if (pathRepresentation == "/") { - if (canonicRepresentation != 0) { + if (canonicRepresentation != nullptr) { *canonicRepresentation = pathRepresentation; } - if (finalizedLayer != 0) { + if (finalizedLayer != nullptr) { *finalizedLayer = NO_LAYER; } return root_; @@ -205,7 +205,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( OUString seg; bool setElement; OUString templateName; - sal_Int32 n = parseSegment(pathRepresentation, 1, &seg, &setElement, 0); + sal_Int32 n = parseSegment(pathRepresentation, 1, &seg, &setElement, nullptr); if (n == -1 || setElement) { throw css::uno::RuntimeException( @@ -216,15 +216,15 @@ rtl::Reference< Node > Data::resolvePathRepresentation( OUStringBuffer canonic; rtl::Reference< Node > parent; int finalized = NO_LAYER; - for (rtl::Reference< Node > p(i == components.end() ? 0 : i->second);;) { + for (rtl::Reference< Node > p(i == components.end() ? nullptr : i->second);;) { if (!p.is()) { return p; } - if (canonicRepresentation != 0) { + if (canonicRepresentation != nullptr) { canonic.append('/'); canonic.append(createSegment(templateName, seg)); } - if (path != 0) { + if (path != nullptr) { path->push_back(seg); } finalized = std::min(finalized, p->getFinalized()); @@ -236,10 +236,10 @@ rtl::Reference< Node > Data::resolvePathRepresentation( } // for backwards compatibility, ignore a final slash if (n == pathRepresentation.getLength()) { - if (canonicRepresentation != 0) { + if (canonicRepresentation != nullptr) { *canonicRepresentation = canonic.makeStringAndClear(); } - if (finalizedLayer != 0) { + if (finalizedLayer != nullptr) { *finalizedLayer = finalized; } return p; @@ -276,7 +276,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( throw css::uno::RuntimeException( "bad path " + pathRepresentation); } - if (!templateName.isEmpty() && p != 0) { + if (!templateName.isEmpty() && p != nullptr) { assert(!p->getTemplateName().isEmpty()); if (!equalTemplateNames(templateName, p->getTemplateName())) { throw css::uno::RuntimeException( diff --git a/configmgr/source/nodemap.cxx b/configmgr/source/nodemap.cxx index 4d823ce73a6d..d2f3cffeb795 100644 --- a/configmgr/source/nodemap.cxx +++ b/configmgr/source/nodemap.cxx @@ -31,7 +31,7 @@ namespace configmgr { void NodeMap::cloneInto(NodeMap * target) const { - assert(target != 0 && target->empty()); + assert(target != nullptr && target->empty()); NodeMapImpl clone(maImpl); for (NodeMapImpl::iterator i(clone.begin()); i != clone.end(); ++i) { i->second = i->second->clone(true); diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx index 14ba0d61343c..3b39b6edddba 100644 --- a/configmgr/source/partial.cxx +++ b/configmgr/source/partial.cxx @@ -41,8 +41,8 @@ bool parseSegment( OUString const & path, sal_Int32 * index, OUString * segment) { assert( - index != 0 && *index >= 0 && *index <= path.getLength() && - segment != 0); + index != nullptr && *index >= 0 && *index <= path.getLength() && + segment != nullptr); if (path[(*index)++] == '/') { OUString name; bool setElement; diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index 91967684b949..08a33d8adf50 100644 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx @@ -74,10 +74,10 @@ Path RootAccess::getAbsolutePath() { void RootAccess::initBroadcaster( Modifications::Node const & modifications, Broadcaster * broadcaster) { - assert(broadcaster != 0); + assert(broadcaster != nullptr); std::vector< css::util::ElementChange > changes; initBroadcasterAndChanges( - modifications, broadcaster, changesListeners_.empty() ? 0 : &changes); + modifications, broadcaster, changesListeners_.empty() ? nullptr : &changes); if (!changes.empty()) { css::util::ChangesSet set(comphelper::containerToSequence(changes)); for (ChangesListeners::iterator i(changesListeners_.begin()); @@ -167,7 +167,7 @@ void RootAccess::commitChanges() Modifications globalMods; commitChildChanges( ((getComponents().resolvePathRepresentation( - pathRepresentation_, 0, 0, &finalizedLayer) + pathRepresentation_, nullptr, nullptr, &finalizedLayer) == node_) && finalizedLayer == Data::NO_LAYER), &globalMods); @@ -221,7 +221,7 @@ rtl::Reference< Node > RootAccess::getNode() { pathRepresentation_, &canonic, &path_, &finalizedLayer); if (!node_.is()) { throw css::uno::RuntimeException( - "cannot find " + pathRepresentation_, 0); + "cannot find " + pathRepresentation_, nullptr); // RootAccess::queryInterface indirectly calls // RootAccess::getNode, so if this RootAccess were passed out in // RuntimeException.Context, client code that called @@ -257,7 +257,7 @@ rtl::Reference< Access > RootAccess::getParentAccess() { } void RootAccess::addTypes(std::vector< css::uno::Type > * types) const { - assert(types != 0); + assert(types != nullptr); types->push_back(cppu::UnoType< css::util::XChangesNotifier >::get()); types->push_back(cppu::UnoType< css::util::XChangesBatch >::get()); } @@ -265,7 +265,7 @@ void RootAccess::addTypes(std::vector< css::uno::Type > * types) const { void RootAccess::addSupportedServiceNames( std::vector< OUString > * services) { - assert(services != 0); + assert(services != nullptr); services->push_back("com.sun.star.configuration.AccessRootElement"); if (update_) { services->push_back("com.sun.star.configuration.UpdateRootElement"); @@ -273,7 +273,7 @@ void RootAccess::addSupportedServiceNames( } void RootAccess::initDisposeBroadcaster(Broadcaster * broadcaster) { - assert(broadcaster != 0); + assert(broadcaster != nullptr); for (ChangesListeners::iterator i(changesListeners_.begin()); i != changesListeners_.end(); ++i) { diff --git a/configmgr/source/services.cxx b/configmgr/source/services.cxx index 7d50d970be96..6affa5f1b79f 100644 --- a/configmgr/source/services.cxx +++ b/configmgr/source/services.cxx @@ -49,27 +49,27 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL dummy( static cppu::ImplementationEntry const services[] = { { &dummy, &configmgr::configuration_provider::getImplementationName, &configmgr::configuration_provider::getSupportedServiceNames, - &configmgr::configuration_provider::createFactory, 0, 0 }, + &configmgr::configuration_provider::createFactory, nullptr, 0 }, { &configmgr::default_provider::create, &configmgr::default_provider::getImplementationName, &configmgr::default_provider::getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, + &cppu::createSingleComponentFactory, nullptr, 0 }, { &configmgr::configuration_registry::create, &configmgr::configuration_registry::getImplementationName, &configmgr::configuration_registry::getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, + &cppu::createSingleComponentFactory, nullptr, 0 }, { &configmgr::read_only_access::create, &configmgr::read_only_access::getImplementationName, &configmgr::read_only_access::getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, + &cppu::createSingleComponentFactory, nullptr, 0 }, { &configmgr::read_write_access::create, &configmgr::read_write_access::getImplementationName, &configmgr::read_write_access::getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, + &cppu::createSingleComponentFactory, nullptr, 0 }, { &configmgr::update::create, &configmgr::update::getImplementationName, &configmgr::update::getSupportedServiceNames, - &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } + &cppu::createSingleComponentFactory, nullptr, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; } diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index 3fc85e478992..eb81d738e8a4 100644 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -49,7 +49,7 @@ namespace configmgr { namespace { bool parseHexDigit(char c, int * value) { - assert(value != 0); + assert(value != nullptr); if (c >= '0' && c <= '9') { *value = c - '0'; return true; @@ -66,7 +66,7 @@ bool parseHexDigit(char c, int * value) { } bool parseValue(xmlreader::Span const & text, sal_Bool * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); if (text.equals("true") || text.equals("1")) { *value = true; return true; @@ -79,7 +79,7 @@ bool parseValue(xmlreader::Span const & text, sal_Bool * value) { } bool parseValue(xmlreader::Span const & text, sal_Int16 * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); // For backwards compatibility, support hexadecimal values: sal_Int32 n = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( @@ -99,7 +99,7 @@ bool parseValue(xmlreader::Span const & text, sal_Int16 * value) { } bool parseValue(xmlreader::Span const & text, sal_Int32 * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); // For backwards compatibility, support hexadecimal values: *value = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( @@ -115,7 +115,7 @@ bool parseValue(xmlreader::Span const & text, sal_Int32 * value) { } bool parseValue(xmlreader::Span const & text, sal_Int64 * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); // For backwards compatibility, support hexadecimal values: *value = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( @@ -131,14 +131,14 @@ bool parseValue(xmlreader::Span const & text, sal_Int64 * value) { } bool parseValue(xmlreader::Span const & text, double * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); *value = OString(text.begin, text.length).toDouble(); //TODO: check valid lexical representation return true; } bool parseValue(xmlreader::Span const & text, OUString * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); *value = text.convertFromUtf8(); return true; } @@ -146,7 +146,7 @@ bool parseValue(xmlreader::Span const & text, OUString * value) { bool parseValue( xmlreader::Span const & text, css::uno::Sequence< sal_Int8 > * value) { - assert(text.is() && value != 0); + assert(text.is() && value != nullptr); if ((text.length & 1) != 0) { return false; } @@ -345,7 +345,7 @@ bool ValueParser::endElement() { switch (state_) { case STATE_TEXT: { - css::uno::Any *pValue = NULL; + css::uno::Any *pValue = nullptr; switch (node_->kind()) { case Node::KIND_PROPERTY: diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index d56b284004e1..0824bae736a7 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -77,7 +77,7 @@ OString convertToUtf8( } // anonymous namespace TempFile::~TempFile() { - if (handle != 0) { + if (handle != nullptr) { if (!closed) { oslFileError e = osl_closeFile(handle); if (e != osl_File_E_None) { @@ -119,7 +119,7 @@ void TempFile::closeAndRename(const OUString &_url) { throw css::uno::RuntimeException( "cannot move " + url); } - handle = 0; + handle = nullptr; } oslFileError TempFile::flush() { diff --git a/configmgr/source/writemodfile.hxx b/configmgr/source/writemodfile.hxx index ffd1fda316cd..caa9eee8b69a 100644 --- a/configmgr/source/writemodfile.hxx +++ b/configmgr/source/writemodfile.hxx @@ -34,7 +34,7 @@ struct TempFile { bool closed; OStringBuffer buffer; - TempFile(): handle(0), closed(false) {} + TempFile(): handle(nullptr), closed(false) {} ~TempFile(); void closeAndRename(const OUString &url); oslFileError flush(); diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 11502e347f2d..c98067b9d304 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -106,7 +106,7 @@ bool XcdParser::startElement( } if ((processedDependencies_.find(dependencyFile_) == processedDependencies_.end()) && - (!dependencyOptional_ || existingDependencies == 0 || + (!dependencyOptional_ || existingDependencies == nullptr || (existingDependencies->find(dependencyFile_) != existingDependencies->end()))) { @@ -130,7 +130,7 @@ bool XcdParser::startElement( if (nsId == ParseManager::NAMESPACE_OOR && name.equals("component-data")) { - nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0); + nestedParser_ = new XcuParser(layer_ + 1, data_, nullptr, nullptr, nullptr); nesting_ = 1; return nestedParser_->startElement( reader, nsId, name, existingDependencies); diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index 46e04dc10ca5..844a69136a34 100644 --- a/configmgr/source/xcsparser.cxx +++ b/configmgr/source/xcsparser.cxx @@ -411,7 +411,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { data_.getTemplate( valueParser_.getLayer(), xmldata::parseTemplateReference( - component, hasNodeType, nodeType, 0))); + component, hasNodeType, nodeType, nullptr))); if (!tmpl.is()) { //TODO: this can erroneously happen as long as import/uses attributes // are not correctly processed @@ -571,7 +571,7 @@ void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) { new SetNode( valueParser_.getLayer(), xmldata::parseTemplateReference( - component, hasNodeType, nodeType, 0), + component, hasNodeType, nodeType, nullptr), isTemplate ? name : OUString()), name)); } @@ -598,7 +598,7 @@ void XcsParser::handleSetItem(xmlreader::XmlReader & reader, SetNode * set) { } } set->getAdditionalTemplateNames().push_back( - xmldata::parseTemplateReference(component, hasNodeType, nodeType, 0)); + xmldata::parseTemplateReference(component, hasNodeType, nodeType, nullptr)); elements_.push(Element(rtl::Reference< Node >(), "")); } diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index abbae1697b7c..4d239ab4f1f9 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -61,7 +61,7 @@ XcuParser::XcuParser( partial_(partial), broadcastModifications_(broadcastModifications), additions_(additions), recordModifications_(layer == Data::NO_LAYER), trackPath_( - partial_ != 0 || broadcastModifications_ != 0 || additions_ != 0 || + partial_ != nullptr || broadcastModifications_ != nullptr || additions_ != nullptr || recordModifications_) {} @@ -284,7 +284,7 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { if (trackPath_) { assert(path_.empty()); path_.push_back(componentName_); - if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) + if (partial_ != nullptr && partial_->contains(path_) == Partial::CONTAINS_NOT) { state_.push(State::Ignore(true)); return; @@ -340,7 +340,7 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { int finalizedLayer; rtl::Reference< Node > node( data_.resolvePathRepresentation( - path, 0, &path_, &finalizedLayer)); + path, nullptr, &path_, &finalizedLayer)); if (!node.is()) { SAL_WARN( "configmgr", @@ -351,7 +351,7 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { assert(!path_.empty()); componentName_ = path_.front(); if (trackPath_) { - if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) + if (partial_ != nullptr && partial_->contains(path_) == Partial::CONTAINS_NOT) { state_.push(State::Ignore(true)); return; @@ -494,7 +494,7 @@ void XcuParser::handleLocpropValue( } if (trackPath_) { path_.push_back(name); - if (partial_ != 0 && + if (partial_ != nullptr && partial_->contains(path_) != Partial::CONTAINS_NODE) { state_.push(State::Ignore(true)); @@ -592,7 +592,7 @@ void XcuParser::handleGroupProp( path_.push_back(name); //TODO: This ignores locprop values for which specific include paths // exist (i.e., for which contains(locprop path) = CONTAINS_SUBNODES): - if (partial_ != 0 && + if (partial_ != nullptr && partial_->contains(path_) != Partial::CONTAINS_NODE) { state_.push(State::Ignore(true)); @@ -781,7 +781,7 @@ void XcuParser::handleGroupNode( } if (trackPath_) { path_.push_back(name); - if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) + if (partial_ != nullptr && partial_->contains(path_) == Partial::CONTAINS_NOT) { state_.push(State::Ignore(true)); return; @@ -864,7 +864,7 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { } if (trackPath_) { path_.push_back(name); - if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) + if (partial_ != nullptr && partial_->contains(path_) == Partial::CONTAINS_NOT) { state_.push(State::Ignore(true)); return; @@ -960,10 +960,10 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { } void XcuParser::recordModification(bool addition) { - if (broadcastModifications_ != 0) { + if (broadcastModifications_ != nullptr) { broadcastModifications_->add(path_); } - if (addition && additions_ != 0) { + if (addition && additions_ != nullptr) { additions_->push_back(path_); } if (recordModifications_) { diff --git a/configmgr/source/xmldata.cxx b/configmgr/source/xmldata.cxx index 95a7891bef70..ac7170682d94 100644 --- a/configmgr/source/xmldata.cxx +++ b/configmgr/source/xmldata.cxx @@ -163,7 +163,7 @@ OUString parseTemplateReference( OUString const & nodeType, OUString const * defaultTemplateName) { if (!hasNodeType) { - if (defaultTemplateName != 0) { + if (defaultTemplateName != nullptr) { return *defaultTemplateName; } throw css::uno::RuntimeException( -- cgit