diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-20 05:51:54 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-12-20 08:34:51 +0100 |
commit | a784ac2daf55f9e620d7c8da1b880ee539d9218a (patch) | |
tree | 9c6261d4ef280e0a3cb5abc26aeb906cfe62a2a7 /include | |
parent | 4e124b17a71d24079f43da68fb239b2e2a29dc4e (diff) |
loplugin:unusedindex
Change-Id: I80c0a8dbfda14e54fcfaf33a241c83bad8495db1
Reviewed-on: https://gerrit.libreoffice.org/46833
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/basicio.hxx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/include/comphelper/basicio.hxx b/include/comphelper/basicio.hxx index 3dd8aea727ae..de444e0c12a1 100644 --- a/include/comphelper/basicio.hxx +++ b/include/comphelper/basicio.hxx @@ -63,28 +63,18 @@ COMPHELPER_DLLPUBLIC const css::uno::Reference<css::io::XObjectOutputStream>& op template <class ELEMENT> const css::uno::Reference<css::io::XObjectInputStream>& operator >> (const css::uno::Reference<css::io::XObjectInputStream>& _rxInStream, css::uno::Sequence<ELEMENT>& _rSeq) { - sal_Int32 nLen = _rxInStream->readLong(); - _rSeq.realloc(nLen); - if (nLen) - { - ELEMENT* pElement = _rSeq.getArray(); - for (sal_Int32 i=0; i<nLen; ++i, ++pElement) - _rxInStream >> *pElement; - } + _rSeq.realloc(_rxInStream->readLong()); + for (ELEMENT& rElement : _rSeq) + _rxInStream >> rElement; return _rxInStream; } template <class ELEMENT> const css::uno::Reference<css::io::XObjectOutputStream>& operator << (const css::uno::Reference<css::io::XObjectOutputStream>& _rxOutStream, const css::uno::Sequence<ELEMENT>& _rSeq) { - sal_Int32 nLen = _rSeq.getLength(); - _rxOutStream->writeLong(nLen); - if (nLen) - { - const ELEMENT* pElement = _rSeq.getConstArray(); - for (sal_Int32 i = 0; i < nLen; ++i, ++pElement) - _rxOutStream << *pElement; - } + _rxOutStream->writeLong(_rSeq.getLength()); + for (const ELEMENT& rElement : _rSeq) + _rxOutStream << rElement; return _rxOutStream; } |