diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-18 09:18:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-18 13:18:38 +0200 |
commit | 454eb3bc05f861712bff0f7593f9aa9809e4ee7c (patch) | |
tree | ea5ca6dbd4efe716bcdcb9ae196849053235c8af /configmgr/source | |
parent | bc8cefd025d89e7f981f07814a16030f92413a8b (diff) |
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/source')
-rw-r--r-- | configmgr/source/dconf.cxx | 16 | ||||
-rw-r--r-- | configmgr/source/writemodfile.cxx | 10 |
2 files changed, 13 insertions, 13 deletions
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>"); |