vcl/osx/vclnsapp.mm             |    6 ++----
 vcl/source/app/salvtables.cxx   |    6 ++----
 vcl/source/control/throbber.cxx |   10 ++++++----
 vcl/source/font/fontcharmap.cxx |    3 +--
 vcl/source/fontsubset/sft.cxx   |    3 +--
 vcl/source/window/floatwin.cxx  |    6 ++++--
 6 files changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 43a9bf11203ed92096af34ab828501e0218832c7
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Oct 16 22:46:30 2021 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Oct 17 11:33:51 2021 +0200

    Simplify vector initialization in vcl
    
    Change-Id: I881627313221081f72f8421c91417e4c111cfd97
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123708
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/vcl/osx/vclnsapp.mm b/vcl/osx/vclnsapp.mm
index 727f58ed391e..f420bfd83c5d 100644
--- a/vcl/osx/vclnsapp.mm
+++ b/vcl/osx/vclnsapp.mm
@@ -226,8 +226,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 -(BOOL)application: (NSApplication*)app openFile: (NSString*)pFile
 {
     (void)app;
-    std::vector<OUString> aFile;
-    aFile.push_back( GetOUString( pFile ) );
+    std::vector<OUString> aFile { GetOUString( pFile ) };
     if( ! AquaSalInstance::isOnCommandLine( aFile[0] ) )
     {
         const ApplicationEvent* pAppEvent = new 
ApplicationEvent(ApplicationEvent::Type::Open, std::move(aFile));
@@ -272,8 +271,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 -(BOOL)application: (NSApplication*)app printFile: (NSString*)pFile
 {
     (void)app;
-    std::vector<OUString> aFile;
-    aFile.push_back( GetOUString( pFile ) );
+    std::vector<OUString> aFile { GetOUString(pFile) };
     const ApplicationEvent* pAppEvent = new 
ApplicationEvent(ApplicationEvent::Type::Print, std::move(aFile));
     AquaSalInstance::aAppEventList.push_back( pAppEvent );
     AquaSalInstance *pInst = GetSalData()->mpInstance;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 58e1cba83ad6..f783841991c3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3748,8 +3748,7 @@ void SalInstanceTreeView::thaw()
 
 void SalInstanceTreeView::set_column_fixed_widths(const std::vector<int>& 
rWidths)
 {
-    std::vector<tools::Long> aTabPositions;
-    aTabPositions.push_back(0);
+    std::vector<tools::Long> aTabPositions{ 0 };
     for (size_t i = 0; i < rWidths.size(); ++i)
         aTabPositions.push_back(aTabPositions[i] + rWidths[i]);
     m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), 
MapUnit::MapPixel);
@@ -5096,8 +5095,7 @@ IMPL_LINK_NOARG(SalInstanceTreeView, DoubleClickHdl, 
SvTreeListBox*, bool)
 
 IMPL_LINK(SalInstanceTreeView, EndDragHdl, HeaderBar*, pHeaderBar, void)
 {
-    std::vector<tools::Long> aTabPositions;
-    aTabPositions.push_back(0);
+    std::vector<tools::Long> aTabPositions{ 0 };
     for (int i = 0; i < pHeaderBar->GetItemCount() - 1; ++i)
         aTabPositions.push_back(aTabPositions[i]
                                 + 
pHeaderBar->GetItemSize(pHeaderBar->GetItemId(i)));
diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx
index e1faeb7c7af1..d7dc3e4a763d 100644
--- a/vcl/source/control/throbber.cxx
+++ b/vcl/source/control/throbber.cxx
@@ -99,10 +99,12 @@ void Throbber::initImages()
 {
     try
     {
-        ::std::vector< ::std::vector< Image > > aImageSets;
-        aImageSets.push_back( lcl_loadImageSet( ImageSet::N16px ) );
-        aImageSets.push_back( lcl_loadImageSet( ImageSet::N32px ) );
-        aImageSets.push_back( lcl_loadImageSet( ImageSet::N64px ) );
+        ::std::vector< ::std::vector< Image > > aImageSets
+        {
+            lcl_loadImageSet( ImageSet::N16px ),
+            lcl_loadImageSet( ImageSet::N32px ),
+            lcl_loadImageSet( ImageSet::N64px )
+        };
 
         // find the best matching image set (size-wise)
         const ::Size aWindowSizePixel = GetSizePixel();
diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx
index 90a08d617a86..72a4feacd36e 100644
--- a/vcl/source/font/fontcharmap.cxx
+++ b/vcl/source/font/fontcharmap.cxx
@@ -176,9 +176,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, 
CmapResult& rResult )
     sal_UCS4* pCodePairs = nullptr;
     int* pStartGlyphs = nullptr;
 
-    std::vector<sal_uInt16> aGlyphIdArray;
+    std::vector<sal_uInt16> aGlyphIdArray { 0 };
     aGlyphIdArray.reserve( 0x1000 );
-    aGlyphIdArray.push_back( 0 );
 
     // format 4, the most common 16bit char mapping table
     if( (nFormat == 4) && ((nOffset+16) < nLength) )
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 86946799a001..dfee625308b2 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -660,8 +660,7 @@ static int GetTTGlyphOutline(AbstractTrueTypeFont *ttf, 
sal_uInt32 glyphID, Cont
     }
     else
     {
-        std::vector< sal_uInt32 > aPrivList;
-        aPrivList.push_back( glyphID );
+        std::vector< sal_uInt32 > aPrivList { glyphID };
         res = GetCompoundTTOutline(ttf, glyphID, pointArray, metrics, 
glyphlist ? *glyphlist : aPrivList );
     }
 
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index f8beb309b3d8..5ac275290df3 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -655,9 +655,11 @@ void FloatingWindow::PixelInvalidate(const 
tools::Rectangle* /*pRectangle*/)
 {
     if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
     {
-        std::vector<vcl::LOKPayloadItem> aPayload;
         const tools::Rectangle aRect(Point(0,0), 
Size(GetSizePixel().Width()+1, GetSizePixel().Height()+1));
-        aPayload.push_back(std::make_pair(OString("rectangle"), 
aRect.toString()));
+        std::vector<vcl::LOKPayloadItem> aPayload
+        {
+            std::make_pair(OString("rectangle"), aRect.toString())
+        };
         const vcl::ILibreOfficeKitNotifier* pNotifier = 
pParent->GetLOKNotifier();
         pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
     }

Reply via email to