summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/gpg
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-06-28 09:12:35 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-06-28 11:11:34 +0200
commit9a884b3d055ffdedbadb64c7f14e6d38078dedb1 (patch)
treeeec3568b78d2cd964b12a657272e547560d3c55f /xmlsecurity/source/gpg
parent553204015f954d20db65e6adcda68b823a8ef235 (diff)
gpg4libre: Don't call production code inside an assert()
Won't work in non-debug builds Change-Id: I64f9c416890ddd02ec8efc0f59ded145cc17896a Reviewed-on: https://gerrit.libreoffice.org/39345 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity/source/gpg')
-rw-r--r--xmlsecurity/source/gpg/CertificateImpl.cxx7
-rw-r--r--xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx7
2 files changed, 10 insertions, 4 deletions
diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx
index 20fa35c52d5d..03fa49cdef68 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -217,14 +217,17 @@ void CertificateImpl::setCertificate(GpgME::Context* ctx, const GpgME::Key& key)
if (err)
throw RuntimeException("The GpgME library failed to retrieve the public key");
- assert(data_out.seek(0,SEEK_SET) == 0);
+ off_t result = data_out.seek(0,SEEK_SET);
+ (void) result;
+ assert(result == 0);
int len=0, curr=0; char buf;
while( (curr=data_out.read(&buf, 1)) )
len += curr;
// write bits to sequence of bytes
m_aBits.realloc(len);
- assert(data_out.seek(0,SEEK_SET) == 0);
+ result = data_out.seek(0,SEEK_SET);
+ assert(result == 0);
if( data_out.read(m_aBits.getArray(), len) != len )
throw RuntimeException("The GpgME library failed to read the key");
}
diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index 8de25b9a4f14..8cec0ceb6fe7 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -205,7 +205,9 @@ SAL_CALL XMLSignature_GpgImpl::generate(
rCtx.setArmor(false);
GpgME::SigningResult sign_res=rCtx.sign(data_in, data_out,
GpgME::Detached);
- assert(data_out.seek(0,SEEK_SET) == 0);
+ off_t result = data_out.seek(0,SEEK_SET);
+ (void) result;
+ assert(result == 0);
int len=0, curr=0; char buf;
while( (curr=data_out.read(&buf, 1)) )
len += curr;
@@ -217,7 +219,8 @@ SAL_CALL XMLSignature_GpgImpl::generate(
xmlChar* signature = static_cast<xmlChar*>(xmlMalloc(len + 1));
if(signature == nullptr)
throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");
- assert(data_out.seek(0,SEEK_SET) == 0);
+ result = data_out.seek(0,SEEK_SET);
+ assert(result == 0);
if( data_out.read(signature, len) != len )
throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");