summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-03-09 21:12:10 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-03-10 09:05:19 +0100
commit2d30c903afddbb416c50587dec1c787c1edfa39f (patch)
treedd6ae706a5b571aacb8b98239cd2411afddcb31f
parent9d8accf03984a64a4105826e55b221962628eb93 (diff)
xmlsecurity: rework to avoid pdfium ifdefs in pdfsignaturehelper
Return early in case pdfium is not available, to avoid the ifdef forest. Change-Id: I1fd1b22015e10527a989c8a1c4f4073fef29553e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112238 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--xmlsecurity/source/helper/pdfsignaturehelper.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index d336b696cb18..1ce8bf08cf41 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -33,11 +33,7 @@
#include <vcl/checksum.hxx>
#include <rtl/ustrbuf.hxx>
#include <svl/cryptosign.hxx>
-#include <config_features.h>
#include <vcl/filter/PDFiumLibrary.hxx>
-#if HAVE_FEATURE_PDFIUM
-#include <fpdf_signature.h>
-#endif
using namespace ::com::sun::star;
@@ -119,7 +115,6 @@ void GetSignatureLineShape(const uno::Reference<frame::XModel>& xModel, sal_Int3
aStream.ReadBytes(rSignatureLineShape.data(), rSignatureLineShape.size());
}
-#if HAVE_FEATURE_PDFIUM
/// Represents a parsed signature.
struct Signature
{
@@ -405,7 +400,6 @@ bool ValidateSignature(SvStream& rStream, const Signature& rSignature,
return svl::crypto::Signing::Verify(rStream, rSignature.m_aByteRanges, bNonDetached, aContents,
rInformation);
}
-#endif
}
PDFSignatureHelper::PDFSignatureHelper() = default;
@@ -425,8 +419,12 @@ bool PDFSignatureHelper::ReadAndVerifySignature(
bool PDFSignatureHelper::ReadAndVerifySignatureSvStream(SvStream& rStream)
{
-#if HAVE_FEATURE_PDFIUM
auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+ if (!pPdfium)
+ {
+ return true;
+ }
+
SvMemoryStream aStream;
sal_uInt64 nPos = rStream.Tell();
rStream.Seek(0);
@@ -482,9 +480,6 @@ bool PDFSignatureHelper::ReadAndVerifySignatureSvStream(SvStream& rStream)
m_aSignatureInfos.push_back(aInfo);
}
-#else
- (void)rStream;
-#endif
return true;
}