Extended loplugin:ostr: oox

Change-Id: Ic3ee80433571767dba9de1ecfb00d2d96beae4db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159690
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2023-11-19 22:04:26 +01:00
parent 1f43e2071f
commit f53172a114
6 changed files with 396 additions and 389 deletions
+3 -3
View File
@@ -74,7 +74,7 @@ CryptoTest::~CryptoTest()
void CryptoTest::testCryptoHash()
{
// Check examples from Wikipedia (https://en.wikipedia.org/wiki/HMAC)
OString aContentString("The quick brown fox jumps over the lazy dog");
OString aContentString("The quick brown fox jumps over the lazy dog"_ostr);
std::vector<sal_uInt8> aContent(aContentString.getStr(),
aContentString.getStr() + aContentString.getLength());
std::vector<sal_uInt8> aKey = { 'k', 'e', 'y' };
@@ -145,7 +145,7 @@ void CryptoTest::testStandard2007()
SvMemoryStream aUnencryptedInput;
SvMemoryStream aEncryptedStream;
OString aTestString = "1234567890ABCDEFG";
OString aTestString = "1234567890ABCDEFG"_ostr;
aUnencryptedInput.WriteBytes(aTestString.getStr(), aTestString.getLength() + 1);
aUnencryptedInput.Seek(STREAM_SEEK_TO_BEGIN);
@@ -418,7 +418,7 @@ void CryptoTest::testAgileEncryptingAndDecrypting()
SvMemoryStream aEncryptionInfo;
SvMemoryStream aEncryptedStream;
OString aTestString = "1234567890ABCDEFGH";
OString aTestString = "1234567890ABCDEFGH"_ostr;
{
oox::crypto::AgileEngine aEngine;
+342 -335
View File
File diff suppressed because it is too large Load Diff
+24 -24
View File
@@ -32,16 +32,16 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradient)
// And make sure a multi-color gradient fill is exported.
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
// linear gradient with 30deg angle
assertXPath(pXmlDoc, "//a:r/a:rPr/a:gradFill/a:lin", "ang", "3600000");
assertXPath(pXmlDoc, "//a:r/a:rPr/a:gradFill/a:lin"_ostr, "ang"_ostr, "3600000");
// three color stops, no transparency
static constexpr OString sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/"_ostr;
assertXPath(pXmlDoc, sPath + "a:gs", 3);
assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", "0");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", "ff1493");
assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos", "30000");
assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", "ffff00");
assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos", "100000");
assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", "00ffff");
assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos"_ostr, "0");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val"_ostr, "ff1493");
assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos"_ostr, "30000");
assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val"_ostr, "ffff00");
assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos"_ostr, "100000");
assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val"_ostr, "00ffff");
}
CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord)
@@ -55,16 +55,16 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord)
// And make sure a multi-color gradient fill is exported.
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// linear gradient with 30deg angle
assertXPath(pXmlDoc, "//w14:lin", "ang", "3600000");
assertXPath(pXmlDoc, "//w14:lin"_ostr, "ang"_ostr, "3600000");
// three color stops, no transparency
static constexpr OString sPath = "//w14:gradFill/w14:gsLst/"_ostr;
assertXPath(pXmlDoc, sPath + "w14:gs", 3);
assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos", "0");
assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val", "ff1493");
assertXPath(pXmlDoc, sPath + "w14:gs[2]", "pos", "30000");
assertXPath(pXmlDoc, sPath + "w14:gs[2]/w14:srgbClr", "val", "ffff00");
assertXPath(pXmlDoc, sPath + "w14:gs[3]", "pos", "100000");
assertXPath(pXmlDoc, sPath + "w14:gs[3]/w14:srgbClr", "val", "00ffff");
assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos"_ostr, "0");
assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val"_ostr, "ff1493");
assertXPath(pXmlDoc, sPath + "w14:gs[2]", "pos"_ostr, "30000");
assertXPath(pXmlDoc, sPath + "w14:gs[2]/w14:srgbClr", "val"_ostr, "ffff00");
assertXPath(pXmlDoc, sPath + "w14:gs[3]", "pos"_ostr, "100000");
assertXPath(pXmlDoc, sPath + "w14:gs[3]/w14:srgbClr", "val"_ostr, "00ffff");
}
CPPUNIT_TEST_FIXTURE(TestMCGR, testTdf155825_SourcOffsetRangeDifferent)
@@ -97,9 +97,9 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testStepCount)
assertXPath(pXmlDoc, sPath + "a:gs[@pos='50000']", 2);
assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000']", 2);
// Without fix the color was 808080.
assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][1]/a:srgbClr", "val", "55aaaa");
assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][1]/a:srgbClr", "val"_ostr, "55aaaa");
// Without fix the color was 40bfbf, producing a gradient in the last segment.
assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][2]/a:srgbClr", "val", "00ffff");
assertXPath(pXmlDoc, sPath + "a:gs[@pos='75000'][2]/a:srgbClr", "val"_ostr, "00ffff");
}
CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans)
@@ -117,14 +117,14 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans)
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
static constexpr OString sPath = "//a:gradFill/a:gsLst/"_ostr;
assertXPath(pXmlDoc, sPath + "a:gs", 3);
assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", "0");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", "00ffff");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr/a:alpha", "val", "20000");
assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos", "50000");
assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val", "ff0000");
assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr/a:alpha", "val", "60396");
assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos", "100000");
assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val", "00ffff");
assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos"_ostr, "0");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val"_ostr, "00ffff");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr/a:alpha", "val"_ostr, "20000");
assertXPath(pXmlDoc, sPath + "a:gs[2]", "pos"_ostr, "50000");
assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr", "val"_ostr, "ff0000");
assertXPath(pXmlDoc, sPath + "a:gs[2]/a:srgbClr/a:alpha", "val"_ostr, "60396");
assertXPath(pXmlDoc, sPath + "a:gs[3]", "pos"_ostr, "100000");
assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr", "val"_ostr, "00ffff");
// no <a:alpha> element for default val="100000"
assertXPath(pXmlDoc, sPath + "a:gs[3]/a:srgbClr/a:alpha", 0);
}
+4 -4
View File
@@ -755,8 +755,8 @@ void AgileEngine::writeEncryptionInfo(BinaryXOutputStream & rStream)
if (aXmlWriter.startDocument(0/*nIndent*/))
{
aXmlWriter.startElement("", "encryption", "http://schemas.microsoft.com/office/2006/encryption");
aXmlWriter.attribute("xmlns:p", OString("http://schemas.microsoft.com/office/2006/keyEncryptor/password"));
aXmlWriter.startElement(""_ostr, "encryption"_ostr, "http://schemas.microsoft.com/office/2006/encryption"_ostr);
aXmlWriter.attribute("xmlns:p", "http://schemas.microsoft.com/office/2006/keyEncryptor/password"_ostr);
aXmlWriter.startElement("keyData");
aXmlWriter.attribute("saltSize", mInfo.saltSize);
@@ -776,9 +776,9 @@ void AgileEngine::writeEncryptionInfo(BinaryXOutputStream & rStream)
aXmlWriter.startElement("keyEncryptors");
aXmlWriter.startElement("keyEncryptor");
aXmlWriter.attribute("uri", OString("http://schemas.microsoft.com/office/2006/keyEncryptor/password"));
aXmlWriter.attribute("uri", "http://schemas.microsoft.com/office/2006/keyEncryptor/password"_ostr);
aXmlWriter.startElement("p", "encryptedKey", "");
aXmlWriter.startElement("p"_ostr, "encryptedKey"_ostr, ""_ostr);
aXmlWriter.attribute("spinCount", mInfo.spinCount);
aXmlWriter.attribute("saltSize", mInfo.saltSize);
aXmlWriter.attribute("blockSize", mInfo.blockSize);
+14 -14
View File
@@ -573,15 +573,15 @@ OString convertFlipMode(model::FlipMode eFlipMode)
switch (eFlipMode)
{
case model::FlipMode::X:
return "x";
return "x"_ostr;
case model::FlipMode::Y:
return "y";
return "y"_ostr;
case model::FlipMode::XY:
return "xy";
return "xy"_ostr;
case model::FlipMode::None:
return "none";
return "none"_ostr;
}
return "none";
return "none"_ostr;
}
OString convertRectangleAlignment(model::RectangleAlignment eFlipMode)
@@ -589,23 +589,23 @@ OString convertRectangleAlignment(model::RectangleAlignment eFlipMode)
switch (eFlipMode)
{
case model::RectangleAlignment::TopLeft:
return "tl";
return "tl"_ostr;
case model::RectangleAlignment::Top:
return "t";
return "t"_ostr;
case model::RectangleAlignment::TopRight:
return "tr";
return "tr"_ostr;
case model::RectangleAlignment::Left:
return "l";
return "l"_ostr;
case model::RectangleAlignment::Center:
return "ctr";
return "ctr"_ostr;
case model::RectangleAlignment::Right:
return "r";
return "r"_ostr;
case model::RectangleAlignment::BottomLeft:
return "bl";
return "bl"_ostr;
case model::RectangleAlignment::Bottom:
return "b";
return "b"_ostr;
case model::RectangleAlignment::BottomRight:
return "br";
return "br"_ostr;
case model::RectangleAlignment::Unset:
break;
}
+9 -9
View File
@@ -1214,7 +1214,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( const Reference< XShape >& xShape )
WriteShapeTransformation( xShape, XML_a );
if (CircleKind_FULL == eCircleKind)
WritePresetShape("ellipse");
WritePresetShape("ellipse"_ostr);
else
{
sal_Int32 nStartAngleIntern(9000);
@@ -1238,16 +1238,16 @@ ShapeExport& ShapeExport::WriteEllipseShape( const Reference< XShape >& xShape )
switch (eCircleKind)
{
case CircleKind_ARC :
WritePresetShape("arc", aAvList);
WritePresetShape("arc"_ostr, aAvList);
break;
case CircleKind_SECTION :
WritePresetShape("pie", aAvList);
WritePresetShape("pie"_ostr, aAvList);
break;
case CircleKind_CUT :
WritePresetShape("chord", aAvList);
WritePresetShape("chord"_ostr, aAvList);
break;
default :
WritePresetShape("ellipse");
WritePresetShape("ellipse"_ostr);
}
}
if( xProps.is() )
@@ -1468,7 +1468,7 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape
xShapeProps->getPropertyValue("IsMirrored") >>= bFlipH;
}
WriteShapeTransformation( xShape, XML_a, bFlipH, false, false, false, true );
WritePresetShape( "rect" );
WritePresetShape( "rect"_ostr );
// graphic object can come with the frame (bnc#654525)
WriteOutline( xShapeProps );
@@ -1944,7 +1944,7 @@ ShapeExport& ShapeExport::WriteLineShape( const Reference< XShape >& xShape )
// visual shape properties
pFS->startElementNS(mnXmlNamespace, XML_spPr);
WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, true);
WritePresetShape( "line" );
WritePresetShape( "line"_ostr );
if( xShapeProps.is() )
WriteOutline( xShapeProps );
pFS->endElementNS( mnXmlNamespace, XML_spPr );
@@ -2532,7 +2532,7 @@ ShapeExport& ShapeExport::WriteTextShape( const Reference< XShape >& xShape )
// visual shape properties
pFS->startElementNS(mnXmlNamespace, XML_spPr);
WriteShapeTransformation( xShape, XML_a );
WritePresetShape( "rect" );
WritePresetShape( "rect"_ostr );
uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY);
if (!IsFontworkShape(xShapeProps)) // Fontwork needs fill and outline in run properties instead.
{
@@ -2577,7 +2577,7 @@ void ShapeExport::WriteMathShape(Reference<XShape> const& xShape)
mpFS->endElementNS(mnXmlNamespace, XML_nvSpPr);
mpFS->startElementNS(mnXmlNamespace, XML_spPr);
WriteShapeTransformation(xShape, XML_a);
WritePresetShape("rect");
WritePresetShape("rect"_ostr);
mpFS->endElementNS(mnXmlNamespace, XML_spPr);
mpFS->startElementNS(mnXmlNamespace, XML_txBody);
mpFS->startElementNS(XML_a, XML_bodyPr);