summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2003-04-29 19:51:33 +0000
committerBernard Normier <bernard@zeroc.com>2003-04-29 19:51:33 +0000
commitd6b805efcf63a16a759f0a104db74c5e9c009f7d (patch)
tree2a73b6a3e15c2cf711a0c4f1ab12dd52687e003e /cpp/src
parentfile UserExceptionFactory.h was initially added on branch slicing. (diff)
downloadice-d6b805efcf63a16a759f0a104db74c5e9c009f7d.tar.bz2
ice-d6b805efcf63a16a759f0a104db74c5e9c009f7d.tar.xz
ice-d6b805efcf63a16a759f0a104db74c5e9c009f7d.zip
Sun: 64 bit + CC 5.3 support
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/DBI.cpp14
-rw-r--r--cpp/src/Glacier/Makefile2
-rw-r--r--cpp/src/Glacier/Request.h2
-rw-r--r--cpp/src/Glacier/StarterI.cpp4
-rw-r--r--cpp/src/Ice/Acceptor.h4
-rw-r--r--cpp/src/Ice/BasicStream.cpp66
-rw-r--r--cpp/src/Ice/Connection.cpp22
-rw-r--r--cpp/src/Ice/Instance.cpp4
-rw-r--r--cpp/src/Ice/LocalObject.cpp2
-rw-r--r--cpp/src/Ice/Network.cpp22
-rw-r--r--cpp/src/Ice/Network.h1
-rw-r--r--cpp/src/Ice/Object.cpp6
-rw-r--r--cpp/src/Ice/StringUtil.cpp2
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp12
-rw-r--r--cpp/src/Ice/ThreadPool.cpp4
-rw-r--r--cpp/src/Ice/Transceiver.h4
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp12
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp4
-rw-r--r--cpp/src/IcePack/AdapterFactory.h2
-rw-r--r--cpp/src/IcePack/NodeI.h2
-rw-r--r--cpp/src/IcePack/ObjectRegistryI.cpp2
-rw-r--r--cpp/src/IcePack/Parser.cpp4
-rw-r--r--cpp/src/IcePack/Scanner.l8
-rw-r--r--cpp/src/IcePack/ServerFactory.h2
-rw-r--r--cpp/src/IcePack/ServerI.h2
-rw-r--r--cpp/src/IcePack/WaitQueue.h2
-rw-r--r--cpp/src/IcePatch/ClientUtil.cpp10
-rw-r--r--cpp/src/IcePatch/IcePatchI.cpp2
-rw-r--r--cpp/src/IcePatch/Util.cpp2
-rw-r--r--cpp/src/IceSSL/ConfigParser.cpp20
-rw-r--r--cpp/src/IceSSL/Convert.cpp2
-rw-r--r--cpp/src/IceSSL/DefaultCertificateVerifier.cpp4
-rw-r--r--cpp/src/IceSSL/OpenSSLUtils.cpp14
-rw-r--r--cpp/src/IceSSL/OpenSSLUtils.h2
-rw-r--r--cpp/src/IceSSL/ServerContext.cpp2
-rw-r--r--cpp/src/IceSSL/SslClientTransceiver.cpp6
-rw-r--r--cpp/src/IceSSL/SslServerTransceiver.cpp4
-rw-r--r--cpp/src/IceSSL/SslTransceiver.cpp18
-rw-r--r--cpp/src/IceStorm/Parser.cpp4
-rw-r--r--cpp/src/IceStorm/Scanner.l8
-rw-r--r--cpp/src/IceStorm/WeightedGraph.cpp12
-rw-r--r--cpp/src/IceUtil/UUID.cpp6
-rw-r--r--cpp/src/IceXML/StreamI.cpp28
-rw-r--r--cpp/src/Slice/Parser.cpp9
-rw-r--r--cpp/src/XMLTransform/XMLTransform.cpp13
-rw-r--r--cpp/src/slice2cpp/Gen.cpp4
-rw-r--r--cpp/src/slice2java/Gen.cpp5
47 files changed, 203 insertions, 183 deletions
diff --git a/cpp/src/Freeze/DBI.cpp b/cpp/src/Freeze/DBI.cpp
index 75490ce00ec..862ec6723e4 100644
--- a/cpp/src/Freeze/DBI.cpp
+++ b/cpp/src/Freeze/DBI.cpp
@@ -526,7 +526,7 @@ DBCursorI::set(const Value& value)
memset(&dbKey, 0, sizeof(dbKey));
memset(&dbData, 0, sizeof(dbData));
dbData.data = const_cast<void*>(static_cast<const void*>(&value[0]));
- dbData.size = value.size();
+ dbData.size = (unsigned int) value.size();
if(_trace >= 1)
{
@@ -1036,7 +1036,7 @@ Freeze::DBI::getCursorAtKeyImpl(::DB_TXN* txn, const Key& key)
dbData.flags = DB_DBT_PARTIAL;
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
- dbKey.size = key.size();
+ dbKey.size = (unsigned int) key.size();
try
{
checkBerkeleyDBReturn(cursor->c_get(cursor, &dbKey, &dbData, DB_SET), _errorPrefix, "DBcursor->c_get");
@@ -1071,9 +1071,9 @@ Freeze::DBI::putImpl(::DB_TXN* txn, const Key& key, const Value& value)
memset(&dbKey, 0, sizeof(dbKey));
memset(&dbData, 0, sizeof(dbData));
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
- dbKey.size = key.size();
+ dbKey.size = (unsigned int) key.size();
dbData.data = const_cast<void*>(static_cast<const void*>(&value[0]));
- dbData.size = value.size();
+ dbData.size = (unsigned int) value.size();
if(_trace >= 1)
{
@@ -1101,7 +1101,7 @@ Freeze::DBI::containsImpl(::DB_TXN* txn, const Key& key)
DBT dbKey;
memset(&dbKey, 0, sizeof(dbKey));
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
- dbKey.size = key.size();
+ dbKey.size = (unsigned int) key.size();
DBT dbData;
memset(&dbData, 0, sizeof(dbData));
@@ -1141,7 +1141,7 @@ Freeze::DBI::getImpl(::DB_TXN* txn, const Key& key)
memset(&dbKey, 0, sizeof(dbKey));
memset(&dbData, 0, sizeof(dbData));
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
- dbKey.size = key.size();
+ dbKey.size = (unsigned int) key.size();
if(_trace >= 1)
{
@@ -1171,7 +1171,7 @@ Freeze::DBI::delImpl(::DB_TXN* txn, const Key& key)
DBT dbKey;
memset(&dbKey, 0, sizeof(dbKey));
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
- dbKey.size = key.size();
+ dbKey.size = (unsigned int) key.size();
if(_trace >= 1)
{
diff --git a/cpp/src/Glacier/Makefile b/cpp/src/Glacier/Makefile
index 8570ca5de30..4779f0bcf96 100644
--- a/cpp/src/Glacier/Makefile
+++ b/cpp/src/Glacier/Makefile
@@ -66,7 +66,7 @@ $(ROUTER): $(ROBJS) $(NAME)
$(STARTER): $(SOBJS) $(NAME)
rm -f $@
- $(CXX) $(LDFLAGS) -o $@ $(SOBJS) -lGlacier -lIceSSL $(LIBS) $(OPENSSL_LIBS) -lcrypt
+ $(CXX) $(LDFLAGS) -o $@ $(SOBJS) -lGlacier -lIceSSL -lcrypt $(OPENSSL_LIBS) $(LIBS)
install:: all
$(INSTALL_LIBRARY) $(VERSIONED_NAME) $(install_libdir)
diff --git a/cpp/src/Glacier/Request.h b/cpp/src/Glacier/Request.h
index 9ad965a1a96..f8485fd6f06 100644
--- a/cpp/src/Glacier/Request.h
+++ b/cpp/src/Glacier/Request.h
@@ -77,7 +77,7 @@ private:
bool _destroy;
};
-};
+}
#endif
diff --git a/cpp/src/Glacier/StarterI.cpp b/cpp/src/Glacier/StarterI.cpp
index f3dcaae308e..ac52b9dbf24 100644
--- a/cpp/src/Glacier/StarterI.cpp
+++ b/cpp/src/Glacier/StarterI.cpp
@@ -57,7 +57,7 @@ Glacier::StarterI::StarterI(const CommunicatorPtr& communicator, const PasswordV
Int bitStrength = _properties->getPropertyAsIntWithDefault(
"Glacier.Starter.Certificate.BitStrength", 1024);
Int secondsValid = _properties->getPropertyAsIntWithDefault(
- "Glacier.Starter.Certificate.SecondsValid", IceSSL::RSACertificateGenContext::daysToSeconds(1));
+ "Glacier.Starter.Certificate.SecondsValid", static_cast<Int>(IceSSL::RSACertificateGenContext::daysToSeconds(1)));
Int issuedAdjust = _properties->getPropertyAsIntWithDefault("Glacier.Starter.Certificate.IssuedAdjust", 0);
_certContext.setCountry(country);
@@ -288,7 +288,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
//
// Convert to standard argc/argv.
//
- int argc = args.size() + 1;
+ int argc = static_cast<int>(args.size()) + 1;
char** argv = static_cast<char**>(malloc((argc + 1) * sizeof(char*)));
StringSeq::iterator p;
int i;
diff --git a/cpp/src/Ice/Acceptor.h b/cpp/src/Ice/Acceptor.h
index 3da8d56abc4..a752cfbec57 100644
--- a/cpp/src/Ice/Acceptor.h
+++ b/cpp/src/Ice/Acceptor.h
@@ -19,7 +19,9 @@
#include <Ice/AcceptorF.h>
#include <Ice/TransceiverF.h>
-#ifndef _WIN32
+#ifdef _WIN32
+typedef int ssize_t;
+#else
# define SOCKET int
#endif
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 4f3414ac270..324b2795cc1 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -77,14 +77,14 @@ IceInternal::BasicStream::swap(BasicStream& other)
}
void inline
-inlineResize(Buffer* buffer, int total)
+inlineResize(Buffer* buffer, size_t total)
{
if(total > 1024 * 1024) // TODO: configurable
{
throw MemoryLimitException(__FILE__, __LINE__);
}
- int capacity = buffer->b.capacity();
+ size_t capacity = buffer->b.capacity();
if(capacity < total)
{
buffer->b.reserve(max(total, 2 * capacity));
@@ -125,7 +125,7 @@ void
IceInternal::BasicStream::endWriteEncaps()
{
assert(_currentWriteEncaps);
- int start = _currentWriteEncaps->start;
+ Container::size_type start = _currentWriteEncaps->start;
_writeEncapsStack.pop_back();
if(_writeEncapsStack.empty())
{
@@ -135,7 +135,7 @@ IceInternal::BasicStream::endWriteEncaps()
{
_currentWriteEncaps = &_writeEncapsStack.back();
}
- Int sz = b.size() - start + sizeof(Int) + 2; // Size includes size and version
+ Int sz = static_cast<Int>(b.size() - start + sizeof(Int) + 2); // Size includes size and version
const Byte* p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Int), b.begin() + start - sizeof(Int) - 2); // - 2 for major and minor version byte
@@ -202,7 +202,7 @@ void
IceInternal::BasicStream::skipReadEncaps()
{
assert(_currentReadEncaps);
- int start = _currentReadEncaps->start;
+ Container::size_type start = _currentReadEncaps->start;
_readEncapsStack.pop_back();
if(_readEncapsStack.empty())
{
@@ -230,7 +230,7 @@ void
IceInternal::BasicStream::checkReadEncaps()
{
assert(_currentReadEncaps);
- int start = _currentReadEncaps->start;
+ Container::size_type start = _currentReadEncaps->start;
Container::iterator save = i;
i = b.begin() + start - sizeof(Int) - 2; // - 2 for major and minor version byte
Int sz;
@@ -250,7 +250,7 @@ Int
IceInternal::BasicStream::getReadEncapsSize()
{
assert(_currentReadEncaps);
- int start = _currentReadEncaps->start;
+ Container::size_type start = _currentReadEncaps->start;
Container::iterator save = i;
i = b.begin() + start - sizeof(Int) - 2; // - 2 for major and minor version byte
Int sz;
@@ -260,7 +260,7 @@ IceInternal::BasicStream::getReadEncapsSize()
throw NegativeSizeException(__FILE__, __LINE__);
}
i = save;
- return sz - sizeof(Int) - 2;
+ return static_cast<Int>(sz - sizeof(Int) - 2);
}
void
@@ -315,7 +315,7 @@ IceInternal::BasicStream::readSize(Ice::Int& v)
void
IceInternal::BasicStream::writeBlob(const vector<Byte>& v)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + v.size());
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
@@ -336,7 +336,7 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
void
IceInternal::BasicStream::writeBlob(const Ice::Byte* v, size_t len)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + len);
ice_copy(&v[0], &v[0 + len], b.begin() + pos);
}
@@ -356,9 +356,9 @@ IceInternal::BasicStream::readBlob(Ice::Byte* v, size_t len)
void
IceInternal::BasicStream::write(const vector<Byte>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz);
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
@@ -391,9 +391,9 @@ IceInternal::BasicStream::read(vector<Byte>& v)
void
IceInternal::BasicStream::write(const vector<bool>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz);
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
@@ -426,7 +426,7 @@ IceInternal::BasicStream::read(vector<bool>& v)
void
IceInternal::BasicStream::write(Short v)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sizeof(Short));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
@@ -439,11 +439,11 @@ IceInternal::BasicStream::write(Short v)
void
IceInternal::BasicStream::write(const vector<Short>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
if(sz > 0)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz * sizeof(Short));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
@@ -505,7 +505,7 @@ IceInternal::BasicStream::read(vector<Short>& v)
void
IceInternal::BasicStream::write(Int v)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sizeof(Int));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
@@ -518,11 +518,11 @@ IceInternal::BasicStream::write(Int v)
void
IceInternal::BasicStream::write(const vector<Int>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
if(sz > 0)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz * sizeof(Int));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
@@ -584,7 +584,7 @@ IceInternal::BasicStream::read(vector<Int>& v)
void
IceInternal::BasicStream::write(Long v)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sizeof(Long));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
@@ -597,11 +597,11 @@ IceInternal::BasicStream::write(Long v)
void
IceInternal::BasicStream::write(const vector<Long>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
if(sz > 0)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz * sizeof(Long));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
@@ -663,7 +663,7 @@ IceInternal::BasicStream::read(vector<Long>& v)
void
IceInternal::BasicStream::write(Float v)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sizeof(Float));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
@@ -676,11 +676,11 @@ IceInternal::BasicStream::write(Float v)
void
IceInternal::BasicStream::write(const vector<Float>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
if(sz > 0)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz * sizeof(Float));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
@@ -742,7 +742,7 @@ IceInternal::BasicStream::read(vector<Float>& v)
void
IceInternal::BasicStream::write(Double v)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sizeof(Double));
const Byte* p = reinterpret_cast<const Byte*>(&v);
#ifdef ICE_BIG_ENDIAN
@@ -755,11 +755,11 @@ IceInternal::BasicStream::write(Double v)
void
IceInternal::BasicStream::write(const vector<Double>& v)
{
- Int sz = v.size();
+ Int sz = static_cast<Int>(v.size());
writeSize(sz);
if(sz > 0)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + sz * sizeof(Double));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_BIG_ENDIAN
@@ -821,11 +821,11 @@ IceInternal::BasicStream::read(vector<Double>& v)
void
IceInternal::BasicStream::write(const string& v)
{
- Int len = v.size();
+ Int len = static_cast<Int>(v.size());
writeSize(len);
if(len > 0)
{
- int pos = b.size();
+ size_t pos = b.size();
inlineResize(this, pos + len);
ice_copy(v.begin(), v.end(), b.begin() + pos);
}
@@ -910,7 +910,7 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
if(v)
{
- Int num = _currentWriteEncaps->objectsWritten.size();
+ Int num = static_cast<Int>(_currentWriteEncaps->objectsWritten.size());
_currentWriteEncaps->objectsWritten[v.get()] = num;
write(v->ice_id());
v->__write(this);
@@ -1021,7 +1021,7 @@ IceInternal::BasicStream::throwException(const string* throwsBegin, const string
pair<const string*, const string*> p = equal_range(throwsBegin, throwsEnd, id);
if(p.first != p.second)
{
- return p.first - throwsBegin;
+ return static_cast<Int>(p.first - throwsBegin);
}
NoUserExceptionFactoryException ex(__FILE__, __LINE__);
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 919f9d5a570..30fa07e37cc 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -219,7 +219,7 @@ IceInternal::Connection::validate()
assert(is.i - is.b.begin() >= headerSize);
is.i = is.b.begin();
MagicBytes m(sizeof(magic), 0);
- is.readBlob(m, sizeof(magic));
+ is.readBlob(m, static_cast<Int>(sizeof(magic)));
if(!equal(m.begin(), m.end(), magic))
{
BadMagicException ex(__FILE__, __LINE__);
@@ -435,7 +435,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway)
// No compression, just fill in the message size.
//
const Byte* p;
- Int sz = os->b.size();
+ Int sz = static_cast<Int>(os->b.size());
p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
@@ -543,7 +543,7 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out)
//
// No compression, just fill in the message size.
//
- Int sz = os->b.size();
+ Int sz = static_cast<Int>(os->b.size());
p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
reverse_copy(p, p + sizeof(Int), os->b.begin() + 10);
@@ -700,7 +700,7 @@ IceInternal::Connection::flushBatchRequest()
//
// No compression, just fill in the message size.
//
- Int sz = _batchStream.b.size();
+ Int sz = static_cast<Int>(_batchStream.b.size());
p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
@@ -792,7 +792,7 @@ IceInternal::Connection::sendResponse(BasicStream* os, Byte compressFlag)
// No compression, just fill in the message size.
//
const Byte* p;
- Int sz = os->b.size();
+ Int sz = static_cast<Int>(os->b.size());
p = reinterpret_cast<const Byte*>(&sz);
#ifdef ICE_BIG_ENDIAN
@@ -960,7 +960,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
stream.i = stream.b.begin();
MagicBytes m(sizeof(magic), 0);
- stream.readBlob(m, sizeof(magic));
+ stream.readBlob(m, static_cast<Int>(sizeof(magic)));
if(!equal(m.begin(), m.end(), magic))
{
BadMagicException ex(__FILE__, __LINE__);
@@ -1674,8 +1674,8 @@ IceInternal::Connection::doCompress(BasicStream& uncompressed, BasicStream& comp
//
// Compress the message body, but not the header.
//
- unsigned int uncompressedLen = uncompressed.b.size() - headerSize;
- unsigned int compressedLen = static_cast<int>(uncompressedLen * 1.01 + 600);
+ unsigned int uncompressedLen = static_cast<unsigned int>(uncompressed.b.size() - headerSize);
+ unsigned int compressedLen = static_cast<unsigned int>(uncompressedLen * 1.01 + 600);
compressed.b.resize(headerSize + sizeof(Int) + compressedLen);
int bzError = BZ2_bzBuffToBuffCompress(&compressed.b[0] + headerSize + sizeof(Int), &compressedLen,
&uncompressed.b[0] + headerSize, uncompressedLen,
@@ -1693,7 +1693,7 @@ IceInternal::Connection::doCompress(BasicStream& uncompressed, BasicStream& comp
// uncompressed stream. Since the header will be copied, this size
// will also be in the header of the compressed stream.
//
- Int compressedSize = compressed.b.size();
+ Int compressedSize = static_cast<Int>(compressed.b.size());
p = reinterpret_cast<const Byte*>(&compressedSize);
#ifdef ICE_BIG_ENDIAN
@@ -1705,7 +1705,7 @@ IceInternal::Connection::doCompress(BasicStream& uncompressed, BasicStream& comp
// Add the size of the uncompressed stream before the message body
// of the compressed stream.
//
- Int uncompressedSize = uncompressed.b.size();
+ Int uncompressedSize = static_cast<Int>(uncompressed.b.size());
p = reinterpret_cast<const Byte*>(&uncompressedSize);
#ifdef ICE_BIG_ENDIAN
@@ -1733,7 +1733,7 @@ IceInternal::Connection::doUncompress(BasicStream& compressed, BasicStream& unco
uncompressed.resize(uncompressedSize);
unsigned int uncompressedLen = uncompressedSize - headerSize;
- unsigned int compressedLen = compressed.b.size() - headerSize - sizeof(Int);
+ unsigned int compressedLen = static_cast<unsigned int>(compressed.b.size() - headerSize - sizeof(Int));
int bzError = BZ2_bzBuffToBuffDecompress(&uncompressed.b[0] + headerSize,
&uncompressedLen,
&compressed.b[0] + headerSize + sizeof(Int),
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index d99564a7a72..9ad9cff4fde 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -388,7 +388,9 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
if(_globalStateCounter == 1) // Only on first call
{
- srand(static_cast<timeval>(IceUtil::Time::now()).tv_usec);
+ unsigned int seed =
+ static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
+ srand(seed);
if(_properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
{
diff --git a/cpp/src/Ice/LocalObject.cpp b/cpp/src/Ice/LocalObject.cpp
index 39eb86ac9ec..b4ba1c0bc4c 100644
--- a/cpp/src/Ice/LocalObject.cpp
+++ b/cpp/src/Ice/LocalObject.cpp
@@ -42,5 +42,5 @@ Ice::LocalObject::operator<(const LocalObject& r) const
Int
Ice::LocalObject::ice_hash() const
{
- return reinterpret_cast<Int>(this) >> 4;
+ return static_cast<Int>(reinterpret_cast<Long>(this) >> 4);
}
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index acee6758900..fbd895675d4 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -296,7 +296,7 @@ void
IceInternal::setTcpNoDelay(SOCKET fd)
{
int flag = 1;
- if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int)) == SOCKET_ERROR)
+ if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -309,7 +309,7 @@ void
IceInternal::setKeepAlive(SOCKET fd)
{
int flag = 1;
- if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, sizeof(int)) == SOCKET_ERROR)
+ if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -321,7 +321,7 @@ IceInternal::setKeepAlive(SOCKET fd)
void
IceInternal::setSendBufferSize(SOCKET fd, int sz)
{
- if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&sz, sizeof(int)) == SOCKET_ERROR)
+ if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&sz, int(sizeof(int))) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -333,7 +333,7 @@ IceInternal::setSendBufferSize(SOCKET fd, int sz)
void
IceInternal::setRecvBufferSize(SOCKET fd, int sz)
{
- if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&sz, sizeof(int)) == SOCKET_ERROR)
+ if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&sz, int(sizeof(int))) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -347,7 +347,7 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_in& addr)
{
#ifndef _WIN32
int flag = 1;
- if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&flag, sizeof(int)) == SOCKET_ERROR)
+ if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -356,7 +356,7 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_in& addr)
}
#endif
- if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) == SOCKET_ERROR)
+ if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -364,7 +364,7 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_in& addr)
throw ex;
}
- socklen_t len = sizeof(addr);
+ socklen_t len = static_cast<socklen_t>(sizeof(addr));
#ifdef NDEBUG
getsockname(fd, reinterpret_cast<struct sockaddr*>(&addr), &len);
#else
@@ -403,7 +403,7 @@ IceInternal::doConnect(SOCKET fd, struct sockaddr_in& addr, int timeout)
#endif
repeatConnect:
- if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) == SOCKET_ERROR)
+ if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
if(interrupted())
{
@@ -471,7 +471,7 @@ repeatConnect:
//
Sleep(0);
#endif
- socklen_t len = sizeof(socklen_t);
+ socklen_t len = static_cast<socklen_t>(sizeof(socklen_t));
int val;
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
{
@@ -1020,7 +1020,7 @@ IceInternal::fdToString(SOCKET fd)
return "<closed>";
}
- socklen_t localLen = sizeof(struct sockaddr_in);
+ socklen_t localLen = static_cast<socklen_t>(sizeof(struct sockaddr_in));
struct sockaddr_in localAddr;
if(getsockname(fd, reinterpret_cast<struct sockaddr*>(&localAddr), &localLen) == SOCKET_ERROR)
{
@@ -1031,7 +1031,7 @@ IceInternal::fdToString(SOCKET fd)
}
bool peerNotConnected = false;
- socklen_t remoteLen = sizeof(struct sockaddr_in);
+ socklen_t remoteLen = static_cast<socklen_t>(sizeof(struct sockaddr_in));
struct sockaddr_in remoteAddr;
if(getpeername(fd, reinterpret_cast<struct sockaddr*>(&remoteAddr), &remoteLen) == SOCKET_ERROR)
{
diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h
index ddd12a6b8a1..2ed6c3d084b 100644
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -19,6 +19,7 @@
#ifdef _WIN32
# include <winsock.h>
+typedef int ssize_t;
#else
# include <unistd.h>
# include <fcntl.h>
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index b2b8d81a458..a57551c1673 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -53,7 +53,7 @@ Ice::Object::operator<(const Object& r) const
Int
Ice::Object::ice_hash() const
{
- return reinterpret_cast<Int>(this) >> 4;
+ return static_cast<Int>(reinterpret_cast<Long>(this) >> 4);
}
const string Ice::Object::__ids[] =
@@ -238,7 +238,7 @@ Ice::Object::__marshal(const ::Ice::StreamPtr& __os) const
{
IceUtil::Mutex::Lock sync(_activeFacetMapMutex);
- __os->startWriteDictionary("ice:facets", _activeFacetMap.size());
+ __os->startWriteDictionary("ice:facets", static_cast<Int>(_activeFacetMap.size()));
for(map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
{
__os->startWriteDictionaryElement();
@@ -388,7 +388,7 @@ Ice::Object::ice_findFacet(const string& name)
ObjectPtr
Ice::Object::ice_findFacetPath(const vector<string>& path, int start)
{
- int sz = path.size();
+ int sz = static_cast<int>(path.size());
if(start > sz)
{
diff --git a/cpp/src/Ice/StringUtil.cpp b/cpp/src/Ice/StringUtil.cpp
index 08b55a223b5..2603dfdea9e 100644
--- a/cpp/src/Ice/StringUtil.cpp
+++ b/cpp/src/Ice/StringUtil.cpp
@@ -146,7 +146,7 @@ IceInternal::decodeString(const string& s, string::size_type start, string::size
while(start < end)
{
- string::size_type ch = s[start];
+ char ch = s[start];
if(ch == '\\')
{
start++;
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index 79aff442209..f4fbd688dde 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -62,7 +62,7 @@ IceInternal::TcpTransceiver::shutdown()
void
IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
{
- int packetSize = buf.b.end() - buf.i;
+ Buffer::Container::difference_type packetSize = buf.b.end() - buf.i;
#ifdef _WIN32
//
@@ -77,7 +77,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
while(buf.i != buf.b.end())
{
assert(_fd != INVALID_SOCKET);
- int ret = ::send(_fd, &*buf.i, packetSize, 0);
+ ssize_t ret = ::send(_fd, &*buf.i, packetSize, 0);
if(ret == 0)
{
@@ -161,7 +161,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
if(_stats)
{
- _stats->bytesSent(_name, ret);
+ _stats->bytesSent(_name, static_cast<Int>(ret));
}
buf.i += ret;
@@ -176,12 +176,12 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
void
IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
{
- int packetSize = buf.b.end() - buf.i;
+ Buffer::Container::difference_type packetSize = buf.b.end() - buf.i;
while(buf.i != buf.b.end())
{
assert(_fd != INVALID_SOCKET);
- int ret = ::recv(_fd, &*buf.i, packetSize, 0);
+ ssize_t ret = ::recv(_fd, &*buf.i, packetSize, 0);
if(ret == 0)
{
@@ -265,7 +265,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
if(_stats)
{
- _stats->bytesReceived(_name, ret);
+ _stats->bytesReceived(_name, static_cast<Int>(ret));
}
buf.i += ret;
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 5f4f6dfb6f2..53152fd03d8 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -634,11 +634,11 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
assert(stream.i == stream.b.end());
}
- int pos = stream.i - stream.b.begin();
+ ptrdiff_t pos = stream.i - stream.b.begin();
assert(pos >= headerSize);
stream.i = stream.b.begin();
MagicBytes m(sizeof(magic), 0);
- stream.readBlob(m, sizeof(magic));
+ stream.readBlob(m, static_cast<Int>(sizeof(magic)));
if(!equal(m.begin(), m.end(), magic))
{
BadMagicException ex(__FILE__, __LINE__);
diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h
index 28fd8adbb98..b5cd431fdae 100644
--- a/cpp/src/Ice/Transceiver.h
+++ b/cpp/src/Ice/Transceiver.h
@@ -18,7 +18,9 @@
#include <IceUtil/Shared.h>
#include <Ice/TransceiverF.h>
-#ifndef _WIN32
+#ifdef _WIN32
+typedef int ssize_t;
+#else
# define SOCKET int
#endif
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index d33c96c5473..889adf46f79 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -63,7 +63,7 @@ IceInternal::UdpTransceiver::write(Buffer& buf, int)
repeat:
assert(_fd != INVALID_SOCKET);
- int ret = ::send(_fd, &buf.b[0], buf.b.size(), 0);
+ ssize_t ret = ::send(_fd, &buf.b[0], buf.b.size(), 0);
if(ret == SOCKET_ERROR)
{
@@ -108,10 +108,10 @@ repeat:
if(_stats)
{
- _stats->bytesSent(_name, ret);
+ _stats->bytesSent(_name, static_cast<Int>(ret));
}
- assert(ret == static_cast<int>(buf.b.size()));
+ assert(ret == static_cast<ssize_t>(buf.b.size()));
buf.i = buf.b.end();
}
@@ -126,7 +126,7 @@ IceInternal::UdpTransceiver::read(Buffer& buf, int)
repeat:
- int ret;
+ ssize_t ret;
if(_connect)
{
//
@@ -135,7 +135,7 @@ repeat:
//
struct sockaddr_in peerAddr;
memset(&peerAddr, 0, sizeof(struct sockaddr_in));
- socklen_t len = sizeof(peerAddr);
+ socklen_t len = static_cast<socklen_t>(sizeof(peerAddr));
assert(_fd != INVALID_SOCKET);
ret = recvfrom(_fd, &buf.b[0], packetSize, 0, reinterpret_cast<struct sockaddr*>(&peerAddr), &len);
if(ret != SOCKET_ERROR)
@@ -199,7 +199,7 @@ repeat:
if(_stats)
{
- _stats->bytesReceived(_name, ret);
+ _stats->bytesReceived(_name, static_cast<Int>(ret));
}
buf.b.resize(ret);
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index 2a123f1e7e0..807dd2e5c10 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -168,7 +168,7 @@ IcePack::ActivatorI::activate(const ServerPtr& server)
//
// Compute arguments.
//
- int argc = server->description.args.size() + _propertiesOverride.size() + 3;
+ int argc = static_cast<int>(server->description.args.size() + _propertiesOverride.size() + 3);
char** argv = static_cast<char**>(malloc(argc * sizeof(char*)));
argv[0] = strdup(path.c_str());
@@ -609,7 +609,7 @@ IcePack::ActivatorI::terminationListener()
}
char s[16];
- int rs;
+ ssize_t rs;
string message;
//
diff --git a/cpp/src/IcePack/AdapterFactory.h b/cpp/src/IcePack/AdapterFactory.h
index 0a07de56ce9..c614dbc0bce 100644
--- a/cpp/src/IcePack/AdapterFactory.h
+++ b/cpp/src/IcePack/AdapterFactory.h
@@ -52,6 +52,6 @@ private:
typedef ::IceUtil::Handle< AdapterFactory> AdapterFactoryPtr;
-};
+}
#endif
diff --git a/cpp/src/IcePack/NodeI.h b/cpp/src/IcePack/NodeI.h
index 2810eef856e..2f53cee988a 100644
--- a/cpp/src/IcePack/NodeI.h
+++ b/cpp/src/IcePack/NodeI.h
@@ -39,6 +39,6 @@ private:
};
-};
+}
#endif
diff --git a/cpp/src/IcePack/ObjectRegistryI.cpp b/cpp/src/IcePack/ObjectRegistryI.cpp
index b26d0c4105e..425352a9197 100644
--- a/cpp/src/IcePack/ObjectRegistryI.cpp
+++ b/cpp/src/IcePack/ObjectRegistryI.cpp
@@ -168,7 +168,7 @@ IcePack::ObjectRegistryI::findByType(const string& type, const Ice::Current&) co
throw ObjectNotExistException();
}
- int r = rand() % p->second.size();
+ int r = rand() % int(p->second.size());
return p->second[r];
}
diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp
index f0c00c7a1d1..24d2ecc6172 100644
--- a/cpp/src/IcePack/Parser.cpp
+++ b/cpp/src/IcePack/Parser.cpp
@@ -733,7 +733,7 @@ IcePack::Parser::getInput(char* buf, int& result, int maxSize)
}
}
- result = line.length();
+ result = (int) line.length();
if(result > maxSize)
{
error("input line too long");
@@ -749,7 +749,7 @@ IcePack::Parser::getInput(char* buf, int& result, int maxSize)
}
else
{
- if(((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
{
error("input in flex scanner failed");
buf[0] = EOF;
diff --git a/cpp/src/IcePack/Scanner.l b/cpp/src/IcePack/Scanner.l
index 16eac61171b..ab945b09369 100644
--- a/cpp/src/IcePack/Scanner.l
+++ b/cpp/src/IcePack/Scanner.l
@@ -173,8 +173,8 @@ NL [\n]
}
{WS}*(\\{WS}*{NL})? {
- int len = strlen(yytext);
- for(int i = 0; i < len; ++i)
+ size_t len = strlen(yytext);
+ for(size_t i = 0; i < len; ++i)
{
if(yytext[i] == '\\')
{
@@ -188,8 +188,8 @@ NL [\n]
}
{NL}|; {
- int len = strlen(yytext);
- for(int i = 0; i < len; ++i)
+ size_t len = strlen(yytext);
+ for(size_t i = 0; i < len; ++i)
{
if(yytext[i] == '\n')
{
diff --git a/cpp/src/IcePack/ServerFactory.h b/cpp/src/IcePack/ServerFactory.h
index ba67510c8a7..f729ed05a88 100644
--- a/cpp/src/IcePack/ServerFactory.h
+++ b/cpp/src/IcePack/ServerFactory.h
@@ -65,6 +65,6 @@ private:
typedef ::IceUtil::Handle< ServerFactory> ServerFactoryPtr;
-};
+}
#endif
diff --git a/cpp/src/IcePack/ServerI.h b/cpp/src/IcePack/ServerI.h
index 69813e02c7c..55c03dd4579 100644
--- a/cpp/src/IcePack/ServerI.h
+++ b/cpp/src/IcePack/ServerI.h
@@ -63,6 +63,6 @@ private:
ServerState _state;
};
-};
+}
#endif
diff --git a/cpp/src/IcePack/WaitQueue.h b/cpp/src/IcePack/WaitQueue.h
index eb016ea3b04..db3b54d69db 100644
--- a/cpp/src/IcePack/WaitQueue.h
+++ b/cpp/src/IcePack/WaitQueue.h
@@ -67,6 +67,6 @@ private:
typedef IceUtil::Handle<WaitQueue> WaitQueuePtr;
-};
+}
#endif
diff --git a/cpp/src/IcePatch/ClientUtil.cpp b/cpp/src/IcePatch/ClientUtil.cpp
index 8c7805ac6d7..b9f54b78b0b 100644
--- a/cpp/src/IcePatch/ClientUtil.cpp
+++ b/cpp/src/IcePatch/ClientUtil.cpp
@@ -49,12 +49,12 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
FileInfo infoBZ2 = getFileInfo(pathBZ2, false);
if(infoBZ2.type == FileTypeRegular)
{
- ByteSeq remoteBZ2MD5 = regular->getBZ2MD5(infoBZ2.size);
- ByteSeq localBZ2MD5 = calcPartialMD5(pathBZ2, infoBZ2.size);
+ ByteSeq remoteBZ2MD5 = regular->getBZ2MD5(static_cast<Int>(infoBZ2.size));
+ ByteSeq localBZ2MD5 = calcPartialMD5(pathBZ2, static_cast<Int>(infoBZ2.size));
if(remoteBZ2MD5 == localBZ2MD5)
{
- posBZ2 = infoBZ2.size;
+ posBZ2 = static_cast<Int>(infoBZ2.size);
}
}
@@ -81,7 +81,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
break;
}
- posBZ2 += bytesBZ2.size();
+ posBZ2 += static_cast<Int>(bytesBZ2.size());
fileBZ2.write(&bytesBZ2[0], bytesBZ2.size());
if(!fileBZ2)
@@ -167,7 +167,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
throw ex;
}
- progressCB.updateUncompress(totalBZ2, pos);
+ progressCB.updateUncompress(totalBZ2, static_cast<Int>(pos));
file.write(bytesBZ2, sz);
if(!file)
diff --git a/cpp/src/IcePatch/IcePatchI.cpp b/cpp/src/IcePatch/IcePatchI.cpp
index ffb7490cbc2..3d84cae16b1 100644
--- a/cpp/src/IcePatch/IcePatchI.cpp
+++ b/cpp/src/IcePatch/IcePatchI.cpp
@@ -228,7 +228,7 @@ IcePatch::RegularI::getBZ2Size(const Current& current) const
}
}
- return infoBZ2.size;
+ return static_cast<Int>(infoBZ2.size);
}
catch(const IceUtil::ThreadLockedException&)
{
diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp
index e7465e1192c..036d7d6b1b7 100644
--- a/cpp/src/IcePatch/Util.cpp
+++ b/cpp/src/IcePatch/Util.cpp
@@ -790,7 +790,7 @@ IcePatch::createBZ2(const string& path, const Ice::LoggerPtr& logger)
if(file.gcount() > 0)
{
- BZ2_bzWrite(&bzError, bzFile, bytes, file.gcount());
+ BZ2_bzWrite(&bzError, bzFile, bytes, static_cast<int>(file.gcount()));
if(bzError != BZ_OK)
{
FileAccessException ex;
diff --git a/cpp/src/IceSSL/ConfigParser.cpp b/cpp/src/IceSSL/ConfigParser.cpp
index f6315094331..d9c3240e1a6 100644
--- a/cpp/src/IceSSL/ConfigParser.cpp
+++ b/cpp/src/IceSSL/ConfigParser.cpp
@@ -367,9 +367,9 @@ IceSSL::ConfigParser::getGeneral(ICE_XERCES_NS DOMNode* rootNode, GeneralConfig&
ICE_XERCES_NS DOMNamedNodeMap* attributes = general->getAttributes();
- int attrCount = attributes->getLength();
+ size_t attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
string nodeName = toString(attribute->getNodeName());
@@ -398,9 +398,9 @@ IceSSL::ConfigParser::getCertAuth(ICE_XERCES_NS DOMNode* rootNode, CertificateAu
ICE_XERCES_NS DOMNamedNodeMap* attributes = certAuthNode->getAttributes();
- int attrCount = attributes->getLength();
+ size_t attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
nodeName = toString(attribute->getNodeName());
@@ -525,9 +525,9 @@ IceSSL::ConfigParser::getCert(ICE_XERCES_NS DOMNode* rootNode, CertificateDesc&
int keySize = 0;
ICE_XERCES_NS DOMNamedNodeMap* attributes = rootNode->getAttributes();
- int attrCount = attributes->getLength();
+ size_t attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
string nodeName = toString(attribute->getNodeName());
@@ -562,9 +562,9 @@ IceSSL::ConfigParser::getDHParams(ICE_XERCES_NS DOMNode* rootNode, DiffieHellman
ICE_XERCES_NS DOMNamedNodeMap* attributes = rootNode->getAttributes();
int keySize = 0;
- int attrCount = attributes->getLength();
+ size_t attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
string nodeName = toString(attribute->getNodeName());
@@ -591,9 +591,9 @@ IceSSL::ConfigParser::loadCertificateFile(ICE_XERCES_NS DOMNode* rootNode, Certi
int encoding = 0; // Initialize, to keep the compiler from complaining.
ICE_XERCES_NS DOMNamedNodeMap* attributes = rootNode->getAttributes();
- int attrCount = attributes->getLength();
+ size_t attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
string nodeName = toString(attribute->getNodeName());
diff --git a/cpp/src/IceSSL/Convert.cpp b/cpp/src/IceSSL/Convert.cpp
index 343a5c000db..6162b772c1c 100644
--- a/cpp/src/IceSSL/Convert.cpp
+++ b/cpp/src/IceSSL/Convert.cpp
@@ -27,7 +27,7 @@ IceSSL::ucharToByteSeq(unsigned char* ucharBuffer, int length, Ice::ByteSeq& des
unsigned char*
IceSSL::byteSeqToUChar(const Ice::ByteSeq& sequence)
{
- int seqSize = sequence.size();
+ size_t seqSize = sequence.size();
assert(seqSize > 0);
diff --git a/cpp/src/IceSSL/DefaultCertificateVerifier.cpp b/cpp/src/IceSSL/DefaultCertificateVerifier.cpp
index b1457aec957..739d1d3ace4 100644
--- a/cpp/src/IceSSL/DefaultCertificateVerifier.cpp
+++ b/cpp/src/IceSSL/DefaultCertificateVerifier.cpp
@@ -62,7 +62,7 @@ IceSSL::DefaultCertificateVerifier::verify(int preVerifyOkay, X509_STORE_CTX* x5
X509* err_cert = X509_STORE_CTX_get_current_cert(x509StoreContext);
- X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf));
+ X509_NAME_oneline(X509_get_subject_name(err_cert), buf, int(sizeof(buf)));
Ice::Trace out(_logger, _traceLevels->securityCat);
@@ -79,7 +79,7 @@ IceSSL::DefaultCertificateVerifier::verify(int preVerifyOkay, X509_STORE_CTX* x5
{
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
{
- X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, sizeof(buf));
+ X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, int(sizeof(buf)));
out << "issuer = " << buf << "\n";
break;
}
diff --git a/cpp/src/IceSSL/OpenSSLUtils.cpp b/cpp/src/IceSSL/OpenSSLUtils.cpp
index c8eee143f12..f8fd7a2cd6c 100644
--- a/cpp/src/IceSSL/OpenSSLUtils.cpp
+++ b/cpp/src/IceSSL/OpenSSLUtils.cpp
@@ -338,7 +338,7 @@ IceSSL::getTempDH(unsigned char* p, int plen, unsigned char* g, int glen)
DH*
IceSSL::getTempDH512()
{
- DH* dh = getTempDH(dh512_p, sizeof(dh512_p), dh512_g, sizeof(dh512_g));
+ DH* dh = getTempDH(dh512_p, (int) sizeof(dh512_p), dh512_g, (int) sizeof(dh512_g));
return dh;
}
@@ -346,7 +346,7 @@ IceSSL::getTempDH512()
DH*
IceSSL::getTempDH1024()
{
- DH* dh = getTempDH(dh1024_p, sizeof(dh1024_p), dh1024_g, sizeof(dh1024_g));
+ DH* dh = getTempDH(dh1024_p, (int) sizeof(dh1024_p), dh1024_g, (int) sizeof(dh1024_g));
return dh;
}
@@ -354,7 +354,7 @@ IceSSL::getTempDH1024()
DH*
IceSSL::getTempDH2048()
{
- DH* dh = getTempDH(dh2048_p, sizeof(dh2048_p), dh2048_g, sizeof(dh2048_g));
+ DH* dh = getTempDH(dh2048_p, (int) sizeof(dh2048_p), dh2048_g, (int) sizeof(dh2048_g));
return dh;
}
@@ -362,7 +362,7 @@ IceSSL::getTempDH2048()
DH*
IceSSL::getTempDH4096()
{
- DH* dh = getTempDH(dh4096_p, sizeof(dh4096_p), dh4096_g, sizeof(dh4096_g));
+ DH* dh = getTempDH(dh4096_p, (int) sizeof(dh4096_p), dh4096_g, (int) sizeof(dh4096_g));
return dh;
}
@@ -379,7 +379,7 @@ IceSSL::sslGetErrors()
const char* data = 0;
int line = 0;
int flags = 0;
- unsigned errorCode = 0;
+ unsigned long errorCode = 0;
int errorNum = 1;
unsigned long es = CRYPTO_thread_id();
@@ -389,7 +389,7 @@ IceSSL::sslGetErrors()
sprintf(bigBuffer,"%6d - Thread ID: %lu\n", errorNum, es);
errorMessage += bigBuffer;
- sprintf(bigBuffer,"%6d - Error: %u\n", errorNum, errorCode);
+ sprintf(bigBuffer,"%6d - Error: %lu\n", errorNum, errorCode);
errorMessage += bigBuffer;
// Request an error from the OpenSSL library
@@ -451,7 +451,7 @@ static const char* errorStrings[] =
};
string
-IceSSL::getVerificationError(int errorCode)
+IceSSL::getVerificationError(long errorCode)
{
string errString;
diff --git a/cpp/src/IceSSL/OpenSSLUtils.h b/cpp/src/IceSSL/OpenSSLUtils.h
index 2815ec4b059..9551fd29193 100644
--- a/cpp/src/IceSSL/OpenSSLUtils.h
+++ b/cpp/src/IceSSL/OpenSSLUtils.h
@@ -36,7 +36,7 @@ DH* getTempDH4096();
std::string sslGetErrors();
-std::string getVerificationError(int);
+std::string getVerificationError(long);
}
diff --git a/cpp/src/IceSSL/ServerContext.cpp b/cpp/src/IceSSL/ServerContext.cpp
index 94e9b6647fe..6b927caffda 100644
--- a/cpp/src/IceSSL/ServerContext.cpp
+++ b/cpp/src/IceSSL/ServerContext.cpp
@@ -52,7 +52,7 @@ IceSSL::ServerContext::configure(const GeneralConfig& generalConfig,
string connectionContext = generalConfig.getContext();
SSL_CTX_set_session_id_context(_sslContext,
reinterpret_cast<const unsigned char *>(connectionContext.c_str()),
- connectionContext.size());
+ (unsigned int) connectionContext.size());
if(_traceLevels->security >= SECURITY_PROTOCOL)
{
diff --git a/cpp/src/IceSSL/SslClientTransceiver.cpp b/cpp/src/IceSSL/SslClientTransceiver.cpp
index bac298101f2..1b58023be0c 100644
--- a/cpp/src/IceSSL/SslClientTransceiver.cpp
+++ b/cpp/src/IceSSL/SslClientTransceiver.cpp
@@ -42,7 +42,7 @@ IceSSL::SslClientTransceiver::write(Buffer& buf, int timeout)
int totalBytesWritten = 0;
int bytesWritten = 0;
- int packetSize = buf.b.end() - buf.i;
+ Buffer::Container::difference_type packetSize = buf.b.end() - buf.i;
#ifdef _WIN32
//
@@ -74,7 +74,7 @@ IceSSL::SslClientTransceiver::write(Buffer& buf, int timeout)
break;
}
- bytesWritten = sslWrite(static_cast<char*>(&*buf.i), packetSize);
+ bytesWritten = sslWrite(static_cast<char*>(&*buf.i), static_cast<Int>(packetSize));
switch(getLastError())
{
@@ -303,7 +303,7 @@ IceSSL::SslClientTransceiver::handshake(int timeout)
case SSL_ERROR_SSL:
{
- int verifyError = SSL_get_verify_result(_sslConnection);
+ long verifyError = SSL_get_verify_result(_sslConnection);
if(verifyError != X509_V_OK && verifyError != 1)
{
diff --git a/cpp/src/IceSSL/SslServerTransceiver.cpp b/cpp/src/IceSSL/SslServerTransceiver.cpp
index e6195d7d13a..88b48696706 100644
--- a/cpp/src/IceSSL/SslServerTransceiver.cpp
+++ b/cpp/src/IceSSL/SslServerTransceiver.cpp
@@ -44,7 +44,7 @@ IceSSL::SslServerTransceiver::write(Buffer& buf, int timeout)
int totalBytesWritten = 0;
int bytesWritten = 0;
- int packetSize = buf.b.end() - buf.i;
+ Buffer::Container::difference_type packetSize = buf.b.end() - buf.i;
#ifdef _WIN32
//
@@ -75,7 +75,7 @@ IceSSL::SslServerTransceiver::write(Buffer& buf, int timeout)
break;
}
- bytesWritten = sslWrite(static_cast<char*>(&*buf.i), packetSize);
+ bytesWritten = sslWrite(static_cast<char*>(&*buf.i), static_cast<Int>(packetSize));
switch(getLastError())
{
diff --git a/cpp/src/IceSSL/SslTransceiver.cpp b/cpp/src/IceSSL/SslTransceiver.cpp
index 567d4a9e9e6..f5b3b5c34c2 100644
--- a/cpp/src/IceSSL/SslTransceiver.cpp
+++ b/cpp/src/IceSSL/SslTransceiver.cpp
@@ -111,7 +111,7 @@ IceSSL::SslTransceiver::read(Buffer& buf, int timeout)
_plugin->registerThread();
- int packetSize = buf.b.end() - buf.i;
+ Buffer::Container::difference_type packetSize = buf.b.end() - buf.i;
int totalBytesRead = 0;
int bytesRead;
@@ -152,7 +152,7 @@ IceSSL::SslTransceiver::read(Buffer& buf, int timeout)
_readTimeout = timeout;
- bytesRead = sslRead(static_cast<char*>(&*buf.i), packetSize);
+ bytesRead = sslRead(static_cast<char*>(&*buf.i), static_cast<Int>(packetSize));
switch(getLastError())
{
@@ -818,10 +818,10 @@ IceSSL::SslTransceiver::showCertificateChain(BIO* bio)
for(int i = 0; i < sk_X509_num(sk); i++)
{
- X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk,i)), buffer, sizeof(buffer));
+ X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk,i)), buffer, int(sizeof(buffer)));
BIO_printf(bio, "%2d s:%s\n", i, buffer);
- X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk,i)), buffer, sizeof(buffer));
+ X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk,i)), buffer, int(sizeof(buffer)));
BIO_printf(bio, " i:%s\n", buffer);
PEM_write_bio_X509(bio, sk_X509_value(sk, i));
@@ -847,10 +847,10 @@ IceSSL::SslTransceiver::showPeerCertificate(BIO* bio, const char* connType)
BIO_printf(bio, "%s Certificate\n", connType);
PEM_write_bio_X509(bio, peerCert);
- X509_NAME_oneline(X509_get_subject_name(peerCert), buffer, sizeof(buffer));
+ X509_NAME_oneline(X509_get_subject_name(peerCert), buffer, int(sizeof(buffer)));
BIO_printf(bio, "subject=%s\n", buffer);
- X509_NAME_oneline(X509_get_issuer_name(peerCert), buffer, sizeof(buffer));
+ X509_NAME_oneline(X509_get_issuer_name(peerCert), buffer, int(sizeof(buffer)));
BIO_printf(bio, "issuer=%s\n", buffer);
EVP_PKEY *pktmp;
@@ -875,7 +875,7 @@ IceSSL::SslTransceiver::showSharedCiphers(BIO* bio)
char buffer[4096];
char* strPointer = 0;
- if((strPointer = SSL_get_shared_ciphers(_sslConnection, buffer, sizeof(buffer))) != 0)
+ if((strPointer = SSL_get_shared_ciphers(_sslConnection, buffer, int(sizeof(buffer)))) != 0)
{
// This works only for SSL 2. In later protocol versions, the client does not know
// what other ciphers (in addition to the one to be used in the current connection)
@@ -968,8 +968,8 @@ IceSSL::SslTransceiver::showClientCAList(BIO* bio, const char* connType)
for(int i = 0; i < sk_X509_NAME_num(sk); i++)
{
- X509_NAME_oneline(sk_X509_NAME_value(sk, i), buffer, sizeof(buffer));
- BIO_write(bio, buffer, strlen(buffer));
+ X509_NAME_oneline(sk_X509_NAME_value(sk, i), buffer, int(sizeof(buffer)));
+ BIO_write(bio, buffer, int(strlen(buffer)));
BIO_write(bio,"\n", 1);
}
}
diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp
index 974ca9f8d85..bd238b8846d 100644
--- a/cpp/src/IceStorm/Parser.cpp
+++ b/cpp/src/IceStorm/Parser.cpp
@@ -461,7 +461,7 @@ Parser::getInput(char* buf, int& result, int maxSize)
}
}
- result = line.length();
+ result = (int) line.length();
if(result > maxSize)
{
error("input line too long");
@@ -477,7 +477,7 @@ Parser::getInput(char* buf, int& result, int maxSize)
}
else
{
- if(((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ if(((result = (int) fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
{
error("input in flex scanner failed");
buf[0] = EOF;
diff --git a/cpp/src/IceStorm/Scanner.l b/cpp/src/IceStorm/Scanner.l
index 0f7d7da728b..caac4678403 100644
--- a/cpp/src/IceStorm/Scanner.l
+++ b/cpp/src/IceStorm/Scanner.l
@@ -125,8 +125,8 @@ NL [\n]
}
{WS}*(\\{WS}*{NL})? {
- int len = strlen(yytext);
- for(int i = 0; i < len; ++i)
+ size_t len = strlen(yytext);
+ for(size_t i = 0; i < len; ++i)
{
if(yytext[i] == '\\')
{
@@ -140,8 +140,8 @@ NL [\n]
}
{NL}|; {
- int len = strlen(yytext);
- for(int i = 0; i < len; ++i)
+ size_t len = strlen(yytext);
+ for(size_t i = 0; i < len; ++i)
{
if(yytext[i] == '\n')
{
diff --git a/cpp/src/IceStorm/WeightedGraph.cpp b/cpp/src/IceStorm/WeightedGraph.cpp
index 6f006893dce..25c11877998 100644
--- a/cpp/src/IceStorm/WeightedGraph.cpp
+++ b/cpp/src/IceStorm/WeightedGraph.cpp
@@ -262,12 +262,12 @@ WeightedGraph::getEdgesFor(const std::string& vertex) const
map<std::string, int>::const_iterator p = _vlookup.find(vertex);
if(p != _vlookup.end())
{
- int row = p->second * _vertices.size();
- for(unsigned int i = row; i < row + _vertices.size(); ++i)
+ size_t row = p->second * _vertices.size();
+ for(size_t i = row; i < row + _vertices.size(); ++i)
{
if(_edges[i] != -1)
{
- edges.push_back(make_pair(_vertices[i-row], _edges[i]));
+ edges.push_back(make_pair(_vertices[i - row], _edges[i]));
}
}
}
@@ -346,14 +346,14 @@ WeightedGraph::visit(unsigned int vertex, int cost, list<pair<unsigned int, int>
// Run through each edges for this vertex (that's a row in the
// adjacency matrix).
//
- int row = vertex * _vertices.size();
- for(unsigned int i = row ; i < row + _vertices.size() ; ++i)
+ size_t row = vertex * _vertices.size();
+ for(size_t i = row ; i < row + _vertices.size() ; ++i)
{
if(_edges[i] != -1)
{
if(cost + _edges[i] <= max)
{
- visit(i - row, cost + _edges[i], visited, max);
+ visit(static_cast<unsigned int>(i - row), cost + _edges[i], visited, max);
}
}
}
diff --git a/cpp/src/IceUtil/UUID.cpp b/cpp/src/IceUtil/UUID.cpp
index 9fe4ea8eb64..910158b112a 100644
--- a/cpp/src/IceUtil/UUID.cpp
+++ b/cpp/src/IceUtil/UUID.cpp
@@ -45,9 +45,9 @@ inline void halfByteToHex(unsigned char hb, char*& hexBuffer)
}
}
-inline void bytesToHex(unsigned char* bytes, int len, char*& hexBuffer)
+inline void bytesToHex(unsigned char* bytes, size_t len, char*& hexBuffer)
{
- for(int i = 0; i < len; i++)
+ for(size_t i = 0; i < len; i++)
{
halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
halfByteToHex((bytes[i] & 0x0F), hexBuffer);
@@ -134,7 +134,7 @@ IceUtil::generateUUID()
assert(sizeof(UUID) == 16);
- ssize_t bytesRead = read(fd, &uuid, sizeof(UUID));
+ size_t bytesRead = read(fd, &uuid, sizeof(UUID));
if (bytesRead != sizeof(UUID))
{
diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp
index 343c99d1547..4ae72e53b1c 100644
--- a/cpp/src/IceXML/StreamI.cpp
+++ b/cpp/src/IceXML/StreamI.cpp
@@ -244,7 +244,7 @@ IceXML::StreamI::StreamI(const ::Ice::CommunicatorPtr& communicator, std::istrea
bool errorsOccured = false;
try
{
- ICE_XERCES_NS MemBufInputSource source((const XMLByte*)_content.data(), _content.size(), "inputsource");
+ ICE_XERCES_NS MemBufInputSource source((const XMLByte*)_content.data(), (unsigned int) _content.size(), "inputsource");
parser.parse(source);
if(parser.getErrorCount() > 0)
{
@@ -474,7 +474,7 @@ IceXML::StreamI::readEnum(const string& name, const ::Ice::StringSeq& table)
endRead();
- return p - table.begin();
+ return ::Ice::Int(p - table.begin());
}
void
@@ -492,7 +492,7 @@ IceXML::StreamI::writeByte(const string& name, ::Ice::Byte value)
void
IceXML::StreamI::writeByteSeq(const string& name, const ::Ice::ByteSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::ByteSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
startWriteSequenceElement();
@@ -600,7 +600,7 @@ IceXML::StreamI::writeBool(const string& name, bool value)
void
IceXML::StreamI::writeBoolSeq(const string& name, const ::Ice::BoolSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::BoolSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e") << (*p ? "true" : "false") << ee;
@@ -661,7 +661,7 @@ IceXML::StreamI::writeShort(const string& name, ::Ice::Short value)
void
IceXML::StreamI::writeShortSeq(const string& name, const ::Ice::ShortSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::ShortSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e") << *p << ee;
@@ -727,7 +727,7 @@ IceXML::StreamI::writeInt(const string& name, ::Ice::Int value)
void
IceXML::StreamI::writeIntSeq(const string& name, const ::Ice::IntSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::IntSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e") << *p << ee;
@@ -788,7 +788,7 @@ IceXML::StreamI::writeLong(const string& name, ::Ice::Long value)
void
IceXML::StreamI::writeLongSeq(const string& name, const ::Ice::LongSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::LongSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e") << *p << ee;
@@ -855,7 +855,7 @@ IceXML::StreamI::writeFloat(const string& name, ::Ice::Float value)
void
IceXML::StreamI::writeFloatSeq(const string& name, const ::Ice::FloatSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::FloatSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e") << *p << ee;
@@ -916,7 +916,7 @@ IceXML::StreamI::writeDouble(const string& name, ::Ice::Double value)
void
IceXML::StreamI::writeDoubleSeq(const string& name, const ::Ice::DoubleSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::DoubleSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e") << *p << ee;
@@ -983,7 +983,7 @@ IceXML::StreamI::writeString(const string& name, const string& value)
void
IceXML::StreamI::writeStringSeq(const string& name, const ::Ice::StringSeq& seq)
{
- startWriteSequence(name, seq.size());
+ startWriteSequence(name, ::Ice::Int(seq.size()));
for(::Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << se("e");
@@ -1380,8 +1380,8 @@ void
IceXML::StreamI::readAttributes(::std::string& id, ::std::string& type, ::std::string& href)
{
ICE_XERCES_NS DOMNamedNodeMap* attributes = _input->current->getAttributes();
- int attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ size_t attrCount = attributes->getLength();
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
string name = toString(attribute->getNodeName());
@@ -1404,8 +1404,8 @@ IceXML::StreamI::readAttributes(::std::string& id, ::std::string& type, ::std::s
IceXML::StreamI::readLength()
{
ICE_XERCES_NS DOMNamedNodeMap* attributes = _input->current->getAttributes();
- int attrCount = attributes->getLength();
- for(int i = 0; i < attrCount; i++)
+ size_t attrCount = attributes->getLength();
+ for(size_t i = 0; i < attrCount; i++)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
string name = toString(attribute->getNodeName());
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 3976698b4ce..92bd2f0a1dc 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -38,6 +38,7 @@ toLower(string& s)
transform(s.begin(), s.end(), s.begin(), ::tolower);
}
+
// ----------------------------------------------------------------------
// SyntaxTreeBase
// ----------------------------------------------------------------------
@@ -3021,7 +3022,15 @@ Slice::Const::typesAreCompatible(const string& name, const TypePtr& constType,
const UnitPtr& unit)
{
BuiltinPtr ct = BuiltinPtr::dynamicCast(constType);
+
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
+// Strange Sun C++ 5.3 bug
+ const IceUtil::HandleBase<SyntaxTreeBase>& hb = literalType;
+ BuiltinPtr lt = BuiltinPtr::dynamicCast(hb);
+#else
BuiltinPtr lt = BuiltinPtr::dynamicCast(literalType);
+#endif
+
if(ct && lt)
{
switch(ct->kind())
diff --git a/cpp/src/XMLTransform/XMLTransform.cpp b/cpp/src/XMLTransform/XMLTransform.cpp
index 4a7e4171c4a..aa193397b55 100644
--- a/cpp/src/XMLTransform/XMLTransform.cpp
+++ b/cpp/src/XMLTransform/XMLTransform.cpp
@@ -369,7 +369,7 @@ XMLTransform::DocumentInfo::DocumentInfo(ICE_XERCES_NS DOMDocument* document, bo
_targetNamespace(targetNamespace)
{
ICE_XERCES_NS DOMNamedNodeMap* attributes = root->getAttributes();
- unsigned int max = attributes->getLength();
+ size_t max = attributes->getLength();
for(unsigned int i = 0; i < max; ++i)
{
ICE_XERCES_NS DOMNode* attribute = attributes->item(i);
@@ -2971,7 +2971,7 @@ XMLTransform::DBTransformer::transform(ICE_XERCES_NS DOMDocument* oldSchema, ICE
fullKey.append(header);
fullKey.append(&k[0], k.size());
fullKey.append(footer);
- ICE_XERCES_NS MemBufInputSource keySource((const XMLByte*)fullKey.data(), fullKey.size(), "key");
+ ICE_XERCES_NS MemBufInputSource keySource((const XMLByte*)fullKey.data(), static_cast<unsigned int>(fullKey.size()), "key");
parser.parse(keySource);
ICE_XERCES_NS DOMDocument* keyDoc = parser.getDocument();
@@ -2992,8 +2992,9 @@ XMLTransform::DBTransformer::transform(ICE_XERCES_NS DOMDocument* oldSchema, ICE
fullValue.append(header);
fullValue.append(&value[0], value.size());
fullValue.append(footer);
- ICE_XERCES_NS MemBufInputSource valueSource((const XMLByte*)fullValue.data(), fullValue.size(),
- "value");
+ ICE_XERCES_NS MemBufInputSource valueSource((const XMLByte*)fullValue.data(),
+ static_cast<unsigned int>(fullValue.size()),
+ "value");
parser.parse(valueSource);
ICE_XERCES_NS DOMDocument* valueDoc = parser.getDocument();
@@ -3149,7 +3150,9 @@ XMLTransform::DBTransformer::transform(const string& schemaStr)
try
{
- ICE_XERCES_NS MemBufInputSource source((const XMLByte*)schemaStr.data(), schemaStr.size(), "schema");
+ ICE_XERCES_NS MemBufInputSource source((const XMLByte*)schemaStr.data(),
+ static_cast<unsigned int>(schemaStr.size()),
+ "schema");
parser.parse(source);
schema = parser.getDocument();
}
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 8263d3b959f..22440e3bc06 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -861,7 +861,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string scoped = fixKwd(p->scoped());
string scope = fixKwd(p->scope());
- int sz = enumerators.size();
+ size_t sz = enumerators.size();
assert(sz <= 0x7fffffff); // 64-bit enums are not supported
H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");";
@@ -2067,7 +2067,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
StringList::const_iterator firstIter = ids.begin();
StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped());
assert(scopedIter != ids.end());
- int scopedPos = ice_distance(firstIter, scopedIter);
+ StringList::difference_type scopedPos = ice_distance(firstIter, scopedIter);
StringList::const_iterator q;
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 2cc87fef63e..3abf2d73957 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -387,7 +387,8 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
StringList::const_iterator firstIter = ids.begin();
StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
assert(scopedIter != ids.end());
- int scopedPos = ice_distance(firstIter, scopedIter);
+ StringList::difference_type scopedPos
+ = ice_distance(firstIter, scopedIter);
out << sp << nl << "public static final String[] __ids =";
out << sb;
@@ -1714,7 +1715,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string absolute = getAbsolute(scoped);
EnumeratorList enumerators = p->getEnumerators();
EnumeratorList::const_iterator en;
- int sz = enumerators.size();
+ size_t sz = enumerators.size();
if(!open(absolute))
{