loplugin:reftotemp in codemaker..connectivity

Change-Id: I9da2976410f7c4da8ab0d85150fc87f2b3df9e0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176275
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-11-08 13:54:19 +02:00
parent 3f691b4a16
commit 5fe9b3df62
9 changed files with 59 additions and 59 deletions

View file

@ -948,7 +948,7 @@ void NetProducer::produceService(
if (ctor.defaultConstructor) if (ctor.defaultConstructor)
{ {
const auto& returnType(getNetName(entity->getBase())); const auto returnType(getNetName(entity->getBase()));
file.beginLine() file.beginLine()
.append("public static ") .append("public static ")
@ -1009,7 +1009,7 @@ void NetProducer::produceService(
} }
else else
{ {
const auto& returnType(getNetName(entity->getBase())); const auto returnType(getNetName(entity->getBase()));
const auto* restParam = !ctor.parameters.empty() && ctor.parameters.front().rest const auto* restParam = !ctor.parameters.empty() && ctor.parameters.front().rest
? &ctor.parameters.front() ? &ctor.parameters.front()
: nullptr; : nullptr;

View file

@ -201,7 +201,7 @@ void EmbeddedObjectContainer::CloseEmbeddedObjects()
{ {
for( const auto& rObj : pImpl->maNameToObjectMap ) 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() ) if( xClose.is() )
{ {
try try

View file

@ -44,12 +44,12 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
sal_Int32 nFields; sal_Int32 nFields;
uno::Reference<reflection::XIdlField> aField; uno::Reference<reflection::XIdlField> aField;
boost::property_tree::ptree aNodeNull, aNodeValue, aNodeField; boost::property_tree::ptree aNodeNull, aNodeValue, aNodeField;
const std::string& rType = aTree.get<std::string>("type", ""); const std::string aType = aTree.get<std::string>("type", "");
const std::string& rValue = aTree.get<std::string>("value", ""); const std::string aValueStr = aTree.get<std::string>("value", "");
uno::Sequence<uno::Reference<reflection::XIdlField>> aFields; uno::Sequence<uno::Reference<reflection::XIdlField>> aFields;
uno::Reference<reflection::XIdlClass> xIdlClass uno::Reference<reflection::XIdlClass> xIdlClass
= css::reflection::theCoreReflection::get(comphelper::getProcessComponentContext()) = css::reflection::theCoreReflection::get(comphelper::getProcessComponentContext())
->forName(OUString::fromUtf8(rType)); ->forName(OUString::fromUtf8(aType));
if (xIdlClass.is()) if (xIdlClass.is())
{ {
uno::TypeClass aTypeClass = xIdlClass->getTypeClass(); 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) if (aTypeClass == uno::TypeClass_VOID)
aAny.clear(); aAny.clear();
else if (aTypeClass == uno::TypeClass_BYTE) else if (aTypeClass == uno::TypeClass_BYTE)
aAny <<= static_cast<sal_Int8>(o3tl::toInt32(rValue)); aAny <<= static_cast<sal_Int8>(o3tl::toInt32(aValueStr));
else if (aTypeClass == uno::TypeClass_BOOLEAN) 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) else if (aTypeClass == uno::TypeClass_SHORT)
aAny <<= static_cast<sal_Int16>(o3tl::toInt32(rValue)); aAny <<= static_cast<sal_Int16>(o3tl::toInt32(aValueStr));
else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT) else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT)
aAny <<= static_cast<sal_uInt16>(o3tl::toUInt32(rValue)); aAny <<= static_cast<sal_uInt16>(o3tl::toUInt32(aValueStr));
else if (aTypeClass == uno::TypeClass_LONG) else if (aTypeClass == uno::TypeClass_LONG)
aAny <<= o3tl::toInt32(rValue); aAny <<= o3tl::toInt32(aValueStr);
else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG) else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG)
aAny <<= static_cast<sal_uInt32>(o3tl::toInt32(rValue)); aAny <<= static_cast<sal_uInt32>(o3tl::toInt32(aValueStr));
else if (aTypeClass == uno::TypeClass_FLOAT) 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) else if (aTypeClass == uno::TypeClass_DOUBLE)
aAny <<= o3tl::toDouble(rValue); aAny <<= o3tl::toDouble(aValueStr);
else if (aTypeClass == uno::TypeClass_STRING) else if (aTypeClass == uno::TypeClass_STRING)
aAny <<= OUString::fromUtf8(rValue); aAny <<= OUString::fromUtf8(aValueStr);
} }
} }
return aAny; return aAny;
@ -308,46 +308,46 @@ static std::vector<css::beans::PropertyValue> JsonToPropertyValues(const boost::
boost::property_tree::ptree aNodeNull, aNodeValue; boost::property_tree::ptree aNodeNull, aNodeValue;
for (const auto& rPair : aTree) for (const auto& rPair : aTree)
{ {
const std::string& rType = rPair.second.get<std::string>("type", ""); const std::string aType = rPair.second.get<std::string>("type", "");
const std::string& rValue = rPair.second.get<std::string>("value", ""); const std::string aValueStr = rPair.second.get<std::string>("value", "");
beans::PropertyValue aValue; beans::PropertyValue aValue;
aValue.Name = OUString::fromUtf8(rPair.first); aValue.Name = OUString::fromUtf8(rPair.first);
if (rType == "string") if (aType == "string")
aValue.Value <<= OUString::fromUtf8(rValue); aValue.Value <<= OUString::fromUtf8(aValueStr);
else if (rType == "boolean") else if (aType == "boolean")
aValue.Value <<= rtl_str_toBoolean(rValue.c_str()); aValue.Value <<= rtl_str_toBoolean(aValueStr.c_str());
else if (rType == "float") else if (aType == "float")
aValue.Value <<= rtl_str_toFloat(rValue.c_str()); aValue.Value <<= rtl_str_toFloat(aValueStr.c_str());
else if (rType == "long") else if (aType == "long")
aValue.Value <<= o3tl::toInt32(rValue); aValue.Value <<= o3tl::toInt32(aValueStr);
else if (rType == "short") else if (aType == "short")
aValue.Value <<= sal_Int16(o3tl::toInt32(rValue)); aValue.Value <<= sal_Int16(o3tl::toInt32(aValueStr));
else if (rType == "unsigned short") else if (aType == "unsigned short")
aValue.Value <<= sal_uInt16(o3tl::toUInt32(rValue)); aValue.Value <<= sal_uInt16(o3tl::toUInt32(aValueStr));
else if (rType == "int64") else if (aType == "int64")
aValue.Value <<= o3tl::toInt64(rValue); aValue.Value <<= o3tl::toInt64(aValueStr);
else if (rType == "int32") else if (aType == "int32")
aValue.Value <<= o3tl::toInt32(rValue); aValue.Value <<= o3tl::toInt32(aValueStr);
else if (rType == "int16") else if (aType == "int16")
aValue.Value <<= sal_Int16(o3tl::toInt32(rValue)); aValue.Value <<= sal_Int16(o3tl::toInt32(aValueStr));
else if (rType == "uint64") else if (aType == "uint64")
aValue.Value <<= rtl_str_toUInt64(rValue.c_str(), 10); aValue.Value <<= rtl_str_toUInt64(aValueStr.c_str(), 10);
else if (rType == "uint32") else if (aType == "uint32")
aValue.Value <<= o3tl::toUInt32(rValue); aValue.Value <<= o3tl::toUInt32(aValueStr);
else if (rType == "uint16") else if (aType == "uint16")
aValue.Value <<= sal_uInt16(o3tl::toUInt32(rValue)); aValue.Value <<= sal_uInt16(o3tl::toUInt32(aValueStr));
else if (rType == "[]byte") else if (aType == "[]byte")
{ {
aNodeValue = rPair.second.get_child("value", aNodeNull); aNodeValue = rPair.second.get_child("value", aNodeNull);
if (aNodeValue != aNodeNull && aNodeValue.size() == 0) if (aNodeValue != aNodeNull && aNodeValue.size() == 0)
{ {
uno::Sequence<sal_Int8> aSeqByte(reinterpret_cast<const sal_Int8*>(rValue.c_str()), uno::Sequence<sal_Int8> aSeqByte(reinterpret_cast<const sal_Int8*>(aValueStr.c_str()),
rValue.size()); aValueStr.size());
aValue.Value <<= aSeqByte; aValue.Value <<= aSeqByte;
} }
} }
else if (rType == "any") else if (aType == "any")
{ {
aNodeValue = rPair.second.get_child("value", aNodeNull); aNodeValue = rPair.second.get_child("value", aNodeNull);
if (aNodeValue != aNodeNull && !aNodeValue.empty()) if (aNodeValue != aNodeNull && !aNodeValue.empty())
@ -355,7 +355,7 @@ static std::vector<css::beans::PropertyValue> JsonToPropertyValues(const boost::
aValue.Value = jsonToUnoAny(aNodeValue); aValue.Value = jsonToUnoAny(aNodeValue);
} }
} }
else if (rType == "[]any") else if (aType == "[]any")
{ {
aNodeValue = rPair.second.get_child("value", aNodeNull); aNodeValue = rPair.second.get_child("value", aNodeNull);
if (aNodeValue != aNodeNull && !aNodeValue.empty()) if (aNodeValue != aNodeNull && !aNodeValue.empty())
@ -366,12 +366,12 @@ static std::vector<css::beans::PropertyValue> JsonToPropertyValues(const boost::
aValue.Value <<= aSeq; 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); aNodeValue = rPair.second.get_child("value", aNodeNull);
aValue.Value <<= comphelper::containerToSequence(JsonToPropertyValues(aNodeValue)); 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); aNodeValue = rPair.second.get_child("value", aNodeNull);
std::vector<uno::Sequence<beans::PropertyValue>> aSeqs; std::vector<uno::Sequence<beans::PropertyValue>> aSeqs;
@ -382,7 +382,7 @@ static std::vector<css::beans::PropertyValue> JsonToPropertyValues(const boost::
aValue.Value <<= comphelper::containerToSequence(aSeqs); aValue.Value <<= comphelper::containerToSequence(aSeqs);
} }
else else
SAL_WARN("comphelper", "JsonToPropertyValues: unhandled type '" << rType << "'"); SAL_WARN("comphelper", "JsonToPropertyValues: unhandled type '" << aType << "'");
aArguments.push_back(aValue); aArguments.push_back(aValue);
} }
return aArguments; return aArguments;

View file

@ -404,11 +404,11 @@ std::shared_ptr<ExpressionNode> const & FunctionParser::parseFunction( const OUS
// TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_* // TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_*
// gives better conversion robustness here (we might want to map space // gives better conversion robustness here (we might want to map space
// etc. to ASCII space here) // etc. to ASCII space here)
const OString& rAsciiFunction( const OString aAsciiFunction(
OUStringToOString( _sFunction, RTL_TEXTENCODING_ASCII_US ) ); OUStringToOString( _sFunction, RTL_TEXTENCODING_ASCII_US ) );
StringIteratorT aStart( rAsciiFunction.getStr() ); StringIteratorT aStart( aAsciiFunction.getStr() );
StringIteratorT aEnd( rAsciiFunction.getStr()+rAsciiFunction.getLength() ); StringIteratorT aEnd( aAsciiFunction.getStr()+aAsciiFunction.getLength() );
// static parser context, because the actual // static parser context, because the actual
// Spirit parser is also a static object // Spirit parser is also a static object

View file

@ -497,7 +497,7 @@ void OStatement_Base::GetAssignValues()
OSL_ENSURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Error in Parse Tree"); OSL_ENSURE(SQL_ISRULE(pOptColumnCommalist,opt_column_commalist),"OResultSet: Error in Parse Tree");
if (pOptColumnCommalist->count() == 0) 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()); aColumnNameList.insert(aColumnNameList.end(), aNames.begin(), aNames.end());
} }
else else

View file

@ -133,7 +133,7 @@ ObjectType Tables::appendObject(const OUString& rName,
m_xMetaData->getConnection())); */ m_xMetaData->getConnection())); */
OUStringBuffer aSqlBuffer("CREATE TABLE "); OUStringBuffer aSqlBuffer("CREATE TABLE ");
OUString sCatalog, sSchema, sComposedName, sTable; OUString sCatalog, sSchema, sComposedName, sTable;
const Reference< XConnection>& xConnection = m_xMetaData->getConnection(); const Reference< XConnection> xConnection = m_xMetaData->getConnection();
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();

View file

@ -258,7 +258,7 @@ template <typename T> T OPreparedResultSet::retrieveValue(sal_Int32 nColumnIndex
return *static_cast<T*>(m_aData[nColumnIndex - 1].buffer); return *static_cast<T*>(m_aData[nColumnIndex - 1].buffer);
else else
{ {
auto const& row = getRowSetValue(nColumnIndex); auto const row = getRowSetValue(nColumnIndex);
if constexpr (std::is_same_v<sal_Int64, T>) if constexpr (std::is_same_v<sal_Int64, T>)
return row.getLong(); return row.getLong();
else if constexpr (std::is_same_v<sal_Int32, T>) else if constexpr (std::is_same_v<sal_Int32, T>)

View file

@ -240,7 +240,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co
case DataType::VARCHAR: case DataType::VARCHAR:
case DataType::LONGVARCHAR: 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<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
} }
} }

View file

@ -441,7 +441,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex )
break; break;
default: default:
{ {
OUString const & sRet = m_aRow[columnIndex].getString(); OUString const sRet = m_aRow[columnIndex].getString();
nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength()); nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(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_CHAR:
case SQL_LONGVARCHAR: 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<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength());
} }
default: default: