summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxattributeoutput.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-01 18:58:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-01 20:53:28 +0200
commit75a862b887fb0b7ff633a396ee7f7f34c2c82964 (patch)
tree50361f282bfcd20ff04f97b59806b95029a9a405 /sw/source/filter/ww8/docxattributeoutput.cxx
parentf8d764b138fddde719a04683f9bd3720c21e0656 (diff)
use more string_view when dealing with attributes
which means we don't need to call strlen on them, since we already know how long they are. Change-Id: Iefc76f38a23250e87a65c27df3634d562464a760 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b870cfabf8f1..38c0bcd2b224 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3213,13 +3213,13 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
if (m_nCharTransparence != 0 && m_pColorAttrList && m_aTextEffectsGrabBag.empty())
{
- const char* pVal = nullptr;
- m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal);
- if (pVal != nullptr && std::string_view("auto") != pVal)
+ std::string_view pVal;
+ m_pColorAttrList->getAsView(FSNS(XML_w, XML_val), pVal);
+ if (!pVal.empty() && pVal != "auto")
{
m_pSerializer->startElementNS(XML_w14, XML_textFill);
m_pSerializer->startElementNS(XML_w14, XML_solidFill);
- m_pSerializer->startElementNS(XML_w14, XML_srgbClr, FSNS(XML_w14, XML_val), pVal);
+ m_pSerializer->startElementNS(XML_w14, XML_srgbClr, FSNS(XML_w14, XML_val), pVal.data());
sal_Int32 nTransparence = m_nCharTransparence * oox::drawingml::MAX_PERCENT / 255.0;
m_pSerializer->singleElementNS(XML_w14, XML_alpha, FSNS(XML_w14, XML_val), OString::number(nTransparence));
m_pSerializer->endElementNS(XML_w14, XML_srgbClr);
@@ -8075,10 +8075,10 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
const Color aColor( rColor.GetValue() );
OString aColorString = msfilter::util::ConvertColor( aColor );
- const char* pExistingValue(nullptr);
- if (m_pColorAttrList.is() && m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pExistingValue))
+ std::string_view pExistingValue;
+ if (m_pColorAttrList.is() && m_pColorAttrList->getAsView(FSNS(XML_w, XML_val), pExistingValue))
{
- assert(aColorString.equalsL(pExistingValue, rtl_str_getLength(pExistingValue)));
+ assert(aColorString.equalsL(pExistingValue.data(), pExistingValue.size()));
return;
}