diff options
Diffstat (limited to 'include/comphelper')
-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; } |