canvas/source/directx/dx_canvashelper.cxx | 2 +- include/comphelper/sequence.hxx | 9 +++++++++ svl/source/passwordcontainer/passwordcontainer.cxx | 2 +- vcl/source/gdi/svgdata.cxx | 3 +-- 4 files changed, 12 insertions(+), 4 deletions(-)
New commits: commit ee0e713b5333dd363e443bf471ecb5cecec09d17 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Wed Nov 9 10:57:28 2016 +0200 make comphelper::sequenceToContainer a little smarter so we don't have to specify the source type Change-Id: I4106705a39874a8043f0f294a11374404d6cfc3a Reviewed-on: https://gerrit.libreoffice.org/30713 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index c319239..94b9c32 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -359,7 +359,7 @@ namespace dxcanvas aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) ); const ::std::vector< Gdiplus::REAL >& rDashArray( - ::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >( + ::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL >, double >( strokeAttributes.DashArray ) ); if( !rDashArray.empty() ) { diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index bb1b1e8..68c361c 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -340,6 +340,15 @@ namespace comphelper return result; } + // this one does better type deduction, but does not allow us to copy into a different element type + template < typename DstType > + inline DstType sequenceToContainer( const css::uno::Sequence< typename DstType::value_type >& i_Sequence ) + { + DstType result( i_Sequence.getLength() ); + ::std::copy( i_Sequence.begin(), i_Sequence.end(), result.begin() ); + return result; + } + /** Copy from a Sequence into an existing container This potentially saves a needless extra copy operation over diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 3471291..d83c699 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -638,7 +638,7 @@ void SAL_CALL PasswordContainer::addPersistent( const OUString& Url, const OUStr void PasswordContainer::PrivateAdd( const OUString& Url, const OUString& UserName, const Sequence< OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException, std::exception) { NamePassRecord aRecord( UserName ); - ::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString>, OUString>( Passwords ); + ::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString> >( Passwords ); if( Mode == PERSISTENT_RECORD ) aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) ); diff --git a/vcl/source/gdi/svgdata.cxx b/vcl/source/gdi/svgdata.cxx index 1ec5014..155844f 100644 --- a/vcl/source/gdi/svgdata.cxx +++ b/vcl/source/gdi/svgdata.cxx @@ -131,8 +131,7 @@ void SvgData::ensureSequenceAndRange() { const uno::Reference< graphic::XSvgParser > xSvgParser = graphic::SvgTools::create(xContext); - maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>, - css::uno::Reference< css::graphic::XPrimitive2D >>(xSvgParser->getDecomposition(myInputStream, maPath)); + maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, maPath)); } catch(const uno::Exception&) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits