[Libreoffice-commits] core.git: desktop/source vcl/osx vcl/quartz

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 6 12:38:21 UTC 2019


 desktop/source/app/app.cxx  |    4 ++--
 vcl/osx/salframe.cxx        |    2 +-
 vcl/osx/salframeview.mm     |    2 +-
 vcl/osx/salmenu.cxx         |    2 +-
 vcl/quartz/salgdi.cxx       |   38 +++++++++++++++++++-------------------
 vcl/quartz/salgdicommon.cxx |    4 ++--
 6 files changed, 26 insertions(+), 26 deletions(-)

New commits:
commit a1a4787a4014f70b00f73fab56996e285e5ed1d0
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jun 6 10:03:25 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 6 14:37:06 2019 +0200

    loplugin:data (macOS)
    
    Change-Id: I404a8364a4c7f8d48533fb3c7757a5b7798de9d8
    Reviewed-on: https://gerrit.libreoffice.org/73588
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c761938b3d50..3874b39270e5 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1103,11 +1103,11 @@ void restartOnMac(bool passArguments) {
         argPtrs.push_back(elem.getStr());
     }
     argPtrs.push_back(nullptr);
-    execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+    execv(execPath8.getStr(), const_cast< char ** >(argPtrs.data()));
     if (errno == ENOTSUP) { // happens when multithreaded on macOS < 10.6
         pid_t pid = fork();
         if (pid == 0) {
-            execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+            execv(execPath8.getStr(), const_cast< char ** >(argPtrs.data()));
         } else if (pid > 0) {
             // Two simultaneously running soffice processes lead to two dock
             // icons, so avoid waiting here unless it must be assumed that the
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 2a60c8d85f81..f72ec1f53f57 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1767,7 +1767,7 @@ void AquaSalFrame::EndSetClipRegion()
     if( ! maClippingRects.empty() )
     {
         mrClippingPath = CGPathCreateMutable();
-        CGPathAddRects( mrClippingPath, nullptr, &maClippingRects[0], maClippingRects.size() );
+        CGPathAddRects( mrClippingPath, nullptr, maClippingRects.data(), maClippingRects.size() );
     }
     if( mpNSView && mbShown )
         [mpNSView setNeedsDisplay: YES];
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index baf5fa96773e..3b2eb52f5eb5 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -1622,7 +1622,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 
         aInputEvent.maText = aInsertString;
         aInputEvent.mnCursorPos = selRange.location;
-        aInputEvent.mpTextAttr = &aInputFlags[0];
+        aInputEvent.mpTextAttr = aInputFlags.data();
         mpFrame->CallCallback( SalEvent::ExtTextInput, static_cast<void *>(&aInputEvent) );
     } else {
         aInputEvent.maText.clear();
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index e55d253a18fc..e52b145634ad 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -804,7 +804,7 @@ void AquaSalMenu::RemoveMenuBarButton( sal_uInt16 i_nId )
     {
         releaseButtonEntry( *pEntry );
         // note: vector guarantees that its contents are in a plain array
-        maButtons.erase( maButtons.begin() + (pEntry - &maButtons[0]) );
+        maButtons.erase( maButtons.begin() + (pEntry - maButtons.data()) );
     }
 
     if( pCurrentMenuBar == this )
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 846b7abbbc49..9637966f9c63 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -132,7 +132,7 @@ const FontCharMapRef CoreTextFontFace::GetFontCharMap() const
 
     // get the CMAP raw data
     std::vector<unsigned char> aBuffer( nBufSize );
-    const int nRawLength = GetFontTable( "cmap", &aBuffer[0] );
+    const int nRawLength = GetFontTable( "cmap", aBuffer.data() );
     SAL_WARN_IF( (nRawLength <= 0), "vcl", "CoreTextFontFace::GetFontCharMap : GetFontTable2 failed!");
     if( nRawLength <= 0 )
         return mxCharMap;
@@ -141,7 +141,7 @@ const FontCharMapRef CoreTextFontFace::GetFontCharMap() const
 
     // parse the CMAP
     CmapResult aCmapResult;
-    if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
+    if( ParseCMAP( aBuffer.data(), nRawLength, aCmapResult ) )
     {
         FontCharMapRef xDefFontCharMap( new FontCharMap(aCmapResult) );
         // create the matching charmap
@@ -167,10 +167,10 @@ bool CoreTextFontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilit
         // allocate a buffer for the OS/2 raw data
         std::vector<unsigned char> aBuffer( nBufSize );
         // get the OS/2 raw data
-        const int nRawLength = GetFontTable( "OS/2", &aBuffer[0] );
+        const int nRawLength = GetFontTable( "OS/2", aBuffer.data() );
         if( nRawLength > 0 )
         {
-            const unsigned char* pOS2Table = &aBuffer[0];
+            const unsigned char* pOS2Table = aBuffer.data();
             vcl::getTTCoverage( maFontCapabilities.oUnicodeRange,
                                 maFontCapabilities.oCodePageRange,
                                 pOS2Table, nRawLength);
@@ -575,7 +575,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
         if( *pJustCFF)
         {
             rBuffer.resize( nCffSize);
-            const int nCffRead = pMacFont->GetFontTable( "CFF ", &rBuffer[0]);
+            const int nCffRead = pMacFont->GetFontTable( "CFF ", rBuffer.data());
             if( nCffRead != nCffSize)
             {
                 return false;
@@ -668,14 +668,14 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
     if( nCmapSize != pMacFont->GetFontTable( "cmap", &rBuffer[nOfs]))
         return false;
 
-    FakeDirEntry( "cmap", nOfs, nCmapSize, &rBuffer[0], pFakeEntry );
+    FakeDirEntry( "cmap", nOfs, nCmapSize, rBuffer.data(), pFakeEntry );
     nOfs += nCmapSize;
     if( nCvtSize )
     {
         if( nCvtSize != pMacFont->GetFontTable( "cvt ", &rBuffer[nOfs]))
             return false;
 
-        FakeDirEntry( "cvt ", nOfs, nCvtSize, &rBuffer[0], pFakeEntry );
+        FakeDirEntry( "cvt ", nOfs, nCvtSize, rBuffer.data(), pFakeEntry );
         nOfs += nCvtSize;
     }
     if( nFpgmSize )
@@ -683,7 +683,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
         if( nFpgmSize != pMacFont->GetFontTable( "fpgm", &rBuffer[nOfs]))
             return false;
 
-        FakeDirEntry( "fpgm", nOfs, nFpgmSize, &rBuffer[0], pFakeEntry );
+        FakeDirEntry( "fpgm", nOfs, nFpgmSize, rBuffer.data(), pFakeEntry );
         nOfs += nFpgmSize;
     }
     if( nCffSize )
@@ -691,7 +691,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
         if( nCffSize != pMacFont->GetFontTable( "CFF ", &rBuffer[nOfs]))
             return false;
 
-        FakeDirEntry( "CFF ", nOfs, nCffSize, &rBuffer[0], pFakeEntry );
+        FakeDirEntry( "CFF ", nOfs, nCffSize, rBuffer.data(), pFakeEntry );
         nOfs += nGlyfSize;
     }
     else
@@ -699,47 +699,47 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
         if( nGlyfSize != pMacFont->GetFontTable( "glyf", &rBuffer[nOfs]))
             return false;
 
-        FakeDirEntry( "glyf", nOfs, nGlyfSize, &rBuffer[0], pFakeEntry );
+        FakeDirEntry( "glyf", nOfs, nGlyfSize, rBuffer.data(), pFakeEntry );
         nOfs += nGlyfSize;
 
         if( nLocaSize != pMacFont->GetFontTable( "loca", &rBuffer[nOfs]))
             return false;
 
-        FakeDirEntry( "loca", nOfs, nLocaSize, &rBuffer[0], pFakeEntry );
+        FakeDirEntry( "loca", nOfs, nLocaSize, rBuffer.data(), pFakeEntry );
         nOfs += nLocaSize;
     }
     if( nHeadSize != pMacFont->GetFontTable( "head", &rBuffer[nOfs]))
         return false;
 
-    FakeDirEntry( "head", nOfs, nHeadSize, &rBuffer[0], pFakeEntry );
+    FakeDirEntry( "head", nOfs, nHeadSize, rBuffer.data(), pFakeEntry );
     nOfs += nHeadSize;
 
     if( nHheaSize != pMacFont->GetFontTable( "hhea", &rBuffer[nOfs]))
         return false;
 
-    FakeDirEntry( "hhea", nOfs, nHheaSize, &rBuffer[0], pFakeEntry );
+    FakeDirEntry( "hhea", nOfs, nHheaSize, rBuffer.data(), pFakeEntry );
     nOfs += nHheaSize;
     if( nHmtxSize != pMacFont->GetFontTable( "hmtx", &rBuffer[nOfs]))
         return false;
 
-    FakeDirEntry( "hmtx", nOfs, nHmtxSize, &rBuffer[0], pFakeEntry );
+    FakeDirEntry( "hmtx", nOfs, nHmtxSize, rBuffer.data(), pFakeEntry );
     nOfs += nHmtxSize;
     if( nMaxpSize != pMacFont->GetFontTable( "maxp", &rBuffer[nOfs]))
         return false;
 
-    FakeDirEntry( "maxp", nOfs, nMaxpSize, &rBuffer[0], pFakeEntry );
+    FakeDirEntry( "maxp", nOfs, nMaxpSize, rBuffer.data(), pFakeEntry );
     nOfs += nMaxpSize;
     if( nNameSize != pMacFont->GetFontTable( "name", &rBuffer[nOfs]))
         return false;
 
-    FakeDirEntry( "name", nOfs, nNameSize, &rBuffer[0], pFakeEntry );
+    FakeDirEntry( "name", nOfs, nNameSize, rBuffer.data(), pFakeEntry );
     nOfs += nNameSize;
     if( nPrepSize )
     {
         if( nPrepSize != pMacFont->GetFontTable( "prep", &rBuffer[nOfs]))
             return false;
 
-        FakeDirEntry( "prep", nOfs, nPrepSize, &rBuffer[0], pFakeEntry );
+        FakeDirEntry( "prep", nOfs, nPrepSize, rBuffer.data(), pFakeEntry );
         nOfs += nPrepSize;
     }
 
@@ -764,7 +764,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
 
     // use the font subsetter to get the widths
     TrueTypeFont* pSftFont = nullptr;
-    SFErrCodes nRC = ::OpenTTFontBuffer( static_cast<void*>(&aBuffer[0]), aBuffer.size(), 0, &pSftFont);
+    SFErrCodes nRC = ::OpenTTFontBuffer( static_cast<void*>(aBuffer.data()), aBuffer.size(), 0, &pSftFont);
     if( nRC != SFErrCodes::Ok )
         return;
 
@@ -779,7 +779,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
             aGlyphIds[i] = static_cast<sal_uInt16>(i);
         }
 
-        std::unique_ptr<sal_uInt16[]> pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, &aGlyphIds[0],
+        std::unique_ptr<sal_uInt16[]> pGlyphMetrics = ::GetTTSimpleGlyphMetrics( pSftFont, aGlyphIds.data(),
                                                                                nGlyphCount, bVertical );
         if( pGlyphMetrics )
         {
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index af70708eb0f2..4e98d231f96e 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -175,7 +175,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
     {
         // provide the raw-CFF data to the subsetter
         ByteCount nCffLen = aBuffer.size();
-        rInfo.LoadFont( FontType::CFF_FONT, &aBuffer[0], nCffLen );
+        rInfo.LoadFont( FontType::CFF_FONT, aBuffer.data(), nCffLen );
 
         // NOTE: assuming that all glyphids requested on Aqua are fully translated
 
@@ -193,7 +193,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
 
     // prepare data for psprint's font subsetter
     TrueTypeFont* pSftFont = nullptr;
-    SFErrCodes nRC = ::OpenTTFontBuffer( static_cast<void*>(&aBuffer[0]), aBuffer.size(), 0, &pSftFont);
+    SFErrCodes nRC = ::OpenTTFontBuffer( static_cast<void*>(aBuffer.data()), aBuffer.size(), 0, &pSftFont);
     if( nRC != SFErrCodes::Ok )
     {
         return false;


More information about the Libreoffice-commits mailing list