1 From ae5acc79d5f6e9b6f64cc550d858f41884362025 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
3 Date: Sat, 30 Dec 2023 20:08:01 +0000
4 Subject: [PATCH] cid#1546460 COPY_INSTEAD_OF_MOVE
7 src/cppunit/TestFactoryRegistry.cpp | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
10 diff --git a/src/cppunit/TestFactoryRegistry.cpp b/src/cppunit/TestFactoryRegistry.cpp
11 index 3b68d58..7b38a34 100644
12 --- a/src/cppunit/TestFactoryRegistry.cpp
13 +++ b/src/cppunit/TestFactoryRegistry.cpp
14 @@ -85,7 +85,7 @@ public:
16 TestFactoryRegistry::TestFactoryRegistry( std::string name ) :
19 + m_name(std::move(name))
23 diff --git a/src/cppunit/XmlElement.cpp b/src/cppunit/XmlElement.cpp
24 index 585c3da..be02385 100644
25 --- a/src/cppunit/XmlElement.cpp
26 +++ b/src/cppunit/XmlElement.cpp
27 @@ -8,8 +8,8 @@ CPPUNIT_NS_BEGIN
29 XmlElement::XmlElement( std::string elementName,
31 - : m_name( elementName )
32 - , m_content( content )
33 + : m_name(std::move(elementName))
34 + , m_content(std::move(content))
38 @@ -18,7 +18,7 @@ XmlElement::XmlElement( std::string elementName,
40 XmlElement::XmlElement( std::string elementName,
42 - : m_name( elementName )
43 + : m_name(std::move(elementName))
47 @@ -74,15 +74,15 @@ XmlElement::setContent( int numericContent )
51 -XmlElement::addAttribute( std::string attributeName,
53 +XmlElement::addAttribute( const std::string& attributeName,
54 + const std::string& value )
56 m_attributes.push_back( Attribute( attributeName, value ) );
61 -XmlElement::addAttribute( std::string attributeName,
62 +XmlElement::addAttribute( const std::string& attributeName,
65 addAttribute( attributeName, StringTools::toString( numericValue ) );
66 @@ -194,7 +194,7 @@ XmlElement::attributesAsString() const
70 -XmlElement::escape( std::string value ) const
71 +XmlElement::escape( const std::string& value ) const
74 for ( unsigned int index =0; index < value.length(); ++index )
75 diff --git a/include/cppunit/tools/XmlElement.h b/include/cppunit/tools/XmlElement.h
76 index 3478a35..d033aa2 100644
77 --- a/include/cppunit/tools/XmlElement.h
78 +++ b/include/cppunit/tools/XmlElement.h
79 @@ -79,14 +79,14 @@ public:
80 * \param attributeName Name of the attribute. Must not be an empty.
81 * \param value Value of the attribute.
83 - void addAttribute( std::string attributeName,
84 - std::string value );
85 + void addAttribute( const std::string& attributeName,
86 + const std::string& value );
88 /*! \brief Adds an attribute with the specified numeric value.
89 * \param attributeName Name of the attribute. Must not be empty.
90 * \param numericValue Numeric value of the attribute.
92 - void addAttribute( std::string attributeName,
93 + void addAttribute( const std::string& attributeName,
96 /*! \brief Adds a child element to the element.
97 @@ -125,7 +125,7 @@ private:
98 typedef std::pair<std::string,std::string> Attribute;
100 std::string attributesAsString() const;
101 - std::string escape( std::string value ) const;
102 + std::string escape( const std::string& value ) const;
106 diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h
107 index ca65593..2010739 100644
108 --- a/include/cppunit/Asserter.h
109 +++ b/include/cppunit/Asserter.h
110 @@ -159,11 +159,11 @@
111 * what are the differences between the expected and actual value.
112 * \param shortDescription Short description for the failure message.
114 - [[noreturn]] static void CPPUNIT_API failNotEqual( std::string expected,
115 - std::string actual,
116 + [[noreturn]] static void CPPUNIT_API failNotEqual( const std::string& expected,
117 + const std::string& actual,
118 const SourceLine &sourceLine,
119 const AdditionalMessage &additionalMessage = AdditionalMessage(),
120 - std::string shortDescription = "equality assertion failed" );
121 + const std::string& shortDescription = "equality assertion failed" );
123 /*! \brief Throws an Exception with the specified message and location.
124 * \param expected Text describing the expected value.
125 @@ -231,11 +231,11 @@
126 * \param shortDescription Short description for the failure message.
128 static void CPPUNIT_API failNotEqualIf( bool shouldFail,
129 - std::string expected,
130 - std::string actual,
131 + const std::string& expected,
132 + const std::string& actual,
133 const SourceLine &sourceLine,
134 const AdditionalMessage &additionalMessage = AdditionalMessage(),
135 - std::string shortDescription = "equality assertion failed" );
136 + const std::string& shortDescription = "equality assertion failed" );
140 diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp
141 index 52f8625..fe2097e 100644
142 --- a/src/cppunit/Asserter.cpp
143 +++ b/src/cppunit/Asserter.cpp
144 @@ -110,11 +110,11 @@
148 -Asserter::failNotEqual( std::string expected,
149 - std::string actual,
150 +Asserter::failNotEqual( const std::string& expected,
151 + const std::string& actual,
152 const SourceLine &sourceLine,
153 const AdditionalMessage &additionalMessage,
154 - std::string shortDescription )
155 + const std::string& shortDescription )
157 fail( makeMessage( makeExpectedEqual(expected),
159 @@ -182,11 +182,11 @@
162 Asserter::failNotEqualIf( bool shouldFail,
163 - std::string expected,
164 - std::string actual,
165 + const std::string& expected,
166 + const std::string& actual,
167 const SourceLine &sourceLine,
168 const AdditionalMessage &additionalMessage,
169 - std::string shortDescription )
170 + const std::string& shortDescription )
173 failNotEqual( expected, actual, sourceLine, additionalMessage, shortDescription );