diff options
author | Tobias Markmann <tm@ayena.de> | 2016-11-23 07:09:39 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-11-23 11:30:02 (GMT) |
commit | e405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch) | |
tree | 9118ef838ebfaec1df90ec24761944b5d833774c /Swift/QtUI/WinUIHelpers.cpp | |
parent | 8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff) | |
download | swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2 |
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information:
Build on macOS 10.12.1 and all tests pass.
Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swift/QtUI/WinUIHelpers.cpp')
-rw-r--r-- | Swift/QtUI/WinUIHelpers.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/Swift/QtUI/WinUIHelpers.cpp b/Swift/QtUI/WinUIHelpers.cpp index 4898916..ec39c38 100644 --- a/Swift/QtUI/WinUIHelpers.cpp +++ b/Swift/QtUI/WinUIHelpers.cpp @@ -1,53 +1,51 @@ /* * Copyright (c) 2012 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* * Copyright (c) 2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/WinUIHelpers.h> #include <windows.h> #include <Wincrypt.h> #include <cryptuiapi.h> #pragma comment(lib, "cryptui.lib") #include <memory> -#include <Swiften/Base/foreach.h> - namespace Swift { void WinUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std::vector<Certificate::ref>& chain) { if (chain.empty()) { return; } // create certificate store to store the certificate chain in HCERTSTORE chainStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); if (!chainStore) { return; } ByteArray certAsDER = chain[0]->toDER(); std::shared_ptr<const CERT_CONTEXT> certificate_chain; { PCCERT_CONTEXT certChain; BOOL ok = CertAddCertificateContextToStore(chainStore, CertCreateCertificateContext(X509_ASN_ENCODING, vecptr(certAsDER), certAsDER.size()), CERT_STORE_ADD_ALWAYS, &certChain); // maybe free the cert contex we created if (!ok || !certChain) { return; } certificate_chain.reset(certChain, CertFreeCertificateContext); } for (size_t i = 1; i < chain.size(); ++i) { ByteArray certAsDER = chain[i]->toDER(); CertAddCertificateContextToStore(chainStore, CertCreateCertificateContext(X509_ASN_ENCODING, vecptr(certAsDER), certAsDER.size()), CERT_STORE_ADD_ALWAYS, NULL); } |