summaryrefslogtreecommitdiff
path: root/basic/source/comp
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/comp')
-rw-r--r--basic/source/comp/buffer.cxx17
-rw-r--r--basic/source/comp/token.cxx3
2 files changed, 8 insertions, 12 deletions
diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx
index 7d95705b6354..9c1e216fd872 100644
--- a/basic/source/comp/buffer.cxx
+++ b/basic/source/comp/buffer.cxx
@@ -40,7 +40,6 @@ SbiBuffer::SbiBuffer( SbiParser* p, short n )
SbiBuffer::~SbiBuffer()
{
- delete[] pBuf;
}
// Reach out the buffer
@@ -48,8 +47,7 @@ SbiBuffer::~SbiBuffer()
char* SbiBuffer::GetBuffer()
{
- char* p = pBuf;
- pBuf = nullptr;
+ char* p = pBuf.release();
pCur = nullptr;
return p;
}
@@ -88,15 +86,14 @@ bool SbiBuffer::Check( sal_Int32 n )
{
pParser->Error( ERRCODE_BASIC_PROG_TOO_LARGE );
nInc = 0;
- delete[] pBuf; pBuf = nullptr;
+ pBuf.reset();
return false;
}
else
{
- if( nSize ) memcpy( p, pBuf, nSize );
- delete[] pBuf;
- pBuf = p;
- pCur = pBuf + nOff;
+ if( nSize ) memcpy( p, pBuf.get(), nSize );
+ pBuf.reset(p);
+ pCur = pBuf.get() + nOff;
nSize = nSize + nn;
}
}
@@ -111,7 +108,7 @@ void SbiBuffer::Patch( sal_uInt32 off, sal_uInt32 val )
{
sal_uInt16 val1 = static_cast<sal_uInt16>( val & 0xFFFF );
sal_uInt16 val2 = static_cast<sal_uInt16>( val >> 16 );
- sal_uInt8* p = reinterpret_cast<sal_uInt8*>(pBuf) + off;
+ sal_uInt8* p = reinterpret_cast<sal_uInt8*>(pBuf.get()) + off;
*p++ = (char) ( val1 & 0xFF );
*p++ = (char) ( val1 >> 8 );
*p++ = (char) ( val2 & 0xFF );
@@ -133,7 +130,7 @@ void SbiBuffer::Chain( sal_uInt32 off )
sal_uInt32 val2 = (nOff >> 16);
do
{
- ip = reinterpret_cast<sal_uInt8*>(pBuf) + i;
+ ip = reinterpret_cast<sal_uInt8*>(pBuf.get()) + i;
sal_uInt8* pTmp = ip;
i = *pTmp++; i |= *pTmp++ << 8; i |= *pTmp++ << 16; i |= *pTmp++ << 24;
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index f779fc1bef6e..40397d3ee149 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -185,7 +185,7 @@ static const TokenTable aTokTable_Basic [] = {
// #i109076
TokenLabelInfo::TokenLabelInfo()
{
- m_pTokenCanBeLabelTab = new bool[VBASUPPORT+1];
+ m_pTokenCanBeLabelTab.reset( new bool[VBASUPPORT+1] );
for( int i = 0 ; i <= VBASUPPORT ; ++i )
{
m_pTokenCanBeLabelTab[i] = false;
@@ -203,7 +203,6 @@ TokenLabelInfo::TokenLabelInfo()
TokenLabelInfo::~TokenLabelInfo()
{
- delete[] m_pTokenCanBeLabelTab;
}