Kaydet (Commit) a1a4787a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:data (macOS)

Change-Id: I404a8364a4c7f8d48533fb3c7757a5b7798de9d8
Reviewed-on: https://gerrit.libreoffice.org/73588
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst a2f4bdb1
......@@ -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
......
......@@ -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];
......
......@@ -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();
......
......@@ -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 )
......
......@@ -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 )
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment