[Libreoffice-commits] core.git: sfx2/source

Matthew Pottage matthewpottage at invincitech.com
Wed Jan 7 07:35:25 PST 2015


 sfx2/source/appl/appopen.cxx |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 1079ccf05b1441649a8232e2ed112e4fceed5943
Author: Matthew Pottage <matthewpottage at invincitech.com>
Date:   Mon Dec 22 09:20:26 2014 +0000

    Completed TODO: simplify appending to sequence.
    
    File sfx2/source/appl/appopen.cxx. Fixed by using std::vector instead of
    Sequence; Simplifying the code.
    
    Change-Id: Iecb45ba3429be86d03fad5275d0f0a92b659a542
    Reviewed-on: https://gerrit.libreoffice.org/13605
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index b76bbb4..27fefa9 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -862,7 +862,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
                 else
                 {
                     // check for "internal" protocols that should not be forwarded to the system
-                    Sequence < OUString > aProtocols(2);
+                    std::vector < OUString > aProtocols(2);
 
                     // add special protocols that always should be treated as internal
                     aProtocols[0] = "private:*";
@@ -883,16 +883,12 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
                             Sequence < OUString > aTmp;
                             aRet >>= aTmp;
 
-                            // todo: add operator+= to SequenceAsVector class and use SequenceAsVector for aProtocols
-                            sal_Int32 nLength = aProtocols.getLength();
-                            aProtocols.realloc( nLength+aTmp.getLength() );
-                            for ( sal_Int32 n=0; n<aTmp.getLength(); n++ )
-                                aProtocols[(++nLength)-1] = aTmp[n];
+                            aProtocols.insert(aProtocols.end(),aTmp.begin(),aTmp.end());
                         }
                     }
 
                     bool bFound = false;
-                    for ( sal_Int32 nProt=0; nProt<aProtocols.getLength(); nProt++ )
+                    for ( size_t nProt=0; nProt<aProtocols.size(); nProt++ )
                     {
                         WildCard aPattern(aProtocols[nProt]);
                         if ( aPattern.Matches( aURL.Complete ) )


More information about the Libreoffice-commits mailing list