From 090616c5fb01a649076e535ad8ef43bd027f4fa2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 Aug 2018 09:18:16 +0100 Subject: flatten conditionals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3b3e45a20c41e538849b7b0b4cdf112d8fac8fe7 Reviewed-on: https://gerrit.libreoffice.org/58388 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- xmlsecurity/source/helper/xmlsignaturehelper.cxx | 29 ++++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'xmlsecurity') diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 43efcb618b1c..1118bff743c7 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -370,21 +370,20 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::ReferenceopenStreamElement(it->Second, nOpenMode), uno::UNO_QUERY); - uno::Reference xPropertySet(xInputStream, uno::UNO_QUERY); - if (xPropertySet.is()) - { - sal_Int64 nSize = 0; - xPropertySet->getPropertyValue("Size") >>= nSize; - uno::Sequence aData; - xInputStream->readBytes(aData, nSize); - mpXSecController->setSignatureBytes(aData); - } - } + if (!bCache) + continue; + // Store the contents of the stream as is, in case we need to write it back later. + xInputStream.clear(); + xInputStream.set(xStorage->openStreamElement(it->Second, nOpenMode), uno::UNO_QUERY); + uno::Reference xPropertySet(xInputStream, uno::UNO_QUERY); + if (!xPropertySet.is()) + continue; + + sal_Int64 nSize = 0; + xPropertySet->getPropertyValue("Size") >>= nSize; + uno::Sequence aData; + xInputStream->readBytes(aData, nSize); + mpXSecController->setSignatureBytes(aData); } } } -- cgit