[Libreoffice-commits] core.git: 3 commits - configmgr/source sw/source

Stephan Bergmann sbergman at redhat.com
Fri Jan 24 08:55:29 PST 2014


 configmgr/source/access.cxx       |   28 ++--
 configmgr/source/childaccess.cxx  |  221 ++++++++++++++------------------------
 configmgr/source/childaccess.hxx  |   16 +-
 configmgr/source/data.cxx         |    2 
 configmgr/source/valueparser.cxx  |    4 
 configmgr/source/writemodfile.cxx |    8 -
 configmgr/source/xcsparser.cxx    |    6 -
 configmgr/source/xcuparser.cxx    |   16 +-
 sw/source/core/layout/tabfrm.cxx  |    4 
 9 files changed, 124 insertions(+), 181 deletions(-)

New commits:
commit 8663493e53bf5f9aa068c1e59e11908a94c5ea08
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 24 17:54:57 2014 +0100

    bool improvements
    
    Change-Id: I5e597c32bf6a2c44fe3b3dc1d67ac0202d556387

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 5fd60d1..eb43320 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -215,7 +215,7 @@ static void lcl_RecalcRow( SwRowFrm& rRow, long nBottom );
 static bool lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, bool bInva );
 // #i26945# - add parameter <_bOnlyRowsAndCells> to control
 // that only row and cell frames are formatted.
-static sal_Bool lcl_InnerCalcLayout( SwFrm *pFrm,
+static bool lcl_InnerCalcLayout( SwFrm *pFrm,
                                       long nBottom,
                                       bool _bOnlyRowsAndCells = false );
 // OD 2004-02-18 #106629# - correct type of 1st parameter
@@ -1569,7 +1569,7 @@ bool SwCntntFrm::CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave,
 
 // #i26945# - add parameter <_bOnlyRowsAndCells> to control
 // that only row and cell frames are formatted.
-static sal_Bool lcl_InnerCalcLayout( SwFrm *pFrm,
+static bool lcl_InnerCalcLayout( SwFrm *pFrm,
                                       long nBottom,
                                       bool _bOnlyRowsAndCells )
 {
commit 6935acb053dcc202a7ce72cdd0fc3a30f1161be0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 24 17:49:17 2014 +0100

    Replace "known-good" dynamic_casts with static_casts
    
    ...it avoids false warnings about unchecked dynamic_cast results from static
    code analyzers, and potentially makes the code a little faster, too.  (Most of
    these dynamic_casts were kind of a leftover from a very early design that
    dispateched on Node type via dynamic_cast instead of a Node::Kind, but which was
    much too slow.)
    
    Change-Id: I8db08a1c35783f8ea6c51eed55b11faa2d958807

diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 616bd0e..1148ac5 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -135,7 +135,7 @@ void Access::markChildAsModified(rtl::Reference< ChildAccess > const & child) {
         parent->modifiedChildren_.insert(
             ModifiedChildren::value_type(
                 p->getNameInternal(),
-                ModifiedChild(dynamic_cast< ChildAccess * >(p.get()), false)));
+                ModifiedChild(static_cast< ChildAccess * >(p.get()), false)));
         p = parent;
     }
 }
@@ -185,7 +185,7 @@ css::uno::Sequence< css::uno::Type > Access::getTypes()
         types.push_back(
             cppu::UnoType< css::container::XHierarchicalNameReplace >::get());
         if (getNode()->kind() != Node::KIND_GROUP ||
-            dynamic_cast< GroupNode * >(getNode().get())->isExtensible())
+            static_cast< GroupNode * >(getNode().get())->isExtensible())
         {
             types.push_back(
                 cppu::UnoType< css::container::XNameContainer >::get());
@@ -322,7 +322,7 @@ css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) {
     switch (p->kind()) {
     case Node::KIND_LOCALIZED_PROPERTY:
         return mapType(
-            dynamic_cast< LocalizedPropertyNode * >(p.get())->getStaticType());
+            static_cast< LocalizedPropertyNode * >(p.get())->getStaticType());
     case Node::KIND_GROUP:
         //TODO: Should a specific type be returned for a non-extensible group
         // with homogeneous members or for an extensible group that currently
@@ -614,7 +614,7 @@ void Access::setName(OUString const & aName)
                         {
                             rtl::Reference< RootAccess > root(getRootAccess());
                             rtl::Reference< ChildAccess > childAccess(
-                                dynamic_cast< ChildAccess * >(this));
+                                static_cast< ChildAccess * >(this));
                             localMods.add(getRelativePath());
                             // unbind() modifies the parent chain that
                             // markChildAsModified() walks, so order is
@@ -1179,7 +1179,7 @@ void Access::removeByName(OUString const & aName)
         if (getNode()->kind() == Node::KIND_GROUP) {
             rtl::Reference< Node > p(child->getNode());
             if (p->kind() != Node::KIND_PROPERTY ||
-                !dynamic_cast< PropertyNode * >(p.get())->isExtension())
+                !static_cast< PropertyNode * >(p.get())->isExtension())
             {
                 throw css::container::NoSuchElementException(
                     aName, static_cast< cppu::OWeakObject * >(this));
@@ -1201,7 +1201,7 @@ css::uno::Reference< css::uno::XInterface > Access::createInstance()
 {
     assert(thisIs(IS_SET|IS_UPDATE));
     OUString tmplName(
-        dynamic_cast< SetNode * >(getNode().get())->getDefaultTemplateName());
+        static_cast< SetNode * >(getNode().get())->getDefaultTemplateName());
     rtl::Reference< Node > tmpl(
         components_.getTemplate(Data::NO_LAYER, tmplName));
     if (!tmpl.is()) {
@@ -1355,7 +1355,7 @@ css::uno::Any Access::queryInterface(css::uno::Type const & aType)
             return res;
         }
         if (getNode()->kind() != Node::KIND_GROUP ||
-            dynamic_cast< GroupNode * >(getNode().get())->isExtensible())
+            static_cast< GroupNode * >(getNode().get())->isExtensible())
         {
             res = cppu::queryInterface(
                 aType, static_cast< css::container::XNameContainer * >(this));
@@ -1534,7 +1534,7 @@ void Access::insertLocalizedValueChild(
     Modifications * localModifications)
 {
     assert(localModifications != 0);
-    LocalizedPropertyNode * locprop = dynamic_cast< LocalizedPropertyNode * >(
+    LocalizedPropertyNode * locprop = static_cast< LocalizedPropertyNode * >(
         getNode().get());
     checkValue(value, locprop->getStaticType(), locprop->isNillable());
     rtl::Reference< ChildAccess > child(
@@ -2075,7 +2075,7 @@ rtl::Reference< ChildAccess > Access::getSubChild(OUString const & path) {
                 break;
             case Node::KIND_SET:
                 if (!templateName.isEmpty() &&
-                    !dynamic_cast< SetNode * >(p.get())->isValidTemplate(
+                    !static_cast< SetNode * >(p.get())->isValidTemplate(
                         templateName))
                 {
                     return rtl::Reference< ChildAccess >();
@@ -2120,7 +2120,7 @@ css::beans::Property Access::asProperty() {
     switch (p->kind()) {
     case Node::KIND_PROPERTY:
         {
-            PropertyNode * prop = dynamic_cast< PropertyNode * >(p.get());
+            PropertyNode * prop = static_cast< PropertyNode * >(p.get());
             type = mapType(prop->getStaticType());
             nillable = prop->isNillable();
             removable = prop->isExtension();
@@ -2129,7 +2129,7 @@ css::beans::Property Access::asProperty() {
     case Node::KIND_LOCALIZED_PROPERTY:
         {
             LocalizedPropertyNode * locprop =
-                dynamic_cast< LocalizedPropertyNode *>(p.get());
+                static_cast< LocalizedPropertyNode *>(p.get());
             if (Components::allLocales(getRootAccess()->getLocale())) {
                 type = cppu::UnoType< css::uno::XInterface >::get();
                     //TODO: correct?
@@ -2144,7 +2144,7 @@ css::beans::Property Access::asProperty() {
     case Node::KIND_LOCALIZED_VALUE:
         {
             LocalizedPropertyNode * locprop =
-                dynamic_cast< LocalizedPropertyNode * >(getParentNode().get());
+                static_cast< LocalizedPropertyNode * >(getParentNode().get());
             type = mapType(locprop->getStaticType());
             nillable = locprop->isNillable();
             removable = false; //TODO ???
@@ -2223,7 +2223,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember(
             static_cast< cppu::OWeakObject * >(this), 1);
     }
     assert(dynamic_cast< SetNode * >(getNode().get()) != 0);
-    if (!dynamic_cast< SetNode * >(getNode().get())->isValidTemplate(
+    if (!static_cast< SetNode * >(getNode().get())->isValidTemplate(
             freeAcc->getNode()->getTemplateName()))
     {
         throw css::lang::IllegalArgumentException(
@@ -2252,7 +2252,7 @@ bool Access::thisIs(int what) {
         ((what & IS_GROUP) == 0 || k == Node::KIND_GROUP) &&
         ((what & IS_SET) == 0 || k == Node::KIND_SET) &&
         ((what & IS_EXTENSIBLE) == 0 || k != Node::KIND_GROUP ||
-         dynamic_cast< GroupNode * >(p.get())->isExtensible()) &&
+         static_cast< GroupNode * >(p.get())->isExtensible()) &&
         ((what & IS_GROUP_MEMBER) == 0 ||
          getParentNode()->kind() == Node::KIND_GROUP)) ||
         ((what & IS_SET_MEMBER) == 0 ||
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index 9e80d1b..6071df0 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -215,7 +215,7 @@ void ChildAccess::setProperty(
     switch (node_->kind()) {
     case Node::KIND_PROPERTY:
         {
-            PropertyNode * prop = dynamic_cast< PropertyNode * >(node_.get());
+            PropertyNode * prop = static_cast< PropertyNode * >(node_.get());
             type = prop->getStaticType();
             nillable = prop->isNillable();
         }
@@ -238,7 +238,7 @@ void ChildAccess::setProperty(
     case Node::KIND_LOCALIZED_VALUE:
         {
             LocalizedPropertyNode * locprop =
-                dynamic_cast< LocalizedPropertyNode * >(getParentNode().get());
+                static_cast< LocalizedPropertyNode * >(getParentNode().get());
             type = locprop->getStaticType();
             nillable = locprop->isNillable();
         }
@@ -258,7 +258,7 @@ css::uno::Any ChildAccess::asValue() {
     }
     switch (node_->kind()) {
     case Node::KIND_PROPERTY:
-        return dynamic_cast< PropertyNode * >(node_.get())->getValue(
+        return static_cast< PropertyNode * >(node_.get())->getValue(
             getComponents());
     case Node::KIND_LOCALIZED_PROPERTY:
         {
@@ -272,7 +272,7 @@ css::uno::Any ChildAccess::asValue() {
         }
         break;
     case Node::KIND_LOCALIZED_VALUE:
-        return dynamic_cast< LocalizedValueNode * >(node_.get())->getValue();
+        return static_cast< LocalizedValueNode * >(node_.get())->getValue();
     default:
         break;
     }
@@ -291,11 +291,11 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
         globalModifications->add(path);
         switch (node_->kind()) {
         case Node::KIND_PROPERTY:
-            dynamic_cast< PropertyNode * >(node_.get())->setValue(
+            static_cast< PropertyNode * >(node_.get())->setValue(
                 Data::NO_LAYER, *changedValue_);
             break;
         case Node::KIND_LOCALIZED_VALUE:
-            dynamic_cast< LocalizedValueNode * >(node_.get())->setValue(
+            static_cast< LocalizedValueNode * >(node_.get())->setValue(
                 Data::NO_LAYER, *changedValue_);
             break;
         default:
diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx
index 8d98699..f6535df 100644
--- a/configmgr/source/data.cxx
+++ b/configmgr/source/data.cxx
@@ -279,7 +279,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
                 break;
             case Node::KIND_SET:
                 if (!templateName.isEmpty() &&
-                    !dynamic_cast< SetNode * >(parent.get())->isValidTemplate(
+                    !static_cast< SetNode * >(parent.get())->isValidTemplate(
                         templateName))
                 {
                     throw css::uno::RuntimeException(
diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx
index 67a65a6..f213d64 100644
--- a/configmgr/source/valueparser.cxx
+++ b/configmgr/source/valueparser.cxx
@@ -389,7 +389,7 @@ bool ValueParser::endElement() {
             }
             switch (node_->kind()) {
             case Node::KIND_PROPERTY:
-                dynamic_cast< PropertyNode * >(node_.get())->setValue(
+                static_cast< PropertyNode * >(node_.get())->setValue(
                     layer_, value);
                 break;
             case Node::KIND_LOCALIZED_PROPERTY:
@@ -402,7 +402,7 @@ bool ValueParser::endElement() {
                                 localizedName_,
                                 new LocalizedValueNode(layer_, value)));
                     } else {
-                        dynamic_cast< LocalizedValueNode * >(i->second.get())->
+                        static_cast< LocalizedValueNode * >(i->second.get())->
                             setValue(layer_, value);
                     }
                 }
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx
index d42bf22..974398c 100644
--- a/configmgr/source/writemodfile.cxx
+++ b/configmgr/source/writemodfile.cxx
@@ -267,7 +267,7 @@ void writeNode(
     switch (node->kind()) {
     case Node::KIND_PROPERTY:
         {
-            PropertyNode * prop = dynamic_cast< PropertyNode * >(node.get());
+            PropertyNode * prop = static_cast< PropertyNode * >(node.get());
             writeData_(handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\""));
             writeAttributeValue(handle, name);
             writeData_(
@@ -314,10 +314,10 @@ void writeNode(
                 writeAttributeValue(handle, name);
                 writeData_(handle, RTL_CONSTASCII_STRINGPARAM("\""));
             }
-            Type type = dynamic_cast< LocalizedPropertyNode * >(parent.get())->
+            Type type = static_cast< LocalizedPropertyNode * >(parent.get())->
                 getStaticType();
             css::uno::Any value(
-                dynamic_cast< LocalizedValueNode * >(node.get())->getValue());
+                static_cast< LocalizedValueNode * >(node.get())->getValue());
             Type dynType = getDynamicType(value);
             assert(dynType != TYPE_ERROR);
             if (type == TYPE_ANY) {
@@ -392,7 +392,7 @@ void writeModifications(
                 break;
             case Node::KIND_GROUP:
                 assert(
-                    dynamic_cast< GroupNode * >(parent.get())->isExtensible());
+                    static_cast< GroupNode * >(parent.get())->isExtensible());
                 writeData_(
                     handle, RTL_CONSTASCII_STRINGPARAM("<prop oor:name=\""));
                 writeAttributeValue(handle, nodeName);
diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx
index ca64e2e..a550240 100644
--- a/configmgr/source/xcsparser.cxx
+++ b/configmgr/source/xcsparser.cxx
@@ -74,7 +74,7 @@ void merge(
                 NodeMap::iterator i1(members.find(i2->first));
                 if (i1 == members.end()) {
                     if (i2->second->kind() == Node::KIND_PROPERTY &&
-                        dynamic_cast< GroupNode * >(
+                        static_cast< GroupNode * >(
                             original.get())->isExtensible())
                     {
                         members.insert(*i2);
@@ -91,7 +91,7 @@ void merge(
                 NodeMap & members = original->getMembers();
                 NodeMap::iterator i1(members.find(i2->first));
                 if (i1 == members.end()) {
-                    if (dynamic_cast< SetNode * >(original.get())->
+                    if (static_cast< SetNode * >(original.get())->
                         isValidTemplate(i2->second->getTemplateName()))
                     {
                         members.insert(*i2);
@@ -235,7 +235,7 @@ bool XcsParser::startElement(
                 {
                     handleSetItem(
                         reader,
-                        dynamic_cast< SetNode * >(elements_.top().node.get()));
+                        static_cast< SetNode * >(elements_.top().node.get()));
                     return true;
                 }
                 break;
diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx
index f6f7f30..9499f97 100644
--- a/configmgr/source/xcuparser.cxx
+++ b/configmgr/source/xcuparser.cxx
@@ -112,7 +112,7 @@ bool XcuParser::startElement(
             {
                 handlePropValue(
                     reader,
-                    dynamic_cast< PropertyNode * >(state_.top().node.get()));
+                    static_cast< PropertyNode * >(state_.top().node.get()));
             } else {
                 throw css::uno::RuntimeException(
                     ("bad property node member <" + name.convertFromUtf8() +
@@ -126,7 +126,7 @@ bool XcuParser::startElement(
             {
                 handleLocpropValue(
                     reader,
-                    dynamic_cast< LocalizedPropertyNode * >(
+                    static_cast< LocalizedPropertyNode * >(
                         state_.top().node.get()));
             } else {
                 throw css::uno::RuntimeException(
@@ -146,7 +146,7 @@ bool XcuParser::startElement(
             {
                 handleGroupProp(
                     reader,
-                    dynamic_cast< GroupNode * >(state_.top().node.get()));
+                    static_cast< GroupNode * >(state_.top().node.get()));
             } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
                        name.equals("node"))
             {
@@ -163,7 +163,7 @@ bool XcuParser::startElement(
                 name.equals("node"))
             {
                 handleSetNode(
-                    reader, dynamic_cast< SetNode * >(state_.top().node.get()));
+                    reader, static_cast< SetNode * >(state_.top().node.get()));
             } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
                        name.equals("prop"))
             {
@@ -383,7 +383,7 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) {
         state_.push(State::Ignore(true));
         return;
     case Node::KIND_LOCALIZED_PROPERTY:
-        valueParser_.type_ = dynamic_cast< LocalizedPropertyNode * >(
+        valueParser_.type_ = static_cast< LocalizedPropertyNode * >(
             node.get())->getStaticType();
         break;
     default:
@@ -542,7 +542,7 @@ void XcuParser::handleLocpropValue(
                     members[name] = new LocalizedValueNode(
                         valueParser_.getLayer(), css::uno::Any());
                 } else {
-                    dynamic_cast< LocalizedValueNode * >(
+                    static_cast< LocalizedValueNode * >(
                         i->second.get())->setValue(
                             valueParser_.getLayer(), css::uno::Any());
                 }
@@ -635,7 +635,7 @@ void XcuParser::handleGroupProp(
         case Node::KIND_LOCALIZED_PROPERTY:
             handleLocalizedGroupProp(
                 reader,
-                dynamic_cast< LocalizedPropertyNode * >(i->second.get()), name,
+                static_cast< LocalizedPropertyNode * >(i->second.get()), name,
                 type, op, finalized);
             break;
         default:
@@ -688,7 +688,7 @@ void XcuParser::handlePlainGroupProp(
     NodeMap::iterator const & propertyIndex, OUString const & name,
     Type type, Operation operation, bool finalized)
 {
-    PropertyNode * property = dynamic_cast< PropertyNode * >(
+    PropertyNode * property = static_cast< PropertyNode * >(
         propertyIndex->second.get());
     if (property->getLayer() > valueParser_.getLayer()) {
         state_.push(State::Ignore(true));
commit a0e4c24ecf8c92f3dba91a1b2319ec816ab57016
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 24 16:32:25 2014 +0100

    Revert "coverity#704575 et al.  and clean-up."
    
    This reverts commit 753eeac8a641d70ad0c44bb15fa8949ac991f5d9, which added bogus
    
      if (... != 0)
    
    checks after dynamic_casts that cannot fail, making the code now look as if it
    was expected that those casts can fail and the code is prepared to handle it
    (which it is not).  Silencing the false coverity reports will be addressed in a
    follow-up commit.
    
    (That commit unfortunately mixed those changes with mass cosmetic changes.)

diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx
index f4481c7..9e80d1b 100644
--- a/configmgr/source/childaccess.cxx
+++ b/configmgr/source/childaccess.cxx
@@ -75,91 +75,78 @@ ChildAccess::ChildAccess(
     Components & components, rtl::Reference< RootAccess > const & root,
     rtl::Reference< Access > const & parent, OUString const & name,
     rtl::Reference< Node > const & node):
-    Access(components), m_rRoot(root), m_rParent(parent), m_sName(name), m_rNode(node),
-    m_bInTransaction(false)
+    Access(components), root_(root), parent_(parent), name_(name), node_(node),
+    inTransaction_(false)
 {
-    m_pLock = lock();
+    lock_ = lock();
     assert(root.is() && parent.is() && node.is());
 }
 
 ChildAccess::ChildAccess(
     Components & components, rtl::Reference< RootAccess > const & root,
     rtl::Reference< Node > const & node):
-    Access(components), m_rRoot(root), m_rNode(node), m_bInTransaction(false)
+    Access(components), root_(root), node_(node), inTransaction_(false)
 {
-    m_pLock = lock();
+    lock_ = lock();
     assert(root.is() && node.is());
 }
 
-Path ChildAccess::getAbsolutePath()
-{
+Path ChildAccess::getAbsolutePath() {
     assert(getParentAccess().is());
     Path path(getParentAccess()->getAbsolutePath());
-    path.push_back(m_sName);
+    path.push_back(name_);
     return path;
 }
 
-Path ChildAccess::getRelativePath()
-{
+Path ChildAccess::getRelativePath() {
     Path path;
     rtl::Reference< Access > parent(getParentAccess());
-    if (parent.is())
-    {
+    if (parent.is()) {
         path = parent->getRelativePath();
     }
-    path.push_back(m_sName);
+    path.push_back(name_);
     return path;
 }
 
-OUString ChildAccess::getRelativePathRepresentation()
-{
+OUString ChildAccess::getRelativePathRepresentation() {
     OUStringBuffer path;
     rtl::Reference< Access > parent(getParentAccess());
-    if (parent.is())
-    {
+    if (parent.is()) {
         path.append(parent->getRelativePathRepresentation());
-        if (!path.isEmpty())
-        {
+        if (!path.isEmpty()) {
             path.append('/');
         }
     }
-    path.append(Data::createSegment(m_rNode->getTemplateName(), m_sName));
+    path.append(Data::createSegment(node_->getTemplateName(), name_));
     return path.makeStringAndClear();
 }
 
-rtl::Reference< Node > ChildAccess::getNode()
-{
-    return m_rNode;
+rtl::Reference< Node > ChildAccess::getNode() {
+    return node_;
 }
 
-bool ChildAccess::isFinalized()
-{
-    return m_rNode->getFinalized() != Data::NO_LAYER ||
-        (m_rParent.is() && m_rParent->isFinalized());
+bool ChildAccess::isFinalized() {
+    return node_->getFinalized() != Data::NO_LAYER ||
+        (parent_.is() && parent_->isFinalized());
 }
 
-OUString ChildAccess::getNameInternal()
-{
-    return m_sName;
+OUString ChildAccess::getNameInternal() {
+    return name_;
 }
 
-rtl::Reference< RootAccess > ChildAccess::getRootAccess()
-{
-    return m_rRoot;
+rtl::Reference< RootAccess > ChildAccess::getRootAccess() {
+    return root_;
 }
 
-rtl::Reference< Access > ChildAccess::getParentAccess()
-{
-    return m_rParent;
+rtl::Reference< Access > ChildAccess::getParentAccess() {
+    return parent_;
 }
 
-void ChildAccess::acquire() throw ()
-{
+void ChildAccess::acquire() throw () {
     Access::acquire();
 }
 
-void ChildAccess::release() throw ()
-{
+void ChildAccess::release() throw () {
     Access::release();
 }
 
@@ -167,16 +154,16 @@ css::uno::Reference< css::uno::XInterface > ChildAccess::getParent()
     throw (css::uno::RuntimeException)
 {
     assert(thisIs(IS_ANY));
-    osl::MutexGuard g(*m_pLock);
+    osl::MutexGuard g(*lock_);
     checkLocalizedPropertyAccess();
-    return static_cast< cppu::OWeakObject * >(m_rParent.get());
+    return static_cast< cppu::OWeakObject * >(parent_.get());
 }
 
 void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &)
     throw (css::lang::NoSupportException, css::uno::RuntimeException)
 {
     assert(thisIs(IS_ANY));
-    osl::MutexGuard g(*m_pLock);
+    osl::MutexGuard g(*lock_);
     checkLocalizedPropertyAccess();
     throw css::lang::NoSupportException(
         "setParent", static_cast< cppu::OWeakObject * >(this));
@@ -187,7 +174,7 @@ sal_Int64 ChildAccess::getSomething(
     throw (css::uno::RuntimeException)
 {
     assert(thisIs(IS_ANY));
-    osl::MutexGuard g(*m_pLock);
+    osl::MutexGuard g(*lock_);
     checkLocalizedPropertyAccess();
     return aIdentifier == getTunnelId()
         ? reinterpret_cast< sal_Int64 >(this) : 0;
@@ -198,61 +185,51 @@ void ChildAccess::bind(
     rtl::Reference< Access > const & parent, OUString const & name)
     throw ()
 {
-    assert(!m_rParent.is() && root.is() && parent.is() && !name.isEmpty());
-    m_rRoot = root;
-    m_rParent = parent;
-    m_sName = name;
+    assert(!parent_.is() && root.is() && parent.is() && !name.isEmpty());
+    root_ = root;
+    parent_ = parent;
+    name_ = name;
 }
 
-void ChildAccess::unbind() throw ()
-{
-    assert(m_rParent.is());
-    m_rParent->releaseChild(m_sName);
-    m_rParent.clear();
-    m_bInTransaction = true;
+void ChildAccess::unbind() throw () {
+    assert(parent_.is());
+    parent_->releaseChild(name_);
+    parent_.clear();
+    inTransaction_ = true;
 }
 
-void ChildAccess::committed()
-{
-    m_bInTransaction = false;
+void ChildAccess::committed() {
+    inTransaction_ = false;
 }
 
-void ChildAccess::setNode(rtl::Reference< Node > const & node)
-{
-    m_rNode = node;
+void ChildAccess::setNode(rtl::Reference< Node > const & node) {
+    node_ = node;
 }
 
-void ChildAccess::setProperty( css::uno::Any const & value,
-                               Modifications * localModifications)
+void ChildAccess::setProperty(
+    css::uno::Any const & value, Modifications * localModifications)
 {
     assert(localModifications != 0);
     Type type = TYPE_ERROR;
     bool nillable = false;
-    switch (m_rNode->kind())
-    {
+    switch (node_->kind()) {
     case Node::KIND_PROPERTY:
         {
-            PropertyNode * prop = dynamic_cast< PropertyNode * >(m_rNode.get());
-            if(prop)
-            {
-                type = prop->getStaticType();
-                nillable = prop->isNillable();
-            }
+            PropertyNode * prop = dynamic_cast< PropertyNode * >(node_.get());
+            type = prop->getStaticType();
+            nillable = prop->isNillable();
         }
         break;
     case Node::KIND_LOCALIZED_PROPERTY:
         {
             OUString locale(getRootAccess()->getLocale());
-            if (!Components::allLocales(locale))
-            {
+            if (!Components::allLocales(locale)) {
                 rtl::Reference< ChildAccess > child(getChild(locale));
-                if (child.is())
-                {
+                if (child.is()) {
                     child->setProperty(value, localModifications);
-                }
-                else
-                {
-                    insertLocalizedValueChild( locale, value, localModifications);
+                } else {
+                    insertLocalizedValueChild(
+                        locale, value, localModifications);
                 }
                 return;
             }
@@ -262,11 +239,8 @@ void ChildAccess::setProperty( css::uno::Any const & value,
         {
             LocalizedPropertyNode * locprop =
                 dynamic_cast< LocalizedPropertyNode * >(getParentNode().get());
-            if(locprop)
-            {
-                type = locprop->getStaticType();
-                nillable = locprop->isNillable();
-            }
+            type = locprop->getStaticType();
+            nillable = locprop->isNillable();
         }
         break;
     default:
@@ -274,32 +248,22 @@ void ChildAccess::setProperty( css::uno::Any const & value,
     }
     checkValue(value, type, nillable);
     getParentAccess()->markChildAsModified(this);
-    m_changedValue.reset(new css::uno::Any(value));
+    changedValue_.reset(new css::uno::Any(value));
     localModifications->add(getRelativePath());
 }
 
-css::uno::Any ChildAccess::asValue()
-{
-    if (m_changedValue.get() != 0)
-    {
-        return *m_changedValue;
+css::uno::Any ChildAccess::asValue() {
+    if (changedValue_.get() != 0) {
+        return *changedValue_;
     }
-    switch (m_rNode->kind())
-    {
+    switch (node_->kind()) {
     case Node::KIND_PROPERTY:
-        {
-            PropertyNode* propnode = dynamic_cast< PropertyNode * >(m_rNode.get());
-            if(propnode)
-            {
-                return propnode->getValue(getComponents());
-            }
-        }
-        break;
+        return dynamic_cast< PropertyNode * >(node_.get())->getValue(
+            getComponents());
     case Node::KIND_LOCALIZED_PROPERTY:
         {
             OUString locale(getRootAccess()->getLocale());
-            if (!Components::allLocales(locale))
-            {
+            if (!Components::allLocales(locale)) {
                 rtl::Reference< ChildAccess > child(getChild("*" + locale));
                 // As a last resort, return a nil value even though it may be
                 // illegal for the given property:
@@ -308,14 +272,7 @@ css::uno::Any ChildAccess::asValue()
         }
         break;
     case Node::KIND_LOCALIZED_VALUE:
-        {
-            LocalizedValueNode* locnode = dynamic_cast< LocalizedValueNode * >(m_rNode.get());
-            if(locnode)
-            {
-                return locnode->getValue();
-            }
-        }
-        break;
+        return dynamic_cast< LocalizedValueNode * >(node_.get())->getValue();
     default:
         break;
     }
@@ -328,56 +285,42 @@ void ChildAccess::commitChanges(bool valid, Modifications * globalModifications)
 {
     assert(globalModifications != 0);
     commitChildChanges(valid, globalModifications);
-    if (valid && m_changedValue.get() != 0)
-    {
+    if (valid && changedValue_.get() != 0) {
         Path path(getAbsolutePath());
         getComponents().addModification(path);
         globalModifications->add(path);
-        switch (m_rNode->kind())
-        {
+        switch (node_->kind()) {
         case Node::KIND_PROPERTY:
-            {
-                PropertyNode* propnode = dynamic_cast< PropertyNode * >(m_rNode.get());
-                if(propnode)
-                {
-                    propnode->setValue( Data::NO_LAYER, *m_changedValue);
-                }
-            }
+            dynamic_cast< PropertyNode * >(node_.get())->setValue(
+                Data::NO_LAYER, *changedValue_);
             break;
         case Node::KIND_LOCALIZED_VALUE:
-            {
-                LocalizedValueNode* locnode = dynamic_cast< LocalizedValueNode * >(m_rNode.get());
-                if(locnode)
-                {
-                    locnode->setValue( Data::NO_LAYER, *m_changedValue);
-                }
-            }
+            dynamic_cast< LocalizedValueNode * >(node_.get())->setValue(
+                Data::NO_LAYER, *changedValue_);
             break;
         default:
             assert(false); // this cannot happen
             break;
         }
     }
-    m_changedValue.reset();
+    changedValue_.reset();
 }
 
-ChildAccess::~ChildAccess()
-{
-    osl::MutexGuard g(*m_pLock);
-    if (m_rParent.is())
-    {
-        m_rParent->releaseChild(m_sName);
+ChildAccess::~ChildAccess() {
+    osl::MutexGuard g(*lock_);
+    if (parent_.is()) {
+        parent_->releaseChild(name_);
     }
 }
 
-void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const
-{
+void ChildAccess::addTypes(std::vector< css::uno::Type > * types) const {
     assert(types != 0);
     types->push_back(cppu::UnoType< css::container::XChild >::get());
     types->push_back(cppu::UnoType< css::lang::XUnoTunnel >::get());
 }
 
-void ChildAccess::addSupportedServiceNames( std::vector< OUString > * services)
+void ChildAccess::addSupportedServiceNames(
+    std::vector< OUString > * services)
 {
     assert(services != 0);
     services->push_back(
@@ -390,7 +333,7 @@ css::uno::Any ChildAccess::queryInterface(css::uno::Type const & aType)
     throw (css::uno::RuntimeException)
 {
     assert(thisIs(IS_ANY));
-    osl::MutexGuard g(*m_pLock);
+    osl::MutexGuard g(*lock_);
     checkLocalizedPropertyAccess();
     css::uno::Any res(Access::queryInterface(aType));
     return res.hasValue()
diff --git a/configmgr/source/childaccess.hxx b/configmgr/source/childaccess.hxx
index c34ea39..ef1444a 100644
--- a/configmgr/source/childaccess.hxx
+++ b/configmgr/source/childaccess.hxx
@@ -105,7 +105,7 @@ public:
 
     void unbind() throw ();
 
-    bool isInTransaction() const { return m_bInTransaction; }
+    bool isInTransaction() const { return inTransaction_; }
     void committed();
     void setNode(rtl::Reference< Node > const & node);
 
@@ -130,14 +130,14 @@ private:
         com::sun::star::uno::Type const & aType)
         throw (com::sun::star::uno::RuntimeException);
 
-    rtl::Reference< RootAccess > m_rRoot;
-    rtl::Reference< Access > m_rParent; // null if free node
-    OUString m_sName;
-    rtl::Reference< Node > m_rNode;
-    std::auto_ptr< com::sun::star::uno::Any > m_changedValue;
-    bool m_bInTransaction;
+    rtl::Reference< RootAccess > root_;
+    rtl::Reference< Access > parent_; // null if free node
+    OUString name_;
+    rtl::Reference< Node > node_;
+    std::auto_ptr< com::sun::star::uno::Any > changedValue_;
+    bool inTransaction_;
         // to determine if a free node can be inserted underneath some root
-    boost::shared_ptr<osl::Mutex> m_pLock;
+    boost::shared_ptr<osl::Mutex> lock_;
 };
 
 }


More information about the Libreoffice-commits mailing list