This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e4e2125aa6 configmgr: avoid C++11-only Boost.Unordered
e4e2125aa6 is described below

commit e4e2125aa62e0f7eb93feb1a28a0a374d6afbf8c
Author: Jim Jagielski <[email protected]>
AuthorDate: Wed Jul 29 10:37:06 2026 -0400

    configmgr: avoid C++11-only Boost.Unordered
    
    Boost.Unordered 1.84 requires C++11 and cannot be compiled by the
    Visual C++ 2008 toolchain still used for Windows builds.
    
    Replace configmgr's recursive unordered maps with C++03-compatible
    std::map containers holding boost::shared_ptr children.
---
 main/configmgr/source/access.cxx        | 10 +++++-----
 main/configmgr/source/components.cxx    |  2 +-
 main/configmgr/source/modifications.cxx |  8 ++++----
 main/configmgr/source/modifications.hxx |  6 ++++--
 main/configmgr/source/partial.cxx       | 19 +++++++++++++++----
 main/configmgr/source/partial.hxx       |  9 +++++++--
 main/configmgr/source/writemodfile.cxx  |  4 ++--
 7 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/main/configmgr/source/access.cxx b/main/configmgr/source/access.cxx
index 7168a8ff24..ba8db3d256 100644
--- a/main/configmgr/source/access.cxx
+++ b/main/configmgr/source/access.cxx
@@ -483,10 +483,10 @@ void Access::initBroadcasterAndChanges(
         if (child.is()) {
             switch (child->getNode()->kind()) {
             case Node::KIND_LOCALIZED_PROPERTY:
-                if (!i->second.children.empty()) {
+                if (!i->second->children.empty()) {
                     if (Components::allLocales(getRootAccess()->getLocale())) {
                         child->initBroadcasterAndChanges(
-                            i->second, broadcaster, allChanges);
+                            *i->second, broadcaster, allChanges);
                             //TODO: if allChanges==0, recurse only into 
children
                             // w/ listeners
                     } else {
@@ -644,7 +644,7 @@ void Access::initBroadcasterAndChanges(
                 break;
             case Node::KIND_GROUP:
             case Node::KIND_SET:
-                if (i->second.children.empty()) {
+                if (i->second->children.empty()) {
                     if (child->getNode()->getTemplateName().getLength() != 0) {
                         for (ContainerListeners::iterator j(
                                  containerListeners_.begin());
@@ -672,7 +672,7 @@ void Access::initBroadcasterAndChanges(
                     // change
                 } else {
                     child->initBroadcasterAndChanges(
-                        i->second, broadcaster, allChanges);
+                        *i->second, broadcaster, allChanges);
                         //TODO: if allChanges==0, recurse only into children w/
                         // listeners
                 }
@@ -781,7 +781,7 @@ void Access::initBroadcasterAndChanges(
                 break;
             case Node::KIND_SET:
                 // Removed set member:
-                if (i->second.children.empty()) {
+                if (i->second->children.empty()) {
                     for (ContainerListeners::iterator j(
                              containerListeners_.begin());
                          j != containerListeners_.end(); ++j)
diff --git a/main/configmgr/source/components.cxx 
b/main/configmgr/source/components.cxx
index 923f917021..33fbaddd62 100644
--- a/main/configmgr/source/components.cxx
+++ b/main/configmgr/source/components.cxx
@@ -278,7 +278,7 @@ void Components::initGlobalBroadcaster(
                         mods = 0;
                         break;
                     }
-                    mods = &k->second;
+                    mods = k->second.get();
                 }
                 //TODO: If the complete tree of which root is a part is 
deleted,
                 // or replaced, mods will be null, but some of the listeners
diff --git a/main/configmgr/source/modifications.cxx 
b/main/configmgr/source/modifications.cxx
index 88ad59614a..0d404e3512 100644
--- a/main/configmgr/source/modifications.cxx
+++ b/main/configmgr/source/modifications.cxx
@@ -44,13 +44,13 @@ void Modifications::add(Path const & path) {
             if (wasPresent && p->children.empty()) {
                 return;
             }
-            j = p->children.insert(Node::Children::value_type(*i, Node())).
-                first;
+            j = p->children.insert(
+                Node::Children::value_type(*i, Node::NodePtr(new Node))).first;
             wasPresent = false;
         } else {
             wasPresent = true;
         }
-        p = &j->second;
+        p = j->second.get();
     }
     p->children.clear();
 }
@@ -72,7 +72,7 @@ void Modifications::remove(Path const & path) {
             }
             break;
         }
-        p = &j->second;
+        p = j->second.get();
     }
 }
 
diff --git a/main/configmgr/source/modifications.hxx 
b/main/configmgr/source/modifications.hxx
index 1aa0d24494..5d16ce7add 100644
--- a/main/configmgr/source/modifications.hxx
+++ b/main/configmgr/source/modifications.hxx
@@ -26,9 +26,10 @@
 
 #include "sal/config.h"
 
-#include <boost/unordered_map.hpp> // using the boost container because it 
explicitly allows recursive types
+#include <map>
 
 #include "boost/noncopyable.hpp"
+#include "boost/shared_ptr.hpp"
 
 #include "path.hxx"
 #include "rtl/ustring.hxx"
@@ -38,7 +39,8 @@ namespace configmgr {
 class Modifications: private boost::noncopyable {
 public:
     struct Node {
-        typedef boost::unordered_map< rtl::OUString, Node, rtl::OUStringHash > 
Children;
+        typedef boost::shared_ptr< Node > NodePtr;
+        typedef std::map< rtl::OUString, NodePtr > Children;
 
         Children children;
     };
diff --git a/main/configmgr/source/partial.cxx 
b/main/configmgr/source/partial.cxx
index 722603ff53..0f852dbd8d 100644
--- a/main/configmgr/source/partial.cxx
+++ b/main/configmgr/source/partial.cxx
@@ -68,6 +68,17 @@ bool parseSegment(
 
 }
 
+Partial::Node * Partial::getOrCreateChild(
+    Node * parent, rtl::OUString const & name)
+{
+    Node::Children::iterator i(parent->children.find(name));
+    if (i == parent->children.end()) {
+        i = parent->children.insert(
+            Node::Children::value_type(name, Node::NodePtr(new Node))).first;
+    }
+    return i->second.get();
+}
+
 Partial::Partial(
     std::set< rtl::OUString > const & includedPaths,
     std::set< rtl::OUString > const & excludedPaths)
@@ -79,7 +90,7 @@ Partial::Partial(
         for (Node * p = &root_;;) {
             rtl::OUString seg;
             bool end = parseSegment(*i, &n, &seg);
-            p = &p->children[seg];
+            p = getOrCreateChild(p, seg);
             if (p->startInclude) {
                 break;
             }
@@ -98,14 +109,14 @@ Partial::Partial(
             rtl::OUString seg;
             bool end = parseSegment(*i, &n, &seg);
             if (end) {
-                p->children[seg].clear();
+                getOrCreateChild(p, seg)->clear();
                 break;
             }
             Node::Children::iterator j(p->children.find(seg));
             if (j == p->children.end()) {
                 break;
             }
-            p = &j->second;
+            p = j->second.get();
         }
     }
 }
@@ -123,7 +134,7 @@ Partial::Containment Partial::contains(Path const & path) 
const {
         {
             break;
         }
-        p = &j->second;
+        p = j->second.get();
         includes |= p->startInclude;
     }
     return ( ( p->children.empty() || p == &root_ )
diff --git a/main/configmgr/source/partial.hxx 
b/main/configmgr/source/partial.hxx
index 1d2c4dfb22..4cf766ca32 100644
--- a/main/configmgr/source/partial.hxx
+++ b/main/configmgr/source/partial.hxx
@@ -26,10 +26,11 @@
 
 #include "sal/config.h"
 
-#include <boost/unordered_map.hpp> // using the boost container because it 
explicitly allows recursive types
+#include <map>
 #include <set>
 
 #include "boost/noncopyable.hpp"
+#include "boost/shared_ptr.hpp"
 
 #include "path.hxx"
 #include "rtl/ustring.hxx"
@@ -50,7 +51,8 @@ public:
 
 private:
     struct Node {
-        typedef boost::unordered_map< rtl::OUString, Node, rtl::OUStringHash > 
Children;
+        typedef boost::shared_ptr< Node > NodePtr;
+        typedef std::map< rtl::OUString, NodePtr > Children;
 
         Node(): startInclude(false) {}
         void clear() { startInclude=false; children.clear(); }
@@ -59,6 +61,9 @@ private:
         bool startInclude;
     };
 
+    static Node * getOrCreateChild(
+        Node * parent, rtl::OUString const & name);
+
     Node root_;
 };
 
diff --git a/main/configmgr/source/writemodfile.cxx 
b/main/configmgr/source/writemodfile.cxx
index 1e2de127bd..2d32ce9419 100644
--- a/main/configmgr/source/writemodfile.cxx
+++ b/main/configmgr/source/writemodfile.cxx
@@ -519,7 +519,7 @@ void writeModifications(
         {
             writeModifications(
                 components, handle, pathRep, node, i->first,
-                node->getMember(i->first), i->second);
+                node->getMember(i->first), *i->second);
         }
     }
 }
@@ -582,7 +582,7 @@ void writeModFile(
         writeModifications(
             components, tmp.handle, rtl::OUString(), rtl::Reference< Node >(),
             j->first, Data::findNode(Data::NO_LAYER, data.components, 
j->first),
-            j->second);
+            *j->second);
     }
     writeData(tmp.handle, RTL_CONSTASCII_STRINGPARAM("</oor:items>"));
     oslFileError e = osl_closeFile(tmp.handle);

Reply via email to