sc/source/filter/html/htmlpars.cxx |   36 ++++++++++++++++++------------------
 sc/source/filter/inc/htmlpars.hxx  |    4 ++--
 2 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit b10bd75c9d1125ab51856b174e4052cbcd933774
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Sep 4 20:39:15 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Sep 5 08:29:15 2021 +0200

    no need to allocate NamePropsType with unique_ptr
    
    Change-Id: Ib042c481d682467620ae72a0b7e0bb2a5c8bf6ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121649
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 7ffda1ca00cd..991b8c0a1960 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -86,17 +86,17 @@ void ScHTMLStyles::add(const char* pElemName, size_t 
nElemName, const char* pCla
             {
                 // new element
                 std::pair<ElemsType::iterator, bool> r =
-                    m_ElemProps.insert(std::make_pair(aElem, 
std::make_unique<NamePropsType>()));
+                    m_ElemProps.insert(std::make_pair(aElem, NamePropsType()));
                 if (!r.second)
                     // insertion failed.
                     return;
                 itrElem = r.first;
             }
 
-            NamePropsType *const pClsProps = itrElem->second.get();
+            NamePropsType& rClsProps = itrElem->second;
             OUString aClass(pClassName, nClassName, RTL_TEXTENCODING_UTF8);
             aClass = aClass.toAsciiLowerCase();
-            insertProp(*pClsProps, aClass, aProp, aValue);
+            insertProp(rClsProps, aClass, aProp, aValue);
         }
         else
         {
@@ -124,13 +124,13 @@ const OUString& ScHTMLStyles::getPropertyValue(
         auto const itr = m_ElemProps.find(rElem);
         if (itr != m_ElemProps.end())
         {
-            const NamePropsType *const pClasses = itr->second.get();
-            NamePropsType::const_iterator itr2 = pClasses->find(rClass);
-            if (itr2 != pClasses->end())
+            const NamePropsType& rClasses = itr->second;
+            NamePropsType::const_iterator itr2 = rClasses.find(rClass);
+            if (itr2 != rClasses.end())
             {
-                const PropsType *const pProps = itr2->second.get();
-                PropsType::const_iterator itr3 = pProps->find(rPropName);
-                if (itr3 != pProps->end())
+                const PropsType& rProps = itr2->second;
+                PropsType::const_iterator itr3 = rProps.find(rPropName);
+                if (itr3 != rProps.end())
                     return itr3->second;
             }
         }
@@ -140,9 +140,9 @@ const OUString& ScHTMLStyles::getPropertyValue(
         auto const itr = m_GlobalProps.find(rClass);
         if (itr != m_GlobalProps.end())
         {
-            const PropsType *const pProps = itr->second.get();
-            PropsType::const_iterator itr2 = pProps->find(rPropName);
-            if (itr2 != pProps->end())
+            const PropsType& rProps = itr->second;
+            PropsType::const_iterator itr2 = rProps.find(rPropName);
+            if (itr2 != rProps.end())
                 return itr2->second;
         }
     }
@@ -151,9 +151,9 @@ const OUString& ScHTMLStyles::getPropertyValue(
         auto const itr = m_ElemGlobalProps.find(rClass);
         if (itr != m_ElemGlobalProps.end())
         {
-            const PropsType *const pProps = itr->second.get();
-            PropsType::const_iterator itr2 = pProps->find(rPropName);
-            if (itr2 != pProps->end())
+            const PropsType& rProps = itr->second;
+            PropsType::const_iterator itr2 = rProps.find(rPropName);
+            if (itr2 != rProps.end())
                 return itr2->second;
         }
     }
@@ -170,7 +170,7 @@ void ScHTMLStyles::insertProp(
     {
         // new element
         std::pair<NamePropsType::iterator, bool> r =
-            rStore.insert(std::make_pair(aName, 
std::make_unique<PropsType>()));
+            rStore.insert(std::make_pair(aName, PropsType()));
         if (!r.second)
             // insertion failed.
             return;
@@ -178,8 +178,8 @@ void ScHTMLStyles::insertProp(
         itr = r.first;
     }
 
-    PropsType *const pProps = itr->second.get();
-    pProps->emplace(aProp, aValue);
+    PropsType& rProps = itr->second;
+    rProps.emplace(aProp, aValue);
 }
 
 // BASE class for HTML parser classes
diff --git a/sc/source/filter/inc/htmlpars.hxx 
b/sc/source/filter/inc/htmlpars.hxx
index a683a0c984d7..e0c4dad24843 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -47,8 +47,8 @@ class ScHTMLTable;
 class ScHTMLStyles
 {
     typedef std::unordered_map<OUString, OUString> PropsType;
-    typedef ::std::map<OUString, std::unique_ptr<PropsType>> NamePropsType;
-    typedef ::std::map<OUString, std::unique_ptr<NamePropsType>> ElemsType;
+    typedef ::std::map<OUString, PropsType> NamePropsType;
+    typedef ::std::map<OUString, NamePropsType> ElemsType;
 
     NamePropsType m_GlobalProps;     /// global properties (for a given class 
for all elements)
     NamePropsType m_ElemGlobalProps; /// element global properties (no class 
specified)

Reply via email to