summaryrefslogtreecommitdiff
path: root/package/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-07-18 19:06:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-20 21:02:52 +0200
commit9bae1f1ad6be4d942c73cfbdd7b3ba55eb3fb983 (patch)
tree6a03cf84eee38c5f4d6a74af1c6e998facc4e906 /package/source
parent42f5b019dd508be71545c54e00b860f3a2b6c7fb (diff)
no need to use a pImpl in CorrectSHA1DigestContext
Change-Id: If7404f63833373c5ac2954c4aac129c52582989c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119280 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package/source')
-rw-r--r--package/source/zipapi/sha1context.cxx23
-rw-r--r--package/source/zipapi/sha1context.hxx6
2 files changed, 11 insertions, 18 deletions
diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx
index c036041a2d76..ab6327234f10 100644
--- a/package/source/zipapi/sha1context.cxx
+++ b/package/source/zipapi/sha1context.cxx
@@ -19,7 +19,6 @@
#include <sal/config.h>
-#include <comphelper/hash.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <rtl/digest.h>
#include <rtl/ref.hxx>
@@ -89,15 +88,7 @@ uno::Reference<xml::crypto::XDigestContext> CorrectSHA1DigestContext::Create()
return new CorrectSHA1DigestContext();
}
-struct CorrectSHA1DigestContext::Impl
-{
- ::osl::Mutex m_Mutex;
- ::comphelper::Hash m_Hash{::comphelper::HashType::SHA1};
- bool m_bDisposed{false};
-};
-
CorrectSHA1DigestContext::CorrectSHA1DigestContext()
- : m_pImpl(new Impl)
{
}
@@ -107,21 +98,21 @@ CorrectSHA1DigestContext::~CorrectSHA1DigestContext()
void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& rData)
{
- ::osl::MutexGuard aGuard(m_pImpl->m_Mutex);
- if (m_pImpl->m_bDisposed)
+ ::osl::MutexGuard aGuard(m_Mutex);
+ if (m_bDisposed)
throw lang::DisposedException();
- m_pImpl->m_Hash.update(reinterpret_cast<unsigned char const*>(rData.getConstArray()), rData.getLength());
+ m_Hash.update(reinterpret_cast<unsigned char const*>(rData.getConstArray()), rData.getLength());
}
uno::Sequence<::sal_Int8> SAL_CALL CorrectSHA1DigestContext::finalizeDigestAndDispose()
{
- ::osl::MutexGuard aGuard(m_pImpl->m_Mutex);
- if (m_pImpl->m_bDisposed)
+ ::osl::MutexGuard aGuard(m_Mutex);
+ if (m_bDisposed)
throw lang::DisposedException();
- m_pImpl->m_bDisposed = true;
- std::vector<unsigned char> const sha1(m_pImpl->m_Hash.finalize());
+ m_bDisposed = true;
+ std::vector<unsigned char> const sha1(m_Hash.finalize());
return uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const*>(sha1.data()), sha1.size());
}
diff --git a/package/source/zipapi/sha1context.hxx b/package/source/zipapi/sha1context.hxx
index 436dfcccbf7c..55e61ee561cb 100644
--- a/package/source/zipapi/sha1context.hxx
+++ b/package/source/zipapi/sha1context.hxx
@@ -21,6 +21,7 @@
#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+#include <comphelper/hash.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/mutex.hxx>
@@ -48,8 +49,9 @@ public:
class CorrectSHA1DigestContext
: public cppu::WeakImplHelper<css::xml::crypto::XDigestContext>
{
- struct Impl;
- std::unique_ptr<Impl> m_pImpl;
+ ::osl::Mutex m_Mutex;
+ ::comphelper::Hash m_Hash{::comphelper::HashType::SHA1};
+ bool m_bDisposed{false};
CorrectSHA1DigestContext();