diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 12:36:16 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-01 15:56:34 (GMT) |
commit | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (patch) | |
tree | 8d396e5801d77a2f0ee4ab8e4c5093d8cf8118e6 /Swiften/TLS/SecureTransport/SecureTransportContext.mm | |
parent | a79db8d446e152b715f435550c2a6e10a36ee532 (diff) | |
download | swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.zip swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.tar.bz2 |
Modernize code to use C++11 nullptr using clang-tidy
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all
source code files on OS X. This does not modernize platform
specific code on Linux and Windows
Test-Information:
Code builds and unit tests pass on OS X 10.11.4.
Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
Diffstat (limited to 'Swiften/TLS/SecureTransport/SecureTransportContext.mm')
-rw-r--r-- | Swiften/TLS/SecureTransport/SecureTransportContext.mm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.mm b/Swiften/TLS/SecureTransport/SecureTransportContext.mm index 62889fd..1c5e3ab 100644 --- a/Swiften/TLS/SecureTransport/SecureTransportContext.mm +++ b/Swiften/TLS/SecureTransport/SecureTransportContext.mm @@ -41,7 +41,7 @@ namespace { CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) { boost::shared_ptr<PKCS12Certificate> pkcs12 = boost::dynamic_pointer_cast<PKCS12Certificate>(key); if (!key) { - return NULL; + return nullptr; } SafeByteArray safePassword = pkcs12->getPassword(); @@ -49,19 +49,19 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) try { passwordSize = boost::numeric_cast<CFIndex>(safePassword.size()); } catch (...) { - return NULL; + return nullptr; } - CFMutableArrayRef certChain = CFArrayCreateMutable(NULL, 0, 0); + CFMutableArrayRef certChain = CFArrayCreateMutable(nullptr, 0, nullptr); OSStatus securityError = errSecSuccess; CFStringRef password = CFStringCreateWithBytes(kCFAllocatorDefault, safePassword.data(), passwordSize, kCFStringEncodingUTF8, false); const void* keys[] = { kSecImportExportPassphrase }; const void* values[] = { password }; - CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL); + CFDictionaryRef options = CFDictionaryCreate(nullptr, keys, values, 1, nullptr, nullptr); - CFArrayRef items = NULL; + CFArrayRef items = nullptr; CFDataRef pkcs12Data = bridge_cast<CFDataRef>([NSData dataWithBytes: static_cast<const void *>(pkcs12->getData().data()) length:pkcs12->getData().size()]); securityError = SecPKCS12Import(pkcs12Data, options, &items); CFRelease(options); @@ -85,10 +85,10 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) if (securityError != errSecSuccess) { if (items) { CFRelease(items); - items = NULL; + items = nullptr; } CFRelease(certChain); - certChain = NULL; + certChain = nullptr; } if (certChain) { @@ -104,7 +104,7 @@ CFArrayRef CreateClientCertificateChainAsCFArrayRef(CertificateWithKey::ref key) } SecureTransportContext::SecureTransportContext(bool checkCertificateRevocation) : state_(None), checkCertificateRevocation_(checkCertificateRevocation) { - sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType), CFRelease); + sslContext_ = boost::shared_ptr<SSLContext>(SSLCreateContext(nullptr, kSSLClientSide, kSSLStreamType), CFRelease); OSStatus error = noErr; // set IO callbacks @@ -200,7 +200,7 @@ void SecureTransportContext::processHandshake() { #pragma clang diagnostic ignored "-Wdeprecated-declarations" void SecureTransportContext::verifyServerCertificate() { - SecTrustRef trust = NULL; + SecTrustRef trust = nullptr; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &trust); if (error != noErr) { fatalError(boost::make_shared<TLSError>(), boost::make_shared<CertificateVerificationError>()); @@ -364,7 +364,7 @@ std::vector<Certificate::ref> SecureTransportContext::getPeerCertificateChain() typedef boost::remove_pointer<SecTrustRef>::type SecTrust; boost::shared_ptr<SecTrust> securityTrust; - SecTrustRef secTrust = NULL;; + SecTrustRef secTrust = nullptr;; OSStatus error = SSLCopyPeerTrust(sslContext_.get(), &secTrust); if (error == noErr) { securityTrust = boost::shared_ptr<SecTrust>(secTrust, CFRelease); |