summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-03-06 15:29:08 +0200
committerNoel Grandin <noel@peralex.com>2014-03-18 08:32:26 +0200
commit86a32589e90ee983159fb5b2c6a594428ab7d422 (patch)
tree6de946fe2b9b25614f0d197af95e9d3aadcd1bd9 /drawinglayer
parentbb17844099ba98a77c8e5d7a25c0c416a4b0641e (diff)
Find places where OUString and OString are passed by value.
It's not very efficient, because we generally end up copying it twice - once into the parameter and again into the destination OUString. So I create a clang plugin that finds such places and generates a warning so that we can convert them to pass-by-reference. Change-Id: I5341a6ea9e3190f4b4c05c42c85595e3dcd83361
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/dumper/EnhancedShapeDumper.cxx2
-rw-r--r--drawinglayer/source/dumper/EnhancedShapeDumper.hxx2
-rw-r--r--drawinglayer/source/dumper/XShapeDumper.cxx48
3 files changed, 26 insertions, 26 deletions
diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
index 75f8e4ea6a58..20eb99d4506d 100644
--- a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
+++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
@@ -429,7 +429,7 @@ void EnhancedShapeDumper::dumpEnhancedCustomShapeGeometryService(uno::Reference<
dumpHandlesAsElement(aHandles);
}
}
-void EnhancedShapeDumper::dumpTypeAsAttribute(OUString sType)
+void EnhancedShapeDumper::dumpTypeAsAttribute(const OUString& sType)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s",
OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr());
diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx
index bb5564a0532a..523d053929a4 100644
--- a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx
+++ b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx
@@ -75,7 +75,7 @@ public:
// EnhancedCustomShapeGeometry.idl
void dumpEnhancedCustomShapeGeometryService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet);
- void dumpTypeAsAttribute(OUString sType);
+ void dumpTypeAsAttribute(const OUString& sType);
void dumpViewBoxAsElement(com::sun::star::awt::Rectangle aViewBox);
void dumpMirroredXAsAttribute(sal_Bool bMirroredX); // also used in EnhancedCustomShapeHandle
void dumpMirroredYAsAttribute(sal_Bool bMirroredY); // also used in EnhancedCustomShapeHandle
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 7a7d59859c61..61eca8c5a0e2 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -43,14 +43,14 @@ void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlT
void dumpFillStyleAsAttribute(com::sun::star::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter);
void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter);
-void dumpFillTransparenceGradientNameAsAttribute(OUString sTranspGradName, xmlTextWriterPtr xmlWriter);
+void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter);
void dumpFillTransparenceGradientAsElement(com::sun::star::awt::Gradient aTranspGrad, xmlTextWriterPtr xmlWriter);
-void dumpFillGradientNameAsAttribute(OUString sGradName, xmlTextWriterPtr xmlWriter);
+void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter);
void dumpFillGradientAsElement(com::sun::star::awt::Gradient aGradient, xmlTextWriterPtr xmlWriter);
void dumpFillHatchAsElement(com::sun::star::drawing::Hatch aHatch, xmlTextWriterPtr xmlWriter);
void dumpFillBackgroundAsAttribute(sal_Bool bBackground, xmlTextWriterPtr xmlWriter);
void dumpFillBitmapAsElement(com::sun::star::uno::Reference<com::sun::star::awt::XBitmap> xBitmap, xmlTextWriterPtr xmlWriter);
-void dumpFillBitmapURLAsAttribute(OUString sBitmapURL, xmlTextWriterPtr xmlWriter);
+void dumpFillBitmapURLAsAttribute(const OUString& sBitmapURL, xmlTextWriterPtr xmlWriter);
void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter);
void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter);
void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter);
@@ -66,13 +66,13 @@ void dumpFillBitmapTileAsAttribute(sal_Bool bBitmapTile, xmlTextWriterPtr xmlWri
// LineProperties.idl
void dumpLineStyleAsAttribute(com::sun::star::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter);
void dumpLineDashAsElement(com::sun::star::drawing::LineDash aLineDash, xmlTextWriterPtr xmlWriter);
-void dumpLineDashNameAsAttribute(OUString sLineDashName, xmlTextWriterPtr xmlWriter);
+void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter);
void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter);
void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter);
void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter);
void dumpLineJointAsAttribute(com::sun::star::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter);
-void dumpLineStartNameAsAttribute(OUString sLineStartName, xmlTextWriterPtr xmlWriter);
-void dumpLineEndNameAsAttribute(OUString sLineEndName, xmlTextWriterPtr xmlWriter);
+void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter);
+void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter);
void dumpLineStartAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aLineStart, xmlTextWriterPtr xmlWriter);
void dumpLineEndAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aLineEnd, xmlTextWriterPtr xmlWriter);
void dumpLineStartCenterAsAttribute(sal_Bool bLineStartCenter, xmlTextWriterPtr xmlWriter);
@@ -124,23 +124,23 @@ void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr
//Shape.idl
void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter);
void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter);
-void dumpLayerNameAsAttribute(OUString sLayerName, xmlTextWriterPtr xmlWriter);
+void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter);
void dumpVisibleAsAttribute(sal_Bool bVisible, xmlTextWriterPtr xmlWriter);
void dumpPrintableAsAttribute(sal_Bool bPrintable, xmlTextWriterPtr xmlWriter);
void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWriter);
-void dumpNameAsAttribute(OUString sName, xmlTextWriterPtr xmlWriter);
+void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter);
void dumpSizeProtectAsAttribute(sal_Bool bSizeProtect, xmlTextWriterPtr xmlWriter);
void dumpHomogenMatrixLine3(com::sun::star::drawing::HomogenMatrixLine3 aLine, xmlTextWriterPtr xmlWriter);
void dumpTransformationAsElement(com::sun::star::drawing::HomogenMatrix3 aTransformation, xmlTextWriterPtr xmlWriter);
void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter);
-void dumpHyperlinkAsAttribute(OUString sHyperlink, xmlTextWriterPtr xmlWriter);
+void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter);
void dumpInteropGrabBagAsElement(uno::Sequence< beans::PropertyValue> aInteropGrabBag, xmlTextWriterPtr xmlWriter);
// CustomShape.idl
-void dumpCustomShapeEngineAsAttribute(OUString sCustomShapeEngine, xmlTextWriterPtr xmlWriter);
-void dumpCustomShapeDataAsAttribute(OUString sCustomShapeData, xmlTextWriterPtr xmlWriter);
+void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter);
+void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter);
void dumpCustomShapeGeometryAsElement(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue> aCustomShapeGeometry, xmlTextWriterPtr xmlWriter);
-void dumpCustomShapeReplacementURLAsAttribute(OUString sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter);
+void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter);
// XShape.idl
void dumpPositionAsAttribute(const com::sun::star::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
@@ -211,7 +211,7 @@ void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr x
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence);
}
-void dumpFillTransparenceGradientNameAsAttribute(OUString sTranspGradName, xmlTextWriterPtr xmlWriter)
+void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s",
OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr());
@@ -261,7 +261,7 @@ void dumpFillTransparenceGradientAsElement(awt::Gradient aTranspGrad, xmlTextWri
xmlTextWriterEndElement( xmlWriter );
}
-void dumpFillGradientNameAsAttribute(OUString sGradName, xmlTextWriterPtr xmlWriter)
+void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s",
OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr());
@@ -317,7 +317,7 @@ void dumpFillBitmapAsElement(uno::Reference<awt::XBitmap> xBitmap, xmlTextWriter
xmlTextWriterEndElement( xmlWriter );
}
-void dumpFillBitmapURLAsAttribute(OUString sBitmapURL, xmlTextWriterPtr xmlWriter)
+void dumpFillBitmapURLAsAttribute(const OUString& sBitmapURL, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapURL"), "%s",
OUStringToOString(sBitmapURL, RTL_TEXTENCODING_UTF8).getStr());
@@ -481,7 +481,7 @@ void dumpLineDashAsElement(drawing::LineDash aLineDash, xmlTextWriterPtr xmlWrit
xmlTextWriterEndElement( xmlWriter );
}
-void dumpLineDashNameAsAttribute(OUString sLineDashName, xmlTextWriterPtr xmlWriter)
+void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s",
OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr());
@@ -526,13 +526,13 @@ void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xm
}
}
-void dumpLineStartNameAsAttribute(OUString sLineStartName, xmlTextWriterPtr xmlWriter)
+void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s",
OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr());
}
-void dumpLineEndNameAsAttribute(OUString sLineEndName, xmlTextWriterPtr xmlWriter)
+void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s",
OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr());
@@ -977,7 +977,7 @@ void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter)
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID);
}
-void dumpLayerNameAsAttribute(OUString sLayerName, xmlTextWriterPtr xmlWriter)
+void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s",
OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr());
@@ -1007,7 +1007,7 @@ void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWrite
xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false");
}
-void dumpNameAsAttribute(OUString sName, xmlTextWriterPtr xmlWriter)
+void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter)
{
if(!sName.isEmpty() && !m_bNameDumped)
{
@@ -1053,7 +1053,7 @@ void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder);
}
-void dumpHyperlinkAsAttribute(OUString sHyperlink, xmlTextWriterPtr xmlWriter)
+void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s",
OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr());
@@ -1096,13 +1096,13 @@ void dumpShapeDescriptorAsAttribute( uno::Reference< drawing::XShapeDescriptor >
// ---------- CustomShape.idl ----------
-void dumpCustomShapeEngineAsAttribute(OUString sCustomShapeEngine, xmlTextWriterPtr xmlWriter)
+void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s",
OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr());
}
-void dumpCustomShapeDataAsAttribute(OUString sCustomShapeData, xmlTextWriterPtr xmlWriter)
+void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s",
OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr());
@@ -1208,7 +1208,7 @@ void dumpCustomShapeGeometryAsElement(uno::Sequence< beans::PropertyValue> aCust
xmlTextWriterEndElement( xmlWriter );
}
-void dumpCustomShapeReplacementURLAsAttribute(OUString sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter)
+void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter)
{
xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s",
OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr());