Adapted to new assertion/logging mechanisms.

This commit is contained in:
Stephan Bergmann
2011-11-29 11:54:46 +01:00
parent f1074136f5
commit 048a25b4c8
20 changed files with 282 additions and 290 deletions

View File

@@ -28,6 +28,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <vector> #include <vector>
#include "com/sun/star/beans/Property.hpp" #include "com/sun/star/beans/Property.hpp"
@@ -80,7 +81,6 @@
#include "cppu/unotype.hxx" #include "cppu/unotype.hxx"
#include "cppuhelper/queryinterface.hxx" #include "cppuhelper/queryinterface.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
#include "osl/interlck.h" #include "osl/interlck.h"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
@@ -137,14 +137,14 @@ bool Access::isValue() {
} }
void Access::markChildAsModified(rtl::Reference< ChildAccess > const & child) { 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); modifiedChildren_[child->getNameInternal()] = ModifiedChild(child, true);
for (rtl::Reference< Access > p(this);;) { for (rtl::Reference< Access > p(this);;) {
rtl::Reference< Access > parent(p->getParentAccess()); rtl::Reference< Access > parent(p->getParentAccess());
if (!parent.is()) { if (!parent.is()) {
break; break;
} }
OSL_ASSERT(dynamic_cast< ChildAccess * >(p.get()) != 0); assert(dynamic_cast< ChildAccess * >(p.get()) != 0);
parent->modifiedChildren_.insert( parent->modifiedChildren_.insert(
ModifiedChildren::value_type( ModifiedChildren::value_type(
p->getNameInternal(), p->getNameInternal(),
@@ -172,7 +172,7 @@ Access::Access(Components & components):
Access::~Access() {} Access::~Access() {}
void Access::initDisposeBroadcaster(Broadcaster * broadcaster) { void Access::initDisposeBroadcaster(Broadcaster * broadcaster) {
OSL_ASSERT(broadcaster != 0); assert(broadcaster != 0);
for (DisposeListeners::iterator i(disposeListeners_.begin()); for (DisposeListeners::iterator i(disposeListeners_.begin());
i != disposeListeners_.end(); ++i) 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) { for (NodeMap::iterator i(members.begin()); i != members.end(); ++i) {
if (modifiedChildren_.find(i->first) == modifiedChildren_.end()) { if (modifiedChildren_.find(i->first) == modifiedChildren_.end()) {
vec.push_back(getUnmodifiedChild(i->first)); vec.push_back(getUnmodifiedChild(i->first));
OSL_ASSERT(vec.back().is()); assert(vec.back().is());
} }
} }
for (ModifiedChildren::iterator i(modifiedChildren_.begin()); for (ModifiedChildren::iterator i(modifiedChildren_.begin());
@@ -355,7 +355,7 @@ void Access::checkValue(css::uno::Any const & value, Type type, bool nillable) {
bool ok; bool ok;
switch (type) { switch (type) {
case TYPE_NIL: case TYPE_NIL:
OSL_ASSERT(false); assert(false);
// fall through (cannot happen) // fall through (cannot happen)
case TYPE_ERROR: case TYPE_ERROR:
ok = false; ok = false;
@@ -363,7 +363,7 @@ void Access::checkValue(css::uno::Any const & value, Type type, bool nillable) {
case TYPE_ANY: case TYPE_ANY:
switch (getDynamicType(value)) { switch (getDynamicType(value)) {
case TYPE_ANY: case TYPE_ANY:
OSL_ASSERT(false); assert(false);
// fall through (cannot happen) // fall through (cannot happen)
case TYPE_ERROR: case TYPE_ERROR:
ok = false; ok = false;
@@ -393,7 +393,7 @@ void Access::insertLocalizedValueChild(
rtl::OUString const & name, css::uno::Any const & value, rtl::OUString const & name, css::uno::Any const & value,
Modifications * localModifications) Modifications * localModifications)
{ {
OSL_ASSERT(localModifications != 0); assert(localModifications != 0);
LocalizedPropertyNode * locprop = dynamic_cast< LocalizedPropertyNode * >( LocalizedPropertyNode * locprop = dynamic_cast< LocalizedPropertyNode * >(
getNode().get()); getNode().get());
checkValue(value, locprop->getStaticType(), locprop->isNillable()); checkValue(value, locprop->getStaticType(), locprop->isNillable());
@@ -408,7 +408,7 @@ void Access::insertLocalizedValueChild(
void Access::reportChildChanges( void Access::reportChildChanges(
std::vector< css::util::ElementChange > * changes) std::vector< css::util::ElementChange > * changes)
{ {
OSL_ASSERT(changes != 0); assert(changes != 0);
for (ModifiedChildren::iterator i(modifiedChildren_.begin()); for (ModifiedChildren::iterator i(modifiedChildren_.begin());
i != modifiedChildren_.end(); ++i) i != modifiedChildren_.end(); ++i)
{ {
@@ -426,7 +426,7 @@ void Access::reportChildChanges(
void Access::commitChildChanges( void Access::commitChildChanges(
bool valid, Modifications * globalModifications) bool valid, Modifications * globalModifications)
{ {
OSL_ASSERT(globalModifications != 0); assert(globalModifications != 0);
while (!modifiedChildren_.empty()) { while (!modifiedChildren_.empty()) {
bool childValid = valid; bool childValid = valid;
ModifiedChildren::iterator i(modifiedChildren_.begin()); ModifiedChildren::iterator i(modifiedChildren_.begin());
@@ -478,7 +478,7 @@ void Access::initBroadcasterAndChanges(
Modifications::Node const & modifications, Broadcaster * broadcaster, Modifications::Node const & modifications, Broadcaster * broadcaster,
std::vector< css::util::ElementChange > * allChanges) std::vector< css::util::ElementChange > * allChanges)
{ {
OSL_ASSERT(broadcaster != 0); assert(broadcaster != 0);
comphelper::SequenceAsVector< css::beans::PropertyChangeEvent > propChanges; comphelper::SequenceAsVector< css::beans::PropertyChangeEvent > propChanges;
bool collectPropChanges = !propertiesChangeListeners_.empty(); bool collectPropChanges = !propertiesChangeListeners_.empty();
for (Modifications::Node::Children::const_iterator i( for (Modifications::Node::Children::const_iterator i(
@@ -563,8 +563,7 @@ void Access::initBroadcasterAndChanges(
// else: spurious Modifications::Node not representing a change // else: spurious Modifications::Node not representing a change
break; break;
case Node::KIND_LOCALIZED_VALUE: case Node::KIND_LOCALIZED_VALUE:
OSL_ASSERT( assert(Components::allLocales(getRootAccess()->getLocale()));
Components::allLocales(getRootAccess()->getLocale()));
for (ContainerListeners::iterator j( for (ContainerListeners::iterator j(
containerListeners_.begin()); containerListeners_.begin());
j != containerListeners_.end(); ++j) j != containerListeners_.end(); ++j)
@@ -585,7 +584,7 @@ void Access::initBroadcasterAndChanges(
child->asValue(), css::uno::Any())); child->asValue(), css::uno::Any()));
//TODO: non-void ReplacedElement //TODO: non-void ReplacedElement
} }
OSL_ASSERT(!collectPropChanges); assert(!collectPropChanges);
break; break;
case Node::KIND_PROPERTY: case Node::KIND_PROPERTY:
{ {
@@ -688,8 +687,7 @@ void Access::initBroadcasterAndChanges(
switch (getNode()->kind()) { switch (getNode()->kind()) {
case Node::KIND_LOCALIZED_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY:
// Removed localized property value: // Removed localized property value:
OSL_ASSERT( assert(Components::allLocales(getRootAccess()->getLocale()));
Components::allLocales(getRootAccess()->getLocale()));
for (ContainerListeners::iterator j( for (ContainerListeners::iterator j(
containerListeners_.begin()); containerListeners_.begin());
j != containerListeners_.end(); ++j) j != containerListeners_.end(); ++j)
@@ -717,7 +715,7 @@ void Access::initBroadcasterAndChanges(
css::uno::Any(), css::uno::Any())); css::uno::Any(), css::uno::Any()));
//TODO: non-void ReplacedElement //TODO: non-void ReplacedElement
} }
OSL_ASSERT(!collectPropChanges); assert(!collectPropChanges);
break; break;
case Node::KIND_GROUP: case Node::KIND_GROUP:
{ {
@@ -820,7 +818,7 @@ void Access::initBroadcasterAndChanges(
// else: spurious Modifications::Node not representing a change // else: spurious Modifications::Node not representing a change
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
} }
@@ -851,7 +849,7 @@ Access::ModifiedChild::ModifiedChild(
css::uno::Sequence< css::uno::Type > Access::getTypes() css::uno::Sequence< css::uno::Type > Access::getTypes()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
comphelper::SequenceAsVector< css::uno::Type > types; 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() css::uno::Sequence< sal_Int8 > Access::getImplementationId()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return css::uno::Sequence< sal_Int8 >(); 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) rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return rtl::OUString( return rtl::OUString(
@@ -918,7 +916,7 @@ rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException)
sal_Bool Access::supportsService(rtl::OUString const & ServiceName) sal_Bool Access::supportsService(rtl::OUString const & ServiceName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
css::uno::Sequence< rtl::OUString > names(getSupportedServiceNames()); 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() css::uno::Sequence< rtl::OUString > Access::getSupportedServiceNames()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
comphelper::SequenceAsVector< rtl::OUString > services; comphelper::SequenceAsVector< rtl::OUString > services;
@@ -995,7 +993,7 @@ css::uno::Sequence< rtl::OUString > Access::getSupportedServiceNames()
} }
void Access::dispose() throw (css::uno::RuntimeException) { void Access::dispose() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1021,7 +1019,7 @@ void Access::addEventListener(
css::uno::Reference< css::lang::XEventListener > const & xListener) css::uno::Reference< css::lang::XEventListener > const & xListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
@@ -1045,7 +1043,7 @@ void Access::removeEventListener(
css::uno::Reference< css::lang::XEventListener > const & aListener) css::uno::Reference< css::lang::XEventListener > const & aListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
DisposeListeners::iterator i(disposeListeners_.find(aListener)); DisposeListeners::iterator i(disposeListeners_.find(aListener));
@@ -1055,7 +1053,7 @@ void Access::removeEventListener(
} }
css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) { css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
rtl::Reference< Node > p(getNode()); rtl::Reference< Node > p(getNode());
@@ -1071,7 +1069,7 @@ css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) {
case Node::KIND_SET: case Node::KIND_SET:
return cppu::UnoType< cppu::UnoVoidType >::get(); //TODO: correct? return cppu::UnoType< cppu::UnoVoidType >::get(); //TODO: correct?
default: default:
OSL_ASSERT(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
static_cast< cppu::OWeakObject * >(this)); 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) { sal_Bool Access::hasElements() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return !getAllChildren().empty(); //TODO: optimize return !getAllChildren().empty(); //TODO: optimize
@@ -1090,7 +1088,7 @@ css::uno::Any Access::getByName(rtl::OUString const & aName)
css::container::NoSuchElementException, css::container::NoSuchElementException,
css::lang::WrappedTargetException, css::uno::RuntimeException) css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
rtl::Reference< ChildAccess > child(getChild(aName)); 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() css::uno::Sequence< rtl::OUString > Access::getElementNames()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); 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) sal_Bool Access::hasByName(rtl::OUString const & aName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return getChild(aName).is(); 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) css::uno::Any Access::getByHierarchicalName(rtl::OUString const & aName)
throw (css::container::NoSuchElementException, css::uno::RuntimeException) throw (css::container::NoSuchElementException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
rtl::Reference< ChildAccess > child(getSubChild(aName)); 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) sal_Bool Access::hasByHierarchicalName(rtl::OUString const & aName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return getSubChild(aName).is(); return getSubChild(aName).is();
@@ -1154,7 +1152,7 @@ void Access::addContainerListener(
css::uno::Reference< css::container::XContainerListener > const & xListener) css::uno::Reference< css::container::XContainerListener > const & xListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
@@ -1178,7 +1176,7 @@ void Access::removeContainerListener(
css::uno::Reference< css::container::XContainerListener > const & xListener) css::uno::Reference< css::container::XContainerListener > const & xListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
ContainerListeners::iterator i(containerListeners_.find(xListener)); ContainerListeners::iterator i(containerListeners_.find(xListener));
@@ -1190,7 +1188,7 @@ void Access::removeContainerListener(
rtl::OUString Access::getExactName(rtl::OUString const & aApproximateName) rtl::OUString Access::getExactName(rtl::OUString const & aApproximateName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return aApproximateName; return aApproximateName;
@@ -1199,7 +1197,7 @@ rtl::OUString Access::getExactName(rtl::OUString const & aApproximateName)
css::uno::Sequence< css::beans::Property > Access::getProperties() css::uno::Sequence< css::beans::Property > Access::getProperties()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
std::vector< rtl::Reference< ChildAccess > > children(getAllChildren()); std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
comphelper::SequenceAsVector< css::beans::Property > properties; 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) css::beans::Property Access::getPropertyByName(rtl::OUString const & aName)
throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
rtl::Reference< ChildAccess > child(getChild(aName)); rtl::Reference< ChildAccess > child(getChild(aName));
if (!child.is()) { if (!child.is()) {
@@ -1228,13 +1226,13 @@ css::beans::Property Access::getPropertyByName(rtl::OUString const & aName)
sal_Bool Access::hasPropertyByName(rtl::OUString const & Name) sal_Bool Access::hasPropertyByName(rtl::OUString const & Name)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
return getChild(Name).is(); return getChild(Name).is();
} }
rtl::OUString Access::getHierarchicalName() throw (css::uno::RuntimeException) { rtl::OUString Access::getHierarchicalName() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
// For backwards compatibility, return an absolute path representation where // For backwards compatibility, return an absolute path representation where
@@ -1258,7 +1256,7 @@ rtl::OUString Access::composeHierarchicalName(
css::lang::IllegalArgumentException, css::lang::NoSupportException, css::lang::IllegalArgumentException, css::lang::NoSupportException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
if (aRelativeName.getLength() == 0 || aRelativeName[0] == '/') { if (aRelativeName.getLength() == 0 || aRelativeName[0] == '/') {
@@ -1278,7 +1276,7 @@ rtl::OUString Access::composeHierarchicalName(
} }
rtl::OUString Access::getName() throw (css::uno::RuntimeException) { rtl::OUString Access::getName() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return getNameInternal(); return getNameInternal();
@@ -1287,7 +1285,7 @@ rtl::OUString Access::getName() throw (css::uno::RuntimeException) {
void Access::setName(rtl::OUString const & aName) void Access::setName(rtl::OUString const & aName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1343,7 +1341,7 @@ void Access::setName(rtl::OUString const & aName)
"configmgr setName inappropriate node")), "configmgr setName inappropriate node")),
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); 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) css::beans::Property Access::getAsProperty() throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return asProperty(); return asProperty();
@@ -1362,7 +1360,7 @@ css::beans::Property Access::getAsProperty() throw (css::uno::RuntimeException)
css::uno::Reference< css::beans::XPropertySetInfo > Access::getPropertySetInfo() css::uno::Reference< css::beans::XPropertySetInfo > Access::getPropertySetInfo()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
return this; return this;
} }
@@ -1373,7 +1371,7 @@ void Access::setPropertyValue(
css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1399,7 +1397,7 @@ css::uno::Any Access::getPropertyValue(rtl::OUString const & PropertyName)
css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
rtl::Reference< ChildAccess > child(getChild(PropertyName)); rtl::Reference< ChildAccess > child(getChild(PropertyName));
if (!child.is()) { if (!child.is()) {
@@ -1417,7 +1415,7 @@ void Access::addPropertyChangeListener(
css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
if (!xListener.is()) { if (!xListener.is()) {
@@ -1445,7 +1443,7 @@ void Access::removePropertyChangeListener(
css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkKnownProperty(aPropertyName); checkKnownProperty(aPropertyName);
PropertyChangeListeners::iterator i( PropertyChangeListeners::iterator i(
@@ -1469,7 +1467,7 @@ void Access::addVetoableChangeListener(
css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
if (!aListener.is()) { if (!aListener.is()) {
@@ -1498,7 +1496,7 @@ void Access::removeVetoableChangeListener(
css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkKnownProperty(PropertyName); checkKnownProperty(PropertyName);
VetoableChangeListeners::iterator i( VetoableChangeListeners::iterator i(
@@ -1521,7 +1519,7 @@ void Access::setPropertyValues(
css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException,
css::lang::WrappedTargetException, css::uno::RuntimeException) css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1560,7 +1558,7 @@ css::uno::Sequence< css::uno::Any > Access::getPropertyValues(
css::uno::Sequence< rtl::OUString > const & aPropertyNames) css::uno::Sequence< rtl::OUString > const & aPropertyNames)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength()); css::uno::Sequence< css::uno::Any > vals(aPropertyNames.getLength());
for (sal_Int32 i = 0; i < aPropertyNames.getLength(); ++i) { for (sal_Int32 i = 0; i < aPropertyNames.getLength(); ++i) {
@@ -1584,7 +1582,7 @@ void Access::addPropertiesChangeListener(
xListener) xListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
if (!xListener.is()) { if (!xListener.is()) {
@@ -1608,7 +1606,7 @@ void Access::removePropertiesChangeListener(
xListener) xListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
PropertiesChangeListeners::iterator i( PropertiesChangeListeners::iterator i(
propertiesChangeListeners_.find(xListener)); propertiesChangeListeners_.find(xListener));
@@ -1623,7 +1621,7 @@ void Access::firePropertiesChangeEvent(
xListener) xListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
css::uno::Sequence< css::beans::PropertyChangeEvent > events( css::uno::Sequence< css::beans::PropertyChangeEvent > events(
aPropertyNames.getLength()); aPropertyNames.getLength());
for (sal_Int32 i = 0; i < events.getLength(); ++i) { for (sal_Int32 i = 0; i < events.getLength(); ++i) {
@@ -1637,7 +1635,7 @@ void Access::firePropertiesChangeEvent(
css::uno::Reference< css::beans::XHierarchicalPropertySetInfo > css::uno::Reference< css::beans::XHierarchicalPropertySetInfo >
Access::getHierarchicalPropertySetInfo() throw (css::uno::RuntimeException) { Access::getHierarchicalPropertySetInfo() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
return this; return this;
} }
@@ -1649,7 +1647,7 @@ void Access::setHierarchicalPropertyValue(
css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1683,7 +1681,7 @@ css::uno::Any Access::getHierarchicalPropertyValue(
css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalPropertyName)); rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalPropertyName));
if (!child.is()) { if (!child.is()) {
@@ -1701,7 +1699,7 @@ void Access::setHierarchicalPropertyValues(
css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException,
css::lang::WrappedTargetException, css::uno::RuntimeException) css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1747,7 +1745,7 @@ css::uno::Sequence< css::uno::Any > Access::getHierarchicalPropertyValues(
css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
css::uno::RuntimeException) css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
css::uno::Sequence< css::uno::Any > vals( css::uno::Sequence< css::uno::Any > vals(
aHierarchicalPropertyNames.getLength()); aHierarchicalPropertyNames.getLength());
@@ -1771,7 +1769,7 @@ css::beans::Property Access::getPropertyByHierarchicalName(
rtl::OUString const & aHierarchicalName) rtl::OUString const & aHierarchicalName)
throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalName)); rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalName));
if (!child.is()) { if (!child.is()) {
@@ -1785,7 +1783,7 @@ sal_Bool Access::hasPropertyByHierarchicalName(
rtl::OUString const & aHierarchicalName) rtl::OUString const & aHierarchicalName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_GROUP)); assert(thisIs(IS_GROUP));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
return getSubChild(aHierarchicalName).is(); return getSubChild(aHierarchicalName).is();
} }
@@ -1797,7 +1795,7 @@ void Access::replaceByName(
css::container::NoSuchElementException, css::container::NoSuchElementException,
css::lang::WrappedTargetException, css::uno::RuntimeException) css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_UPDATE)); assert(thisIs(IS_UPDATE));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1826,7 +1824,7 @@ void Access::replaceByName(
} }
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc);
@@ -1841,7 +1839,7 @@ void Access::insertByName(
css::container::ElementExistException, css::container::ElementExistException,
css::lang::WrappedTargetException, css::uno::RuntimeException) css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_EXTENSIBLE|IS_UPDATE)); assert(thisIs(IS_EXTENSIBLE|IS_UPDATE));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1878,7 +1876,7 @@ void Access::insertByName(
} }
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc); getNotificationRoot()->initBroadcaster(localMods.getRoot(), &bc);
@@ -1891,7 +1889,7 @@ void Access::removeByName(rtl::OUString const & aName)
css::container::NoSuchElementException, css::container::NoSuchElementException,
css::lang::WrappedTargetException, css::uno::RuntimeException) css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_EXTENSIBLE|IS_UPDATE)); assert(thisIs(IS_EXTENSIBLE|IS_UPDATE));
Broadcaster bc; Broadcaster bc;
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
@@ -1926,7 +1924,7 @@ void Access::removeByName(rtl::OUString const & aName)
css::uno::Reference< css::uno::XInterface > Access::createInstance() css::uno::Reference< css::uno::XInterface > Access::createInstance()
throw (css::uno::Exception, css::uno::RuntimeException) throw (css::uno::Exception, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_SET|IS_UPDATE)); assert(thisIs(IS_SET|IS_UPDATE));
rtl::OUString tmplName( rtl::OUString tmplName(
dynamic_cast< SetNode * >(getNode().get())->getDefaultTemplateName()); dynamic_cast< SetNode * >(getNode().get())->getDefaultTemplateName());
rtl::Reference< Node > tmpl( rtl::Reference< Node > tmpl(
@@ -1947,7 +1945,7 @@ css::uno::Reference< css::uno::XInterface > Access::createInstanceWithArguments(
css::uno::Sequence< css::uno::Any > const & aArguments) css::uno::Sequence< css::uno::Any > const & aArguments)
throw (css::uno::Exception, css::uno::RuntimeException) throw (css::uno::Exception, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_SET|IS_UPDATE)); assert(thisIs(IS_SET|IS_UPDATE));
if (aArguments.getLength() != 0) { if (aArguments.getLength() != 0) {
throw css::uno::Exception( throw css::uno::Exception(
rtl::OUString( rtl::OUString(
@@ -1971,7 +1969,7 @@ rtl::Reference< ChildAccess > Access::getModifiedChild(
rtl::Reference< ChildAccess > Access::getUnmodifiedChild( rtl::Reference< ChildAccess > Access::getUnmodifiedChild(
rtl::OUString const & name) rtl::OUString const & name)
{ {
OSL_ASSERT(modifiedChildren_.find(name) == modifiedChildren_.end()); assert(modifiedChildren_.find(name) == modifiedChildren_.end());
rtl::Reference< Node > node(getNode()->getMember(name)); rtl::Reference< Node > node(getNode()->getMember(name));
if (!node.is()) { if (!node.is()) {
return rtl::Reference< ChildAccess >(); return rtl::Reference< ChildAccess >();
@@ -2078,7 +2076,7 @@ bool Access::setChildProperty(
rtl::OUString const & name, css::uno::Any const & value, rtl::OUString const & name, css::uno::Any const & value,
Modifications * localModifications) Modifications * localModifications)
{ {
OSL_ASSERT(localModifications != 0); assert(localModifications != 0);
rtl::Reference< ChildAccess > child(getChild(name)); rtl::Reference< ChildAccess > child(getChild(name));
if (!child.is()) { if (!child.is()) {
return false; return false;
@@ -2201,7 +2199,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember(
"configmgr inappropriate set element")), "configmgr inappropriate set element")),
static_cast< cppu::OWeakObject * >(this), 1); 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( if (!dynamic_cast< SetNode * >(getNode().get())->isValidTemplate(
freeAcc->getNode()->getTemplateName())) 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) { bool Access::thisIs(int what) {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
rtl::Reference< Node > p(getNode()); rtl::Reference< Node > p(getNode());

View File

@@ -564,7 +564,7 @@ private:
boost::shared_ptr<osl::Mutex> lock_; boost::shared_ptr<osl::Mutex> lock_;
#if OSL_DEBUG_LEVEL > 0 #if !defined NDEBUG
protected: protected:
enum { enum {
IS_ANY = 0, IS_GROUP = 0x01, IS_SET = 0x02, IS_EXTENSIBLE = 0x04, IS_ANY = 0, IS_GROUP = 0x01, IS_SET = 0x02, IS_EXTENSIBLE = 0x04,

View File

@@ -28,6 +28,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <vector> #include <vector>
#include "com/sun/star/container/XChild.hpp" #include "com/sun/star/container/XChild.hpp"
@@ -43,7 +44,6 @@
#include "cppuhelper/queryinterface.hxx" #include "cppuhelper/queryinterface.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "comphelper/servicehelper.hxx" #include "comphelper/servicehelper.hxx"
#include "osl/diagnose.h"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/string.h" #include "rtl/string.h"
@@ -94,7 +94,7 @@ ChildAccess::ChildAccess(
inTransaction_(false) inTransaction_(false)
{ {
lock_ = lock(); lock_ = lock();
OSL_ASSERT(root.is() && parent.is() && node.is()); assert(root.is() && parent.is() && node.is());
} }
ChildAccess::ChildAccess( ChildAccess::ChildAccess(
@@ -103,11 +103,11 @@ ChildAccess::ChildAccess(
Access(components), root_(root), node_(node), inTransaction_(false) Access(components), root_(root), node_(node), inTransaction_(false)
{ {
lock_ = lock(); lock_ = lock();
OSL_ASSERT(root.is() && node.is()); assert(root.is() && node.is());
} }
Path ChildAccess::getAbsolutePath() { Path ChildAccess::getAbsolutePath() {
OSL_ASSERT(getParentAccess().is()); assert(getParentAccess().is());
Path path(getParentAccess()->getAbsolutePath()); Path path(getParentAccess()->getAbsolutePath());
path.push_back(name_); path.push_back(name_);
return path; return path;
@@ -168,7 +168,7 @@ void ChildAccess::release() throw () {
css::uno::Reference< css::uno::XInterface > ChildAccess::getParent() css::uno::Reference< css::uno::XInterface > ChildAccess::getParent()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return static_cast< cppu::OWeakObject * >(parent_.get()); 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 &) void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &)
throw (css::lang::NoSupportException, css::uno::RuntimeException) throw (css::lang::NoSupportException, css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
throw css::lang::NoSupportException( throw css::lang::NoSupportException(
@@ -189,7 +189,7 @@ sal_Int64 ChildAccess::getSomething(
css::uno::Sequence< sal_Int8 > const & aIdentifier) css::uno::Sequence< sal_Int8 > const & aIdentifier)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return aIdentifier == getTunnelId() return aIdentifier == getTunnelId()
@@ -201,15 +201,14 @@ void ChildAccess::bind(
rtl::Reference< Access > const & parent, rtl::OUString const & name) rtl::Reference< Access > const & parent, rtl::OUString const & name)
throw () throw ()
{ {
OSL_ASSERT( assert(!parent_.is() && root.is() && parent.is() && name.getLength() != 0);
!parent_.is() && root.is() && parent.is() && name.getLength() != 0);
root_ = root; root_ = root;
parent_ = parent; parent_ = parent;
name_ = name; name_ = name;
} }
void ChildAccess::unbind() throw () { void ChildAccess::unbind() throw () {
OSL_ASSERT(parent_.is()); assert(parent_.is());
parent_->releaseChild(name_); parent_->releaseChild(name_);
parent_.clear(); parent_.clear();
inTransaction_ = true; inTransaction_ = true;
@@ -226,7 +225,7 @@ void ChildAccess::setNode(rtl::Reference< Node > const & node) {
void ChildAccess::setProperty( void ChildAccess::setProperty(
css::uno::Any const & value, Modifications * localModifications) css::uno::Any const & value, Modifications * localModifications)
{ {
OSL_ASSERT(localModifications != 0); assert(localModifications != 0);
Type type = TYPE_ERROR; Type type = TYPE_ERROR;
bool nillable = false; bool nillable = false;
switch (node_->kind()) { switch (node_->kind()) {
@@ -366,7 +365,7 @@ css::uno::Any ChildAccess::asValue() {
void ChildAccess::commitChanges(bool valid, Modifications * globalModifications) void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
{ {
OSL_ASSERT(globalModifications != 0); assert(globalModifications != 0);
commitChildChanges(valid, globalModifications); commitChildChanges(valid, globalModifications);
if (valid && changedValue_.get() != 0) { if (valid && changedValue_.get() != 0) {
Path path(getAbsolutePath()); Path path(getAbsolutePath());
@@ -382,7 +381,7 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
Data::NO_LAYER, *changedValue_); Data::NO_LAYER, *changedValue_);
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
} }
@@ -397,7 +396,7 @@ ChildAccess::~ChildAccess() {
} }
void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const { 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::container::XChild >::get());
types->push_back(cppu::UnoType< css::lang::XUnoTunnel >::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( void ChildAccess::addSupportedServiceNames(
std::vector< rtl::OUString > * services) std::vector< rtl::OUString > * services)
{ {
OSL_ASSERT(services != 0); assert(services != 0);
services->push_back( services->push_back(
getParentNode()->kind() == Node::KIND_GROUP getParentNode()->kind() == Node::KIND_GROUP
? rtl::OUString( ? rtl::OUString(
@@ -419,7 +418,7 @@ void ChildAccess::addSupportedServiceNames(
css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType) css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
OSL_ASSERT(thisIs(IS_ANY)); assert(thisIs(IS_ANY));
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
css::uno::Any res(Access::queryInterface(aType)); css::uno::Any res(Access::queryInterface(aType));

View File

@@ -29,6 +29,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cstddef> #include <cstddef>
#include <list> #include <list>
@@ -45,18 +46,18 @@
#include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/conditn.hxx" #include "osl/conditn.hxx"
#include "osl/diagnose.h"
#include "osl/file.hxx" #include "osl/file.hxx"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "osl/thread.hxx" #include "osl/thread.hxx"
#include "rtl/bootstrap.hxx" #include "rtl/bootstrap.hxx"
#include "rtl/logfile.h" #include "rtl/logfile.h"
#include "rtl/oustringostreaminserter.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/textenc.h"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "rtl/instance.hxx" #include "rtl/instance.hxx"
#include "sal/log.hxx"
#include "sal/types.h" #include "sal/types.h"
#include "salhelper/simplereferenceobject.hxx" #include "salhelper/simplereferenceobject.hxx"
@@ -99,11 +100,12 @@ void parseXcsFile(
SAL_THROW(( SAL_THROW((
css::container::NoSuchElementException, css::uno::RuntimeException)) 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; (void) partial; (void) modifications; (void) additions;
OSL_VERIFY( bool ok = rtl::Reference< ParseManager >(
rtl::Reference< ParseManager >( new ParseManager(url, new XcsParser(layer, data)))->parse();
new ParseManager(url, new XcsParser(layer, data)))->parse()); assert(ok);
(void) ok; // avoid warnings
} }
void parseXcuFile( void parseXcuFile(
@@ -112,13 +114,13 @@ void parseXcuFile(
SAL_THROW(( SAL_THROW((
css::container::NoSuchElementException, css::uno::RuntimeException)) css::container::NoSuchElementException, css::uno::RuntimeException))
{ {
OSL_VERIFY( bool ok = rtl::Reference< ParseManager >(
rtl::Reference< ParseManager >( new ParseManager(
new ParseManager( url,
url, new XcuParser(layer, data, partial, modifications, additions)))->
new XcuParser( parse();
layer, data, partial, modifications, additions)))-> assert(ok);
parse()); (void) ok; // avoid warnings
} }
rtl::OUString expand(rtl::OUString const & str) { 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) { 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) { if (node->getLayer() > layer && node->getLayer() < Data::NO_LAYER) {
return false; return false;
} }
@@ -189,7 +191,7 @@ Components::WriteThread::WriteThread(
reference_(reference), components_(components), url_(url), data_(data) reference_(reference), components_(components), url_(url), data_(data)
{ {
lock_ = lock(); lock_ = lock();
OSL_ASSERT(reference != 0); assert(reference != 0);
acquire(); acquire();
} }
@@ -201,11 +203,10 @@ void Components::WriteThread::run() {
try { try {
writeModFile(components_, url_, data_); writeModFile(components_, url_, data_);
} catch (css::uno::RuntimeException & e) { } catch (css::uno::RuntimeException & e) {
// Silently ignore write errors, instead of aborting: // Ignore write errors, instead of aborting:
OSL_TRACE( SAL_WARN(
"configmgr error writing modifications: %s", "configmgr",
rtl::OUStringToOString( "error writing modifications: \"" << e.Message << '"');
e.Message, RTL_TEXTENCODING_UTF8).getStr());
} }
} catch (...) { } catch (...) {
reference_->clear(); reference_->clear();
@@ -225,7 +226,7 @@ class theComponentsSingleton :
Components & Components::getSingleton( Components & Components::getSingleton(
css::uno::Reference< css::uno::XComponentContext > const & context) css::uno::Reference< css::uno::XComponentContext > const & context)
{ {
OSL_ASSERT(context.is()); assert(context.is());
return theComponentsSingleton::get(context); return theComponentsSingleton::get(context);
} }
@@ -344,7 +345,7 @@ void Components::insertExtensionXcsFile(
void Components::insertExtensionXcuFile( void Components::insertExtensionXcuFile(
bool shared, rtl::OUString const & fileUri, Modifications * modifications) bool shared, rtl::OUString const & fileUri, Modifications * modifications)
{ {
OSL_ASSERT(modifications != 0); assert(modifications != 0);
int layer = getExtensionLayer(shared) + 1; int layer = getExtensionLayer(shared) + 1;
Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer); Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer);
try { try {
@@ -376,7 +377,7 @@ void Components::removeExtensionXcuFile(
// item->additions records all additions of set members in textual order, // item->additions records all additions of set members in textual order,
// the latter check works well when iterating through item->additions in // the latter check works well when iterating through item->additions in
// reverse order. // reverse order.
OSL_ASSERT(modifications != 0); assert(modifications != 0);
rtl::Reference< Data::ExtensionXcu > item( rtl::Reference< Data::ExtensionXcu > item(
data_.removeExtensionXcuAdditions(fileUri)); data_.removeExtensionXcuAdditions(fileUri));
if (item.is()) { if (item.is()) {
@@ -395,9 +396,9 @@ void Components::removeExtensionXcuFile(
map = &node->getMembers(); map = &node->getMembers();
} }
if (node.is()) { if (node.is()) {
OSL_ASSERT(parent.is()); assert(parent.is());
if (parent->kind() == Node::KIND_SET) { if (parent->kind() == Node::KIND_SET) {
OSL_ASSERT( assert(
node->kind() == Node::KIND_GROUP || node->kind() == Node::KIND_GROUP ||
node->kind() == Node::KIND_SET); node->kind() == Node::KIND_SET);
if (canRemoveFromLayer(item->layer, node)) { if (canRemoveFromLayer(item->layer, node)) {
@@ -418,17 +419,17 @@ void Components::insertModificationXcuFile(
std::set< rtl::OUString > const & excludedPaths, std::set< rtl::OUString > const & excludedPaths,
Modifications * modifications) Modifications * modifications)
{ {
OSL_ASSERT(modifications != 0); assert(modifications != 0);
Partial part(includedPaths, excludedPaths); Partial part(includedPaths, excludedPaths);
try { try {
parseFileLeniently( parseFileLeniently(
&parseXcuFile, fileUri, Data::NO_LAYER, data_, &part, modifications, &parseXcuFile, fileUri, Data::NO_LAYER, data_, &part, modifications,
0); 0);
} catch (css::container::NoSuchElementException & e) { } catch (css::container::NoSuchElementException & e) {
OSL_TRACE( SAL_WARN(
"configmgr error inserting non-existing %s: %s", "configmgr",
rtl::OUStringToOString(fileUri, RTL_TEXTENCODING_UTF8).getStr(), "error inserting non-existing \"" << fileUri << "\": \""
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); << e.Message << '"');
} }
} }
@@ -458,11 +459,10 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue(
} catch (css::uno::Exception & e) { } catch (css::uno::Exception & e) {
// Assuming these exceptions indicate that the service is not // Assuming these exceptions indicate that the service is not
// installed: // installed:
OSL_TRACE( SAL_WARN(
"createInstance(%s) failed with %s", "configmgr",
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(), "createInstance(" << name << ") failed with \"" << e.Message
rtl::OUStringToOString( << '"');
e.Message, RTL_TEXTENCODING_UTF8).getStr());
} }
css::uno::Reference< css::beans::XPropertySet > propset; css::uno::Reference< css::beans::XPropertySet > propset;
if (service.is()) { if (service.is()) {
@@ -508,7 +508,7 @@ Components::Components(
css::uno::Reference< css::uno::XComponentContext > const & context): css::uno::Reference< css::uno::XComponentContext > const & context):
context_(context), sharedExtensionLayer_(-1), userExtensionLayer_(-1) context_(context), sharedExtensionLayer_(-1), userExtensionLayer_(-1)
{ {
OSL_ASSERT(context.is()); assert(context.is());
lock_ = lock(); lock_ = lock();
rtl::OUString conf( rtl::OUString conf(
expand( expand(
@@ -624,18 +624,17 @@ void Components::parseFileLeniently(
Partial const * partial, Modifications * modifications, Partial const * partial, Modifications * modifications,
Additions * additions) Additions * additions)
{ {
OSL_ASSERT(parseFile != 0); assert(parseFile != 0);
try { try {
(*parseFile)(url, layer, data, partial, modifications, additions); (*parseFile)(url, layer, data, partial, modifications, additions);
} catch (css::container::NoSuchElementException &) { } catch (css::container::NoSuchElementException &) {
throw; throw;
} catch (css::uno::Exception & e) { //TODO: more specific exception catching } catch (css::uno::Exception & e) { //TODO: more specific exception catching
// Silently ignore invalid XML files, instead of completely preventing // Ignore invalid XML files, instead of completely preventing OOo from
// OOo from starting: // starting:
OSL_TRACE( SAL_WARN(
"configmgr error reading %s: %s", "configmgr",
rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr(), "error reading \"" << url << "\": \"" << e.Message << '"');
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
} }
} }
@@ -720,10 +719,8 @@ void Components::parseFileList(
try { try {
parseFileLeniently(parseFile, url, layer, data_, 0, 0, adds); parseFileLeniently(parseFile, url, layer, data_, 0, 0, adds);
} catch (css::container::NoSuchElementException & e) { } catch (css::container::NoSuchElementException & e) {
OSL_TRACE( SAL_WARN(
"configmgr file does not exist: %s", "configmgr", "file does not exist: \"" << e.Message << '"');
rtl::OUStringToOString(
e.Message, RTL_TEXTENCODING_UTF8).getStr());
if (adds != 0) { if (adds != 0) {
data_.removeExtensionXcuAdditions(url); data_.removeExtensionXcuAdditions(url);
} }
@@ -874,8 +871,8 @@ void Components::parseModificationLayer(rtl::OUString const & url) {
try { try {
parseFileLeniently(&parseXcuFile, url, Data::NO_LAYER, data_, 0, 0, 0); parseFileLeniently(&parseXcuFile, url, Data::NO_LAYER, data_, 0, 0, 0);
} catch (css::container::NoSuchElementException &) { } catch (css::container::NoSuchElementException &) {
OSL_TRACE( SAL_INFO(
"configmgr user registrymodifications.xcu does not (yet) exist"); "configmgr", "user registrymodifications.xcu does not (yet) exist");
// Migrate old user layer data (can be removed once migration is no // Migrate old user layer data (can be removed once migration is no
// longer relevant, probably OOo 4; also see hack for xsi namespace in // longer relevant, probably OOo 4; also see hack for xsi namespace in
// xmlreader::XmlReader::registerNamespaceIri): // xmlreader::XmlReader::registerNamespaceIri):

View File

@@ -28,6 +28,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <vector> #include <vector>
#include "boost/noncopyable.hpp" #include "boost/noncopyable.hpp"
@@ -58,7 +59,6 @@
#include "cppuhelper/implbase2.hxx" #include "cppuhelper/implbase2.hxx"
#include "cppuhelper/interfacecontainer.hxx" #include "cppuhelper/interfacecontainer.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "sal/types.h" #include "sal/types.h"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
@@ -109,7 +109,7 @@ public:
locale_(locale) locale_(locale)
{ {
lock_ = lock(); lock_ = lock();
OSL_ASSERT(context.is()); assert(context.is());
} }
private: private:

View File

@@ -26,6 +26,8 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "boost/noncopyable.hpp" #include "boost/noncopyable.hpp"
#include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/beans/NamedValue.hpp"
#include "com/sun/star/beans/Property.hpp" #include "com/sun/star/beans/Property.hpp"
@@ -58,7 +60,6 @@
#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase3.hxx" #include "cppuhelper/implbase3.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
@@ -326,7 +327,7 @@ private:
Service::Service( Service::Service(
css::uno::Reference< css::uno::XComponentContext > const & context) css::uno::Reference< css::uno::XComponentContext > const & context)
{ {
OSL_ASSERT(context.is()); assert(context.is());
try { try {
provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >( provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >(
(css::uno::Reference< css::lang::XMultiComponentFactory >( (css::uno::Reference< css::lang::XMultiComponentFactory >(

View File

@@ -29,17 +29,18 @@
#include "sal/config.h" #include "sal/config.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h" #include "rtl/oustringostreaminserter.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/textenc.h"
#include "rtl/ustrbuf.hxx" #include "rtl/ustrbuf.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "sal/log.hxx"
#include "sal/types.h" #include "sal/types.h"
#include "additions.hxx" #include "additions.hxx"
@@ -59,7 +60,7 @@ bool decode(
rtl::OUString const & encoded, sal_Int32 begin, sal_Int32 end, rtl::OUString const & encoded, sal_Int32 begin, sal_Int32 end,
rtl::OUString * decoded) rtl::OUString * decoded)
{ {
OSL_ASSERT( assert(
begin >= 0 && begin <= end && end <= encoded.getLength() && begin >= 0 && begin <= end && end <= encoded.getLength() &&
decoded != 0); decoded != 0);
rtl::OUStringBuffer buf; rtl::OUStringBuffer buf;
@@ -83,7 +84,7 @@ bool decode(
} else { } else {
return false; return false;
} }
OSL_ASSERT(begin <= end); assert(begin <= end);
} else { } else {
buf.append(c); buf.append(c);
} }
@@ -128,7 +129,7 @@ sal_Int32 Data::parseSegment(
rtl::OUString const & path, sal_Int32 index, rtl::OUString * name, rtl::OUString const & path, sal_Int32 index, rtl::OUString * name,
bool * setElement, rtl::OUString * templateName) bool * setElement, rtl::OUString * templateName)
{ {
OSL_ASSERT( assert(
index >= 0 && index <= path.getLength() && name != 0 && index >= 0 && index <= path.getLength() && name != 0 &&
setElement != 0); setElement != 0);
sal_Int32 i = index; sal_Int32 i = index;
@@ -187,7 +188,7 @@ bool Data::equalTemplateNames(
{ {
if (shortName.indexOf(':') == -1) { if (shortName.indexOf(':') == -1) {
sal_Int32 i = longName.indexOf(':') + 1; sal_Int32 i = longName.indexOf(':') + 1;
OSL_ASSERT(i > 0); assert(i > 0);
return return
rtl_ustr_compare_WithLength( rtl_ustr_compare_WithLength(
shortName.getStr(), shortName.getLength(), shortName.getStr(), shortName.getLength(),
@@ -308,7 +309,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (templateName.getLength() != 0 && p != 0) { if (templateName.getLength() != 0 && p != 0) {
OSL_ASSERT(p->getTemplateName().getLength() != 0); assert(p->getTemplateName().getLength() != 0);
if (!equalTemplateNames(templateName, p->getTemplateName())) { if (!equalTemplateNames(templateName, p->getTemplateName())) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(rtl::OUString( (rtl::OUString(
@@ -359,9 +360,9 @@ rtl::Reference< Data::ExtensionXcu > Data::removeExtensionXcuAdditions(
// extension xcu files that are never added via addExtensionXcuAdditions // extension xcu files that are never added via addExtensionXcuAdditions
// (also, there might be url spelling differences between calls to // (also, there might be url spelling differences between calls to
// addExtensionXcuAdditions and removeExtensionXcuAdditions?): // addExtensionXcuAdditions and removeExtensionXcuAdditions?):
OSL_TRACE( SAL_INFO(
"unknown configmgr::Data::removeExtensionXcuAdditions(%s)", "configmgr",
rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()); "unknown Data::removeExtensionXcuAdditions(" << url << ")");
return rtl::Reference< ExtensionXcu >(); return rtl::Reference< ExtensionXcu >();
} }
rtl::Reference< ExtensionXcu > item(i->second); rtl::Reference< ExtensionXcu > item(i->second);

View File

@@ -28,10 +28,11 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
@@ -49,7 +50,7 @@ namespace css = com::sun::star;
} }
NodeMap & Node::getMembers() { NodeMap & Node::getMembers() {
OSL_ASSERT(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
@@ -61,7 +62,7 @@ rtl::OUString Node::getTemplateName() const {
void Node::setMandatory(int layer) { void Node::setMandatory(int layer) {
(void) layer; // avoid warnings (void) layer; // avoid warnings
OSL_ASSERT(layer == Data::NO_LAYER); assert(layer == Data::NO_LAYER);
} }
int Node::getMandatory() const { int Node::getMandatory() const {
@@ -69,7 +70,7 @@ int Node::getMandatory() const {
} }
void Node::setLayer(int layer) { void Node::setLayer(int layer) {
OSL_ASSERT(layer >= layer_); assert(layer >= layer_);
layer_ = layer; layer_ = layer;
} }

View File

@@ -29,8 +29,8 @@
#include "sal/config.h" #include "sal/config.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include "osl/diagnose.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "node.hxx" #include "node.hxx"
@@ -39,7 +39,7 @@
namespace configmgr { namespace configmgr {
void cloneNodeMap(NodeMap const & source, NodeMap * target) { void cloneNodeMap(NodeMap const & source, NodeMap * target) {
OSL_ASSERT(target != 0 && target->empty()); assert(target != 0 && target->empty());
NodeMap clone(source); NodeMap clone(source);
for (NodeMap::iterator i(clone.begin()); i != clone.end(); ++i) { for (NodeMap::iterator i(clone.begin()); i != clone.end(); ++i) {
i->second = i->second->clone(true); i->second = i->second->clone(true);

View File

@@ -28,9 +28,10 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "com/sun/star/container/NoSuchElementException.hpp" #include "com/sun/star/container/NoSuchElementException.hpp"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "osl/diagnose.h"
#include "sal/types.h" #include "sal/types.h"
#include "xmlreader/span.hxx" #include "xmlreader/span.hxx"
#include "xmlreader/xmlreader.hxx" #include "xmlreader/xmlreader.hxx"
@@ -52,21 +53,21 @@ ParseManager::ParseManager(
css::container::NoSuchElementException, css::uno::RuntimeException)): css::container::NoSuchElementException, css::uno::RuntimeException)):
reader_(url), parser_(parser) reader_(url), parser_(parser)
{ {
OSL_ASSERT(parser.is()); assert(parser.is());
int id; int id;
id = reader_.registerNamespaceIri( id = reader_.registerNamespaceIri(
xmlreader::Span( xmlreader::Span(
RTL_CONSTASCII_STRINGPARAM("http://openoffice.org/2001/registry"))); RTL_CONSTASCII_STRINGPARAM("http://openoffice.org/2001/registry")));
OSL_ASSERT(id == NAMESPACE_OOR); assert(id == NAMESPACE_OOR);
id = reader_.registerNamespaceIri( id = reader_.registerNamespaceIri(
xmlreader::Span( xmlreader::Span(
RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/2001/XMLSchema"))); RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/2001/XMLSchema")));
OSL_ASSERT(id == NAMESPACE_XS); assert(id == NAMESPACE_XS);
id = reader_.registerNamespaceIri( id = reader_.registerNamespaceIri(
xmlreader::Span( xmlreader::Span(
RTL_CONSTASCII_STRINGPARAM( RTL_CONSTASCII_STRINGPARAM(
"http://www.w3.org/2001/XMLSchema-instance"))); "http://www.w3.org/2001/XMLSchema-instance")));
OSL_ASSERT(id == NAMESPACE_XSI); assert(id == NAMESPACE_XSI);
(void)id; (void)id;
} }

View File

@@ -28,13 +28,13 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <map> #include <map>
#include <set> #include <set>
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "sal/types.h" #include "sal/types.h"
@@ -51,7 +51,7 @@ namespace css = com::sun::star;
bool parseSegment( bool parseSegment(
rtl::OUString const & path, sal_Int32 * index, rtl::OUString * segment) rtl::OUString const & path, sal_Int32 * index, rtl::OUString * segment)
{ {
OSL_ASSERT( assert(
index != 0 && *index >= 0 && *index <= path.getLength() && index != 0 && *index >= 0 && *index <= path.getLength() &&
segment != 0); segment != 0);
if (path[(*index)++] == '/') { if (path[(*index)++] == '/') {

View File

@@ -28,9 +28,10 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/beans/Optional.hpp"
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#include "osl/diagnose.h"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #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) { void PropertyNode::setExternal(int layer, rtl::OUString const & descriptor) {
OSL_ASSERT(descriptor.getLength() != 0); assert(!descriptor.isEmpty());
setLayer(layer); setLayer(layer);
externalDescriptor_ = descriptor; externalDescriptor_ = descriptor;
} }

View File

@@ -28,6 +28,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <vector> #include <vector>
#include "com/sun/star/lang/DisposedException.hpp" #include "com/sun/star/lang/DisposedException.hpp"
@@ -48,7 +49,6 @@
#include "cppu/unotype.hxx" #include "cppu/unotype.hxx"
#include "cppuhelper/queryinterface.hxx" #include "cppuhelper/queryinterface.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
@@ -89,7 +89,7 @@ Path RootAccess::getAbsolutePath() {
void RootAccess::initBroadcaster( void RootAccess::initBroadcaster(
Modifications::Node const & modifications, Broadcaster * broadcaster) Modifications::Node const & modifications, Broadcaster * broadcaster)
{ {
OSL_ASSERT(broadcaster != 0); assert(broadcaster != 0);
comphelper::SequenceAsVector< css::util::ElementChange > changes; comphelper::SequenceAsVector< css::util::ElementChange > changes;
initBroadcasterAndChanges( initBroadcasterAndChanges(
modifications, broadcaster, changesListeners_.empty() ? 0 : &changes); modifications, broadcaster, changesListeners_.empty() ? 0 : &changes);
@@ -166,7 +166,7 @@ rtl::Reference< Node > RootAccess::getNode() {
// RuntimeException.Context is left null here // RuntimeException.Context is left null here
} }
pathRepresentation_ = canonic; pathRepresentation_ = canonic;
OSL_ASSERT(!path_.empty()); assert(!path_.empty());
name_ = path_.back(); name_ = path_.back();
finalized_ = finalizedLayer != Data::NO_LAYER; finalized_ = finalizedLayer != Data::NO_LAYER;
} }
@@ -192,7 +192,7 @@ rtl::Reference< Access > RootAccess::getParentAccess() {
} }
void RootAccess::addTypes(std::vector< css::uno::Type > * types) const { 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::XChangesNotifier >::get());
types->push_back(cppu::UnoType< css::util::XChangesBatch >::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( void RootAccess::addSupportedServiceNames(
std::vector< rtl::OUString > * services) std::vector< rtl::OUString > * services)
{ {
OSL_ASSERT(services != 0); assert(services != 0);
services->push_back( services->push_back(
rtl::OUString( rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( RTL_CONSTASCII_USTRINGPARAM(
@@ -214,7 +214,7 @@ void RootAccess::addSupportedServiceNames(
} }
void RootAccess::initDisposeBroadcaster(Broadcaster * broadcaster) { void RootAccess::initDisposeBroadcaster(Broadcaster * broadcaster) {
OSL_ASSERT(broadcaster != 0); assert(broadcaster != 0);
for (ChangesListeners::iterator i(changesListeners_.begin()); for (ChangesListeners::iterator i(changesListeners_.begin());
i != changesListeners_.end(); ++i) i != changesListeners_.end(); ++i)
{ {
@@ -233,9 +233,7 @@ void RootAccess::clearListeners() throw() {
css::uno::Any RootAccess::queryInterface(css::uno::Type const & aType) css::uno::Any RootAccess::queryInterface(css::uno::Type const & aType)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_ANY));
OSL_ASSERT(thisIs(IS_ANY));
#endif
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
css::uno::Any res(Access::queryInterface(aType)); css::uno::Any res(Access::queryInterface(aType));
@@ -258,9 +256,7 @@ void RootAccess::addChangesListener(
css::uno::Reference< css::util::XChangesListener > const & aListener) css::uno::Reference< css::util::XChangesListener > const & aListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_ANY));
OSL_ASSERT(thisIs(IS_ANY));
#endif
{ {
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
@@ -284,9 +280,7 @@ void RootAccess::removeChangesListener(
css::uno::Reference< css::util::XChangesListener > const & aListener) css::uno::Reference< css::util::XChangesListener > const & aListener)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_ANY));
OSL_ASSERT(thisIs(IS_ANY));
#endif
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
ChangesListeners::iterator i(changesListeners_.find(aListener)); ChangesListeners::iterator i(changesListeners_.find(aListener));
@@ -298,9 +292,7 @@ void RootAccess::removeChangesListener(
void RootAccess::commitChanges() void RootAccess::commitChanges()
throw (css::lang::WrappedTargetException, css::uno::RuntimeException) throw (css::lang::WrappedTargetException, css::uno::RuntimeException)
{ {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_UPDATE));
OSL_ASSERT(thisIs(IS_UPDATE));
#endif
if (!alive_) if (!alive_)
{ {
return; return;
@@ -325,9 +317,7 @@ void RootAccess::commitChanges()
} }
sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) { sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_UPDATE));
OSL_ASSERT(thisIs(IS_UPDATE));
#endif
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
//TODO: Optimize: //TODO: Optimize:
@@ -339,9 +329,7 @@ sal_Bool RootAccess::hasPendingChanges() throw (css::uno::RuntimeException) {
css::util::ChangesSet RootAccess::getPendingChanges() css::util::ChangesSet RootAccess::getPendingChanges()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_UPDATE));
OSL_ASSERT(thisIs(IS_UPDATE));
#endif
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
comphelper::SequenceAsVector< css::util::ElementChange > changes; comphelper::SequenceAsVector< css::util::ElementChange > changes;
@@ -351,9 +339,7 @@ css::util::ChangesSet RootAccess::getPendingChanges()
rtl::OUString RootAccess::getImplementationName() throw (css::uno::RuntimeException) rtl::OUString RootAccess::getImplementationName() throw (css::uno::RuntimeException)
{ {
#if OSL_DEBUG_LEVEL > 0 assert(thisIs(IS_ANY));
OSL_ASSERT(thisIs(IS_ANY));
#endif
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "configmgr.RootAccess" ) ); return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "configmgr.RootAccess" ) );

View File

@@ -28,13 +28,14 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx" #include "cppuhelper/factory.hxx"
#include "cppuhelper/implementationentry.hxx" #include "cppuhelper/implementationentry.hxx"
#include "osl/diagnose.h"
#include "uno/lbnames.h" #include "uno/lbnames.h"
#include "sal/types.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 &) css::uno::Reference< css::uno::XComponentContext > const &)
SAL_THROW((css::uno::Exception)) SAL_THROW((css::uno::Exception))
{ {
OSL_ASSERT(false); assert(false);
return css::uno::Reference< css::uno::XInterface >(); return css::uno::Reference< css::uno::XInterface >();
} }

View File

@@ -28,6 +28,8 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
@@ -36,7 +38,6 @@
#include "com/sun/star/uno/TypeClass.hpp" #include "com/sun/star/uno/TypeClass.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "cppu/unotype.hxx" #include "cppu/unotype.hxx"
#include "osl/diagnose.h"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
@@ -73,7 +74,7 @@ Type elementType(Type type) {
case TYPE_HEXBINARY_LIST: case TYPE_HEXBINARY_LIST:
return TYPE_HEXBINARY; return TYPE_HEXBINARY;
default: default:
OSL_ASSERT(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
@@ -114,7 +115,7 @@ css::uno::Type mapType(Type type) {
return cppu::UnoType< return cppu::UnoType<
css::uno::Sequence< css::uno::Sequence< sal_Int8 > > >::get(); css::uno::Sequence< css::uno::Sequence< sal_Int8 > > >::get();
default: default:
OSL_ASSERT(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());

View File

@@ -28,13 +28,14 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "comphelper/sequenceasvector.hxx" #include "comphelper/sequenceasvector.hxx"
#include "osl/diagnose.h"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/string.hxx" #include "rtl/string.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
@@ -59,7 +60,7 @@ namespace {
namespace css = com::sun::star; namespace css = com::sun::star;
bool parseHexDigit(char c, int * value) { bool parseHexDigit(char c, int * value) {
OSL_ASSERT(value != 0); assert(value != 0);
if (c >= '0' && c <= '9') { if (c >= '0' && c <= '9') {
*value = c - '0'; *value = c - '0';
return true; return true;
@@ -76,7 +77,7 @@ bool parseHexDigit(char c, int * value) {
} }
bool parseValue(xmlreader::Span const & text, sal_Bool * 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")) || if (text.equals(RTL_CONSTASCII_STRINGPARAM("true")) ||
text.equals(RTL_CONSTASCII_STRINGPARAM("1"))) 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) { 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: // For backwards compatibility, support hexadecimal values:
sal_Int32 n = sal_Int32 n =
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 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) { 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: // For backwards compatibility, support hexadecimal values:
*value = *value =
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 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) { 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: // For backwards compatibility, support hexadecimal values:
*value = *value =
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( 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) { 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(); *value = rtl::OString(text.begin, text.length).toDouble();
//TODO: check valid lexical representation //TODO: check valid lexical representation
return true; return true;
} }
bool parseValue(xmlreader::Span const & text, rtl::OUString * value) { bool parseValue(xmlreader::Span const & text, rtl::OUString * value) {
OSL_ASSERT(text.is() && value != 0); assert(text.is() && value != 0);
*value = text.convertFromUtf8(); *value = text.convertFromUtf8();
return true; return true;
} }
@@ -157,7 +158,7 @@ bool parseValue(xmlreader::Span const & text, rtl::OUString * value) {
bool parseValue( bool parseValue(
xmlreader::Span const & text, css::uno::Sequence< sal_Int8 > * value) 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) { if ((text.length & 1) != 0) {
return false; return false;
} }
@@ -260,7 +261,7 @@ css::uno::Any parseValue(
return parseListValue< css::uno::Sequence< sal_Int8 > >( return parseListValue< css::uno::Sequence< sal_Int8 > >(
separator, text); separator, text);
default: default:
OSL_ASSERT(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
@@ -400,7 +401,7 @@ bool ValueParser::endElement() {
value = convertItems< css::uno::Sequence< sal_Int8 > >(); value = convertItems< css::uno::Sequence< sal_Int8 > >();
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
items_.clear(); items_.clear();
@@ -426,7 +427,7 @@ bool ValueParser::endElement() {
} }
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
separator_ = rtl::OString(); separator_ = rtl::OString();
@@ -449,7 +450,7 @@ bool ValueParser::endElement() {
void ValueParser::characters(xmlreader::Span const & text) { void ValueParser::characters(xmlreader::Span const & text) {
if (node_.is()) { if (node_.is()) {
OSL_ASSERT(state_ == STATE_TEXT || state_ == STATE_IT); assert(state_ == STATE_TEXT || state_ == STATE_IT);
pad_.add(text.begin, text.length); pad_.add(text.begin, text.length);
} }
} }
@@ -457,7 +458,7 @@ void ValueParser::characters(xmlreader::Span const & text) {
void ValueParser::start( void ValueParser::start(
rtl::Reference< Node > const & node, rtl::OUString const & localizedName) rtl::Reference< Node > const & node, rtl::OUString const & localizedName)
{ {
OSL_ASSERT(node.is() && !node_.is()); assert(node.is() && !node_.is());
node_ = node; node_ = node;
localizedName_ = localizedName; localizedName_ = localizedName;
state_ = STATE_TEXT; state_ = STATE_TEXT;
@@ -470,7 +471,9 @@ int ValueParser::getLayer() const {
template< typename T > css::uno::Any ValueParser::convertItems() { template< typename T > css::uno::Any ValueParser::convertItems() {
css::uno::Sequence< T > seq(items_.size()); css::uno::Sequence< T > seq(items_.size());
for (sal_Int32 i = 0; i < seq.getLength(); ++i) { 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); return css::uno::makeAny(seq);
} }

View File

@@ -28,15 +28,17 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include "boost/noncopyable.hpp" #include "boost/noncopyable.hpp"
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h"
#include "osl/file.h" #include "osl/file.h"
#include "osl/file.hxx" #include "osl/file.hxx"
#include "rtl/oustringostreaminserter.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/string.hxx" #include "rtl/string.hxx"
#include "rtl/textcvt.h" #include "rtl/textcvt.h"
@@ -44,6 +46,7 @@
#include "rtl/ustrbuf.hxx" #include "rtl/ustrbuf.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "sal/log.hxx"
#include "sal/types.h" #include "sal/types.h"
#include "xmlreader/span.hxx" #include "xmlreader/span.hxx"
@@ -69,8 +72,7 @@ namespace css = com::sun::star;
rtl::OString convertToUtf8( rtl::OString convertToUtf8(
rtl::OUString const & text, sal_Int32 offset, sal_Int32 length) rtl::OUString const & text, sal_Int32 offset, sal_Int32 length)
{ {
OSL_ASSERT( assert(offset <= text.getLength() && text.getLength() - offset >= length);
offset <= text.getLength() && text.getLength() - offset >= length);
rtl::OString s; rtl::OString s;
if (!rtl_convertUStringToString( if (!rtl_convertUStringToString(
&s.pData, text.pData->buffer + offset, length, &s.pData, text.pData->buffer + offset, length,
@@ -101,19 +103,20 @@ TempFile::~TempFile() {
if (!closed) { if (!closed) {
oslFileError e = osl_closeFile(handle); oslFileError e = osl_closeFile(handle);
if (e != osl_File_E_None) { if (e != osl_File_E_None) {
OSL_TRACE( SAL_WARN("configmgr", "osl_closeFile failed with " << +e);
"osl_closeFile failed with %ld", static_cast< long >(e));
} }
} }
osl::FileBase::RC e = osl::File::remove(url); osl::FileBase::RC e = osl::File::remove(url);
if (e != osl::FileBase::E_None) { 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) { void writeData(oslFileHandle handle, char const * begin, sal_Int32 length) {
OSL_ASSERT(length >= 0); assert(length >= 0);
sal_uInt64 n; sal_uInt64 n;
if ((osl_writeFile(handle, begin, static_cast< sal_uInt32 >(length), &n) != if ((osl_writeFile(handle, begin, static_cast< sal_uInt32 >(length), &n) !=
osl_File_E_None) || osl_File_E_None) ||
@@ -133,7 +136,7 @@ void writeAttributeValue(oslFileHandle handle, rtl::OUString const & value) {
sal_Int32 i = 0; sal_Int32 i = 0;
sal_Int32 j = i; sal_Int32 j = i;
for (; j < value.getLength(); ++j) { for (; j < value.getLength(); ++j) {
OSL_ASSERT( assert(
value[j] == 0x0009 || value[j] == 0x000A || value[j] == 0x000D || value[j] == 0x0009 || value[j] == 0x000A || value[j] == 0x000D ||
(value[j] >= 0x0020 && value[j] != 0xFFFE && value[j] != 0xFFFF)); (value[j] >= 0x0020 && value[j] != 0xFFFE && value[j] != 0xFFFF));
switch(value[j]) { 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); writeItemListValue< css::uno::Sequence< sal_Int8 > >(handle, value);
break; break;
default: // TYPE_ERROR, TYPE_NIL, TYPE_ANY 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\"")); writeData(handle, RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"fuse\""));
Type type = prop->getStaticType(); Type type = prop->getStaticType();
Type dynType = getDynamicType(prop->getValue(components)); Type dynType = getDynamicType(prop->getValue(components));
OSL_ASSERT(dynType != TYPE_ERROR); assert(dynType != TYPE_ERROR);
if (type == TYPE_ANY) { if (type == TYPE_ANY) {
type = dynType; type = dynType;
if (type != TYPE_NIL) { if (type != TYPE_NIL) {
@@ -412,7 +415,7 @@ void writeNode(
css::uno::Any value( css::uno::Any value(
dynamic_cast< LocalizedValueNode * >(node.get())->getValue()); dynamic_cast< LocalizedValueNode * >(node.get())->getValue());
Type dynType = getDynamicType(value); Type dynType = getDynamicType(value);
OSL_ASSERT(dynType != TYPE_ERROR); assert(dynType != TYPE_ERROR);
if (type == TYPE_ANY) { if (type == TYPE_ANY) {
type = dynType; type = dynType;
if (type != TYPE_NIL) { if (type != TYPE_NIL) {
@@ -460,7 +463,7 @@ void writeModifications(
// It is never necessary to write oor:finalized or oor:mandatory attributes, // It is never necessary to write oor:finalized or oor:mandatory attributes,
// as they cannot be set via the UNO API. // as they cannot be set via the UNO API.
if (modifications.children.empty()) { if (modifications.children.empty()) {
OSL_ASSERT(parent.is()); assert(parent.is());
// components themselves have no parent but must have children // components themselves have no parent but must have children
writeData(handle, RTL_CONSTASCII_STRINGPARAM("<item oor:path=\"")); writeData(handle, RTL_CONSTASCII_STRINGPARAM("<item oor:path=\""));
writeAttributeValue(handle, parentPathRepresentation); writeAttributeValue(handle, parentPathRepresentation);
@@ -481,7 +484,7 @@ void writeModifications(
handle, RTL_CONSTASCII_STRINGPARAM(" oor:op=\"remove\"/>")); handle, RTL_CONSTASCII_STRINGPARAM(" oor:op=\"remove\"/>"));
break; break;
case Node::KIND_GROUP: case Node::KIND_GROUP:
OSL_ASSERT( assert(
dynamic_cast< GroupNode * >(parent.get())->isExtensible()); dynamic_cast< GroupNode * >(parent.get())->isExtensible());
writeData( writeData(
handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\"")); handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\""));
@@ -499,13 +502,13 @@ void writeModifications(
RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"remove\"/>")); RTL_CONSTASCII_STRINGPARAM("\" oor:op=\"remove\"/>"));
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
} }
writeData(handle, RTL_CONSTASCII_STRINGPARAM("</item>")); writeData(handle, RTL_CONSTASCII_STRINGPARAM("</item>"));
} else { } else {
OSL_ASSERT(node.is()); assert(node.is());
rtl::OUString pathRep( rtl::OUString pathRep(
parentPathRepresentation + parentPathRepresentation +
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) +
@@ -527,16 +530,17 @@ void writeModFile(
Components & components, rtl::OUString const & url, Data const & data) Components & components, rtl::OUString const & url, Data const & data)
{ {
sal_Int32 i = url.lastIndexOf('/'); sal_Int32 i = url.lastIndexOf('/');
OSL_ASSERT(i != -1); assert(i != -1);
rtl::OUString dir(url.copy(0, i)); rtl::OUString dir(url.copy(0, i));
switch (osl::Directory::createPath(dir)) { switch (osl::Directory::createPath(dir)) {
case osl::FileBase::E_None: case osl::FileBase::E_None:
case osl::FileBase::E_EXIST: case osl::FileBase::E_EXIST:
break; break;
case osl::FileBase::E_ACCES: case osl::FileBase::E_ACCES:
OSL_TRACE( SAL_INFO(
"cannot create registrymodifications.xcu path (E_ACCES); changes" "configmgr",
" will be lost"); ("cannot create registrymodifications.xcu path (E_ACCES); changes"
" will be lost"));
return; return;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
@@ -550,9 +554,10 @@ void writeModFile(
case osl::FileBase::E_None: case osl::FileBase::E_None:
break; break;
case osl::FileBase::E_ACCES: case osl::FileBase::E_ACCES:
OSL_TRACE( SAL_INFO(
"cannot create temp registrymodifications.xcu (E_ACCES); changes" "configmgr",
" will be lost"); ("cannot create temp registrymodifications.xcu (E_ACCES); changes"
" will be lost"));
return; return;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(

View File

@@ -28,13 +28,13 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <cstddef> #include <cstddef>
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/strbuf.hxx" #include "rtl/strbuf.hxx"
#include "rtl/string.h" #include "rtl/string.h"
@@ -67,7 +67,7 @@ void merge(
rtl::Reference< Node > const & original, rtl::Reference< Node > const & original,
rtl::Reference< Node > const & update) rtl::Reference< Node > const & update)
{ {
OSL_ASSERT( assert(
original.is() && update.is() && original->kind() == update->kind() && original.is() && update.is() && original->kind() == update->kind() &&
update->getFinalized() == Data::NO_LAYER); update->getFinalized() == Data::NO_LAYER);
if (update->getLayer() >= original->getLayer() && if (update->getLayer() >= original->getLayer() &&
@@ -155,7 +155,7 @@ bool XcsParser::startElement(
name.equals(RTL_CONSTASCII_STRINGPARAM("uses")) || name.equals(RTL_CONSTASCII_STRINGPARAM("uses")) ||
name.equals(RTL_CONSTASCII_STRINGPARAM("constraints"))))) name.equals(RTL_CONSTASCII_STRINGPARAM("constraints")))))
{ {
OSL_ASSERT(ignoring_ < LONG_MAX); assert(ignoring_ < LONG_MAX);
++ignoring_; ++ignoring_;
return true; return true;
} }
@@ -173,7 +173,7 @@ bool XcsParser::startElement(
name.equals(RTL_CONSTASCII_STRINGPARAM("component"))) name.equals(RTL_CONSTASCII_STRINGPARAM("component")))
{ {
state_ = STATE_COMPONENT; state_ = STATE_COMPONENT;
OSL_ASSERT(elements_.empty()); assert(elements_.empty());
elements_.push( elements_.push(
Element( Element(
new GroupNode( new GroupNode(
@@ -200,7 +200,7 @@ bool XcsParser::startElement(
} }
// fall through // fall through
case STATE_COMPONENT: case STATE_COMPONENT:
OSL_ASSERT(!elements_.empty()); assert(!elements_.empty());
switch (elements_.top().node->kind()) { switch (elements_.top().node->kind()) {
case Node::KIND_PROPERTY: case Node::KIND_PROPERTY:
case Node::KIND_LOCALIZED_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY:
@@ -248,14 +248,14 @@ bool XcsParser::startElement(
} }
break; break;
default: // Node::KIND_LOCALIZED_VALUE default: // Node::KIND_LOCALIZED_VALUE
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
break; break;
case STATE_COMPONENT_DONE: case STATE_COMPONENT_DONE:
break; break;
default: // STATE_START default: // STATE_START
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
break; break;
} }
} }
@@ -302,7 +302,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) {
} }
break; break;
default: default:
OSL_ASSERT(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
rtl::OUString( rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("this cannot happen")), RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
@@ -338,7 +338,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) {
case STATE_COMPONENT_DONE: case STATE_COMPONENT_DONE:
break; break;
default: default:
OSL_ASSERT(false); // this cannot happen assert(false); // this cannot happen
} }
} }
} }

View File

@@ -29,18 +29,20 @@
#include "sal/config.h" #include "sal/config.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h" #include "rtl/oustringostreaminserter.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/strbuf.hxx" #include "rtl/strbuf.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/string.hxx" #include "rtl/string.hxx"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "sal/log.hxx"
#include "xmlreader/span.hxx" #include "xmlreader/span.hxx"
#include "xmlreader/xmlreader.hxx" #include "xmlreader/xmlreader.hxx"
@@ -201,10 +203,10 @@ bool XcuParser::startElement(
} else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) name.equals(RTL_CONSTASCII_STRINGPARAM("prop")))
{ {
OSL_TRACE( SAL_WARN(
"configmgr bad set node <prop> member in %s", "configmgr",
rtl::OUStringToOString( "bad set node <prop> member in \"" << reader.getUrl()
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); << '"');
state_.push(State(true)); // ignored state_.push(State(true)); // ignored
} else { } else {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
@@ -225,18 +227,18 @@ void XcuParser::endElement(xmlreader::XmlReader const &) {
if (valueParser_.endElement()) { if (valueParser_.endElement()) {
return; return;
} }
OSL_ASSERT(!state_.empty()); assert(!state_.empty());
bool pop = state_.top().pop; bool pop = state_.top().pop;
rtl::Reference< Node > insert; rtl::Reference< Node > insert;
rtl::OUString name; rtl::OUString name;
if (state_.top().insert) { if (state_.top().insert) {
insert = state_.top().node; insert = state_.top().node;
OSL_ASSERT(insert.is()); assert(insert.is());
name = state_.top().name; name = state_.top().name;
} }
state_.pop(); state_.pop();
if (insert.is()) { if (insert.is()) {
OSL_ASSERT(!state_.empty() && state_.top().node.is()); assert(!state_.empty() && state_.top().node.is());
state_.top().node->getMembers()[name] = insert; state_.top().node->getMembers()[name] = insert;
} }
if (pop && !path_.empty()) { if (pop && !path_.empty()) {
@@ -251,7 +253,7 @@ void XcuParser::characters(xmlreader::Span const & text) {
} }
XcuParser::Operation XcuParser::parseOperation(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"))) { if (text.equals(RTL_CONSTASCII_STRINGPARAM("modify"))) {
return OPERATION_MODIFY; return OPERATION_MODIFY;
} }
@@ -341,7 +343,7 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) {
componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()).
convertFromUtf8(); convertFromUtf8();
if (trackPath_) { if (trackPath_) {
OSL_ASSERT(path_.empty()); assert(path_.empty());
path_.push_back(componentName_); path_.push_back(componentName_);
if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT)
{ {
@@ -353,12 +355,10 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) {
Data::findNode( Data::findNode(
valueParser_.getLayer(), data_.components, componentName_)); valueParser_.getLayer(), data_.components, componentName_));
if (!node.is()) { if (!node.is()) {
OSL_TRACE( SAL_WARN(
"configmgr unknown component %s in %s", "configmgr",
rtl::OUStringToOString( "unknown component \"" << componentName_ << "\" in \""
componentName_, RTL_TEXTENCODING_UTF8).getStr(), << reader.getUrl() << '"');
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
state_.push(State(true)); // ignored state_.push(State(true)); // ignored
return; return;
} }
@@ -408,15 +408,13 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) {
data_.resolvePathRepresentation( data_.resolvePathRepresentation(
path, 0, &path_, &finalizedLayer)); path, 0, &path_, &finalizedLayer));
if (!node.is()) { if (!node.is()) {
OSL_TRACE( SAL_WARN(
"configmgr unknown item %s in %s", "configmgr",
rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(), "unknown item \"" << path << "\" in \"" << reader.getUrl() << '"');
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
state_.push(State(true)); // ignored state_.push(State(true)); // ignored
return; return;
} }
OSL_ASSERT(!path_.empty()); assert(!path_.empty());
componentName_ = path_.front(); componentName_ = path_.front();
if (trackPath_) { if (trackPath_) {
if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT) if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT)
@@ -430,11 +428,10 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) {
switch (node->kind()) { switch (node->kind()) {
case Node::KIND_PROPERTY: case Node::KIND_PROPERTY:
case Node::KIND_LOCALIZED_VALUE: case Node::KIND_LOCALIZED_VALUE:
OSL_TRACE( SAL_WARN(
"configmgr item of bad type %s in %s", "configmgr",
rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(), "item of bad type \"" << path << "\" in \"" << reader.getUrl()
rtl::OUStringToOString( << '"');
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
state_.push(State(true)); // ignored state_.push(State(true)); // ignored
return; return;
case Node::KIND_LOCALIZED_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY:
@@ -761,11 +758,10 @@ void XcuParser::handleUnknownGroupProp(
} }
// fall through // fall through
default: default:
OSL_TRACE( SAL_WARN(
"configmgr unknown property %s in %s", "configmgr",
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(), "unknown property \"" << name << "\" in \"" << reader.getUrl()
rtl::OUStringToOString( << '"');
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
state_.push(State(true)); // ignored state_.push(State(true)); // ignored
break; break;
} }
@@ -929,11 +925,9 @@ void XcuParser::handleGroupNode(
rtl::Reference< Node > child( rtl::Reference< Node > child(
Data::findNode(valueParser_.getLayer(), group->getMembers(), name)); Data::findNode(valueParser_.getLayer(), group->getMembers(), name));
if (!child.is()) { if (!child.is()) {
OSL_TRACE( SAL_WARN(
"configmgr unknown node %s in %s", "configmgr",
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(), "unknown node \"" << name << "\" in \"" << reader.getUrl() << '"');
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
state_.push(State(true)); // ignored state_.push(State(true)); // ignored
return; return;
} }
@@ -1055,7 +1049,10 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) {
switch (op) { switch (op) {
case OPERATION_MODIFY: case OPERATION_MODIFY:
if (i == set->getMembers().end()) { 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 state_.push(State(true)); // ignored
} else { } else {
state_.push( state_.push(

View File

@@ -28,6 +28,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <cassert>
#include <climits> #include <climits>
#include <stack> #include <stack>
@@ -35,7 +36,6 @@
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "osl/diagnose.h"
#include "osl/file.hxx" #include "osl/file.hxx"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/strbuf.hxx" #include "rtl/strbuf.hxx"
@@ -72,7 +72,7 @@ namespace css = com::sun::star;
Type parseType( Type parseType(
xmlreader::XmlReader const & reader, xmlreader::Span const & text) 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, ':'); sal_Int32 i = rtl_str_indexOfChar_WithLength(text.begin, text.length, ':');
if (i >= 0) { if (i >= 0) {
switch (reader.getNamespaceId(xmlreader::Span(text.begin, i))) { switch (reader.getNamespaceId(xmlreader::Span(text.begin, i))) {
@@ -166,7 +166,7 @@ Type parseType(
} }
bool parseBoolean(xmlreader::Span const & text) { bool parseBoolean(xmlreader::Span const & text) {
OSL_ASSERT(text.is()); assert(text.is());
if (text.equals(RTL_CONSTASCII_STRINGPARAM("true"))) { if (text.equals(RTL_CONSTASCII_STRINGPARAM("true"))) {
return true; return true;
} }