diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-11 15:51:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-12 12:46:45 +0200 |
commit | d4d37662b090cb237585156a47cd8e1f1cbe2656 (patch) | |
tree | 70e59ca62b055d7e49325a268d952e0ea057b2e9 /sax | |
parent | f2e65b3dbcd4c0ca91781067255854a0c5141d60 (diff) |
loplugin:constfields in reportdesign,sal,sax
and improve the rewriter so I spend less time fixing formatting
Change-Id: Ic2a6e5e31a5a202d2d02a47d77c484a57a5ec514
Reviewed-on: https://gerrit.libreoffice.org/61676
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/expatwrap/sax_expat.cxx | 10 | ||||
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 6 | ||||
-rw-r--r-- | sax/source/tools/fastserializer.cxx | 14 | ||||
-rw-r--r-- | sax/source/tools/fastserializer.hxx | 5 |
4 files changed, 9 insertions, 26 deletions
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index b7e76d4eb207..57437b093442 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -140,11 +140,12 @@ struct Entity }; +static constexpr OUStringLiteral gsCDATA = "CDATA"; + class SaxExpatParser_Impl { public: // module scope Mutex aMutex; - OUString sCDATA; bool m_bEnableDoS; // fdo#60471 thank you Adobe Illustrator css::uno::Reference< XDocumentHandler > rDocumentHandler; @@ -179,8 +180,7 @@ public: // module scope public: SaxExpatParser_Impl() - : sCDATA("CDATA") - , m_bEnableDoS(false) + : m_bEnableDoS(false) , bExceptionWasThrown(false) , bRTExceptionWasThrown(false) { @@ -389,7 +389,7 @@ class ParserCleanup { private: SaxExpatParser_Impl& m_rParser; - XML_Parser m_xmlParser; + XML_Parser const m_xmlParser; public: ParserCleanup(SaxExpatParser_Impl& rParser, XML_Parser xmlParser) : m_rParser(rParser) @@ -711,7 +711,7 @@ void SaxExpatParser_Impl::callbackStartElement( void *pvThis , assert(awAttributes[i+1]); pImpl->rAttrList->AddAttribute( XML_CHAR_TO_OUSTRING( awAttributes[i] ) , - pImpl->sCDATA, // expat doesn't know types + gsCDATA, // expat doesn't know types XML_CHAR_TO_OUSTRING( awAttributes[i+1] ) ); i +=2; } diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 447acdc68274..3d53147d9382 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -92,8 +92,8 @@ struct Event struct NameWithToken { - OUString msName; - sal_Int32 mnToken; + OUString const msName; + sal_Int32 const mnToken; NameWithToken(const OUString& sName, sal_Int32 nToken) : msName(sName), mnToken(nToken) {} @@ -102,7 +102,7 @@ struct NameWithToken struct SaxContext { Reference< XFastContextHandler > mxContext; - sal_Int32 mnElementToken; + sal_Int32 const mnElementToken; OUString maNamespace; OUString maElementName; diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index b232d0b3abf0..590c0167a29e 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -59,7 +59,6 @@ namespace sax_fastparser { , mbMarkStackEmpty(true) , mpDoubleStr(nullptr) , mnDoubleStrCapacity(RTL_STR_MAX_VALUEOFDOUBLE) - , mbXescape(true) { rtl_string_new_WithLength(&mpDoubleStr, mnDoubleStrCapacity); mxFastTokenHandler = css::xml::sax::FastTokenHandler::create( @@ -197,7 +196,6 @@ namespace sax_fastparser { } break; default: - if (mbXescape) { // Escape characters not valid in XML 1.0 as // _xHHHH_. A literal "_xHHHH_" has to be @@ -242,18 +240,6 @@ namespace sax_fastparser { * scanning for both encoded sequences and * write as _xHHHH_? */ } -#if OSL_DEBUG_LEVEL > 0 - else - { - if (bGood && invalidChar(pStr[i])) - { - bGood = false; - // The SAL_WARN() for the single character is - // issued in writeBytes(), just gather for the - // SAL_WARN_IF() below. - } - } -#endif writeBytes( &c, 1 ); break; } diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index c166f38f0b8c..f450580ff3e5 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -35,7 +35,7 @@ namespace sax_fastparser { struct TokenValue { - sal_Int32 nToken; + sal_Int32 const nToken; const char *pValue; TokenValue(sal_Int32 _nToken, const char *_pValue) : nToken(_nToken), pValue(_pValue) {} }; @@ -228,9 +228,6 @@ private: rtl_String *mpDoubleStr; sal_Int32 mnDoubleStrCapacity; TokenValueList maTokenValues; - bool mbXescape; ///< whether to escape invalid XML characters as _xHHHH_ in write(const char*,sal_Int32,true) - /* TODO: make that configurable from the outside for - * some specific cases? */ #ifdef DBG_UTIL std::stack<sal_Int32> m_DebugStartedElements; |