[Libreoffice-commits] core.git: include/sax include/xmloff sc/source xmloff/source

Mohammed Abdul Azeem azeemmysore at gmail.com
Fri Feb 10 11:34:42 UTC 2017


 include/sax/fastattribs.hxx       |    6 ++++++
 include/xmloff/xmltoken.hxx       |    4 ++++
 sc/source/filter/xml/xmlbodyi.cxx |    2 +-
 sc/source/filter/xml/xmlcelli.cxx |    7 +++----
 sc/source/filter/xml/xmltabi.cxx  |    4 ++--
 xmloff/source/core/xmltoken.cxx   |   11 +++++++++++
 6 files changed, 27 insertions(+), 7 deletions(-)

New commits:
commit 32c0ab80aa0dbe105be15c5feee4e3bd7cc5ee25
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date:   Thu Feb 9 20:33:15 2017 +0530

    Further modifications to FastAttributeIter:
    
    attempt to further reduce unnecessary allocation and
    freeing of OUString.
    
    Change-Id: I85169cfcd2311a5e6a96dc0292ce0686d1b0e43d
    Reviewed-on: https://gerrit.libreoffice.org/34092
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 112e678..9588990 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -145,6 +145,12 @@ public:
                             mrList.AttributeValueLength(mnIdx),
                             RTL_TEXTENCODING_UTF8);
         }
+
+        const char* toCString()
+        {
+            assert(mnIdx < mrList.maAttributeTokens.size());
+            return mrList.getFastAttributeValue(mnIdx);
+        }
         bool isString(const char *str)
         {
             assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 989fa33..70b57d1 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3291,6 +3291,10 @@ namespace xmloff { namespace token {
     XMLOFF_DLLPUBLIC bool IsXMLToken(
         const OUString& rString,
         enum XMLTokenEnum eToken );
+
+    XMLOFF_DLLPUBLIC bool IsXMLToken(
+        const char* pCString,
+        enum XMLTokenEnum eToken );
 } }
 
 #endif
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index bb6ba3f..dcddb22 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -104,7 +104,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
         {
             const sal_Int32 nLocalToken = nToken & TOKEN_MASK;
             if( nLocalToken == XML_STRUCTURE_PROTECTED )
-                bProtected = IsXMLToken( it.toString(), XML_TRUE );
+                bProtected = IsXMLToken( it.toCString(), XML_TRUE );
             else if ( nLocalToken == XML_PROTECTION_KEY )
                 sPassword = it.toString();
             else if (  nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM )
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 70b5b74..f5e2ee1 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -258,13 +258,12 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                 {
                     if (!it.isEmpty())
                     {
-                        const OUString sValue = it.toString();
-                        if ( IsXMLToken(sValue, XML_TRUE) )
+                        if ( IsXMLToken( it.toCString(), XML_TRUE ) )
                             fValue = 1.0;
-                        else if ( IsXMLToken(sValue, XML_FALSE) )
+                        else if ( IsXMLToken( it.toCString(), XML_FALSE ) )
                             fValue = 0.0;
                         else
-                            ::sax::Converter::convertDouble(fValue, sValue);
+                            ::sax::Converter::convertDouble(fValue, it.toString() );
                         bIsEmpty = false;
                     }
                 }
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 065ee00..668fbee 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -162,7 +162,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
                         sStyleName = it.toString();
                     break;
                 case XML_TOK_TABLE_PROTECTED:
-                    aProtectData.mbProtected = IsXMLToken( it.toString(), XML_TRUE );
+                    aProtectData.mbProtected = IsXMLToken( it.toCString(), XML_TRUE );
                 break;
                 case XML_TOK_TABLE_PRINT_RANGES:
                         sPrintRanges = it.toString();
@@ -178,7 +178,7 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
                 break;
                 case XML_TOK_TABLE_PRINT:
                     {
-                        if (IsXMLToken( it.toString(), XML_FALSE) )
+                        if (IsXMLToken( it.toCString(), XML_FALSE) )
                             bPrintEntireSheet = false;
                     }
                     break;
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 9aefba0..813c864 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3328,6 +3328,17 @@ namespace xmloff { namespace token {
         const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
         return rString.equalsAsciiL( pToken->pChar, pToken->nLength );
     }
+
+    bool IsXMLToken(
+        const char* pCString,
+        enum XMLTokenEnum eToken )
+    {
+        assert(XML_TOKEN_INVALID < eToken);
+        assert(eToken < XML_TOKEN_END);
+
+        const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken];
+        return !strcmp( pCString, pToken->pChar );
+    }
 }
 }
 


More information about the Libreoffice-commits mailing list