From 5fe9b3df62aebe68eed2daa4625b6f360b925a74 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 8 Nov 2024 13:54:19 +0200 Subject: [PATCH] loplugin:reftotemp in codemaker..connectivity Change-Id: I9da2976410f7c4da8ab0d85150fc87f2b3df9e0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176275 Tested-by: Jenkins Reviewed-by: Noel Grandin --- codemaker/source/netmaker/netproduce.cxx | 4 +- .../container/embeddedobjectcontainer.cxx | 2 +- comphelper/source/misc/sequenceashashmap.cxx | 94 +++++++++---------- .../source/commontools/RowFunctionParser.cxx | 6 +- .../source/drivers/file/FStatement.cxx | 2 +- .../source/drivers/firebird/Tables.cxx | 2 +- .../mysqlc/mysqlc_prepared_resultset.cxx | 2 +- .../odbc/ODatabaseMetaDataResultSet.cxx | 2 +- .../source/drivers/odbc/OResultSet.cxx | 4 +- 9 files changed, 59 insertions(+), 59 deletions(-) diff --git a/codemaker/source/netmaker/netproduce.cxx b/codemaker/source/netmaker/netproduce.cxx index b11569c2130b..a8ac33f6d991 100644 --- a/codemaker/source/netmaker/netproduce.cxx +++ b/codemaker/source/netmaker/netproduce.cxx @@ -948,7 +948,7 @@ void NetProducer::produceService( if (ctor.defaultConstructor) { - const auto& returnType(getNetName(entity->getBase())); + const auto returnType(getNetName(entity->getBase())); file.beginLine() .append("public static ") @@ -1009,7 +1009,7 @@ void NetProducer::produceService( } else { - const auto& returnType(getNetName(entity->getBase())); + const auto returnType(getNetName(entity->getBase())); const auto* restParam = !ctor.parameters.empty() && ctor.parameters.front().rest ? &ctor.parameters.front() : nullptr; diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index b01ef3b0a9c6..2e5e311e997a 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -201,7 +201,7 @@ void EmbeddedObjectContainer::CloseEmbeddedObjects() { for( const auto& rObj : pImpl->maNameToObjectMap ) { - uno::Reference < util::XCloseable > const & xClose = rObj.second; + uno::Reference < embed::XEmbeddedObject > const & xClose = rObj.second; if( xClose.is() ) { try diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index 651f1ee4aad9..46a23db43ba9 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -44,12 +44,12 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree) sal_Int32 nFields; uno::Reference aField; boost::property_tree::ptree aNodeNull, aNodeValue, aNodeField; - const std::string& rType = aTree.get("type", ""); - const std::string& rValue = aTree.get("value", ""); + const std::string aType = aTree.get("type", ""); + const std::string aValueStr = aTree.get("value", ""); uno::Sequence> aFields; uno::Reference xIdlClass = css::reflection::theCoreReflection::get(comphelper::getProcessComponentContext()) - ->forName(OUString::fromUtf8(rType)); + ->forName(OUString::fromUtf8(aType)); if (xIdlClass.is()) { uno::TypeClass aTypeClass = xIdlClass->getTypeClass(); @@ -70,28 +70,28 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree) } } } - else if (!rValue.empty()) + else if (!aValueStr.empty()) { if (aTypeClass == uno::TypeClass_VOID) aAny.clear(); else if (aTypeClass == uno::TypeClass_BYTE) - aAny <<= static_cast(o3tl::toInt32(rValue)); + aAny <<= static_cast(o3tl::toInt32(aValueStr)); else if (aTypeClass == uno::TypeClass_BOOLEAN) - aAny <<= rtl_str_toBoolean(rValue.c_str()); + aAny <<= rtl_str_toBoolean(aValueStr.c_str()); else if (aTypeClass == uno::TypeClass_SHORT) - aAny <<= static_cast(o3tl::toInt32(rValue)); + aAny <<= static_cast(o3tl::toInt32(aValueStr)); else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT) - aAny <<= static_cast(o3tl::toUInt32(rValue)); + aAny <<= static_cast(o3tl::toUInt32(aValueStr)); else if (aTypeClass == uno::TypeClass_LONG) - aAny <<= o3tl::toInt32(rValue); + aAny <<= o3tl::toInt32(aValueStr); else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG) - aAny <<= static_cast(o3tl::toInt32(rValue)); + aAny <<= static_cast(o3tl::toInt32(aValueStr)); else if (aTypeClass == uno::TypeClass_FLOAT) - aAny <<= rtl_str_toFloat(rValue.c_str()); + aAny <<= rtl_str_toFloat(aValueStr.c_str()); else if (aTypeClass == uno::TypeClass_DOUBLE) - aAny <<= o3tl::toDouble(rValue); + aAny <<= o3tl::toDouble(aValueStr); else if (aTypeClass == uno::TypeClass_STRING) - aAny <<= OUString::fromUtf8(rValue); + aAny <<= OUString::fromUtf8(aValueStr); } } return aAny; @@ -308,46 +308,46 @@ static std::vector JsonToPropertyValues(const boost:: boost::property_tree::ptree aNodeNull, aNodeValue; for (const auto& rPair : aTree) { - const std::string& rType = rPair.second.get("type", ""); - const std::string& rValue = rPair.second.get("value", ""); + const std::string aType = rPair.second.get("type", ""); + const std::string aValueStr = rPair.second.get("value", ""); beans::PropertyValue aValue; aValue.Name = OUString::fromUtf8(rPair.first); - if (rType == "string") - aValue.Value <<= OUString::fromUtf8(rValue); - else if (rType == "boolean") - aValue.Value <<= rtl_str_toBoolean(rValue.c_str()); - else if (rType == "float") - aValue.Value <<= rtl_str_toFloat(rValue.c_str()); - else if (rType == "long") - aValue.Value <<= o3tl::toInt32(rValue); - else if (rType == "short") - aValue.Value <<= sal_Int16(o3tl::toInt32(rValue)); - else if (rType == "unsigned short") - aValue.Value <<= sal_uInt16(o3tl::toUInt32(rValue)); - else if (rType == "int64") - aValue.Value <<= o3tl::toInt64(rValue); - else if (rType == "int32") - aValue.Value <<= o3tl::toInt32(rValue); - else if (rType == "int16") - aValue.Value <<= sal_Int16(o3tl::toInt32(rValue)); - else if (rType == "uint64") - aValue.Value <<= rtl_str_toUInt64(rValue.c_str(), 10); - else if (rType == "uint32") - aValue.Value <<= o3tl::toUInt32(rValue); - else if (rType == "uint16") - aValue.Value <<= sal_uInt16(o3tl::toUInt32(rValue)); - else if (rType == "[]byte") + if (aType == "string") + aValue.Value <<= OUString::fromUtf8(aValueStr); + else if (aType == "boolean") + aValue.Value <<= rtl_str_toBoolean(aValueStr.c_str()); + else if (aType == "float") + aValue.Value <<= rtl_str_toFloat(aValueStr.c_str()); + else if (aType == "long") + aValue.Value <<= o3tl::toInt32(aValueStr); + else if (aType == "short") + aValue.Value <<= sal_Int16(o3tl::toInt32(aValueStr)); + else if (aType == "unsigned short") + aValue.Value <<= sal_uInt16(o3tl::toUInt32(aValueStr)); + else if (aType == "int64") + aValue.Value <<= o3tl::toInt64(aValueStr); + else if (aType == "int32") + aValue.Value <<= o3tl::toInt32(aValueStr); + else if (aType == "int16") + aValue.Value <<= sal_Int16(o3tl::toInt32(aValueStr)); + else if (aType == "uint64") + aValue.Value <<= rtl_str_toUInt64(aValueStr.c_str(), 10); + else if (aType == "uint32") + aValue.Value <<= o3tl::toUInt32(aValueStr); + else if (aType == "uint16") + aValue.Value <<= sal_uInt16(o3tl::toUInt32(aValueStr)); + else if (aType == "[]byte") { aNodeValue = rPair.second.get_child("value", aNodeNull); if (aNodeValue != aNodeNull && aNodeValue.size() == 0) { - uno::Sequence aSeqByte(reinterpret_cast(rValue.c_str()), - rValue.size()); + uno::Sequence aSeqByte(reinterpret_cast(aValueStr.c_str()), + aValueStr.size()); aValue.Value <<= aSeqByte; } } - else if (rType == "any") + else if (aType == "any") { aNodeValue = rPair.second.get_child("value", aNodeNull); if (aNodeValue != aNodeNull && !aNodeValue.empty()) @@ -355,7 +355,7 @@ static std::vector JsonToPropertyValues(const boost:: aValue.Value = jsonToUnoAny(aNodeValue); } } - else if (rType == "[]any") + else if (aType == "[]any") { aNodeValue = rPair.second.get_child("value", aNodeNull); if (aNodeValue != aNodeNull && !aNodeValue.empty()) @@ -366,12 +366,12 @@ static std::vector JsonToPropertyValues(const boost:: aValue.Value <<= aSeq; } } - else if (rType == "[]com.sun.star.beans.PropertyValue") + else if (aType == "[]com.sun.star.beans.PropertyValue") { aNodeValue = rPair.second.get_child("value", aNodeNull); aValue.Value <<= comphelper::containerToSequence(JsonToPropertyValues(aNodeValue)); } - else if (rType == "[][]com.sun.star.beans.PropertyValue") + else if (aType == "[][]com.sun.star.beans.PropertyValue") { aNodeValue = rPair.second.get_child("value", aNodeNull); std::vector> aSeqs; @@ -382,7 +382,7 @@ static std::vector JsonToPropertyValues(const boost:: aValue.Value <<= comphelper::containerToSequence(aSeqs); } else - SAL_WARN("comphelper", "JsonToPropertyValues: unhandled type '" << rType << "'"); + SAL_WARN("comphelper", "JsonToPropertyValues: unhandled type '" << aType << "'"); aArguments.push_back(aValue); } return aArguments; diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx index f8799848de9b..0a1ee2ce4af4 100644 --- a/connectivity/source/commontools/RowFunctionParser.cxx +++ b/connectivity/source/commontools/RowFunctionParser.cxx @@ -404,11 +404,11 @@ std::shared_ptr const & FunctionParser::parseFunction( const OUS // TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_* // gives better conversion robustness here (we might want to map space // etc. to ASCII space here) - const OString& rAsciiFunction( + const OString aAsciiFunction( OUStringToOString( _sFunction, RTL_TEXTENCODING_ASCII_US ) ); - StringIteratorT aStart( rAsciiFunction.getStr() ); - StringIteratorT aEnd( rAsciiFunction.getStr()+rAsciiFunction.getLength() ); + StringIteratorT aStart( aAsciiFunction.getStr() ); + StringIteratorT aEnd( aAsciiFunction.getStr()+aAsciiFunction.getLength() ); // static parser context, because the actual // Spirit parser is also a static object diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index a2be8e7695cd..931b13961f02 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -497,7 +497,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Error in Parse Tree"); if (pOptColumnCommalist->count() == 0) { - const Sequence< OUString>& aNames = m_xColNames->getElementNames(); + const Sequence< OUString> aNames = m_xColNames->getElementNames(); aColumnNameList.insert(aColumnNameList.end(), aNames.begin(), aNames.end()); } else diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx index d28671464250..7ef7a26e0dad 100644 --- a/connectivity/source/drivers/firebird/Tables.cxx +++ b/connectivity/source/drivers/firebird/Tables.cxx @@ -133,7 +133,7 @@ ObjectType Tables::appendObject(const OUString& rName, m_xMetaData->getConnection())); */ OUStringBuffer aSqlBuffer("CREATE TABLE "); OUString sCatalog, sSchema, sComposedName, sTable; - const Reference< XConnection>& xConnection = m_xMetaData->getConnection(); + const Reference< XConnection> xConnection = m_xMetaData->getConnection(); ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx index ab3753f5691c..d8bfbe5f9892 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx @@ -258,7 +258,7 @@ template T OPreparedResultSet::retrieveValue(sal_Int32 nColumnIndex return *static_cast(m_aData[nColumnIndex - 1].buffer); else { - auto const& row = getRowSetValue(nColumnIndex); + auto const row = getRowSetValue(nColumnIndex); if constexpr (std::is_same_v) return row.getLong(); else if constexpr (std::is_same_v) diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index f4ecb960c188..3e5f94a996d9 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -240,7 +240,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co case DataType::VARCHAR: case DataType::LONGVARCHAR: { - OUString const & aRet = OTools::getStringValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding); + OUString const aRet = OTools::getStringValue(m_pConnection.get(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this,m_nTextEncoding); return Sequence(reinterpret_cast(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); } } diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index 65fd1419271e..1603f4396749 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -441,7 +441,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) break; default: { - OUString const & sRet = m_aRow[columnIndex].getString(); + OUString const sRet = m_aRow[columnIndex].getString(); nRet = Sequence(reinterpret_cast(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength()); } } @@ -460,7 +460,7 @@ Sequence< sal_Int8 > OResultSet::impl_getBytes( sal_Int32 columnIndex ) case SQL_CHAR: case SQL_LONGVARCHAR: { - OUString const & aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding); + OUString const aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding); return Sequence(reinterpret_cast(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); } default: