[Libreoffice-commits] core.git: 2 commits - cui/source include/sot sd/source sfx2/source sot/source

Noel Grandin noel at peralex.com
Thu Jan 9 01:00:29 PST 2014


 cui/source/dialogs/multifil.cxx       |    2 +-
 cui/source/dialogs/multipat.cxx       |    4 ++--
 include/sot/filelist.hxx              |    3 ++-
 sd/source/ui/dlg/PhotoAlbumDialog.cxx |   10 +++++-----
 sfx2/source/appl/newhelp.cxx          |    8 ++++----
 sot/source/base/filelist.cxx          |    8 +++-----
 6 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 6d25220ad6c869bb7cd79cf678d092b81558a8d2
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jan 8 14:29:55 2014 +0200

    remove unnecessary use of OUString*
    
    in FileList. There no benefit in storing a ref-counted value class like
    OUString by pointer in a std::vector.
    
    Change-Id: I302bc460de67c7fe324d745f3225df4e17195486

diff --git a/include/sot/filelist.hxx b/include/sot/filelist.hxx
index 32499df..631f3ca 100644
--- a/include/sot/filelist.hxx
+++ b/include/sot/filelist.hxx
@@ -24,7 +24,8 @@
 #include <tools/stream.hxx>
 
 #include <vector>
-typedef ::std::vector< OUString* > FileStringList;
+
+typedef ::std::vector< OUString > FileStringList;
 
 class SOT_DLLPUBLIC FileList : public SvDataCopyStream
 {
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index da4cd9f..4493fcf 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.cxx
@@ -39,8 +39,6 @@ FileList::~FileList()
 
 void FileList::ClearAll( void )
 {
-    for ( size_t i = 0, n = aStrList.size(); i < n; ++i )
-        delete aStrList[ i ];
     aStrList.clear();
 }
 
@@ -53,7 +51,7 @@ void FileList::ClearAll( void )
 FileList& FileList::operator=( const FileList& rFileList )
 {
     for ( size_t i = 0, n = rFileList.aStrList.size(); i < n; ++i )
-        aStrList.push_back( new OUString( *rFileList.aStrList[ i ] ) );
+        aStrList.push_back( rFileList.aStrList[ i ] );
     return *this;
 }
 
@@ -137,14 +135,14 @@ SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
 
 void FileList::AppendFile( const OUString& rStr )
 {
-    aStrList.push_back( new OUString( rStr ) );
+    aStrList.push_back( rStr );
 }
 
 OUString FileList::GetFile( size_t i ) const
 {
     OUString aStr;
     if( i < aStrList.size() )
-        aStr = *aStrList[ i ];
+        aStr = aStrList[ i ];
     return aStr;
 }
 
commit f85b2f676dabd388254fb411d497e36ccecd2ddb
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jan 8 14:23:04 2014 +0200

    remove unnecessary casts when calling Combobox::SetEntryData
    
    An OUString* is type compatibile with void*.
    
    Change-Id: I6f01fe02c75f4db0bda09c7e288cb88d1fbf3c37

diff --git a/cui/source/dialogs/multifil.cxx b/cui/source/dialogs/multifil.cxx
index 3a29b87..0eca236 100644
--- a/cui/source/dialogs/multifil.cxx
+++ b/cui/source/dialogs/multifil.cxx
@@ -117,7 +117,7 @@ IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn )
         else
         {
             sal_uInt16 nPos = aPathLB.InsertEntry( sInsFile, LISTBOX_APPEND );
-            aPathLB.SetEntryData( nPos, (void*) new OUString( sInsFile ) );
+            aPathLB.SetEntryData( nPos, new OUString( sInsFile ) );
         }
 
     } // end of if ( aDlg.Execute() == ERRCODE_NONE )
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index fc24c30..1fa83cb 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -120,7 +120,7 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl)
             else
             {
                 sal_uInt16 nPos = aPathLB.InsertEntry( sInsPath, LISTBOX_APPEND );
-                aPathLB.SetEntryData( nPos, (void*)new OUString( aURL ) );
+                aPathLB.SetEntryData( nPos, new OUString( aURL ) );
             }
         }
         SelectHdl_Impl( NULL );
@@ -296,7 +296,7 @@ void SvxMultiPathDialog::SetPath( const OUString& rPath )
                 nPos = aPathLB.InsertEntry( sSystemPath, LISTBOX_APPEND );
             else
                 nPos = aPathLB.InsertEntry( sPath, LISTBOX_APPEND );
-            aPathLB.SetEntryData( nPos, (void*)new OUString( sPath ) );
+            aPathLB.SetEntryData( nPos, new OUString( sPath ) );
         }
     }
 
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 38d777f..25c7554 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -481,7 +481,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl)
                 // Store full path, show filename only. Use INetURLObject to display spaces in filename correctly
                 INetURLObject aUrl = INetURLObject(aFilesArr[i]);
                 sal_Int16 nPos = pImagesLst->InsertEntry( aUrl.GetLastName(INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8) );
-                pImagesLst->SetEntryData(nPos, (OUString*) new OUString(aUrl.GetMainURL(INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8)));
+                pImagesLst->SetEntryData(nPos, new OUString(aUrl.GetMainURL(INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8)));
             }
         }
     }
@@ -509,10 +509,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, UpHdl)
         pImagesLst->RemoveEntry( sUpperEntry );
 
         pImagesLst->InsertEntry( sActEntry, nActPos - 1 );
-        pImagesLst->SetEntryData( nActPos - 1, (void*) new OUString(sAct));
+        pImagesLst->SetEntryData( nActPos - 1, new OUString(sAct));
 
         pImagesLst->InsertEntry( sUpperEntry, nActPos );
-        pImagesLst->SetEntryData( nActPos, (void*) new OUString(sUpper));
+        pImagesLst->SetEntryData( nActPos, new OUString(sUpper));
 
         pImagesLst->SelectEntryPos(nActPos - 1);
     }
@@ -538,10 +538,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, DownHdl)
         pImagesLst->RemoveEntry( sDownEntry );
 
         pImagesLst->InsertEntry( sDownEntry, nActPos );
-        pImagesLst->SetEntryData( nActPos, (void*) new OUString(sDown));
+        pImagesLst->SetEntryData( nActPos, new OUString(sDown));
 
         pImagesLst->InsertEntry( sActEntry, nActPos + 1 );
-        pImagesLst->SetEntryData( nActPos + 1, (void*) new OUString(sAct));
+        pImagesLst->SetEntryData( nActPos + 1, new OUString(sAct));
 
         pImagesLst->SelectEntryPos(nActPos + 1);
 
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 8bd2f5f..77e7362 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1076,7 +1076,7 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl)
             nIdx = 0;
             OUString* pURL = new OUString( rRow.getToken( 2, '\t', nIdx ) );
             sal_uInt16 nPos = aResultsLB.InsertEntry( aTitle );
-            aResultsLB.SetEntryData( nPos, (void*)(sal_uIntPtr)pURL );
+            aResultsLB.SetEntryData( nPos, pURL );
         }
         LeaveWait();
 
@@ -1279,7 +1279,7 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction )
                     OUString aImageURL = IMAGE_URL;
                     aImageURL += INetURLObject( *pURL ).GetHost();
                     nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
-                    SetEntryData( nPos, (void*)(sal_uIntPtr)( new OUString( *pURL ) ) );
+                    SetEntryData( nPos, new OUString( *pURL ) );
                     SelectEntryPos( nPos );
                     delete pURL;
                 }
@@ -1452,7 +1452,7 @@ void BookmarksTabPage_Impl::AddBookmarks( const OUString& rTitle, const OUString
     OUString aImageURL = IMAGE_URL;
     aImageURL += INetURLObject( rURL ).GetHost();
     sal_uInt16 nPos = aBookmarksBox.InsertEntry( rTitle, SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
-    aBookmarksBox.SetEntryData( nPos, (void*)(sal_uIntPtr)( new OUString( rURL ) ) );
+    aBookmarksBox.SetEntryData( nPos, new OUString( rURL ) );
 }
 
 OUString SfxHelpWindow_Impl::buildHelpURL(const OUString& sFactory        ,
@@ -1593,7 +1593,7 @@ void SfxHelpIndexWindow_Impl::Initialize()
         OUString aURL = rRow.getToken( 2, '\t', nIdx );
         OUString* pFactory = new OUString( INetURLObject( aURL ).GetHost() );
         sal_uInt16 nPos = aActiveLB.InsertEntry( aTitle );
-        aActiveLB.SetEntryData( nPos, (void*)(sal_uIntPtr)pFactory );
+        aActiveLB.SetEntryData( nPos, pFactory );
     }
 
     aActiveLB.SetDropDownLineCount( (sal_uInt16)aFactories.size() );


More information about the Libreoffice-commits mailing list