reportdesign/source/filter/xml/xmlCell.cxx        |    8 +--
 sc/source/filter/xml/XMLTrackedChangesContext.cxx |    3 -
 sw/source/filter/xml/xmltbli.cxx                  |   47 ++++++++++------------
 xmloff/source/chart/SchXMLTableContext.cxx        |    5 --
 xmloff/source/table/XMLTableImport.cxx            |   10 +---
 5 files changed, 32 insertions(+), 41 deletions(-)

New commits:
commit 1b69f0c2731ec66e76073ab0f2936b7112bf1e77
Author:     Noel <noelgran...@gmail.com>
AuthorDate: Mon Dec 14 15:05:37 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Dec 14 17:46:15 2020 +0100

    use more direct parsing on FastAttributeList
    
    instead of first allocating an OUString
    
    Change-Id: I796b1b2d47eb3cb9bebb00ae1bbd465010ebf494
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107691
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/reportdesign/source/filter/xml/xmlCell.cxx 
b/reportdesign/source/filter/xml/xmlCell.cxx
index 27155525ba69..adfac9d59cc6 100644
--- a/reportdesign/source/filter/xml/xmlCell.cxx
+++ b/reportdesign/source/filter/xml/xmlCell.cxx
@@ -62,18 +62,16 @@ OXMLCell::OXMLCell( ORptFilter& rImport
 
     for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
     {
-        OUString sValue = aIter.toString();
-
         switch( aIter.getToken() )
         {
             case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-                m_sStyleName = sValue;
+                m_sStyleName = aIter.toString();
                 break;
             case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_SPANNED):
-                m_pContainer->setColumnSpanned(sValue.toInt32());
+                m_pContainer->setColumnSpanned(aIter.toInt32());
                 break;
             case XML_ELEMENT(TABLE, XML_NUMBER_ROWS_SPANNED):
-                m_pContainer->setRowSpanned(sValue.toInt32());
+                m_pContainer->setRowSpanned(aIter.toInt32());
                 break;
             default:
                 XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 2accb0987344..d8292c5feecd 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -666,9 +666,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLChangeTextPContext
         sal_Int32 nRepeat(0);
         for( auto& aIter : sax_fastparser::castToFastAttributeList(mxAttrList) 
)
         {
-            const OUString sValue = aIter.toString();
             if (aIter.getToken() == XML_ELEMENT(TEXT, XML_C))
-                nRepeat = sValue.toInt32();
+                nRepeat = aIter.toInt32();
             else
                 XMLOFF_WARN_UNKNOWN("sc", aIter);
         }
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 77f7ee7f9128..be694b483d00 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -356,15 +356,14 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
     m_sSaveParaDefault = 
GetImport().GetTextImport()->GetCellParaStyleDefault();
     for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
     {
-        const OUString sValue = aIter.toString();
         switch( aIter.getToken() )
         {
         case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-            m_aStyleName = sValue;
-            GetImport().GetTextImport()->SetCellParaStyleDefault(sValue);
+            m_aStyleName = aIter.toString();
+            GetImport().GetTextImport()->SetCellParaStyleDefault(m_aStyleName);
             break;
         case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_SPANNED):
-            m_nColSpan = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
sValue.toInt32()));
+            m_nColSpan = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
aIter.toInt32()));
             if (m_nColSpan > 256)
             {
                 SAL_INFO("sw.xml", "ignoring huge table:number-columns-spanned 
" << m_nColSpan);
@@ -372,7 +371,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
             }
             break;
         case XML_ELEMENT(TABLE, XML_NUMBER_ROWS_SPANNED):
-            m_nRowSpan = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
sValue.toInt32()));
+            m_nRowSpan = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
aIter.toInt32()));
             if (m_nRowSpan > 8192 || (m_nRowSpan > 256 && 
utl::ConfigManager::IsFuzzing()))
             {
                 SAL_INFO("sw.xml", "ignoring huge table:number-rows-spanned " 
<< m_nRowSpan);
@@ -380,7 +379,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
             }
             break;
         case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_REPEATED):
-            m_nColRepeat = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
sValue.toInt32()));
+            m_nColRepeat = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
aIter.toInt32()));
             if (m_nColRepeat > 256)
             {
                 SAL_INFO("sw.xml", "ignoring huge 
table:number-columns-repeated " << m_nColRepeat);
@@ -391,14 +390,14 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
             {
                 OUString sTmp;
                 const sal_uInt16 nPrefix2 = GetImport().GetNamespaceMap().
-                        GetKeyByAttrValueQName(sValue, &sTmp);
-                m_sFormula = XML_NAMESPACE_OOOW == nPrefix2 ? sTmp : sValue;
+                        GetKeyByAttrValueQName(aIter.toString(), &sTmp);
+                m_sFormula = XML_NAMESPACE_OOOW == nPrefix2 ? sTmp : 
aIter.toString();
             }
             break;
         case XML_ELEMENT(OFFICE, XML_VALUE):
             {
                 double fTmp;
-                if (::sax::Converter::convertDouble(fTmp, sValue))
+                if (::sax::Converter::convertDouble(fTmp, aIter.toString()))
                 {
                     m_fValue = fTmp;
                     m_bHasValue = true;
@@ -408,7 +407,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
         case XML_ELEMENT(OFFICE, XML_TIME_VALUE):
             {
                 double fTmp;
-                if (::sax::Converter::convertDuration(fTmp, sValue))
+                if (::sax::Converter::convertDuration(fTmp, aIter.toString()))
                 {
                     m_fValue = fTmp;
                     m_bHasValue = true;
@@ -419,7 +418,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
             {
                 double fTmp;
                 if (GetImport().GetMM100UnitConverter().convertDateTime(fTmp,
-                                                                      sValue))
+                                                                      
aIter.toString()))
                 {
                     m_fValue = fTmp;
                     m_bHasValue = true;
@@ -429,7 +428,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
         case XML_ELEMENT(OFFICE, XML_BOOLEAN_VALUE):
             {
                 bool bTmp(false);
-                if (::sax::Converter::convertBool(bTmp, sValue))
+                if (::sax::Converter::convertBool(bTmp, aIter.toString()))
                 {
                     m_fValue = (bTmp ? 1.0 : 0.0);
                     m_bHasValue = true;
@@ -440,7 +439,7 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
         case XML_ELEMENT(TABLE, XML_PROTECTED):
             {
                 bool bTmp(false);
-                if (::sax::Converter::convertBool(bTmp, sValue))
+                if (::sax::Converter::convertBool(bTmp, aIter.toString()))
                 {
                     m_bProtect = bTmp;
                 }
@@ -448,13 +447,13 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
             break;
         case XML_ELEMENT(OFFICE, XML_STRING_VALUE):
             {
-                m_StringValue = sValue;
+                m_StringValue = aIter.toString();
                 m_bHasStringValue = true;
             }
             break;
         case XML_ELEMENT(OFFICE, XML_VALUE_TYPE):
             {
-                if ("string" == sValue)
+                if ("string" == aIter.toString())
                 {
                     m_bValueTypeIsString = true;
                 }
@@ -635,15 +634,14 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl(
 
     for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
     {
-        OUString sValue = aIter.toString();
         switch (aIter.getToken())
         {
             case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-                aStyleName = sValue;
+                aStyleName = aIter.toString();
                 break;
             case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_REPEATED):
             {
-                nColRep = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
sValue.toInt32()));
+                nColRep = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
aIter.toInt32()));
                 if (nColRep > 256)
                 {
                     SAL_INFO("sw.xml", "ignoring huge 
table:number-columns-repeated " << nColRep);
@@ -652,7 +650,7 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl(
                 break;
             }
             case XML_ELEMENT(TABLE, XML_DEFAULT_CELL_STYLE_NAME):
-                aDfltCellStyleName = sValue;
+                aDfltCellStyleName = aIter.toString();
                 break;
             case XML_ELEMENT(XML, XML_ID):
             {
@@ -775,15 +773,14 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( 
SwXMLImport& rImport,
 
     for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
     {
-        const OUString sValue = aIter.toString();
         switch(aIter.getToken())
         {
             case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-                aStyleName = sValue;
+                aStyleName = aIter.toString();
                 break;
             case XML_ELEMENT(STYLE,  XML_NUMBER_ROWS_REPEATED):
             {
-                nRowRepeat = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
sValue.toInt32()));
+                nRowRepeat = static_cast<sal_uInt32>(std::max<sal_Int32>(1, 
aIter.toInt32()));
                 if (nRowRepeat > 8192 || (nRowRepeat > 256 && 
utl::ConfigManager::IsFuzzing()))
                 {
                     SAL_INFO("sw.xml", "ignoring huge 
table:number-rows-repeated " << nRowRepeat);
@@ -792,13 +789,13 @@ SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( 
SwXMLImport& rImport,
                 break;
             }
             case XML_ELEMENT(STYLE, XML_DEFAULT_CELL_STYLE_NAME):
-                aDfltCellStyleName = sValue;
+                aDfltCellStyleName = aIter.toString();
                 break;
             case XML_ELEMENT(XML, XML_ID):
-                sXmlId = sValue;
+                sXmlId = aIter.toString();
                 break;
             default:
-                SAL_WARN("sw", "unknown attribute " << 
SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << "=" << sValue);
+                XMLOFF_WARN_UNKNOWN("sw", aIter);
         }
     }
     if( GetTable()->IsValid() )
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx 
b/xmloff/source/chart/SchXMLTableContext.cxx
index e00245a2e2c3..8b128461bf35 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -427,9 +427,8 @@ void SchXMLTableColumnContext::startFastElement (sal_Int32 
/*nElement*/,
         {
             case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_REPEATED):
             {
-                OUString aValue = aIter.toString();
-                if( !aValue.isEmpty())
-                    nRepeated = aValue.toInt32();
+                if( !aIter.isEmpty())
+                    nRepeated = aIter.toInt32();
                 break;
             }
             case XML_ELEMENT(TABLE, XML_VISIBILITY):
diff --git a/xmloff/source/table/XMLTableImport.cxx 
b/xmloff/source/table/XMLTableImport.cxx
index 6d8b30f474ce..d6c2d549c3b5 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -619,21 +619,19 @@ XMLCellImportContext::XMLCellImportContext( SvXMLImport& 
rImport,
     // read attributes for the table-cell
     for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
     {
-        const OUString sValue = aIter.toString();
-
         switch (aIter.getToken())
         {
             case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_REPEATED):
-                mnRepeated = sValue.toInt32();
+                mnRepeated = aIter.toInt32();
                 break;
             case XML_ELEMENT(TABLE, XML_NUMBER_COLUMNS_SPANNED):
-                mnColSpan = sValue.toInt32();
+                mnColSpan = aIter.toInt32();
                 break;
             case XML_ELEMENT(TABLE, XML_NUMBER_ROWS_SPANNED):
-                mnRowSpan = sValue.toInt32();
+                mnRowSpan = aIter.toInt32();
                 break;
             case XML_ELEMENT(TABLE, XML_STYLE_NAME):
-                sStyleName = sValue;
+                sStyleName = aIter.toString();
                 break;
             case XML_ELEMENT(XML, XML_ID):
 //FIXME: TODO
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to