[Libreoffice-commits] core.git: package/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 20 19:03:30 UTC 2021
package/source/zipapi/sha1context.cxx | 23 +++++++----------------
package/source/zipapi/sha1context.hxx | 6 ++++--
2 files changed, 11 insertions(+), 18 deletions(-)
New commits:
commit 9bae1f1ad6be4d942c73cfbdd7b3ba55eb3fb983
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 18 19:06:06 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 20 21:02:52 2021 +0200
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 at collabora.co.uk>
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();
More information about the Libreoffice-commits
mailing list