include/comphelper/basicio.hxx | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
New commits: commit a784ac2daf55f9e620d7c8da1b880ee539d9218a Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Wed Dec 20 05:51:54 2017 +0200 loplugin:unusedindex Change-Id: I80c0a8dbfda14e54fcfaf33a241c83bad8495db1 Reviewed-on: https://gerrit.libreoffice.org/46833 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> 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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits