summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Buffer.h2
-rw-r--r--cpp/src/Glacier2/RequestQueue.cpp2
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp12
-rw-r--r--cpp/src/IceGrid/Database.cpp4
-rw-r--r--cpp/src/IceGrid/ServerI.cpp2
-rw-r--r--cpp/src/IcePatch2/Util.cpp6
-rw-r--r--cpp/src/IceSSL/AcceptorI.cpp2
-rwxr-xr-xcpp/src/IceSSL/Certificate.cpp2
-rw-r--r--cpp/src/IceSSL/ConnectorI.cpp3
-rw-r--r--cpp/src/IceSSL/TransceiverI.cpp12
-rw-r--r--cpp/src/IceSSL/Util.cpp4
11 files changed, 26 insertions, 25 deletions
diff --git a/cpp/include/Ice/Buffer.h b/cpp/include/Ice/Buffer.h
index 00760017c61..f143144f096 100644
--- a/cpp/include/Ice/Buffer.h
+++ b/cpp/include/Ice/Buffer.h
@@ -41,7 +41,7 @@ public:
typedef Ice::Byte& reference;
typedef const Ice::Byte& const_reference;
typedef Ice::Byte* pointer;
- typedef int difference_type;
+ typedef ptrdiff_t difference_type;
typedef size_t size_type;
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp
index 6554eda8b3b..ef0beeb6b3b 100644
--- a/cpp/src/Glacier2/RequestQueue.cpp
+++ b/cpp/src/Glacier2/RequestQueue.cpp
@@ -290,7 +290,7 @@ void
Glacier2::RequestQueue::run()
{
RequestQueuePtr self = this; // This is to avoid creating a temporary Ptr for each call to Request::invoke()
- int dispatchCount = 0; // The dispatch count keeps track of the number of outstanding twoway requests.
+ ptrdiff_t dispatchCount = 0; // The dispatch count keeps track of the number of outstanding twoway requests.
while(true)
{
vector<RequestPtr> requests;
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index a7e51ae2dc5..69cfafa432a 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -78,8 +78,8 @@ IceInternal::TcpTransceiver::shutdownReadWrite()
void
IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
{
- Buffer::Container::difference_type packetSize =
- static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ // Its impossible for the packetSize to be more than an Int.
+ int packetSize = static_cast<int>(buf.b.end() - buf.i);
#ifdef _WIN32
//
@@ -185,7 +185,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
if(packetSize > buf.b.end() - buf.i)
{
- packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
}
}
}
@@ -193,8 +193,8 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
void
IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
{
- Buffer::Container::difference_type packetSize =
- static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ // Its impossible for the packetSize to be more than an Int.
+ int packetSize = static_cast<int>(buf.b.end() - buf.i);
while(buf.i != buf.b.end())
{
@@ -309,7 +309,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
if(packetSize > buf.b.end() - buf.i)
{
- packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
}
}
}
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp
index 9b478a19b2e..6b8b77c1363 100644
--- a/cpp/src/IceGrid/Database.cpp
+++ b/cpp/src/IceGrid/Database.cpp
@@ -728,7 +728,7 @@ Database::removeAdapter(const string& adapterId)
else
{
serial = _serial;
- _serial += infos.size();
+ _serial += static_cast<int>(static_cast<int>(infos.size()));
}
}
@@ -1066,7 +1066,7 @@ Ice::ObjectPrx
Database::getObjectByType(const string& type)
{
Ice::ObjectProxySeq objs = getObjectsByType(type);
- return objs[IceUtil::random(objs.size())];
+ return objs[IceUtil::random(static_cast<int>(objs.size()))];
}
Ice::ObjectPrx
diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp
index fdab6755490..e604cde28c1 100644
--- a/cpp/src/IceGrid/ServerI.cpp
+++ b/cpp/src/IceGrid/ServerI.cpp
@@ -1739,7 +1739,7 @@ ServerI::updateImpl(const string& application, const ServerDescriptorPtr& desc,
//
vector<char> buf(256);
buf.resize(256);
- DWORD size = buf.size();
+ DWORD size = static_cast<DWORD>(buf.size());
bool success = GetUserName(&buf[0], &size);
if(!success && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp
index 6d50e29f14c..66642d5ba37 100644
--- a/cpp/src/IcePatch2/Util.cpp
+++ b/cpp/src/IcePatch2/Util.cpp
@@ -972,11 +972,11 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
}
}
- int bytesLeft = buf.st_size;
+ unsigned int bytesLeft = buf.st_size;
while(bytesLeft > 0)
{
ByteSeq bytes(min(bytesLeft, 1024*1024));
- if(read(fd, &bytes[0], bytes.size()) == -1)
+ if(read(fd, &bytes[0], static_cast<unsigned int>(bytes.size())) == -1)
{
if(doCompress)
{
@@ -985,7 +985,7 @@ getFileInfoSeqInt(const string& basePath, const string& relPath, int compress, G
close(fd);
throw "cannot read from `" + path + "':\n" + lastError();
}
- bytesLeft -= bytes.size();
+ bytesLeft -= static_cast<unsigned int>(bytes.size());
if(doCompress)
{
diff --git a/cpp/src/IceSSL/AcceptorI.cpp b/cpp/src/IceSSL/AcceptorI.cpp
index 0dbebd5ac4e..bafdba93fa8 100644
--- a/cpp/src/IceSSL/AcceptorI.cpp
+++ b/cpp/src/IceSSL/AcceptorI.cpp
@@ -88,7 +88,7 @@ IceSSL::AcceptorI::accept(int timeout)
desc = IceInternal::addrToString(remoteAddr);
}
- BIO* bio = BIO_new_socket(fd, BIO_CLOSE);
+ BIO* bio = BIO_new_socket(static_cast<int>(fd), BIO_CLOSE);
if(!bio)
{
IceInternal::closeSocketNoThrow(fd);
diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp
index bbbe2a864ad..15e03fbe49b 100755
--- a/cpp/src/IceSSL/Certificate.cpp
+++ b/cpp/src/IceSSL/Certificate.cpp
@@ -390,7 +390,7 @@ Certificate::load(const string& file)
CertificatePtr
Certificate::decode(const string& encoding)
{
- BIO *cert = BIO_new_mem_buf((void*)&encoding[0], encoding.size());
+ BIO *cert = BIO_new_mem_buf(static_cast<void*>(const_cast<char*>(&encoding[0])), static_cast<int>(encoding.size()));
X509* x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
if(x == NULL)
{
diff --git a/cpp/src/IceSSL/ConnectorI.cpp b/cpp/src/IceSSL/ConnectorI.cpp
index 11f9c32f3ae..2fac1c00d14 100644
--- a/cpp/src/IceSSL/ConnectorI.cpp
+++ b/cpp/src/IceSSL/ConnectorI.cpp
@@ -43,7 +43,8 @@ IceSSL::ConnectorI::connect(int timeout)
IceInternal::setBlock(fd, false);
IceInternal::doConnect(fd, _addr, timeout);
- BIO* bio = BIO_new_socket(fd, BIO_CLOSE);
+ // This static_cast is necessary due to 64bit windows. There SOCKET is a non-int type.
+ BIO* bio = BIO_new_socket(static_cast<int>(fd), BIO_CLOSE);
if(!bio)
{
IceInternal::closeSocketNoThrow(fd);
diff --git a/cpp/src/IceSSL/TransceiverI.cpp b/cpp/src/IceSSL/TransceiverI.cpp
index ffa74ed4914..512691d0b69 100644
--- a/cpp/src/IceSSL/TransceiverI.cpp
+++ b/cpp/src/IceSSL/TransceiverI.cpp
@@ -80,8 +80,8 @@ IceSSL::TransceiverI::shutdownReadWrite()
void
IceSSL::TransceiverI::write(IceInternal::Buffer& buf, int timeout)
{
- IceInternal::Buffer::Container::difference_type packetSize =
- static_cast<IceInternal::Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ // Its impossible for the packetSize to be more than an Int.
+ int packetSize = static_cast<int>(buf.b.end() - buf.i);
#ifdef _WIN32
//
@@ -206,7 +206,7 @@ IceSSL::TransceiverI::write(IceInternal::Buffer& buf, int timeout)
if(packetSize > buf.b.end() - buf.i)
{
- packetSize = static_cast<IceInternal::Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
}
}
}
@@ -214,8 +214,8 @@ IceSSL::TransceiverI::write(IceInternal::Buffer& buf, int timeout)
void
IceSSL::TransceiverI::read(IceInternal::Buffer& buf, int timeout)
{
- IceInternal::Buffer::Container::difference_type packetSize =
- static_cast<IceInternal::Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ // Its impossible for the packetSize to be more than an Int.
+ int packetSize = static_cast<int>(buf.b.end() - buf.i);
while(buf.i != buf.b.end())
{
@@ -349,7 +349,7 @@ IceSSL::TransceiverI::read(IceInternal::Buffer& buf, int timeout)
if(packetSize > buf.b.end() - buf.i)
{
- packetSize = static_cast<IceInternal::Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
}
}
}
diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp
index 90527f4c85f..628641df9dc 100644
--- a/cpp/src/IceSSL/Util.cpp
+++ b/cpp/src/IceSSL/Util.cpp
@@ -292,11 +292,11 @@ repeatSelect:
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- ret = ::select(fd + 1, &rFdSet, &wFdSet, 0, &tv);
+ ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, &tv);
}
else
{
- ret = ::select(fd + 1, &rFdSet, &wFdSet, 0, 0);
+ ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, 0);
}
if(ret == 0)