summaryrefslogtreecommitdiff
path: root/registry/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-11 13:50:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-12 08:24:45 +0200
commit1c3ffcdd4e702264728d222046c401b90cb1c8c9 (patch)
treeda40599532933bcc4f6363d56423150b07b2bc44 /registry/source
parent48ca5005ecea5286564c682f6d75716f3c4d8451 (diff)
loplugin:constantparam
Change-Id: Ia769b3176aea287cd57414d7ce8e88c6da43883e Reviewed-on: https://gerrit.libreoffice.org/55622 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'registry/source')
-rw-r--r--registry/source/reflread.cxx38
1 files changed, 8 insertions, 30 deletions
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
index fc5a7325a704..c459bab9a8fb 100644
--- a/registry/source/reflread.cxx
+++ b/registry/source/reflread.cxx
@@ -60,13 +60,10 @@ public:
const sal_uInt8* m_pBuffer;
sal_uInt32 m_bufferLen;
- bool m_isCopied;
- BlopObject(const sal_uInt8* buffer, sal_uInt32 len, bool copyBuffer);
+ BlopObject(const sal_uInt8* buffer, sal_uInt32 len);
// throws std::bad_alloc
- ~BlopObject();
-
sal_uInt8 readBYTE(sal_uInt32 index) const
{
if (index >= m_bufferLen) {
@@ -152,29 +149,10 @@ public:
}
};
-BlopObject::BlopObject(const sal_uInt8* buffer, sal_uInt32 len, bool copyBuffer)
+BlopObject::BlopObject(const sal_uInt8* buffer, sal_uInt32 len)
: m_bufferLen(len)
- , m_isCopied(copyBuffer)
{
- if (m_isCopied)
- {
- m_pBuffer = nullptr;
- sal_uInt8* newBuffer = new sal_uInt8[len];
- memcpy(newBuffer, buffer, len);
- m_pBuffer = newBuffer;
- }
- else
- {
- m_pBuffer = buffer;
- }
-}
-
-BlopObject::~BlopObject()
-{
- if (m_isCopied)
- {
- delete[] m_pBuffer;
- }
+ m_pBuffer = buffer;
}
/**************************************************************************
@@ -241,7 +219,7 @@ public:
std::unique_ptr<StringCache> m_pStringCache;
ConstantPool(const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries)
- : BlopObject(buffer, len, false)
+ : BlopObject(buffer, len)
, m_numOfEntries(numEntries)
{
}
@@ -556,7 +534,7 @@ public:
ConstantPool* m_pCP;
FieldList(const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
- : BlopObject(buffer, len, false)
+ : BlopObject(buffer, len)
, m_numOfEntries(numEntries)
, m_pCP(pCP)
{
@@ -740,7 +718,7 @@ public:
ConstantPool* m_pCP;
ReferenceList(const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
- : BlopObject(buffer, len, false)
+ : BlopObject(buffer, len)
, m_numOfEntries(numEntries)
, m_pCP(pCP)
{
@@ -841,7 +819,7 @@ public:
ConstantPool* m_pCP;
MethodList(const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
- : BlopObject(buffer, len, false)
+ : BlopObject(buffer, len)
, m_numOfEntries(numEntries)
, m_pCP(pCP)
{
@@ -1111,7 +1089,7 @@ public:
TypeRegistryEntry::TypeRegistryEntry(
const sal_uInt8* buffer, sal_uInt32 len):
- BlopObject(buffer, len, /*copyBuffer*/false), m_refCount(1), m_nSuperTypes(0),
+ BlopObject(buffer, len), m_refCount(1), m_nSuperTypes(0),
m_offset_SUPERTYPES(0)
{
std::size_t const entrySize = sizeof(sal_uInt16);