loplugin:constvars in test..unotools

Change-Id: I087dc53ca5c18893974bbd9d959de56d5a4cdfa0
Reviewed-on: https://gerrit.libreoffice.org/77827
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2019-08-20 15:54:16 +02:00
parent 50a6041bfa
commit 1d4eb1be35
11 changed files with 30 additions and 30 deletions

View File

@ -24,13 +24,13 @@ namespace apitest
{
void FunctionDescription::testFunctionDescriptionProperties()
{
uno::Sequence<beans::PropertyValue> aFunctionDescription(init());
const uno::Sequence<beans::PropertyValue> aFunctionDescription(init());
std::vector<OUString> names;
// Only test the get/read operation of the values, because set/write operation doesn't
// make any sense. It doesn't trigger any changes.
// See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html.
for (auto& value : aFunctionDescription)
for (const auto& value : aFunctionDescription)
{
if (value.Name == "Id")
{

View File

@ -27,13 +27,13 @@ namespace apitest
void SheetSortDescriptor2::testSheetSortDescriptor2Properties()
{
uno::Reference<util::XSortable> xSortable(init(), UNO_QUERY_THROW);
uno::Sequence<beans::PropertyValue> values = xSortable->createSortDescriptor();
const uno::Sequence<beans::PropertyValue> values = xSortable->createSortDescriptor();
std::vector<OUString> names;
// Only test the get/read operation of the values, because set/write operation doesn't
// make any sense. It doesn't trigger any changes.
// See discussion: nabble.documentfoundation.org/Testing-UNO-API-service-properties-td4236286.html.
for (auto& value : values)
for (const auto& value : values)
{
if (value.Name == "BindFormatsToContent")
{

View File

@ -2068,7 +2068,7 @@ void VCLXToolkit::callTopWindowListeners(
{
css::lang::EventObject aAwtEvent(
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
for (css::uno::Reference<XInterface> & i : aListeners)
for (const css::uno::Reference<XInterface> & i : aListeners)
{
css::uno::Reference< css::awt::XTopWindowListener >
xListener(i, css::uno::UNO_QUERY);
@ -2111,7 +2111,7 @@ bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
sal::static_int_cast< sal_Int16 >(
pKeyEvent->GetKeyCode().GetFunction()));
for (css::uno::Reference<XInterface> & i : aHandlers)
for (const css::uno::Reference<XInterface> & i : aHandlers)
{
css::uno::Reference< css::awt::XKeyHandler > xHandler(
i, css::uno::UNO_QUERY);
@ -2158,7 +2158,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
xNext, false);
for (css::uno::Reference<XInterface> & i : aListeners)
for (const css::uno::Reference<XInterface> & i : aListeners)
{
css::uno::Reference< css::awt::XFocusListener > xListener(
i, css::uno::UNO_QUERY);

View File

@ -579,7 +579,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
while ( pLangDepProp->pPropName != nullptr )
{
bool bMustBeInserted( true );
for (PropertyValue & i : aPeerPropertiesToSet)
for (const PropertyValue & i : aPeerPropertiesToSet)
{
if ( i.Name.equalsAsciiL(
pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))

View File

@ -103,7 +103,7 @@ long ButtonDialog::ImplGetButtonSize()
long nSepSize = 0;
maCtrlSize = Size( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT );
for (auto & it : m_ItemList)
for (const auto & it : m_ItemList)
{
nSepSize += nLastSepSize;
@ -203,7 +203,7 @@ void ButtonDialog::ImplPosControls()
IMPL_LINK( ButtonDialog, ImplClickHdl, Button*, pBtn, void )
{
for (auto & it : m_ItemList)
for (const auto & it : m_ItemList)
{
if ( it->mpPushButton == pBtn )
{

View File

@ -227,7 +227,7 @@ void FTPContentProvider::forHost( const OUString& host,
OUString& account)
{
osl::MutexGuard aGuard(m_aMutex);
for(ServerInfo & i : m_ServerInfo)
for(const ServerInfo & i : m_ServerInfo)
if(host == i.host &&
port == i.port &&
username == i.username )

View File

@ -605,7 +605,7 @@ FTPDirentry FTPURL::direntry() const
std::vector<FTPDirentry> aList = aURL.list(OpenMode::ALL);
for(FTPDirentry & d : aList) {
for(const FTPDirentry & d : aList) {
if(d.m_aName == nettitle) { // the relevant file is found
aDirentry = d;
break;

View File

@ -1334,7 +1334,7 @@ structMember:
dynamic_cast<unoidl::detail::SourceProviderPlainStructTypeEntityPad *>(
ent->pad.get());
if (p1 != nullptr) {
for (auto & i: p1->members) {
for (const auto & i: p1->members) {
if (id == i.name) {
error(
@3, yyscanner,
@ -1401,7 +1401,7 @@ structMember:
p2 = dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
ent->pad.get());
if (p2 != nullptr) {
for (auto & i: p2->members) {
for (const auto & i: p2->members) {
if (id == i.name) {
error(
@3, yyscanner,
@ -1420,7 +1420,7 @@ structMember:
= dynamic_cast<unoidl::detail::SourceProviderExceptionTypeEntityPad *>(
ent->pad.get());
assert(p3 != nullptr);
for (auto & i: p3->members) {
for (const auto & i: p3->members) {
if (id == i.name) {
error(
@3, yyscanner,
@ -1869,7 +1869,7 @@ methodParam:
default:
break;
}
for (auto & i: pad->directMethods.back().parameters) {
for (const auto & i: pad->directMethods.back().parameters) {
if (id == i.name) {
error(
@5, yyscanner,
@ -2353,7 +2353,7 @@ singleInterfaceBasedServiceDefn:
assert(pad != nullptr);
std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor> ctors;
if ($7) {
for (auto & i: pad->constructors) {
for (const auto & i: pad->constructors) {
std::vector<unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter> parms;
for (auto & j: i.parameters) {
parms.emplace_back(j.name, j.type.getName(), j.rest);
@ -2392,7 +2392,7 @@ ctor:
rtl::Reference<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>
pad(getCurrentPad<unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad>(
data));
for (auto & i: pad->constructors) {
for (const auto & i: pad->constructors) {
if (id == i.name) {
error(
@2, yyscanner,
@ -2518,7 +2518,7 @@ ctorParam:
+ " rest parameter must be last parameter"));
YYERROR;
}
for (auto & i: pad->constructors.back().parameters) {
for (const auto & i: pad->constructors.back().parameters) {
if (id == i.name) {
error(
@6, yyscanner,
@ -2630,7 +2630,7 @@ serviceBase:
std::vector<unoidl::AnnotatedReference> & v(
opt
? pad->directOptionalBaseServices : pad->directMandatoryBaseServices);
for (auto & i: v) {
for (const auto & i: v) {
if (name == i.name) {
error(
@4, yyscanner,
@ -2707,7 +2707,7 @@ serviceInterfaceBase:
opt
? pad->directOptionalBaseInterfaces
: pad->directMandatoryBaseInterfaces);
for (auto & i: v) {
for (const auto & i: v) {
if (name == i.name) {
error(
@4, yyscanner,
@ -2794,7 +2794,7 @@ serviceProperty:
rtl::Reference<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>
pad(getCurrentPad<unoidl::detail::SourceProviderAccumulationBasedServiceEntityPad>(
data));
for (auto & i: pad->directProperties) {
for (const auto & i: pad->directProperties) {
if (id == i.name) {
error(
@4, yyscanner,
@ -3477,7 +3477,7 @@ primaryExpr:
unoidl::detail::SourceProviderEnumTypeEntityPad * p1 = dynamic_cast<
unoidl::detail::SourceProviderEnumTypeEntityPad *>(pad.get());
if (p1 != nullptr) {
for (auto & j: p1->members) {
for (const auto & j: p1->members) {
if (j.name == name) {
v = unoidl::ConstantValue(j.value);
found = true;
@ -3490,7 +3490,7 @@ primaryExpr:
unoidl::detail::SourceProviderConstantGroupEntityPad *>(
pad.get());
if (p2 != nullptr) {
for (auto & j: p2->members) {
for (const auto & j: p2->members) {
if (j.name == name) {
v = j.value;
found = true;
@ -3538,7 +3538,7 @@ primaryExpr:
unoidl::detail::SourceProviderConstantGroupEntityPad *>(
ent->pad.get());
if (pad != nullptr) {
for (auto & j: pad->members) {
for (const auto & j: pad->members) {
if (j.name == id) {
v = j.value;
found = true;

View File

@ -204,7 +204,7 @@ void insertTypeDependency(
OUString nucl(decomposeType(type, &rank, &args, &entity));
if (entity) {
insertEntityDependency(manager, iterator, nucl, true);
for (auto & i: args) {
for (const auto & i: args) {
insertTypeDependency(manager, iterator, i);
}
}
@ -1041,7 +1041,7 @@ SAL_IMPLEMENT_MAIN() {
scanMap(mgr, prov->createRootCursor(), published, "", ents);
std::vector<OUString> sorted(sort(ents));
std::vector<OUString> mods;
for (auto & i: sorted) {
for (const auto & i: sorted) {
writeEntity(ents, mods, i);
}
closeModules(mods, mods.size());

View File

@ -713,7 +713,7 @@ sal_uInt64 writeMap(
write32(file, cmap.size());
// overflow from std::map::size_type -> sal_uInt64 is
// unrealistic
for (auto & j: cmap) {
for (const auto & j: cmap) {
write32(file, j.second.nameOffset);
write32(file, j.second.dataOffset);
}
@ -846,7 +846,7 @@ sal_uInt64 writeMap(
*rootSize = map.size();
// overflow from std::map::size_type -> std::size_t is unrealistic
}
for (auto & i: map) {
for (const auto & i: map) {
write32(file, i.second.nameOffset);
write32(file, i.second.dataOffset);
}

View File

@ -416,7 +416,7 @@ css::uno::Sequence < OUString > SvtModuleOptions_Impl::GetAllServiceNames()
{
std::vector<OUString> aVec;
for( auto & rFactory : m_lFactories )
for( const auto & rFactory : m_lFactories )
if( rFactory.getInstalled() )
aVec.push_back( rFactory.getFactory() );