diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-01-11 11:25:42 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-01-11 11:25:42 +0100 |
commit | 15f84c9cd4bf0a58ce85868c980eeaf1dc330f5c (patch) | |
tree | 8fdb5cf3cd7bd99e06e57180c26f4d19acbbefe1 /xmloff | |
parent | 5088b2066651ed133dcfd93388f7ac7187844d33 (diff) |
Some loplugin:conststringvar/stringconstant improvements: xmloff
Change-Id: I05e03936d9e5518fa7ba4d9c72d5b8e241e32526
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/ColorPropertySet.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/animationimport.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/meta/xmlmetae.cxx | 22 |
3 files changed, 13 insertions, 17 deletions
diff --git a/xmloff/source/chart/ColorPropertySet.cxx b/xmloff/source/chart/ColorPropertySet.cxx index 0494864d1631..7061bac800ae 100644 --- a/xmloff/source/chart/ColorPropertySet.cxx +++ b/xmloff/source/chart/ColorPropertySet.cxx @@ -50,8 +50,7 @@ private: }; lcl_ColorPropertySetInfo::lcl_ColorPropertySetInfo() : - // note: length of FillColor and LineColor is 9 - m_aColorPropName( "FillColor", 9, RTL_TEXTENCODING_ASCII_US ), + m_aColorPropName( "FillColor" ), m_aColorProp( m_aColorPropName, -1, cppu::UnoType<sal_Int32>::get(), 0) {} @@ -85,8 +84,7 @@ namespace chart { ColorPropertySet::ColorPropertySet( sal_Int32 nColor ) : - // note: length of FillColor and LineColor is 9 - m_aColorPropName( "FillColor", 9, RTL_TEXTENCODING_ASCII_US ), + m_aColorPropName( "FillColor" ), m_nColor( nColor ), m_nDefaultColor( 0x0099ccff ) // blue 8 {} diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index c4c113b744a5..ac7033f91047 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -105,7 +105,7 @@ static ::rtl::OUString lcl_GetMediaReference(SvXMLImport const& rImport, ::rtl::OUString const& rURL) { if (rImport.IsPackageURL(rURL)) - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:")) + rURL; + return "vnd.sun.star.Package:" + rURL; return rImport.GetAbsoluteReference(rURL); } diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx index 6532545505f1..9d94e7917573 100644 --- a/xmloff/source/meta/xmlmetae.cxx +++ b/xmloff/source/meta/xmlmetae.cxx @@ -295,10 +295,10 @@ void SvXMLMetaExport::MExport_() } } -static const char * const s_xmlns = "xmlns"; -static const char * const s_xmlns2 = "xmlns:"; -static const char * const s_meta = "meta:"; -static const char * const s_href = "xlink:href"; +static const char s_xmlns[] = "xmlns"; +static const char s_xmlns2[] = "xmlns:"; +static const char s_meta[] = "meta:"; +static const char s_href[] = "xlink:href"; SvXMLMetaExport::SvXMLMetaExport( SvXMLExport& i_rExp, @@ -326,11 +326,9 @@ void SvXMLMetaExport::Export() key != USHRT_MAX; key = rNsMap.GetNextKey(key)) { beans::StringPair ns; const OUString attrname = rNsMap.GetAttrNameByKey(key); - if (attrname.matchAsciiL(s_xmlns2, strlen(s_xmlns2))) { - ns.First = attrname.copy(strlen(s_xmlns2)); - } else if (attrname.equalsAsciiL(s_xmlns, strlen(s_xmlns))) { - // default initialized empty string - } else { + if (!attrname.startsWith(s_xmlns2, &ns.First) + || attrname == s_xmlns) // default initialized empty string + { assert(!"namespace attribute not starting with xmlns unexpected"); } ns.Second = rNsMap.GetNameByKey(key); @@ -376,7 +374,7 @@ SvXMLMetaExport::startElement(const OUString & i_rName, const sal_Int16 nCount = i_xAttribs->getLength(); for (sal_Int16 i = 0; i < nCount; ++i) { const OUString name(i_xAttribs->getNameByIndex(i)); - if (name.matchAsciiL(s_xmlns, strlen(s_xmlns))) { + if (name.startsWith(s_xmlns)) { bool found(false); const SvXMLNamespaceMap & rNsMap(mrExport.GetNamespaceMap()); for (sal_uInt16 key = rNsMap.GetFirstKey(); @@ -419,14 +417,14 @@ SvXMLMetaExport::startElement(const OUString & i_rName, } // attach the attributes - if (i_rName.matchAsciiL(s_meta, strlen(s_meta))) { + if (i_rName.startsWith(s_meta)) { // special handling for all elements that may have // xlink:href attributes; these must be made relative const sal_Int16 nLength = i_xAttribs->getLength(); for (sal_Int16 i = 0; i < nLength; ++i) { const OUString name (i_xAttribs->getNameByIndex (i)); OUString value(i_xAttribs->getValueByIndex(i)); - if (name.matchAsciiL(s_href, strlen(s_href))) { + if (name.startsWith(s_href)) { value = mrExport.GetRelativeReference(value); } mrExport.AddAttribute(name, value); |