summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-11-10 17:46:57 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-11-11 00:03:37 +0100
commit1fc79c3491906d85ed9972e161112459035b62ed (patch)
tree29f284f4a814b2b7a61417046364b489ce2187d7 /include/comphelper
parentf697d06b67e91c704c088dceafade209462e0b95 (diff)
Avoid using O[U]StringConcat lvalues containing dangling refs to temporaries
...in code accidentally using auto like > auto const aURL = uri->getUriReference() + "/" > + INetURLObject::encode( > m_sEmbeddedName, INetURLObject::PART_FPATH, > INetURLObject::EncodeMechanism::All); > > uno::Reference<uno::XInterface> xDataSource(xDatabaseContext->getByName(aURL), uno::UNO_QUERY); in <https://gerrit.libreoffice.org/#/c/44569/1> "Properly construct vnd.sun.star.pkg URL" did (causing hard to debug test failures there). So make functions taking O[U]StringConcat take those by rvalue reference. Unfortunately, that also needed adaption of various functions that just forward their arguments. And some code in sc/qa/unit/ucalc_formula.cxx used CPPUNIT_ASSERT_EQUAL on OUStringConcat arguments in cases where that happened to actually compile (because the structure of the two OUStringConcats was identical), which needed adaption too (but which would arguably better use CPPUNIT_ASSERT_EQUAL_MESSAGE, anyway). Change-Id: I8994d932aaedb2a491c7c81c167e93379d4fb6e3 Reviewed-on: https://gerrit.libreoffice.org/44608 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/propertyvalue.hxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/comphelper/propertyvalue.hxx b/include/comphelper/propertyvalue.hxx
index ba442c12a931..3415d2304f83 100644
--- a/include/comphelper/propertyvalue.hxx
+++ b/include/comphelper/propertyvalue.hxx
@@ -10,6 +10,10 @@
#ifndef INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
#define INCLUDED_COMPHELPER_PROPERTYVALUE_HXX
+#include <sal/config.h>
+
+#include <utility>
+
#include <com/sun/star/beans/PropertyValue.hpp>
namespace comphelper
@@ -22,11 +26,11 @@ namespace comphelper
*
* instead of writing 3 extra lines to set the name and value of the beans::PropertyValue.
*/
-template<typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, const T& rValue)
+template<typename T> css::beans::PropertyValue makePropertyValue(const OUString& rName, T&& rValue)
{
css::beans::PropertyValue aValue;
aValue.Name = rName;
- aValue.Value = css::uno::toAny(rValue);
+ aValue.Value = css::uno::toAny(std::forward<T>(rValue));
return aValue;
}