loplugin:data (macOS)

Change-Id: I404a8364a4c7f8d48533fb3c7757a5b7798de9d8
Reviewed-on: https://gerrit.libreoffice.org/73588
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2019-06-06 10:03:25 +02:00
parent a2f4bdb191
commit a1a4787a40
6 changed files with 26 additions and 26 deletions

View File

@ -1103,11 +1103,11 @@ void restartOnMac(bool passArguments) {
argPtrs.push_back(elem.getStr()); argPtrs.push_back(elem.getStr());
} }
argPtrs.push_back(nullptr); 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 if (errno == ENOTSUP) { // happens when multithreaded on macOS < 10.6
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { if (pid == 0) {
execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0])); execv(execPath8.getStr(), const_cast< char ** >(argPtrs.data()));
} else if (pid > 0) { } else if (pid > 0) {
// Two simultaneously running soffice processes lead to two dock // Two simultaneously running soffice processes lead to two dock
// icons, so avoid waiting here unless it must be assumed that the // icons, so avoid waiting here unless it must be assumed that the

View File

@ -1767,7 +1767,7 @@ void AquaSalFrame::EndSetClipRegion()
if( ! maClippingRects.empty() ) if( ! maClippingRects.empty() )
{ {
mrClippingPath = CGPathCreateMutable(); mrClippingPath = CGPathCreateMutable();
CGPathAddRects( mrClippingPath, nullptr, &maClippingRects[0], maClippingRects.size() ); CGPathAddRects( mrClippingPath, nullptr, maClippingRects.data(), maClippingRects.size() );
} }
if( mpNSView && mbShown ) if( mpNSView && mbShown )
[mpNSView setNeedsDisplay: YES]; [mpNSView setNeedsDisplay: YES];

View File

@ -1622,7 +1622,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
aInputEvent.maText = aInsertString; aInputEvent.maText = aInsertString;
aInputEvent.mnCursorPos = selRange.location; aInputEvent.mnCursorPos = selRange.location;
aInputEvent.mpTextAttr = &aInputFlags[0]; aInputEvent.mpTextAttr = aInputFlags.data();
mpFrame->CallCallback( SalEvent::ExtTextInput, static_cast<void *>(&aInputEvent) ); mpFrame->CallCallback( SalEvent::ExtTextInput, static_cast<void *>(&aInputEvent) );
} else { } else {
aInputEvent.maText.clear(); aInputEvent.maText.clear();

View File

@ -804,7 +804,7 @@ void AquaSalMenu::RemoveMenuBarButton( sal_uInt16 i_nId )
{ {
releaseButtonEntry( *pEntry ); releaseButtonEntry( *pEntry );
// note: vector guarantees that its contents are in a plain array // 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 ) if( pCurrentMenuBar == this )

View File

@ -132,7 +132,7 @@ const FontCharMapRef CoreTextFontFace::GetFontCharMap() const
// get the CMAP raw data // get the CMAP raw data
std::vector<unsigned char> aBuffer( nBufSize ); 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!"); SAL_WARN_IF( (nRawLength <= 0), "vcl", "CoreTextFontFace::GetFontCharMap : GetFontTable2 failed!");
if( nRawLength <= 0 ) if( nRawLength <= 0 )
return mxCharMap; return mxCharMap;
@ -141,7 +141,7 @@ const FontCharMapRef CoreTextFontFace::GetFontCharMap() const
// parse the CMAP // parse the CMAP
CmapResult aCmapResult; CmapResult aCmapResult;
if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) ) if( ParseCMAP( aBuffer.data(), nRawLength, aCmapResult ) )
{ {
FontCharMapRef xDefFontCharMap( new FontCharMap(aCmapResult) ); FontCharMapRef xDefFontCharMap( new FontCharMap(aCmapResult) );
// create the matching charmap // create the matching charmap
@ -167,10 +167,10 @@ bool CoreTextFontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilit
// allocate a buffer for the OS/2 raw data // allocate a buffer for the OS/2 raw data
std::vector<unsigned char> aBuffer( nBufSize ); std::vector<unsigned char> aBuffer( nBufSize );
// get the OS/2 raw data // 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 ) if( nRawLength > 0 )
{ {
const unsigned char* pOS2Table = &aBuffer[0]; const unsigned char* pOS2Table = aBuffer.data();
vcl::getTTCoverage( maFontCapabilities.oUnicodeRange, vcl::getTTCoverage( maFontCapabilities.oUnicodeRange,
maFontCapabilities.oCodePageRange, maFontCapabilities.oCodePageRange,
pOS2Table, nRawLength); pOS2Table, nRawLength);
@ -575,7 +575,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
if( *pJustCFF) if( *pJustCFF)
{ {
rBuffer.resize( nCffSize); rBuffer.resize( nCffSize);
const int nCffRead = pMacFont->GetFontTable( "CFF ", &rBuffer[0]); const int nCffRead = pMacFont->GetFontTable( "CFF ", rBuffer.data());
if( nCffRead != nCffSize) if( nCffRead != nCffSize)
{ {
return false; return false;
@ -668,14 +668,14 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
if( nCmapSize != pMacFont->GetFontTable( "cmap", &rBuffer[nOfs])) if( nCmapSize != pMacFont->GetFontTable( "cmap", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "cmap", nOfs, nCmapSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "cmap", nOfs, nCmapSize, rBuffer.data(), pFakeEntry );
nOfs += nCmapSize; nOfs += nCmapSize;
if( nCvtSize ) if( nCvtSize )
{ {
if( nCvtSize != pMacFont->GetFontTable( "cvt ", &rBuffer[nOfs])) if( nCvtSize != pMacFont->GetFontTable( "cvt ", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "cvt ", nOfs, nCvtSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "cvt ", nOfs, nCvtSize, rBuffer.data(), pFakeEntry );
nOfs += nCvtSize; nOfs += nCvtSize;
} }
if( nFpgmSize ) if( nFpgmSize )
@ -683,7 +683,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
if( nFpgmSize != pMacFont->GetFontTable( "fpgm", &rBuffer[nOfs])) if( nFpgmSize != pMacFont->GetFontTable( "fpgm", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "fpgm", nOfs, nFpgmSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "fpgm", nOfs, nFpgmSize, rBuffer.data(), pFakeEntry );
nOfs += nFpgmSize; nOfs += nFpgmSize;
} }
if( nCffSize ) if( nCffSize )
@ -691,7 +691,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
if( nCffSize != pMacFont->GetFontTable( "CFF ", &rBuffer[nOfs])) if( nCffSize != pMacFont->GetFontTable( "CFF ", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "CFF ", nOfs, nCffSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "CFF ", nOfs, nCffSize, rBuffer.data(), pFakeEntry );
nOfs += nGlyfSize; nOfs += nGlyfSize;
} }
else else
@ -699,47 +699,47 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
if( nGlyfSize != pMacFont->GetFontTable( "glyf", &rBuffer[nOfs])) if( nGlyfSize != pMacFont->GetFontTable( "glyf", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "glyf", nOfs, nGlyfSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "glyf", nOfs, nGlyfSize, rBuffer.data(), pFakeEntry );
nOfs += nGlyfSize; nOfs += nGlyfSize;
if( nLocaSize != pMacFont->GetFontTable( "loca", &rBuffer[nOfs])) if( nLocaSize != pMacFont->GetFontTable( "loca", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "loca", nOfs, nLocaSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "loca", nOfs, nLocaSize, rBuffer.data(), pFakeEntry );
nOfs += nLocaSize; nOfs += nLocaSize;
} }
if( nHeadSize != pMacFont->GetFontTable( "head", &rBuffer[nOfs])) if( nHeadSize != pMacFont->GetFontTable( "head", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "head", nOfs, nHeadSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "head", nOfs, nHeadSize, rBuffer.data(), pFakeEntry );
nOfs += nHeadSize; nOfs += nHeadSize;
if( nHheaSize != pMacFont->GetFontTable( "hhea", &rBuffer[nOfs])) if( nHheaSize != pMacFont->GetFontTable( "hhea", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "hhea", nOfs, nHheaSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "hhea", nOfs, nHheaSize, rBuffer.data(), pFakeEntry );
nOfs += nHheaSize; nOfs += nHheaSize;
if( nHmtxSize != pMacFont->GetFontTable( "hmtx", &rBuffer[nOfs])) if( nHmtxSize != pMacFont->GetFontTable( "hmtx", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "hmtx", nOfs, nHmtxSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "hmtx", nOfs, nHmtxSize, rBuffer.data(), pFakeEntry );
nOfs += nHmtxSize; nOfs += nHmtxSize;
if( nMaxpSize != pMacFont->GetFontTable( "maxp", &rBuffer[nOfs])) if( nMaxpSize != pMacFont->GetFontTable( "maxp", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "maxp", nOfs, nMaxpSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "maxp", nOfs, nMaxpSize, rBuffer.data(), pFakeEntry );
nOfs += nMaxpSize; nOfs += nMaxpSize;
if( nNameSize != pMacFont->GetFontTable( "name", &rBuffer[nOfs])) if( nNameSize != pMacFont->GetFontTable( "name", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "name", nOfs, nNameSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "name", nOfs, nNameSize, rBuffer.data(), pFakeEntry );
nOfs += nNameSize; nOfs += nNameSize;
if( nPrepSize ) if( nPrepSize )
{ {
if( nPrepSize != pMacFont->GetFontTable( "prep", &rBuffer[nOfs])) if( nPrepSize != pMacFont->GetFontTable( "prep", &rBuffer[nOfs]))
return false; return false;
FakeDirEntry( "prep", nOfs, nPrepSize, &rBuffer[0], pFakeEntry ); FakeDirEntry( "prep", nOfs, nPrepSize, rBuffer.data(), pFakeEntry );
nOfs += nPrepSize; nOfs += nPrepSize;
} }
@ -764,7 +764,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
// use the font subsetter to get the widths // use the font subsetter to get the widths
TrueTypeFont* pSftFont = nullptr; 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 ) if( nRC != SFErrCodes::Ok )
return; return;
@ -779,7 +779,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
aGlyphIds[i] = static_cast<sal_uInt16>(i); 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 ); nGlyphCount, bVertical );
if( pGlyphMetrics ) if( pGlyphMetrics )
{ {

View File

@ -175,7 +175,7 @@ bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
{ {
// provide the raw-CFF data to the subsetter // provide the raw-CFF data to the subsetter
ByteCount nCffLen = aBuffer.size(); 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 // 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 // prepare data for psprint's font subsetter
TrueTypeFont* pSftFont = nullptr; 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 ) if( nRC != SFErrCodes::Ok )
{ {
return false; return false;