summaryrefslogtreecommitdiffstats
path: root/configmgr
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-18 09:18:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-18 13:18:38 +0200
commit454eb3bc05f861712bff0f7593f9aa9809e4ee7c (patch)
treeea5ca6dbd4efe716bcdcb9ae196849053235c8af /configmgr
parentRevert "make: map slowcheck to gbuild's build and slowcheck" (diff)
downloadcore-454eb3bc05f861712bff0f7593f9aa9809e4ee7c.tar.gz
core-454eb3bc05f861712bff0f7593f9aa9809e4ee7c.zip
use for-range on Sequence in cli_ure..connectivity
Change-Id: Ic5254e402d153a13c29928b59738cbe1603d0139 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94399 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/qa/unit/test.cxx6
-rw-r--r--configmgr/source/dconf.cxx16
-rw-r--r--configmgr/source/writemodfile.cxx10
3 files changed, 16 insertions, 16 deletions
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
index e553c1947f66..daa2070086f7 100644
--- a/configmgr/qa/unit/test.cxx
+++ b/configmgr/qa/unit/test.cxx
@@ -316,15 +316,15 @@ void Test::testReadCommands()
"/org.openoffice.Office.UI.GenericCommands/UserInterface/"
"Commands"),
css::uno::UNO_QUERY_THROW);
- css::uno::Sequence< OUString > names(access->getElementNames());
+ const css::uno::Sequence< OUString > names(access->getElementNames());
/*CPPUNIT_ASSERT_EQUAL(749, names.getLength());*/
// testSetSetMemberName() already removed ".uno:FontworkGalleryFloater"
sal_uInt32 n = osl_getGlobalTimer();
for (int i = 0; i < 8; ++i) {
- for (sal_Int32 j = 0; j < names.getLength(); ++j) {
+ for (OUString const & childName : names) {
css::uno::Reference< css::container::XNameAccess > child;
- if (access->getByName(names[j]) >>= child) {
+ if (access->getByName(childName) >>= child) {
CPPUNIT_ASSERT(child.is());
child->getByName("Label");
child->getByName("ContextLabel");
diff --git a/configmgr/source/dconf.cxx b/configmgr/source/dconf.cxx
index 8493b3351e83..75c0bb360ce3 100644
--- a/configmgr/source/dconf.cxx
+++ b/configmgr/source/dconf.cxx
@@ -1264,12 +1264,12 @@ bool addProperty(
}
case TYPE_STRING_LIST:
{
- css::uno::Sequence<OUString> seq(
+ const css::uno::Sequence<OUString> seq(
value.get<css::uno::Sequence<OUString>>());
std::vector<GVariant *> vs;
- for (sal_Int32 i = 0; i != seq.getLength(); ++i) {
+ for (OUString const & s : seq) {
children.emplace_front(
- g_variant_new_string(encodeString(seq[i]).getStr()));
+ g_variant_new_string(encodeString(s).getStr()));
if (children.front().get() == nullptr) {
SAL_WARN(
"configmgr.dconf", "g_variant_new_string failed");
@@ -1287,11 +1287,11 @@ bool addProperty(
}
case TYPE_HEXBINARY_LIST:
{
- css::uno::Sequence<css::uno::Sequence<sal_Int8>> seq(
+ const css::uno::Sequence<css::uno::Sequence<sal_Int8>> seqSeq(
value.get<
css::uno::Sequence<css::uno::Sequence<sal_Int8>>>());
std::vector<GVariant *> vs;
- for (sal_Int32 i = 0; i != seq.getLength(); ++i) {
+ for (css::uno::Sequence<sal_Int8> const & seq : seqSeq) {
static_assert(
sizeof(sal_Int32) <= sizeof(gsize),
"G_MAXSIZE too small");
@@ -1299,8 +1299,8 @@ bool addProperty(
sizeof (sal_Int8) == sizeof (guchar), "size mismatch");
children.emplace_front(
g_variant_new_fixed_array(
- G_VARIANT_TYPE_BYTE, seq[i].getConstArray(),
- seq[i].getLength(), sizeof (sal_Int8)));
+ G_VARIANT_TYPE_BYTE, seq.getConstArray(),
+ seq.getLength(), sizeof (sal_Int8)));
if (children.front().get() == nullptr) {
SAL_WARN(
"configmgr.dconf",
@@ -1318,7 +1318,7 @@ bool addProperty(
sizeof(sal_Int32) <= sizeof(gsize),
"G_MAXSIZE too small");
v.reset(
- g_variant_new_array(ty.get(), vs.data(), seq.getLength()));
+ g_variant_new_array(ty.get(), vs.data(), seqSeq.getLength()));
break;
}
default:
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx
index 22fd43ecf797..3df150c448cd 100644
--- a/configmgr/source/writemodfile.cxx
+++ b/configmgr/source/writemodfile.cxx
@@ -178,13 +178,13 @@ void writeValueContent_(TempFile &handle, const OUString& value) {
void writeValueContent_(
TempFile &handle, css::uno::Sequence< sal_Int8 > const & value)
{
- for (sal_Int32 i = 0; i < value.getLength(); ++i) {
+ for (const auto & v : value) {
static char const hexDigit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
'D', 'E', 'F' };
handle.writeString(
- std::string_view(hexDigit + ((value[i] >> 4) & 0xF), 1));
- handle.writeString(std::string_view(hexDigit + (value[i] & 0xF), 1));
+ std::string_view(hexDigit + ((v >> 4) & 0xF), 1));
+ handle.writeString(std::string_view(hexDigit + (v & 0xF), 1));
}
}
@@ -219,9 +219,9 @@ template< typename T > void writeItemListValue(
handle.writeString(">");
css::uno::Sequence< T > val;
value >>= val;
- for (sal_Int32 i = 0; i < val.getLength(); ++i) {
+ for (const auto & i : val) {
handle.writeString("<it>");
- writeValueContent_(handle, val[i]);
+ writeValueContent_(handle, i);
handle.writeString("</it>");
}
handle.writeString("</value>");