vcl: replace alloca() with std::unique_ptr
Change-Id: I82b982895ee422bcf5a23756df4d81c89bc47636
This commit is contained in:
parent
9555d03c98
commit
28f18b68db
@ -53,8 +53,6 @@ using namespace psp;
|
||||
|
||||
#include "rtl/ustrbuf.hxx"
|
||||
|
||||
#include "sal/alloca.h"
|
||||
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
@ -1086,7 +1084,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi
|
||||
// update rMissingCodes by removing resolved unicodes
|
||||
if( !rMissingCodes.isEmpty() )
|
||||
{
|
||||
sal_uInt32* pRemainingCodes = static_cast<sal_uInt32*>(alloca( rMissingCodes.getLength() * sizeof(sal_uInt32) ));
|
||||
std::unique_ptr<sal_uInt32[]> const pRemainingCodes(new sal_uInt32[rMissingCodes.getLength()]);
|
||||
int nRemainingLen = 0;
|
||||
FcCharSet* unicodes;
|
||||
if (!FcPatternGetCharSet(pSet->fonts[0], FC_CHARSET, 0, &unicodes))
|
||||
@ -1099,7 +1097,7 @@ bool PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissi
|
||||
pRemainingCodes[ nRemainingLen++ ] = nCode;
|
||||
}
|
||||
}
|
||||
OUString sStillMissing(pRemainingCodes, nRemainingLen);
|
||||
OUString sStillMissing(pRemainingCodes.get(), nRemainingLen);
|
||||
#if defined(ENABLE_DBUS) && defined(ENABLE_PACKAGEKIT)
|
||||
if (get_xid_for_dbus())
|
||||
{
|
||||
|
@ -59,8 +59,6 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "sal/alloca.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
@ -472,7 +470,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
|
||||
|
||||
// first transform the character codes to unicode
|
||||
// note: this only works with single byte encodings
|
||||
sal_Unicode* pUnicodes = static_cast<sal_Unicode*>(alloca( pInfo->numOfChars * sizeof(sal_Unicode)));
|
||||
std::unique_ptr<sal_Unicode[]> const pUnicodes(new sal_Unicode[pInfo->numOfChars]);
|
||||
CharMetricInfo* pChar = pInfo->cmi;
|
||||
int i;
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <sal/types.h>
|
||||
#include <sal/alloca.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -244,7 +243,7 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( FontSelectPatt
|
||||
// there is a matching fallback in the cache
|
||||
// so update rMissingCodes with codepoints not yet resolved by this fallback
|
||||
int nRemainingLength = 0;
|
||||
sal_UCS4* pRemainingCodes = static_cast<sal_UCS4*>(alloca( rMissingCodes.getLength() * sizeof(sal_UCS4) ));
|
||||
std::unique_ptr<sal_UCS4[]> const pRemainingCodes(new sal_UCS4[rMissingCodes.getLength()]);
|
||||
OUString aFontName;
|
||||
|
||||
while( nStrIndex < rMissingCodes.getLength() )
|
||||
@ -254,7 +253,7 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( FontSelectPatt
|
||||
if( !bCached || (rFontSelData.maSearchName != aFontName) )
|
||||
pRemainingCodes[ nRemainingLength++ ] = cChar;
|
||||
}
|
||||
rMissingCodes = OUString( pRemainingCodes, nRemainingLength );
|
||||
rMissingCodes = OUString( pRemainingCodes.get(), nRemainingLength );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "vcl/printerinfomanager.hxx"
|
||||
#include "tools/stream.hxx"
|
||||
|
||||
#include <sal/alloca.h>
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include <memory>
|
||||
|
||||
@ -293,9 +292,9 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
|
||||
{
|
||||
rJobData.m_aContext.setParser( rJobData.m_pParser );
|
||||
int nBytes = bytes - aStream.Tell();
|
||||
char* pRemain = static_cast<char*>(alloca( bytes - aStream.Tell() ));
|
||||
aStream.Read( pRemain, nBytes );
|
||||
rJobData.m_aContext.rebuildFromStreamBuffer( pRemain, nBytes );
|
||||
std::unique_ptr<char[]> pRemain(new char[bytes - aStream.Tell()]);
|
||||
aStream.Read( pRemain.get(), nBytes );
|
||||
rJobData.m_aContext.rebuildFromStreamBuffer( pRemain.get(), nBytes );
|
||||
bContext = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user