diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-11-29 11:54:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-11-29 13:12:20 +0100 |
commit | 048a25b4c89cb33bbdc72c0525418891c08a6acb (patch) | |
tree | 04c16e90cefdd78cf41f5abccfbaea1d332b8ce5 | |
parent | f1074136f5ac1d4dd2b2bbdd84c779e90d4f0a22 (diff) |
Adapted to new assertion/logging mechanisms.
-rw-r--r-- | configmgr/source/access.cxx | 150 | ||||
-rw-r--r-- | configmgr/source/access.hxx | 2 | ||||
-rw-r--r-- | configmgr/source/childaccess.cxx | 31 | ||||
-rw-r--r-- | configmgr/source/components.cxx | 95 | ||||
-rw-r--r-- | configmgr/source/configurationprovider.cxx | 4 | ||||
-rw-r--r-- | configmgr/source/configurationregistry.cxx | 5 | ||||
-rw-r--r-- | configmgr/source/data.cxx | 21 | ||||
-rw-r--r-- | configmgr/source/node.cxx | 9 | ||||
-rw-r--r-- | configmgr/source/nodemap.cxx | 4 | ||||
-rw-r--r-- | configmgr/source/parsemanager.cxx | 11 | ||||
-rw-r--r-- | configmgr/source/partial.cxx | 4 | ||||
-rw-r--r-- | configmgr/source/propertynode.cxx | 5 | ||||
-rw-r--r-- | configmgr/source/rootaccess.cxx | 40 | ||||
-rw-r--r-- | configmgr/source/services.cxx | 5 | ||||
-rw-r--r-- | configmgr/source/type.cxx | 7 | ||||
-rw-r--r-- | configmgr/source/valueparser.cxx | 33 | ||||
-rw-r--r-- | configmgr/source/writemodfile.cxx | 49 | ||||
-rw-r--r-- | configmgr/source/xcsparser.cxx | 18 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 73 | ||||
-rw-r--r-- | configmgr/source/xmldata.cxx | 6 |
20 files changed, 282 insertions, 290 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 41bed3e09c9a..dab5e21c62fd 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <vector> #include "com/sun/star/beans/Property.hpp" @@ -80,7 +81,6 @@ #include "cppu/unotype.hxx" #include "cppuhelper/queryinterface.hxx" #include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" #include "osl/interlck.h" #include "osl/mutex.hxx" #include "rtl/ref.hxx" @@ -137,14 +137,14 @@ bool Access::isValue() { } void Access::markChildAsModified(rtl::Reference< ChildAccess > const & child) { - OSL_ASSERT(child.is() && child->getParentAccess() == this); + assert(child.is() && child->getParentAccess() == this); modifiedChildren_[child->getNameInternal()] = ModifiedChild(child, true); for (rtl::Reference< Access > p(this);;) { rtl::Reference< Access > parent(p->getParentAccess()); if (!parent.is()) { break; } - OSL_ASSERT(dynamic_cast< ChildAccess * >(p.get()) != 0); + assert(dynamic_cast< ChildAccess * >(p.get()) != 0); parent->modifiedChildren_.insert( ModifiedChildren::value_type( p->getNameInternal(), @@ -172,7 +172,7 @@ Access::Access(Components & components): Access::~Access() {} void Access::initDisposeBroadcaster(Broadcaster * broadcaster) { - OSL_ASSERT(broadcaster != 0); + assert(broadcaster != 0); for (DisposeListeners::iterator i(disposeListeners_.begin()); i != disposeListeners_.end(); ++i) { @@ -337,7 +337,7 @@ std::vector< rtl::Reference< ChildAccess > > Access::getAllChildren() { for (NodeMap::iterator i(members.begin()); i != members.end(); ++i) { if (modifiedChildren_.find(i->first) == modifiedChildren_.end()) { vec.push_back(getUnmodifiedChild(i->first)); - OSL_ASSERT(vec.back().is()); + assert(vec.back().is()); } } for (ModifiedChildren::iterator i(modifiedChildren_.begin()); @@ -355,7 +355,7 @@ void Access::checkValue(css::uno::Any const & value, Type type, bool nillable) { bool ok; switch (type) { case TYPE_NIL: - OSL_ASSERT(false); + assert(false); // fall through (cannot happen) case TYPE_ERROR: ok = false; @@ -363,7 +363,7 @@ void Access::checkValue(css::uno::Any const & value, Type type, bool nillable) { case TYPE_ANY: switch (getDynamicType(value)) { case TYPE_ANY: - OSL_ASSERT(false); + assert(false); // fall through (cannot happen) case TYPE_ERROR: ok = false; @@ -393,7 +393,7 @@ void Access::insertLocalizedValueChild( rtl::OUString const & name, css::uno::Any const & value, Modifications * localModifications) { - OSL_ASSERT(localModifications != 0); + assert(localModifications != 0); LocalizedPropertyNode * locprop = dynamic_cast< LocalizedPropertyNode * >( getNode().get()); checkValue(value, locprop->getStaticType(), locprop->isNillable()); @@ -408,7 +408,7 @@ void Access::insertLocalizedValueChild( void Access::reportChildChanges( std::vector< css::util::ElementChange > * changes) { - OSL_ASSERT(changes != 0); + assert(changes != 0); for (ModifiedChildren::iterator i(modifiedChildren_.begin()); i != modifiedChildren_.end(); ++i) { @@ -426,7 +426,7 @@ void Access::reportChildChanges( void Access::commitChildChanges( bool valid, Modifications * globalModifications) { - OSL_ASSERT(globalModifications != 0); + assert(globalModifications != 0); while (!modifiedChildren_.empty()) { bool childValid = valid; ModifiedChildren::iterator i(modifiedChildren_.begin()); @@ -478,7 +478,7 @@ void Access::initBroadcasterAndChanges( Modifications::Node const & modifications, Broadcaster * broadcaster, std::vector< css::util::ElementChange > * allChanges) { - OSL_ASSERT(broadcaster != 0); + assert(broadcaster != 0); comphelper::SequenceAsVector< css::beans::PropertyChangeEvent > propChanges; bool collectPropChanges = !propertiesChangeListeners_.empty(); for (Modifications::Node::Children::const_iterator i( @@ -563,8 +563,7 @@ void Access::initBroadcasterAndChanges( // else: spurious Modifications::Node not representing a change break; case Node::KIND_LOCALIZED_VALUE: - OSL_ASSERT( - Components::allLocales(getRootAccess()->getLocale())); + assert(Components::allLocales(getRootAccess()->getLocale())); for (ContainerListeners::iterator j( containerListeners_.begin()); j != containerListeners_.end(); ++j) @@ -585,7 +584,7 @@ void Access::initBroadcasterAndChanges( child->asValue(), css::uno::Any())); //TODO: non-void ReplacedElement } - OSL_ASSERT(!collectPropChanges); + assert(!collectPropChanges); break; case Node::KIND_PROPERTY: { @@ -688,8 +687,7 @@ void Access::initBroadcasterAndChanges( switch (getNode()->kind()) { case Node::KIND_LOCALIZED_PROPERTY: // Removed localized property value: - OSL_ASSERT( - Components::allLocales(getRootAccess()->getLocale())); + assert(Components::allLocales(getRootAccess()->getLocale())); for (ContainerListeners::iterator j( containerListeners_.begin()); j != containerListeners_.end(); ++j) @@ -717,7 +715,7 @@ void Access::initBroadcasterAndChanges( css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement } - OSL_ASSERT(!collectPropChanges); + assert(!collectPropChanges); break; case Node::KIND_GROUP: { @@ -820,7 +818,7 @@ void Access::initBroadcasterAndChanges( // else: spurious Modifications::Node not representing a change break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } @@ -851,7 +849,7 @@ Access::ModifiedChild::ModifiedChild( css::uno::Sequence< css::uno::Type > Access::getTypes() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); comphelper::SequenceAsVector< css::uno::Type > types; @@ -900,7 +898,7 @@ css::uno::Sequence< css::uno::Type > Access::getTypes() css::uno::Sequence< sal_Int8 > Access::getImplementationId() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return css::uno::Sequence< sal_Int8 >(); @@ -908,7 +906,7 @@ css::uno::Sequence< sal_Int8 > Access::getImplementationId() rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return rtl::OUString( @@ -918,7 +916,7 @@ rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException) sal_Bool Access::supportsService(rtl::OUString const & ServiceName) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); css::uno::Sequence< rtl::OUString > names(getSupportedServiceNames()); @@ -933,7 +931,7 @@ sal_Bool Access::supportsService(rtl::OUString const & ServiceName) css::uno::Sequence< rtl::OUString > Access::getSupportedServiceNames() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); comphelper::SequenceAsVector< rtl::OUString > services; @@ -995,7 +993,7 @@ css::uno::Sequence< rtl::OUString > Access::getSupportedServiceNames() } void Access::dispose() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1021,7 +1019,7 @@ void Access::addEventListener( css::uno::Reference< css::lang::XEventListener > const & xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); { osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); @@ -1045,7 +1043,7 @@ void Access::removeEventListener( css::uno::Reference< css::lang::XEventListener > const & aListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); DisposeListeners::iterator i(disposeListeners_.find(aListener)); @@ -1055,7 +1053,7 @@ void Access::removeEventListener( } css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); rtl::Reference< Node > p(getNode()); @@ -1071,7 +1069,7 @@ css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) { case Node::KIND_SET: return cppu::UnoType< cppu::UnoVoidType >::get(); //TODO: correct? default: - OSL_ASSERT(false); + assert(false); throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), static_cast< cppu::OWeakObject * >(this)); @@ -1079,7 +1077,7 @@ css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) { } sal_Bool Access::hasElements() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return !getAllChildren().empty(); //TODO: optimize @@ -1090,7 +1088,7 @@ css::uno::Any Access::getByName(rtl::OUString const & aName) css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); rtl::Reference< ChildAccess > child(getChild(aName)); @@ -1104,7 +1102,7 @@ css::uno::Any Access::getByName(rtl::OUString const & aName) css::uno::Sequence< rtl::OUString > Access::getElementNames() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); @@ -1121,7 +1119,7 @@ css::uno::Sequence< rtl::OUString > Access::getElementNames() sal_Bool Access::hasByName(rtl::OUString const & aName) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return getChild(aName).is(); @@ -1130,7 +1128,7 @@ sal_Bool Access::hasByName(rtl::OUString const & aName) css::uno::Any Access::getByHierarchicalName(rtl::OUString const & aName) throw (css::container::NoSuchElementException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); rtl::Reference< ChildAccess > child(getSubChild(aName)); @@ -1144,7 +1142,7 @@ css::uno::Any Access::getByHierarchicalName(rtl::OUString const & aName) sal_Bool Access::hasByHierarchicalName(rtl::OUString const & aName) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return getSubChild(aName).is(); @@ -1154,7 +1152,7 @@ void Access::addContainerListener( css::uno::Reference< css::container::XContainerListener > const & xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); { osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); @@ -1178,7 +1176,7 @@ void Access::removeContainerListener( css::uno::Reference< css::container::XContainerListener > const & xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); ContainerListeners::iterator i(containerListeners_.find(xListener)); @@ -1190,7 +1188,7 @@ void Access::removeContainerListener( rtl::OUString Access::getExactName(rtl::OUString const & aApproximateName) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return aApproximateName; @@ -1199,7 +1197,7 @@ rtl::OUString Access::getExactName(rtl::OUString const & aApproximateName) css::uno::Sequence< css::beans::Property > Access::getProperties() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); comphelper::SequenceAsVector< css::beans::Property > properties; @@ -1215,7 +1213,7 @@ css::uno::Sequence< css::beans::Property > Access::getProperties() css::beans::Property Access::getPropertyByName(rtl::OUString const & aName) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); rtl::Reference< ChildAccess > child(getChild(aName)); if (!child.is()) { @@ -1228,13 +1226,13 @@ css::beans::Property Access::getPropertyByName(rtl::OUString const & aName) sal_Bool Access::hasPropertyByName(rtl::OUString const & Name) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); return getChild(Name).is(); } rtl::OUString Access::getHierarchicalName() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); // For backwards compatibility, return an absolute path representation where @@ -1258,7 +1256,7 @@ rtl::OUString Access::composeHierarchicalName( css::lang::IllegalArgumentException, css::lang::NoSupportException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); if (aRelativeName.getLength() == 0 || aRelativeName[0] == '/') { @@ -1278,7 +1276,7 @@ rtl::OUString Access::composeHierarchicalName( } rtl::OUString Access::getName() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return getNameInternal(); @@ -1287,7 +1285,7 @@ rtl::OUString Access::getName() throw (css::uno::RuntimeException) { void Access::setName(rtl::OUString const & aName) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1343,7 +1341,7 @@ void Access::setName(rtl::OUString const & aName) "configmgr setName inappropriate node")), static_cast< cppu::OWeakObject * >(this)); default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); @@ -1353,7 +1351,7 @@ void Access::setName(rtl::OUString const & aName) css::beans::Property Access::getAsProperty() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return asProperty(); @@ -1362,7 +1360,7 @@ css::beans::Property Access::getAsProperty() throw (css::uno::RuntimeException) css::uno::Reference< css::beans::XPropertySetInfo > Access::getPropertySetInfo() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); return this; } @@ -1373,7 +1371,7 @@ void Access::setPropertyValue( css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1399,7 +1397,7 @@ css::uno::Any Access::getPropertyValue(rtl::OUString const & PropertyName) css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); rtl::Reference< ChildAccess > child(getChild(PropertyName)); if (!child.is()) { @@ -1417,7 +1415,7 @@ void Access::addPropertyChangeListener( css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); { osl::MutexGuard g(*lock_); if (!xListener.is()) { @@ -1445,7 +1443,7 @@ void Access::removePropertyChangeListener( css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); checkKnownProperty(aPropertyName); PropertyChangeListeners::iterator i( @@ -1469,7 +1467,7 @@ void Access::addVetoableChangeListener( css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); { osl::MutexGuard g(*lock_); if (!aListener.is()) { @@ -1498,7 +1496,7 @@ void Access::removeVetoableChangeListener( css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); checkKnownProperty(PropertyName); VetoableChangeListeners::iterator i( @@ -1521,7 +1519,7 @@ void Access::setPropertyValues( css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1560,7 +1558,7 @@ css::uno::Sequence< css::uno::Any > Access::getPropertyValues( css::uno::Sequence< rtl::OUString > const & aPropertyNames) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength()); for (sal_Int32 i = 0; i < aPropertyNames.getLength(); ++i) { @@ -1584,7 +1582,7 @@ void Access::addPropertiesChangeListener( xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); { osl::MutexGuard g(*lock_); if (!xListener.is()) { @@ -1608,7 +1606,7 @@ void Access::removePropertiesChangeListener( xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); PropertiesChangeListeners::iterator i( propertiesChangeListeners_.find(xListener)); @@ -1623,7 +1621,7 @@ void Access::firePropertiesChangeEvent( xListener) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); css::uno::Sequence< css::beans::PropertyChangeEvent > events( aPropertyNames.getLength()); for (sal_Int32 i = 0; i < events.getLength(); ++i) { @@ -1637,7 +1635,7 @@ void Access::firePropertiesChangeEvent( css::uno::Reference< css::beans::XHierarchicalPropertySetInfo > Access::getHierarchicalPropertySetInfo() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); return this; } @@ -1649,7 +1647,7 @@ void Access::setHierarchicalPropertyValue( css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1683,7 +1681,7 @@ css::uno::Any Access::getHierarchicalPropertyValue( css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalPropertyName)); if (!child.is()) { @@ -1701,7 +1699,7 @@ void Access::setHierarchicalPropertyValues( css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1747,7 +1745,7 @@ css::uno::Sequence< css::uno::Any > Access::getHierarchicalPropertyValues( css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); css::uno::Sequence< css::uno::Any > vals( aHierarchicalPropertyNames.getLength()); @@ -1771,7 +1769,7 @@ css::beans::Property Access::getPropertyByHierarchicalName( rtl::OUString const & aHierarchicalName) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalName)); if (!child.is()) { @@ -1785,7 +1783,7 @@ sal_Bool Access::hasPropertyByHierarchicalName( rtl::OUString const & aHierarchicalName) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_GROUP)); + assert(thisIs(IS_GROUP)); osl::MutexGuard g(*lock_); return getSubChild(aHierarchicalName).is(); } @@ -1797,7 +1795,7 @@ void Access::replaceByName( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_UPDATE)); + assert(thisIs(IS_UPDATE)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1826,7 +1824,7 @@ void Access::replaceByName( } break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); @@ -1841,7 +1839,7 @@ void Access::insertByName( css::container::ElementExistException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_EXTENSIBLE|IS_UPDATE)); + assert(thisIs(IS_EXTENSIBLE|IS_UPDATE)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1878,7 +1876,7 @@ void Access::insertByName( } break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); @@ -1891,7 +1889,7 @@ void Access::removeByName(rtl::OUString const & aName) css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_EXTENSIBLE|IS_UPDATE)); + assert(thisIs(IS_EXTENSIBLE|IS_UPDATE)); Broadcaster bc; { osl::MutexGuard g(*lock_); @@ -1926,7 +1924,7 @@ void Access::removeByName(rtl::OUString const & aName) css::uno::Reference< css::uno::XInterface > Access::createInstance() throw (css::uno::Exception, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_SET|IS_UPDATE)); + assert(thisIs(IS_SET|IS_UPDATE)); rtl::OUString tmplName( dynamic_cast< SetNode * >(getNode().get())->getDefaultTemplateName()); rtl::Reference< Node > tmpl( @@ -1947,7 +1945,7 @@ css::uno::Reference< css::uno::XInterface > Access::createInstanceWithArguments( css::uno::Sequence< css::uno::Any > const & aArguments) throw (css::uno::Exception, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_SET|IS_UPDATE)); + assert(thisIs(IS_SET|IS_UPDATE)); if (aArguments.getLength() != 0) { throw css::uno::Exception( rtl::OUString( @@ -1971,7 +1969,7 @@ rtl::Reference< ChildAccess > Access::getModifiedChild( rtl::Reference< ChildAccess > Access::getUnmodifiedChild( rtl::OUString const & name) { - OSL_ASSERT(modifiedChildren_.find(name) == modifiedChildren_.end()); + assert(modifiedChildren_.find(name) == modifiedChildren_.end()); rtl::Reference< Node > node(getNode()->getMember(name)); if (!node.is()) { return rtl::Reference< ChildAccess >(); @@ -2078,7 +2076,7 @@ bool Access::setChildProperty( rtl::OUString const & name, css::uno::Any const & value, Modifications * localModifications) { - OSL_ASSERT(localModifications != 0); + assert(localModifications != 0); rtl::Reference< ChildAccess > child(getChild(name)); if (!child.is()) { return false; @@ -2201,7 +2199,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember( "configmgr inappropriate set element")), static_cast< cppu::OWeakObject * >(this), 1); } - OSL_ASSERT(dynamic_cast< SetNode * >(getNode().get()) != 0); + assert(dynamic_cast< SetNode * >(getNode().get()) != 0); if (!dynamic_cast< SetNode * >(getNode().get())->isValidTemplate( freeAcc->getNode()->getTemplateName())) { @@ -2224,7 +2222,7 @@ rtl::Reference< Access > Access::getNotificationRoot() { } } -#if OSL_DEBUG_LEVEL > 0 +#if !defined NDEBUG bool Access::thisIs(int what) { osl::MutexGuard g(*lock_); rtl::Reference< Node > p(getNode()); diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index bf314f2f6aca..d2409cbb2f1d 100644 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx @@ -564,7 +564,7 @@ private: boost::shared_ptr<osl::Mutex> lock_; -#if OSL_DEBUG_LEVEL > 0 +#if !defined NDEBUG protected: enum { IS_ANY = 0, IS_GROUP = 0x01, IS_SET = 0x02, IS_EXTENSIBLE = 0x04, diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index 1471358f870c..a9c41d2e0ac2 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <vector> #include "com/sun/star/container/XChild.hpp" @@ -43,7 +44,6 @@ #include "cppuhelper/queryinterface.hxx" #include "cppuhelper/weak.hxx" #include "comphelper/servicehelper.hxx" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" @@ -94,7 +94,7 @@ ChildAccess::ChildAccess( inTransaction_(false) { lock_ = lock(); - OSL_ASSERT(root.is() && parent.is() && node.is()); + assert(root.is() && parent.is() && node.is()); } ChildAccess::ChildAccess( @@ -103,11 +103,11 @@ ChildAccess::ChildAccess( Access(components), root_(root), node_(node), inTransaction_(false) { lock_ = lock(); - OSL_ASSERT(root.is() && node.is()); + assert(root.is() && node.is()); } Path ChildAccess::getAbsolutePath() { - OSL_ASSERT(getParentAccess().is()); + assert(getParentAccess().is()); Path path(getParentAccess()->getAbsolutePath()); path.push_back(name_); return path; @@ -168,7 +168,7 @@ void ChildAccess::release() throw () { css::uno::Reference< css::uno::XInterface > ChildAccess::getParent() throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return static_cast< cppu::OWeakObject * >(parent_.get()); @@ -177,7 +177,7 @@ css::uno::Reference< css::uno::XInterface > ChildAccess::getParent() void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &) throw (css::lang::NoSupportException, css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); throw css::lang::NoSupportException( @@ -189,7 +189,7 @@ sal_Int64 ChildAccess::getSomething( css::uno::Sequence< sal_Int8 > const & aIdentifier) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return aIdentifier == getTunnelId() @@ -201,15 +201,14 @@ void ChildAccess::bind( rtl::Reference< Access > const & parent, rtl::OUString const & name) throw () { - OSL_ASSERT( - !parent_.is() && root.is() && parent.is() && name.getLength() != 0); + assert(!parent_.is() && root.is() && parent.is() && name.getLength() != 0); root_ = root; parent_ = parent; name_ = name; } void ChildAccess::unbind() throw () { - OSL_ASSERT(parent_.is()); + assert(parent_.is()); parent_->releaseChild(name_); parent_.clear(); inTransaction_ = true; @@ -226,7 +225,7 @@ void ChildAccess::setNode(rtl::Reference< Node > const & node) { void ChildAccess::setProperty( css::uno::Any const & value, Modifications * localModifications) { - OSL_ASSERT(localModifications != 0); + assert(localModifications != 0); Type type = TYPE_ERROR; bool nillable = false; switch (node_->kind()) { @@ -366,7 +365,7 @@ css::uno::Any ChildAccess::asValue() { void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) { - OSL_ASSERT(globalModifications != 0); + assert(globalModifications != 0); commitChildChanges(valid, globalModifications); if (valid && changedValue_.get() != 0) { Path path(getAbsolutePath()); @@ -382,7 +381,7 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) Data::NO_LAYER, *changedValue_); break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } @@ -397,7 +396,7 @@ ChildAccess::~ChildAccess() { } void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const { - OSL_ASSERT(types != 0); + assert(types != 0); types->push_back(cppu::UnoType< css::container::XChild >::get()); types->push_back(cppu::UnoType< css::lang::XUnoTunnel >::get()); } @@ -405,7 +404,7 @@ void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const { void ChildAccess::addSupportedServiceNames( std::vector< rtl::OUString > * services) { - OSL_ASSERT(services != 0); + assert(services != 0); services->push_back( getParentNode()->kind() == Node::KIND_GROUP ? rtl::OUString( @@ -419,7 +418,7 @@ void ChildAccess::addSupportedServiceNames( css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType) throw (css::uno::RuntimeException) { - OSL_ASSERT(thisIs(IS_ANY)); + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); css::uno::Any res(Access::queryInterface(aType)); diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 611eebc3bb12..48d555e3236e 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -29,6 +29,7 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> #include <cstddef> #include <list> @@ -45,18 +46,18 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "osl/conditn.hxx" -#include "osl/diagnose.h" #include "osl/file.hxx" #include "osl/mutex.hxx" #include "osl/thread.hxx" #include "rtl/bootstrap.hxx" #include "rtl/logfile.h" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" -#include "rtl/textenc.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "rtl/instance.hxx" +#include "sal/log.hxx" #include "sal/types.h" #include "salhelper/simplereferenceobject.hxx" @@ -99,11 +100,12 @@ void parseXcsFile( SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { - OSL_ASSERT(partial == 0 && modifications == 0 && additions == 0); + assert(partial == 0 && modifications == 0 && additions == 0); (void) partial; (void) modifications; (void) additions; - OSL_VERIFY( - rtl::Reference< ParseManager >( - new ParseManager(url, new XcsParser(layer, data)))->parse()); + bool ok = rtl::Reference< ParseManager >( + new ParseManager(url, new XcsParser(layer, data)))->parse(); + assert(ok); + (void) ok; // avoid warnings } void parseXcuFile( @@ -112,13 +114,13 @@ void parseXcuFile( SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { - OSL_VERIFY( - rtl::Reference< ParseManager >( - new ParseManager( - url, - new XcuParser( - layer, data, partial, modifications, additions)))-> - parse()); + bool ok = rtl::Reference< ParseManager >( + new ParseManager( + url, + new XcuParser(layer, data, partial, modifications, additions)))-> + parse(); + assert(ok); + (void) ok; // avoid warnings } rtl::OUString expand(rtl::OUString const & str) { @@ -128,7 +130,7 @@ rtl::OUString expand(rtl::OUString const & str) { } bool canRemoveFromLayer(int layer, rtl::Reference< Node > const & node) { - OSL_ASSERT(node.is()); + assert(node.is()); if (node->getLayer() > layer && node->getLayer() < Data::NO_LAYER) { return false; } @@ -189,7 +191,7 @@ Components::WriteThread::WriteThread( reference_(reference), components_(components), url_(url), data_(data) { lock_ = lock(); - OSL_ASSERT(reference != 0); + assert(reference != 0); acquire(); } @@ -201,11 +203,10 @@ void Components::WriteThread::run() { try { writeModFile(components_, url_, data_); } catch (css::uno::RuntimeException & e) { - // Silently ignore write errors, instead of aborting: - OSL_TRACE( - "configmgr error writing modifications: %s", - rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_UTF8).getStr()); + // Ignore write errors, instead of aborting: + SAL_WARN( + "configmgr", + "error writing modifications: \"" << e.Message << '"'); } } catch (...) { reference_->clear(); @@ -225,7 +226,7 @@ class theComponentsSingleton : Components & Components::getSingleton( css::uno::Reference< css::uno::XComponentContext > const & context) { - OSL_ASSERT(context.is()); + assert(context.is()); return theComponentsSingleton::get(context); } @@ -344,7 +345,7 @@ void Components::insertExtensionXcsFile( void Components::insertExtensionXcuFile( bool shared, rtl::OUString const & fileUri, Modifications * modifications) { - OSL_ASSERT(modifications != 0); + assert(modifications != 0); int layer = getExtensionLayer(shared) + 1; Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer); try { @@ -376,7 +377,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. - OSL_ASSERT(modifications != 0); + assert(modifications != 0); rtl::Reference< Data::ExtensionXcu > item( data_.removeExtensionXcuAdditions(fileUri)); if (item.is()) { @@ -395,9 +396,9 @@ void Components::removeExtensionXcuFile( map = &node->getMembers(); } if (node.is()) { - OSL_ASSERT(parent.is()); + assert(parent.is()); if (parent->kind() == Node::KIND_SET) { - OSL_ASSERT( + assert( node->kind() == Node::KIND_GROUP || node->kind() == Node::KIND_SET); if (canRemoveFromLayer(item->layer, node)) { @@ -418,17 +419,17 @@ void Components::insertModificationXcuFile( std::set< rtl::OUString > const & excludedPaths, Modifications * modifications) { - OSL_ASSERT(modifications != 0); + assert(modifications != 0); Partial part(includedPaths, excludedPaths); try { parseFileLeniently( &parseXcuFile, fileUri, Data::NO_LAYER, data_, &part, modifications, 0); } catch (css::container::NoSuchElementException & e) { - OSL_TRACE( - "configmgr error inserting non-existing %s: %s", - rtl::OUStringToOString(fileUri, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "error inserting non-existing \"" << fileUri << "\": \"" + << e.Message << '"'); } } @@ -458,11 +459,10 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue( } catch (css::uno::Exception & e) { // Assuming these exceptions indicate that the service is not // installed: - OSL_TRACE( - "createInstance(%s) failed with %s", - rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "createInstance(" << name << ") failed with \"" << e.Message + << '"'); } css::uno::Reference< css::beans::XPropertySet > propset; if (service.is()) { @@ -508,7 +508,7 @@ Components::Components( css::uno::Reference< css::uno::XComponentContext > const & context): context_(context), sharedExtensionLayer_(-1), userExtensionLayer_(-1) { - OSL_ASSERT(context.is()); + assert(context.is()); lock_ = lock(); rtl::OUString conf( expand( @@ -624,18 +624,17 @@ void Components::parseFileLeniently( Partial const * partial, Modifications * modifications, Additions * additions) { - OSL_ASSERT(parseFile != 0); + assert(parseFile != 0); try { (*parseFile)(url, layer, data, partial, modifications, additions); } catch (css::container::NoSuchElementException &) { throw; } catch (css::uno::Exception & e) { //TODO: more specific exception catching - // Silently ignore invalid XML files, instead of completely preventing - // OOo from starting: - OSL_TRACE( - "configmgr error reading %s: %s", - rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + // Ignore invalid XML files, instead of completely preventing OOo from + // starting: + SAL_WARN( + "configmgr", + "error reading \"" << url << "\": \"" << e.Message << '"'); } } @@ -720,10 +719,8 @@ void Components::parseFileList( try { parseFileLeniently(parseFile, url, layer, data_, 0, 0, adds); } catch (css::container::NoSuchElementException & e) { - OSL_TRACE( - "configmgr file does not exist: %s", - rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", "file does not exist: \"" << e.Message << '"'); if (adds != 0) { data_.removeExtensionXcuAdditions(url); } @@ -874,8 +871,8 @@ void Components::parseModificationLayer(rtl::OUString const & url) { try { parseFileLeniently(&parseXcuFile, url, Data::NO_LAYER, data_, 0, 0, 0); } catch (css::container::NoSuchElementException &) { - OSL_TRACE( - "configmgr user registrymodifications.xcu does not (yet) exist"); + SAL_INFO( + "configmgr", "user registrymodifications.xcu does not (yet) exist"); // Migrate old user layer data (can be removed once migration is no // longer relevant, probably OOo 4; also see hack for xsi namespace in // xmlreader::XmlReader::registerNamespaceIri): diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index 787d670bd207..952db7a2d2cf 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <vector> #include "boost/noncopyable.hpp" @@ -58,7 +59,6 @@ #include "cppuhelper/implbase2.hxx" #include "cppuhelper/interfacecontainer.hxx" #include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "sal/types.h" #include "rtl/ref.hxx" @@ -109,7 +109,7 @@ public: locale_(locale) { lock_ = lock(); - OSL_ASSERT(context.is()); + assert(context.is()); } private: diff --git a/configmgr/source/configurationregistry.cxx b/configmgr/source/configurationregistry.cxx index 4830e1b0942f..61d1f2b031d9 100644 --- a/configmgr/source/configurationregistry.cxx +++ b/configmgr/source/configurationregistry.cxx @@ -26,6 +26,8 @@ #include "sal/config.h" +#include <cassert> + #include "boost/noncopyable.hpp" #include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/beans/Property.hpp" @@ -58,7 +60,6 @@ #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase3.hxx" #include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -326,7 +327,7 @@ private: Service::Service( css::uno::Reference< css::uno::XComponentContext > const & context) { - OSL_ASSERT(context.is()); + assert(context.is()); try { provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >( (css::uno::Reference< css::lang::XMultiComponentFactory >( diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index cdf4ee13d312..0fdc1e5eba92 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -29,17 +29,18 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" -#include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "sal/log.hxx" #include "sal/types.h" #include "additions.hxx" @@ -59,7 +60,7 @@ bool decode( rtl::OUString const & encoded, sal_Int32 begin, sal_Int32 end, rtl::OUString * decoded) { - OSL_ASSERT( + assert( begin >= 0 && begin <= end && end <= encoded.getLength() && decoded != 0); rtl::OUStringBuffer buf; @@ -83,7 +84,7 @@ bool decode( } else { return false; } - OSL_ASSERT(begin <= end); + assert(begin <= end); } else { buf.append(c); } @@ -128,7 +129,7 @@ sal_Int32 Data::parseSegment( rtl::OUString const & path, sal_Int32 index, rtl::OUString * name, bool * setElement, rtl::OUString * templateName) { - OSL_ASSERT( + assert( index >= 0 && index <= path.getLength() && name != 0 && setElement != 0); sal_Int32 i = index; @@ -187,7 +188,7 @@ bool Data::equalTemplateNames( { if (shortName.indexOf(':') == -1) { sal_Int32 i = longName.indexOf(':') + 1; - OSL_ASSERT(i > 0); + assert(i > 0); return rtl_ustr_compare_WithLength( shortName.getStr(), shortName.getLength(), @@ -308,7 +309,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( css::uno::Reference< css::uno::XInterface >()); } if (templateName.getLength() != 0 && p != 0) { - OSL_ASSERT(p->getTemplateName().getLength() != 0); + assert(p->getTemplateName().getLength() != 0); if (!equalTemplateNames(templateName, p->getTemplateName())) { throw css::uno::RuntimeException( (rtl::OUString( @@ -359,9 +360,9 @@ rtl::Reference< Data::ExtensionXcu > Data::removeExtensionXcuAdditions( // extension xcu files that are never added via addExtensionXcuAdditions // (also, there might be url spelling differences between calls to // addExtensionXcuAdditions and removeExtensionXcuAdditions?): - OSL_TRACE( - "unknown configmgr::Data::removeExtensionXcuAdditions(%s)", - rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()); + SAL_INFO( + "configmgr", + "unknown Data::removeExtensionXcuAdditions(" << url << ")"); return rtl::Reference< ExtensionXcu >(); } rtl::Reference< ExtensionXcu > item(i->second); diff --git a/configmgr/source/node.cxx b/configmgr/source/node.cxx index 8141c2858f9d..892cdaa622fd 100644 --- a/configmgr/source/node.cxx +++ b/configmgr/source/node.cxx @@ -28,10 +28,11 @@ #include "sal/config.h" +#include <cassert> + #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -49,7 +50,7 @@ namespace css = com::sun::star; } NodeMap & Node::getMembers() { - OSL_ASSERT(false); + assert(false); throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), css::uno::Reference< css::uno::XInterface >()); @@ -61,7 +62,7 @@ rtl::OUString Node::getTemplateName() const { void Node::setMandatory(int layer) { (void) layer; // avoid warnings - OSL_ASSERT(layer == Data::NO_LAYER); + assert(layer == Data::NO_LAYER); } int Node::getMandatory() const { @@ -69,7 +70,7 @@ int Node::getMandatory() const { } void Node::setLayer(int layer) { - OSL_ASSERT(layer >= layer_); + assert(layer >= layer_); layer_ = layer; } diff --git a/configmgr/source/nodemap.cxx b/configmgr/source/nodemap.cxx index 2a9d198e2bf5..508ba4ab3eb5 100644 --- a/configmgr/source/nodemap.cxx +++ b/configmgr/source/nodemap.cxx @@ -29,8 +29,8 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> -#include "osl/diagnose.h" #include "rtl/ustring.hxx" #include "node.hxx" @@ -39,7 +39,7 @@ namespace configmgr { void cloneNodeMap(NodeMap const & source, NodeMap * target) { - OSL_ASSERT(target != 0 && target->empty()); + assert(target != 0 && target->empty()); NodeMap clone(source); for (NodeMap::iterator i(clone.begin()); i != clone.end(); ++i) { i->second = i->second->clone(true); diff --git a/configmgr/source/parsemanager.cxx b/configmgr/source/parsemanager.cxx index d228791adff7..7d9abd4ab485 100644 --- a/configmgr/source/parsemanager.cxx +++ b/configmgr/source/parsemanager.cxx @@ -28,9 +28,10 @@ #include "sal/config.h" +#include <cassert> + #include "com/sun/star/container/NoSuchElementException.hpp" #include "com/sun/star/uno/RuntimeException.hpp" -#include "osl/diagnose.h" #include "sal/types.h" #include "xmlreader/span.hxx" #include "xmlreader/xmlreader.hxx" @@ -52,21 +53,21 @@ ParseManager::ParseManager( css::container::NoSuchElementException, css::uno::RuntimeException)): reader_(url), parser_(parser) { - OSL_ASSERT(parser.is()); + assert(parser.is()); int id; id = reader_.registerNamespaceIri( xmlreader::Span( RTL_CONSTASCII_STRINGPARAM("http://openoffice.org/2001/registry"))); - OSL_ASSERT(id == NAMESPACE_OOR); + assert(id == NAMESPACE_OOR); id = reader_.registerNamespaceIri( xmlreader::Span( RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/2001/XMLSchema"))); - OSL_ASSERT(id == NAMESPACE_XS); + assert(id == NAMESPACE_XS); id = reader_.registerNamespaceIri( xmlreader::Span( RTL_CONSTASCII_STRINGPARAM( "http://www.w3.org/2001/XMLSchema-instance"))); - OSL_ASSERT(id == NAMESPACE_XSI); + assert(id == NAMESPACE_XSI); (void)id; } diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx index 7b22a66d68ec..7922e2c7505a 100644 --- a/configmgr/source/partial.cxx +++ b/configmgr/source/partial.cxx @@ -28,13 +28,13 @@ #include "sal/config.h" +#include <cassert> #include <map> #include <set> #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -51,7 +51,7 @@ namespace css = com::sun::star; bool parseSegment( rtl::OUString const & path, sal_Int32 * index, rtl::OUString * segment) { - OSL_ASSERT( + assert( index != 0 && *index >= 0 && *index <= path.getLength() && segment != 0); if (path[(*index)++] == '/') { diff --git a/configmgr/source/propertynode.cxx b/configmgr/source/propertynode.cxx index b14760aab421..5aa86db68c9f 100644 --- a/configmgr/source/propertynode.cxx +++ b/configmgr/source/propertynode.cxx @@ -28,9 +28,10 @@ #include "sal/config.h" +#include <cassert> + #include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/uno/Any.hxx" -#include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -86,7 +87,7 @@ void PropertyNode::setValue(int layer, css::uno::Any const & value) { } void PropertyNode::setExternal(int layer, rtl::OUString const & descriptor) { - OSL_ASSERT(descriptor.getLength() != 0); + assert(!descriptor.isEmpty()); setLayer(layer); externalDescriptor_ = descriptor; } diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index 337eed145174..fc1fe39e8073 100644 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <vector> #include "com/sun/star/lang/DisposedException.hpp" @@ -48,7 +49,6 @@ #include "cppu/unotype.hxx" #include "cppuhelper/queryinterface.hxx" #include "cppuhelper/weak.hxx" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "rtl/ref.hxx" #include "rtl/ustring.h" @@ -89,7 +89,7 @@ Path RootAccess::getAbsolutePath() { void RootAccess::initBroadcaster( Modifications::Node const & modifications, Broadcaster * broadcaster) { - OSL_ASSERT(broadcaster != 0); + assert(broadcaster != 0); comphelper::SequenceAsVector< css::util::ElementChange > changes; initBroadcasterAndChanges( modifications, broadcaster, changesListeners_.empty() ? 0 : &changes); @@ -166,7 +166,7 @@ rtl::Reference< Node > RootAccess::getNode() { // RuntimeException.Context is left null here } pathRepresentation_ = canonic; - OSL_ASSERT(!path_.empty()); + assert(!path_.empty()); name_ = path_.back(); finalized_ = finalizedLayer != Data::NO_LAYER; } @@ -192,7 +192,7 @@ rtl::Reference< Access > RootAccess::getParentAccess() { } void RootAccess::addTypes(std::vector< css::uno::Type > * types) const { - OSL_ASSERT(types != 0); + assert(types != 0); types->push_back(cppu::UnoType< css::util::XChangesNotifier >::get()); types->push_back(cppu::UnoType< css::util::XChangesBatch >::get()); } @@ -200,7 +200,7 @@ void RootAccess::addTypes(std::vector< css::uno::Type > * types) const { void RootAccess::addSupportedServiceNames( std::vector< rtl::OUString > * services) { - OSL_ASSERT(services != 0); + assert(services != 0); services->push_back( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -214,7 +214,7 @@ void RootAccess::addSupportedServiceNames( } void RootAccess::initDisposeBroadcaster(Broadcaster * broadcaster) { - OSL_ASSERT(broadcaster != 0); + assert(broadcaster != 0); for (ChangesListeners::iterator i(changesListeners_.begin()); i != changesListeners_.end(); ++i) { @@ -233,9 +233,7 @@ void RootAccess::clearListeners() throw() { css::uno::Any RootAccess::queryInterface(css::uno::Type const & aType) throw (css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_ANY)); -#endif + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); css::uno::Any res(Access::queryInterface(aType)); @@ -258,9 +256,7 @@ void RootAccess::addChangesListener( css::uno::Reference< css::util::XChangesListener > const & aListener) throw (css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_ANY)); -#endif + assert(thisIs(IS_ANY)); { osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); @@ -284,9 +280,7 @@ void RootAccess::removeChangesListener( css::uno::Reference< css::util::XChangesListener > const & aListener) throw (css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_ANY)); -#endif + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); ChangesListeners::iterator i(changesListeners_.find(aListener)); @@ -298,9 +292,7 @@ void RootAccess::removeChangesListener( void RootAccess::commitChanges() throw (css::lang::WrappedTargetException, css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_UPDATE)); -#endif + assert(thisIs(IS_UPDATE)); if (!alive_) { return; @@ -325,9 +317,7 @@ void RootAccess::commitChanges() } sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_UPDATE)); -#endif + assert(thisIs(IS_UPDATE)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); //TODO: Optimize: @@ -339,9 +329,7 @@ sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) { css::util::ChangesSet RootAccess::getPendingChanges() throw (css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_UPDATE)); -#endif + assert(thisIs(IS_UPDATE)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); comphelper::SequenceAsVector< css::util::ElementChange > changes; @@ -351,9 +339,7 @@ css::util::ChangesSet RootAccess::getPendingChanges() rtl::OUString RootAccess::getImplementationName() throw (css::uno::RuntimeException) { -#if OSL_DEBUG_LEVEL > 0 - OSL_ASSERT(thisIs(IS_ANY)); -#endif + assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "configmgr.RootAccess" ) ); diff --git a/configmgr/source/services.cxx b/configmgr/source/services.cxx index 6069c575a7b2..365c50c0e064 100644 --- a/configmgr/source/services.cxx +++ b/configmgr/source/services.cxx @@ -28,13 +28,14 @@ #include "sal/config.h" +#include <cassert> + #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/factory.hxx" #include "cppuhelper/implementationentry.hxx" -#include "osl/diagnose.h" #include "uno/lbnames.h" #include "sal/types.h" @@ -51,7 +52,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL dummy( css::uno::Reference< css::uno::XComponentContext > const &) SAL_THROW((css::uno::Exception)) { - OSL_ASSERT(false); + assert(false); return css::uno::Reference< css::uno::XInterface >(); } diff --git a/configmgr/source/type.cxx b/configmgr/source/type.cxx index a0ce83a5ea82..86a2e6dabced 100644 --- a/configmgr/source/type.cxx +++ b/configmgr/source/type.cxx @@ -28,6 +28,8 @@ #include "sal/config.h" +#include <cassert> + #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" @@ -36,7 +38,6 @@ #include "com/sun/star/uno/TypeClass.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "cppu/unotype.hxx" -#include "osl/diagnose.h" #include "rtl/string.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" @@ -73,7 +74,7 @@ Type elementType(Type type) { case TYPE_HEXBINARY_LIST: return TYPE_HEXBINARY; default: - OSL_ASSERT(false); + assert(false); throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), css::uno::Reference< css::uno::XInterface >()); @@ -114,7 +115,7 @@ css::uno::Type mapType(Type type) { return cppu::UnoType< css::uno::Sequence< css::uno::Sequence< sal_Int8 > > >::get(); default: - OSL_ASSERT(false); + assert(false); throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), css::uno::Reference< css::uno::XInterface >()); diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index 40f2816008ff..a98aae6ccf03 100644 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -28,13 +28,14 @@ #include "sal/config.h" +#include <cassert> + #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "comphelper/sequenceasvector.hxx" -#include "osl/diagnose.h" #include "rtl/string.h" #include "rtl/string.hxx" #include "rtl/ustring.h" @@ -59,7 +60,7 @@ namespace { namespace css = com::sun::star; bool parseHexDigit(char c, int * value) { - OSL_ASSERT(value != 0); + assert(value != 0); if (c >= '0' && c <= '9') { *value = c - '0'; return true; @@ -76,7 +77,7 @@ bool parseHexDigit(char c, int * value) { } bool parseValue(xmlreader::Span const & text, sal_Bool * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); if (text.equals(RTL_CONSTASCII_STRINGPARAM("true")) || text.equals(RTL_CONSTASCII_STRINGPARAM("1"))) { @@ -93,7 +94,7 @@ bool parseValue(xmlreader::Span const & text, sal_Bool * value) { } bool parseValue(xmlreader::Span const & text, sal_Int16 * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); // For backwards compatibility, support hexadecimal values: sal_Int32 n = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( @@ -112,7 +113,7 @@ bool parseValue(xmlreader::Span const & text, sal_Int16 * value) { } bool parseValue(xmlreader::Span const & text, sal_Int32 * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); // For backwards compatibility, support hexadecimal values: *value = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( @@ -127,7 +128,7 @@ bool parseValue(xmlreader::Span const & text, sal_Int32 * value) { } bool parseValue(xmlreader::Span const & text, sal_Int64 * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); // For backwards compatibility, support hexadecimal values: *value = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( @@ -142,14 +143,14 @@ bool parseValue(xmlreader::Span const & text, sal_Int64 * value) { } bool parseValue(xmlreader::Span const & text, double * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); *value = rtl::OString(text.begin, text.length).toDouble(); //TODO: check valid lexical representation return true; } bool parseValue(xmlreader::Span const & text, rtl::OUString * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); *value = text.convertFromUtf8(); return true; } @@ -157,7 +158,7 @@ bool parseValue(xmlreader::Span const & text, rtl::OUString * value) { bool parseValue( xmlreader::Span const & text, css::uno::Sequence< sal_Int8 > * value) { - OSL_ASSERT(text.is() && value != 0); + assert(text.is() && value != 0); if ((text.length & 1) != 0) { return false; } @@ -260,7 +261,7 @@ css::uno::Any parseValue( return parseListValue< css::uno::Sequence< sal_Int8 > >( separator, text); default: - OSL_ASSERT(false); + assert(false); throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), css::uno::Reference< css::uno::XInterface >()); @@ -400,7 +401,7 @@ bool ValueParser::endElement() { value = convertItems< css::uno::Sequence< sal_Int8 > >(); break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } items_.clear(); @@ -426,7 +427,7 @@ bool ValueParser::endElement() { } break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } separator_ = rtl::OString(); @@ -449,7 +450,7 @@ bool ValueParser::endElement() { void ValueParser::characters(xmlreader::Span const & text) { if (node_.is()) { - OSL_ASSERT(state_ == STATE_TEXT || state_ == STATE_IT); + assert(state_ == STATE_TEXT || state_ == STATE_IT); pad_.add(text.begin, text.length); } } @@ -457,7 +458,7 @@ void ValueParser::characters(xmlreader::Span const & text) { void ValueParser::start( rtl::Reference< Node > const & node, rtl::OUString const & localizedName) { - OSL_ASSERT(node.is() && !node_.is()); + assert(node.is() && !node_.is()); node_ = node; localizedName_ = localizedName; state_ = STATE_TEXT; @@ -470,7 +471,9 @@ int ValueParser::getLayer() const { template< typename T > css::uno::Any ValueParser::convertItems() { css::uno::Sequence< T > seq(items_.size()); for (sal_Int32 i = 0; i < seq.getLength(); ++i) { - OSL_VERIFY(items_[i] >>= seq[i]); + bool ok = (items_[i] >>= seq[i]); + assert(ok); + (void) ok; // avoid warnings } return css::uno::makeAny(seq); } diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index 3e9ddc7fcddd..1bae01ab88c5 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -28,15 +28,17 @@ #include "sal/config.h" +#include <cassert> + #include "boost/noncopyable.hpp" #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "osl/file.h" #include "osl/file.hxx" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/string.h" #include "rtl/string.hxx" #include "rtl/textcvt.h" @@ -44,6 +46,7 @@ #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "sal/log.hxx" #include "sal/types.h" #include "xmlreader/span.hxx" @@ -69,8 +72,7 @@ namespace css = com::sun::star; rtl::OString convertToUtf8( rtl::OUString const & text, sal_Int32 offset, sal_Int32 length) { - OSL_ASSERT( - offset <= text.getLength() && text.getLength() - offset >= length); + assert(offset <= text.getLength() && text.getLength() - offset >= length); rtl::OString s; if (!rtl_convertUStringToString( &s.pData, text.pData->buffer + offset, length, @@ -101,19 +103,20 @@ TempFile::~TempFile() { if (!closed) { oslFileError e = osl_closeFile(handle); if (e != osl_File_E_None) { - OSL_TRACE( - "osl_closeFile failed with %ld", static_cast< long >(e)); + SAL_WARN("configmgr", "osl_closeFile failed with " << +e); } } osl::FileBase::RC e = osl::File::remove(url); if (e != osl::FileBase::E_None) { - OSL_TRACE("osl_removeFile failed with %ld", static_cast< long >(e)); + SAL_WARN( + "configmgr", + "osl::File::remove(" << url << ") failed with " << +e); } } } void writeData(oslFileHandle handle, char const * begin, sal_Int32 length) { - OSL_ASSERT(length >= 0); + assert(length >= 0); sal_uInt64 n; if ((osl_writeFile(handle, begin, static_cast< sal_uInt32 >(length), &n) != osl_File_E_None) || @@ -133,7 +136,7 @@ void writeAttributeValue(oslFileHandle handle, rtl::OUString const & value) { sal_Int32 i = 0; sal_Int32 j = i; for (; j < value.getLength(); ++j) { - OSL_ASSERT( + assert( value[j] == 0x0009 || value[j] == 0x000A || value[j] == 0x000D || (value[j] >= 0x0020 && value[j] != 0xFFFE && value[j] != 0xFFFF)); switch(value[j]) { @@ -332,7 +335,7 @@ void writeValue(oslFileHandle handle, Type type, css::uno::Any const & value) { writeItemListValue< css::uno::Sequence< sal_Int8 > >(handle, value); break; default: // TYPE_ERROR, TYPE_NIL, TYPE_ANY - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen } } @@ -367,7 +370,7 @@ void writeNode( writeData(handle, RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"fuse\"")); Type type = prop->getStaticType(); Type dynType = getDynamicType(prop->getValue(components)); - OSL_ASSERT(dynType != TYPE_ERROR); + assert(dynType != TYPE_ERROR); if (type == TYPE_ANY) { type = dynType; if (type != TYPE_NIL) { @@ -412,7 +415,7 @@ void writeNode( css::uno::Any value( dynamic_cast< LocalizedValueNode * >(node.get())->getValue()); Type dynType = getDynamicType(value); - OSL_ASSERT(dynType != TYPE_ERROR); + assert(dynType != TYPE_ERROR); if (type == TYPE_ANY) { type = dynType; if (type != TYPE_NIL) { @@ -460,7 +463,7 @@ void writeModifications( // It is never necessary to write oor:finalized or oor:mandatory attributes, // as they cannot be set via the UNO API. if (modifications.children.empty()) { - OSL_ASSERT(parent.is()); + assert(parent.is()); // components themselves have no parent but must have children writeData(handle, RTL_CONSTASCII_STRINGPARAM("<item oor:path=\"")); writeAttributeValue(handle, parentPathRepresentation); @@ -481,7 +484,7 @@ void writeModifications( handle, RTL_CONSTASCII_STRINGPARAM(" oor:op=\"remove\"/>")); break; case Node::KIND_GROUP: - OSL_ASSERT( + assert( dynamic_cast< GroupNode * >(parent.get())->isExtensible()); writeData( handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\"")); @@ -499,13 +502,13 @@ void writeModifications( RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"remove\"/>")); break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } writeData(handle, RTL_CONSTASCII_STRINGPARAM("</item>")); } else { - OSL_ASSERT(node.is()); + assert(node.is()); rtl::OUString pathRep( parentPathRepresentation + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + @@ -527,16 +530,17 @@ void writeModFile( Components & components, rtl::OUString const & url, Data const & data) { sal_Int32 i = url.lastIndexOf('/'); - OSL_ASSERT(i != -1); + assert(i != -1); rtl::OUString dir(url.copy(0, i)); switch (osl::Directory::createPath(dir)) { case osl::FileBase::E_None: case osl::FileBase::E_EXIST: break; case osl::FileBase::E_ACCES: - OSL_TRACE( - "cannot create registrymodifications.xcu path (E_ACCES); changes" - " will be lost"); + SAL_INFO( + "configmgr", + ("cannot create registrymodifications.xcu path (E_ACCES); changes" + " will be lost")); return; default: throw css::uno::RuntimeException( @@ -550,9 +554,10 @@ void writeModFile( case osl::FileBase::E_None: break; case osl::FileBase::E_ACCES: - OSL_TRACE( - "cannot create temp registrymodifications.xcu (E_ACCES); changes" - " will be lost"); + SAL_INFO( + "configmgr", + ("cannot create temp registrymodifications.xcu (E_ACCES); changes" + " will be lost")); return; default: throw css::uno::RuntimeException( diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index a67d80bd43d7..95d994327b85 100644 --- a/configmgr/source/xcsparser.cxx +++ b/configmgr/source/xcsparser.cxx @@ -28,13 +28,13 @@ #include "sal/config.h" +#include <cassert> #include <cstddef> #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/strbuf.hxx" #include "rtl/string.h" @@ -67,7 +67,7 @@ void merge( rtl::Reference< Node > const & original, rtl::Reference< Node > const & update) { - OSL_ASSERT( + assert( original.is() && update.is() && original->kind() == update->kind() && update->getFinalized() == Data::NO_LAYER); if (update->getLayer() >= original->getLayer() && @@ -155,7 +155,7 @@ bool XcsParser::startElement( name.equals(RTL_CONSTASCII_STRINGPARAM("uses")) || name.equals(RTL_CONSTASCII_STRINGPARAM("constraints"))))) { - OSL_ASSERT(ignoring_ < LONG_MAX); + assert(ignoring_ < LONG_MAX); ++ignoring_; return true; } @@ -173,7 +173,7 @@ bool XcsParser::startElement( name.equals(RTL_CONSTASCII_STRINGPARAM("component"))) { state_ = STATE_COMPONENT; - OSL_ASSERT(elements_.empty()); + assert(elements_.empty()); elements_.push( Element( new GroupNode( @@ -200,7 +200,7 @@ bool XcsParser::startElement( } // fall through case STATE_COMPONENT: - OSL_ASSERT(!elements_.empty()); + assert(!elements_.empty()); switch (elements_.top().node->kind()) { case Node::KIND_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY: @@ -248,14 +248,14 @@ bool XcsParser::startElement( } break; default: // Node::KIND_LOCALIZED_VALUE - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } break; case STATE_COMPONENT_DONE: break; default: // STATE_START - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen break; } } @@ -302,7 +302,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { } break; default: - OSL_ASSERT(false); + assert(false); throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), @@ -338,7 +338,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { case STATE_COMPONENT_DONE: break; default: - OSL_ASSERT(false); // this cannot happen + assert(false); // this cannot happen } } } diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index 2f592da687f1..764cf8ce36f3 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -29,18 +29,20 @@ #include "sal/config.h" #include <algorithm> +#include <cassert> #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" +#include "rtl/oustringostreaminserter.hxx" #include "rtl/ref.hxx" #include "rtl/strbuf.hxx" #include "rtl/string.h" #include "rtl/string.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "sal/log.hxx" #include "xmlreader/span.hxx" #include "xmlreader/xmlreader.hxx" @@ -201,10 +203,10 @@ bool XcuParser::startElement( } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) { - OSL_TRACE( - "configmgr bad set node <prop> member in %s", - rtl::OUStringToOString( - reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "bad set node <prop> member in \"" << reader.getUrl() + << '"'); state_.push(State(true)); // ignored } else { throw css::uno::RuntimeException( @@ -225,18 +227,18 @@ void XcuParser::endElement(xmlreader::XmlReader const &) { if (valueParser_.endElement()) { return; } - OSL_ASSERT(!state_.empty()); + assert(!state_.empty()); bool pop = state_.top().pop; rtl::Reference< Node > insert; rtl::OUString name; if (state_.top().insert) { insert = state_.top().node; - OSL_ASSERT(insert.is()); + assert(insert.is()); name = state_.top().name; } state_.pop(); if (insert.is()) { - OSL_ASSERT(!state_.empty() && state_.top().node.is()); + assert(!state_.empty() && state_.top().node.is()); state_.top().node->getMembers()[name] = insert; } if (pop && !path_.empty()) { @@ -251,7 +253,7 @@ void XcuParser::characters(xmlreader::Span const & text) { } XcuParser::Operation XcuParser::parseOperation(xmlreader::Span const & text) { - OSL_ASSERT(text.is()); + assert(text.is()); if (text.equals(RTL_CONSTASCII_STRINGPARAM("modify"))) { return OPERATION_MODIFY; } @@ -341,7 +343,7 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). convertFromUtf8(); if (trackPath_) { - OSL_ASSERT(path_.empty()); + assert(path_.empty()); path_.push_back(componentName_); if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) { @@ -353,12 +355,10 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { Data::findNode( valueParser_.getLayer(), data_.components, componentName_)); if (!node.is()) { - OSL_TRACE( - "configmgr unknown component %s in %s", - rtl::OUStringToOString( - componentName_, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( - reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "unknown component \"" << componentName_ << "\" in \"" + << reader.getUrl() << '"'); state_.push(State(true)); // ignored return; } @@ -408,15 +408,13 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { data_.resolvePathRepresentation( path, 0, &path_, &finalizedLayer)); if (!node.is()) { - OSL_TRACE( - "configmgr unknown item %s in %s", - rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( - reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "unknown item \"" << path << "\" in \"" << reader.getUrl() << '"'); state_.push(State(true)); // ignored return; } - OSL_ASSERT(!path_.empty()); + assert(!path_.empty()); componentName_ = path_.front(); if (trackPath_) { if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) @@ -430,11 +428,10 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { switch (node->kind()) { case Node::KIND_PROPERTY: case Node::KIND_LOCALIZED_VALUE: - OSL_TRACE( - "configmgr item of bad type %s in %s", - rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( - reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "item of bad type \"" << path << "\" in \"" << reader.getUrl() + << '"'); state_.push(State(true)); // ignored return; case Node::KIND_LOCALIZED_PROPERTY: @@ -761,11 +758,10 @@ void XcuParser::handleUnknownGroupProp( } // fall through default: - OSL_TRACE( - "configmgr unknown property %s in %s", - rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( - reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "unknown property \"" << name << "\" in \"" << reader.getUrl() + << '"'); state_.push(State(true)); // ignored break; } @@ -929,11 +925,9 @@ void XcuParser::handleGroupNode( rtl::Reference< Node > child( Data::findNode(valueParser_.getLayer(), group->getMembers(), name)); if (!child.is()) { - OSL_TRACE( - "configmgr unknown node %s in %s", - rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( - reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + SAL_WARN( + "configmgr", + "unknown node \"" << name << "\" in \"" << reader.getUrl() << '"'); state_.push(State(true)); // ignored return; } @@ -1055,7 +1049,10 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { switch (op) { case OPERATION_MODIFY: if (i == set->getMembers().end()) { - OSL_TRACE("ignoring modify of unknown set member node"); + SAL_WARN( + "configmgr", + "ignoring modify of unknown set member node \"" << name + << "\" in \"" << reader.getUrl() << '"'); state_.push(State(true)); // ignored } else { state_.push( diff --git a/configmgr/source/xmldata.cxx b/configmgr/source/xmldata.cxx index c688d73cfa22..d6ed12ec81f0 100644 --- a/configmgr/source/xmldata.cxx +++ b/configmgr/source/xmldata.cxx @@ -28,6 +28,7 @@ #include "sal/config.h" +#include <cassert> #include <climits> #include <stack> @@ -35,7 +36,6 @@ #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "osl/file.hxx" #include "rtl/ref.hxx" #include "rtl/strbuf.hxx" @@ -72,7 +72,7 @@ namespace css = com::sun::star; Type parseType( xmlreader::XmlReader const & reader, xmlreader::Span const & text) { - OSL_ASSERT(text.is()); + assert(text.is()); sal_Int32 i = rtl_str_indexOfChar_WithLength(text.begin, text.length, ':'); if (i >= 0) { switch (reader.getNamespaceId(xmlreader::Span(text.begin, i))) { @@ -166,7 +166,7 @@ Type parseType( } bool parseBoolean(xmlreader::Span const & text) { - OSL_ASSERT(text.is()); + assert(text.is()); if (text.equals(RTL_CONSTASCII_STRINGPARAM("true"))) { return true; } |