summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-05-03 14:26:26 +0200
committerJose <jose@zeroc.com>2019-05-03 14:26:26 +0200
commit2b53106e6f81bd9129067def75a55538f44347a5 (patch)
treebc4c58e3a8077e44ce8b17c83869f16e12f36a6b
parentFilter UDP and Properties test with iOS (diff)
downloadice-2b53106e6f81bd9129067def75a55538f44347a5.tar.bz2
ice-2b53106e6f81bd9129067def75a55538f44347a5.tar.xz
ice-2b53106e6f81bd9129067def75a55538f44347a5.zip
Fix C++ warnings
-rw-r--r--cpp/src/Ice/SHA1.cpp4
-rw-r--r--cpp/src/Ice/Selector.cpp12
-rw-r--r--cpp/src/IceSSL/SecureTransportCertificateI.cpp16
-rw-r--r--cpp/src/IceSSL/SecureTransportTransceiverI.cpp2
-rw-r--r--cpp/src/IceSSL/SecureTransportUtil.cpp20
-rw-r--r--cpp/src/IceUtil/Time.cpp4
6 files changed, 33 insertions, 25 deletions
diff --git a/cpp/src/Ice/SHA1.cpp b/cpp/src/Ice/SHA1.cpp
index e94c2ce2612..a1d79afa250 100644
--- a/cpp/src/Ice/SHA1.cpp
+++ b/cpp/src/Ice/SHA1.cpp
@@ -108,7 +108,7 @@ IceInternal::SHA1::Hasher::update(const unsigned char* data, size_t length)
throw IceUtil::SyscallException(__FILE__, __LINE__, GetLastError());
}
# elif defined(__APPLE__)
- CC_SHA1_Update(&_ctx, reinterpret_cast<const void*>(data), length);
+ CC_SHA1_Update(&_ctx, reinterpret_cast<const void*>(data), static_cast<CC_LONG>(length));
# else
SHA1_Update(&_ctx, reinterpret_cast<const void*>(data), length);
# endif
@@ -175,7 +175,7 @@ IceInternal::sha1(const unsigned char* data, size_t length, vector<unsigned char
hasher.finalize(md);
#elif defined(__APPLE__)
md.resize(CC_SHA1_DIGEST_LENGTH);
- CC_SHA1(&data[0], length, &md[0]);
+ CC_SHA1(&data[0], static_cast<CC_LONG>(length), &md[0]);
#else
md.resize(SHA_DIGEST_LENGTH);
::SHA1(&data[0], length, &md[0]);
diff --git a/cpp/src/Ice/Selector.cpp b/cpp/src/Ice/Selector.cpp
index 58f38e92506..e76b8ad93f5 100644
--- a/cpp/src/Ice/Selector.cpp
+++ b/cpp/src/Ice/Selector.cpp
@@ -616,7 +616,7 @@ Selector::finishSelect(vector<pair<EventHandler*, SocketOperation> >& handlers)
if(ev.flags & EV_ERROR)
{
Ice::Error out(_instance->initializationData().logger);
- out << "selector returned error:\n" << IceUtilInternal::errorToString(ev.data);
+ out << "selector returned error:\n" << IceUtilInternal::errorToString(static_cast<int>(ev.data));
continue;
}
p.first = reinterpret_cast<EventHandler*>(ev.udata);
@@ -729,11 +729,11 @@ Selector::select(int timeout)
struct timespec ts;
ts.tv_sec = timeout;
ts.tv_nsec = 0;
- _count = kevent(_queueFd, 0, 0, &_events[0], _events.size(), &ts);
+ _count = kevent(_queueFd, 0, 0, &_events[0], static_cast<int>(_events.size()), &ts);
}
else
{
- _count = kevent(_queueFd, 0, 0, &_events[0], _events.size(), 0);
+ _count = kevent(_queueFd, 0, 0, &_events[0], static_cast<int>(_events.size()), 0);
}
#elif defined(ICE_USE_SELECT)
fd_set* rFdSet = fdSetCopy(_selectedReadFdSet, _readFdSet);
@@ -807,7 +807,8 @@ void
Selector::updateSelector()
{
#if defined(ICE_USE_KQUEUE)
- int rs = kevent(_queueFd, &_changes[0], _changes.size(), &_changes[0], _changes.size(), &zeroTimeout);
+ int rs = kevent(_queueFd, &_changes[0], static_cast<int>(_changes.size()),
+ &_changes[0], static_cast<int>(_changes.size()), &zeroTimeout);
if(rs < 0)
{
Ice::Error out(_instance->initializationData().logger);
@@ -824,7 +825,8 @@ Selector::updateSelector()
if(_changes[i].flags & EV_ERROR && _changes[i].data != EINPROGRESS)
{
Ice::Error out(_instance->initializationData().logger);
- out << "error while updating selector:\n" << IceUtilInternal::errorToString(_changes[i].data);
+ out << "error while updating selector:\n"
+ << IceUtilInternal::errorToString(static_cast<int>(_changes[i].data));
}
}
}
diff --git a/cpp/src/IceSSL/SecureTransportCertificateI.cpp b/cpp/src/IceSSL/SecureTransportCertificateI.cpp
index 26b8a62a269..fced1cc0fed 100644
--- a/cpp/src/IceSSL/SecureTransportCertificateI.cpp
+++ b/cpp/src/IceSSL/SecureTransportCertificateI.cpp
@@ -2,6 +2,12 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//
+//
+// Disable deprecation warnings for SecCertificateCopyNormalizedIssuerContent and
+// SecCertificateCopyNormalizedSubjectContent
+//
+#include <IceUtil/DisableWarnings.h>
+
#include <IceSSL/Plugin.h>
#include <IceSSL/SecureTransport.h>
#include <IceSSL/CertificateI.h>
@@ -293,8 +299,8 @@ getX509Name(SecCertificateRef cert, CFTypeRef key)
if(property)
{
CFArrayRef dn = static_cast<CFArrayRef>(CFDictionaryGetValue(property.get(), kSecPropertyKeyValue));
- int size = CFArrayGetCount(dn);
- for(int i = 0; i < size; ++i)
+ CFIndex size = CFArrayGetCount(dn);
+ for(CFIndex i = 0; i < size; ++i)
{
CFDictionaryRef dict = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(dn, i));
rdnPairs.push_front(make_pair(
@@ -317,9 +323,9 @@ getX509AltName(SecCertificateRef cert, CFTypeRef key)
if(property)
{
CFArrayRef names = static_cast<CFArrayRef>(CFDictionaryGetValue(property.get(), kSecPropertyKeyValue));
- int size = CFArrayGetCount(names);
+ CFIndex size = CFArrayGetCount(names);
- for(int i = 0; i < size; ++i)
+ for(CFIndex i = 0; i < size; ++i)
{
CFDictionaryRef dict = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(names, i));
@@ -341,7 +347,7 @@ getX509AltName(SecCertificateRef cert, CFTypeRef key)
{
CFArrayRef section = (CFArrayRef)v;
ostringstream os;
- for(int j = 0, count = CFArrayGetCount(section); j < count;)
+ for(CFIndex j = 0, count = CFArrayGetCount(section); j < count;)
{
CFDictionaryRef d = (CFDictionaryRef)CFArrayGetValueAtIndex(section, j);
diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
index 7d33252b749..7c5cda6f256 100644
--- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
+++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
@@ -289,7 +289,7 @@ IceSSL::SecureTransport::TransceiverI::initialize(IceInternal::Buffer& readBuffe
throw ProtocolException(__FILE__, __LINE__, os.str());
}
- for(int i = 0, count = SecTrustGetCertificateCount(_trust.get()); i < count; ++i)
+ for(CFIndex i = 0, count = SecTrustGetCertificateCount(_trust.get()); i < count; ++i)
{
SecCertificateRef cert = SecTrustGetCertificateAtIndex(_trust.get(), i);
CFRetain(cert);
diff --git a/cpp/src/IceSSL/SecureTransportUtil.cpp b/cpp/src/IceSSL/SecureTransportUtil.cpp
index a3ae427d516..5d20a56ee05 100644
--- a/cpp/src/IceSSL/SecureTransportUtil.cpp
+++ b/cpp/src/IceSSL/SecureTransportUtil.cpp
@@ -112,7 +112,7 @@ isCA(SecCertificateRef cert)
if(property)
{
CFArrayRef propertyValues = static_cast<CFArrayRef>(CFDictionaryGetValue(property.get(), kSecPropertyKeyValue));
- for(int i = 0, size = CFArrayGetCount(propertyValues); i < size; ++i)
+ for(CFIndex i = 0, size = CFArrayGetCount(propertyValues); i < size; ++i)
{
CFDictionaryRef dict = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(propertyValues, i));
CFStringRef label = static_cast<CFStringRef>(CFDictionaryGetValue(dict, kSecPropertyKeyLabel));
@@ -243,7 +243,7 @@ openKeychain(const std::string& path, const std::string& keychainPassword)
if(err == noErr)
{
const char* pass = keychainPassword.empty() ? 0 : keychainPassword.c_str();
- if((err = SecKeychainUnlock(keychain.get(), keychainPassword.size(), pass, pass != 0)))
+ if((err = SecKeychainUnlock(keychain.get(), static_cast<int>(keychainPassword.size()), pass, pass != 0)))
{
throw PluginInitializationException(__FILE__, __LINE__,
"IceSSL: unable to unlock keychain:\n" + sslErrorToString(err));
@@ -253,7 +253,7 @@ openKeychain(const std::string& path, const std::string& keychainPassword)
{
const char* pass = keychainPassword.empty() ? 0 : keychainPassword.c_str();
keychain.reset(0);
- if((err = SecKeychainCreate(keychainPath.c_str(), keychainPassword.size(), pass, pass == 0, 0, &keychain.get())))
+ if((err = SecKeychainCreate(keychainPath.c_str(), static_cast<int>(keychainPassword.size()), pass, pass == 0, 0, &keychain.get())))
{
throw PluginInitializationException(__FILE__, __LINE__,
"IceSSL: unable to create keychain:\n" + sslErrorToString(err));
@@ -354,9 +354,9 @@ loadPrivateKey(const string& file, SecCertificateRef cert, SecKeychainRef keycha
// private key into the keychain and add the certificate.
//
UniqueRef<CFArrayRef> items(loadKeychainItems(file, kSecItemTypePrivateKey, keychain, password, prompt, retryMax));
- int count = CFArrayGetCount(items.get());
+ CFIndex count = CFArrayGetCount(items.get());
UniqueRef<SecKeyRef> key;
- for(int i = 0; i < count; ++i)
+ for(CFIndex i = 0; i < count; ++i)
{
SecKeychainItemRef itemRef =
static_cast<SecKeychainItemRef>(const_cast<void*>(CFArrayGetValueAtIndex(items.get(), 0)));
@@ -405,7 +405,7 @@ loadPrivateKey(const string& file, SecCertificateRef cert, SecKeychainRef keycha
SecKeychainAttribute attr;
attr.tag = kSecKeyLabel;
attr.data = const_cast<UInt8*>(CFDataGetBytePtr(hash.get()));
- attr.length = CFDataGetLength(hash.get());
+ attr.length = static_cast<int>(CFDataGetLength(hash.get()));
attributes.push_back(attr);
}
@@ -421,13 +421,13 @@ loadPrivateKey(const string& file, SecCertificateRef cert, SecKeychainRef keycha
SecKeychainAttribute attr;
attr.tag = kSecKeyPrintName;
attr.data = const_cast<char*>(label.c_str());
- attr.length = label.size();
+ attr.length = static_cast<int>(label.size());
attributes.push_back(attr);
}
SecKeychainAttributeList attrs;
attrs.attr = &attributes[0];
- attrs.count = attributes.size();
+ attrs.count = static_cast<int>(attributes.size());
SecKeychainItemModifyAttributesAndData(reinterpret_cast<SecKeychainItemRef>(key.get()), &attrs, 0, 0);
UniqueRef<SecIdentityRef> identity;
@@ -637,7 +637,7 @@ IceSSL::SecureTransport::loadCACertificates(const string& file)
#else
UniqueRef<CFArrayRef> items(loadKeychainItems(file, kSecItemTypeCertificate, 0, "", 0, 0));
UniqueRef<CFArrayRef> certificateAuthorities(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
- int count = CFArrayGetCount(items.get());
+ CFIndex count = CFArrayGetCount(items.get());
for(CFIndex i = 0; i < count; ++i)
{
SecCertificateRef cert =
@@ -800,7 +800,7 @@ IceSSL::SecureTransport::findCertificateChain(const std::string& keychainPath,
"IceSSL: error evaluating trust:\n" + sslErrorToString(err));
}
- int chainLength = SecTrustGetCertificateCount(trust.get());
+ CFIndex chainLength = SecTrustGetCertificateCount(trust.get());
UniqueRef<CFArrayRef> items(CFArrayCreateMutable(kCFAllocatorDefault, chainLength, &kCFTypeArrayCallBacks));
for(int i = 0; i < chainLength; ++i)
{
diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp
index 4c4dc4b68a4..d68fff4a02e 100644
--- a/cpp/src/IceUtil/Time.cpp
+++ b/cpp/src/IceUtil/Time.cpp
@@ -197,8 +197,8 @@ IceUtil::Time::microSecondsDouble(double t)
IceUtil::Time::operator timeval() const
{
timeval tv;
- tv.tv_sec = static_cast<long>(_usec / 1000000);
- tv.tv_usec = static_cast<long>(_usec % 1000000);
+ tv.tv_sec = static_cast<time_t>(_usec / 1000000);
+ tv.tv_usec = static_cast<suseconds_t>(_usec % 1000000);
return tv;
}
#endif