summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2003-04-09 15:03:35 +0000
committerBernard Normier <bernard@zeroc.com>2003-04-09 15:03:35 +0000
commit3cbc97486f02fdd25a532af96146aa956e51e26d (patch)
tree49dadb69954c3c3ef6ce87a9320b8c5c7bb714b8 /cpp/src
parentadding Strategy.ice (diff)
downloadice-3cbc97486f02fdd25a532af96146aa956e51e26d.tar.bz2
ice-3cbc97486f02fdd25a532af96146aa956e51e26d.tar.xz
ice-3cbc97486f02fdd25a532af96146aa956e51e26d.zip
Solaris/Sun C++ 5.4 port
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/EvictorI.cpp4
-rw-r--r--cpp/src/Glacier/StarterI.cpp13
-rw-r--r--cpp/src/Ice/Application.cpp4
-rw-r--r--cpp/src/Ice/Connection.cpp4
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp18
-rw-r--r--cpp/src/Ice/Incoming.cpp4
-rw-r--r--cpp/src/Ice/Instance.cpp4
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp6
-rw-r--r--cpp/src/Ice/Network.cpp4
-rw-r--r--cpp/src/Ice/Object.cpp12
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.cpp4
-rw-r--r--cpp/src/Ice/ObjectFactoryManager.cpp6
-rw-r--r--cpp/src/Ice/RouterInfo.cpp4
-rw-r--r--cpp/src/Ice/RoutingTable.cpp2
-rw-r--r--cpp/src/Ice/ServantManager.cpp12
-rw-r--r--cpp/src/Ice/UserExceptionFactoryManager.cpp4
-rw-r--r--cpp/src/IcePack/AdapterRegistryI.cpp2
-rw-r--r--cpp/src/IcePack/ComponentBuilder.cpp87
-rw-r--r--cpp/src/IcePack/Makefile2
-rw-r--r--cpp/src/IcePack/NodeRegistryI.cpp2
-rw-r--r--cpp/src/IcePack/ObjectRegistryI.cpp4
-rw-r--r--cpp/src/IcePack/Parser.cpp7
-rw-r--r--cpp/src/IcePack/ServerRegistryI.cpp2
-rw-r--r--cpp/src/IcePatch/IcePatchI.cpp4
-rw-r--r--cpp/src/IcePatch/Util.cpp2
-rw-r--r--cpp/src/IceStorm/Makefile2
-rw-r--r--cpp/src/IceStorm/Parser.cpp7
-rw-r--r--cpp/src/IceStorm/TopicManagerI.cpp2
-rw-r--r--cpp/src/IceStorm/WeightedGraph.cpp2
-rw-r--r--cpp/src/IceXML/StreamI.cpp2
-rw-r--r--cpp/src/Slice/Grammar.y26
-rw-r--r--cpp/src/Slice/Parser.cpp22
-rw-r--r--cpp/src/XMLTransform/XMLTransform.cpp50
-rw-r--r--cpp/src/icecpp/config.h10
-rw-r--r--cpp/src/slice2cpp/Gen.cpp24
-rw-r--r--cpp/src/slice2java/Gen.cpp14
36 files changed, 220 insertions, 158 deletions
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp
index 4094cd4a902..ae791ab5f81 100644
--- a/cpp/src/Freeze/EvictorI.cpp
+++ b/cpp/src/Freeze/EvictorI.cpp
@@ -144,6 +144,7 @@ Freeze::EvictorI::createObject(const Identity& ident, const ObjectPtr& servant)
//
// Save the Ice object's initial state and add it to the queue.
//
+
save(ident, servant);
add(ident, servant);
@@ -397,7 +398,7 @@ Freeze::EvictorI::save(const Identity& ident, const ObjectPtr& servant)
// NOTE: Do not synchronize on the evictor mutex or else
// deadlocks may occur.
//
- _dict.insert(make_pair(ident, servant));
+ _dict.insert(pair<const Identity, const ObjectPtr>(ident, servant));
}
void
@@ -435,6 +436,7 @@ Freeze::EvictorI::evict()
Identity ident = *p;
EvictorElementPtr element = q->second;
+
//
// Notify the persistence strategy about the evicted object.
//
diff --git a/cpp/src/Glacier/StarterI.cpp b/cpp/src/Glacier/StarterI.cpp
index 48a251b57fb..f3dcaae308e 100644
--- a/cpp/src/Glacier/StarterI.cpp
+++ b/cpp/src/Glacier/StarterI.cpp
@@ -16,19 +16,20 @@
# error Sorry, the Glacier Starter is not yet supported on WIN32.
#endif
-#include <IceUtil/UUID.h>
-#include <IceSSL/RSAKeyPair.h>
-#include <Glacier/StarterI.h>
-#include <fcntl.h>
-
//
// crypt.h is necessary on older Linux distributions, but not with
// OpenSSL 0.96x.
//
-#if defined(__linux__) && OPENSSL_VERSION_NUMBER >= 0x0090700fL
+#if (defined(__linux__) || defined(__sun))
# include <crypt.h>
#endif
+
+#include <IceUtil/UUID.h>
+#include <IceSSL/RSAKeyPair.h>
+#include <Glacier/StarterI.h>
+#include <fcntl.h>
+
using namespace std;
using namespace Ice;
using namespace Glacier;
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index 40ed1359dbd..943514b6f16 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -14,6 +14,10 @@
#include <Ice/Application.h>
+#ifndef _WIN32
+#include <signal.h>
+#endif
+
using namespace std;
using namespace Ice;
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 21a74876acd..c26a7258c03 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -449,7 +449,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway)
//
if(!_endpoint->datagram() && !oneway)
{
- _requestsHint = _requests.insert(_requests.end(), make_pair(requestId, out));
+ _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
}
if(_acmTimeout > 0)
@@ -547,7 +547,7 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out)
//
// Only add to the request map if there was no exception.
//
- _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), make_pair(requestId, out));
+ _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), pair<const Int, OutgoingAsyncPtr>(requestId, out));
if(_acmTimeout > 0)
{
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 1369246940d..ea5086b930f 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -57,7 +57,7 @@ IceInternal::OutgoingConnectionFactory::destroy()
(&Connection::destroy), Connection::CommunicatorDestroyed));
#else
for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::secondVoidMemFun1<EndpointPtr, Connection, Connection::DestructionReason>
+ bind2nd(Ice::secondVoidMemFun1<const EndpointPtr, Connection, Connection::DestructionReason>
(&Connection::destroy), Connection::CommunicatorDestroyed));
#endif
@@ -83,7 +83,7 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished()
// finished.
//
for_each(_connections.begin(), _connections.end(),
- Ice::secondVoidMemFun<EndpointPtr, Connection>(&Connection::waitUntilFinished));
+ Ice::secondVoidMemFun<const EndpointPtr, Connection>(&Connection::waitUntilFinished));
//
// We're done, now we can throw away all connections.
@@ -144,8 +144,8 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
//
for(q = endpoints.begin(); q != endpoints.end(); ++q)
{
- pair<multimap<EndpointPtr, ConnectionPtr>::const_iterator,
- multimap<EndpointPtr, ConnectionPtr>::const_iterator> r = _connections.equal_range(*q);
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(*q);
while(r.first != r.second)
{
@@ -201,8 +201,8 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
{
for(q = endpoints.begin(); q != endpoints.end(); ++q)
{
- pair<multimap<EndpointPtr, ConnectionPtr>::const_iterator,
- multimap<EndpointPtr, ConnectionPtr>::const_iterator> r = _connections.equal_range(*q);
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(*q);
while(r.first != r.second)
{
@@ -295,7 +295,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
}
else
{
- _connections.insert(_connections.end(), make_pair(connection->endpoint(), connection));
+ _connections.insert(_connections.end(), pair<const EndpointPtr, ConnectionPtr>(connection->endpoint(), connection));
if(_destroyed)
{
@@ -350,8 +350,8 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router)
endpoint = endpoint->compress(defaultsAndOverrides->overrideCompressValue);
}
- pair<multimap<EndpointPtr, ConnectionPtr>::const_iterator,
- multimap<EndpointPtr, ConnectionPtr>::const_iterator> r = _connections.equal_range(endpoint);
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(endpoint);
while(r.first != r.second)
{
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index b4bf6d7734c..8ee0c45e08c 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -143,8 +143,8 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
_is.readSize(sz);
while(sz--)
{
- pair<string, string> pr;
- _is.read(pr.first);
+ pair<const string, string> pr;
+ _is.read(const_cast<string&>(pr.first));
_is.read(pr.second);
_current.ctx.insert(_current.ctx.end(), pr);
}
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index c69093250f2..d99564a7a72 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -42,7 +42,7 @@
#endif
#ifndef _WIN32
-# include <csignal>
+# include <signal.h>
# include <syslog.h>
# include <pwd.h>
# include <sys/types.h>
@@ -590,7 +590,7 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
LocatorPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultLocator)));
}
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__sun)
//
// daemon() must be called after any plug-ins have been
// installed. For example, an SSL plug-in might want to
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index 32ac46b7b78..358ec4fe298 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -48,7 +48,7 @@ IceInternal::LocatorManager::destroy()
{
IceUtil::Mutex::Lock sync(*this);
- for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<LocatorPrx, LocatorInfo>(&LocatorInfo::destroy));
+ for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<const LocatorPrx, LocatorInfo>(&LocatorInfo::destroy));
_table.clear();
_tableHint = _table.end();
@@ -98,10 +98,10 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
if(t == _locatorTables.end())
{
t = _locatorTables.insert(_locatorTables.begin(),
- make_pair(locator->ice_getIdentity(), new LocatorTable()));
+ pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(), new LocatorTable()));
}
- _tableHint = _table.insert(_tableHint, make_pair(locator, new LocatorInfo(locator, t->second)));
+ _tableHint = _table.insert(_tableHint, pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second)));
}
else
{
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 73c14933493..8809debefba 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -603,6 +603,10 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
addr.sin_port = htons(port);
addr.sin_addr.s_addr = inet_addr(host.c_str());
+#ifdef __sun
+#define INADDR_NONE -1
+#endif
+
if(addr.sin_addr.s_addr == INADDR_NONE)
{
IceUtil::Mutex::Lock sync(getHostByNameMutex);
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index 5e1397a2c9b..b2b8d81a458 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -164,7 +164,7 @@ string Ice::Object::__all[] =
DispatchStatus
Ice::Object::__dispatch(Incoming& in, const Current& current)
{
- pair<const string*, const string*> r =
+ pair<string*, string*> r =
equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
if(r.first == r.second)
@@ -226,8 +226,8 @@ Ice::Object::__read(::IceInternal::BasicStream* __is)
while(sz-- > 0)
{
- pair<string, ObjectPtr> v;
- __is->read(v.first);
+ pair<const string, ObjectPtr> v;
+ __is->read(const_cast<string&>(v.first));
__is->read("", 0, v.second);
_activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, v);
}
@@ -263,8 +263,8 @@ Ice::Object::__unmarshal(const ::Ice::StreamPtr& __is)
while(sz-- > 0)
{
__is->startReadDictionaryElement();
- pair<string, ObjectPtr> v;
- v.first = __is->readString("ice:key");
+ pair<const string, ObjectPtr> v;
+ const_cast<string&>(v.first) = __is->readString("ice:key");
v.second = __is->readObject("ice:value", "", 0);
_activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, v);
__is->endReadDictionaryElement();
@@ -298,7 +298,7 @@ Ice::Object::ice_addFacet(const ObjectPtr& facet, const string& name)
throw ex;
}
- _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, make_pair(name, facet));
+ _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, pair<const string, ObjectPtr>(name, facet));
}
ObjectPtr
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp
index e02d3b2ea23..c87ce94bf31 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.cpp
+++ b/cpp/src/Ice/ObjectAdapterFactory.cpp
@@ -39,7 +39,7 @@ IceInternal::ObjectAdapterFactory::shutdown()
}
for_each(_adapters.begin(), _adapters.end(),
- Ice::secondVoidMemFun<string, ObjectAdapter>(&ObjectAdapter::deactivate));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::deactivate));
_instance = 0;
_communicator = 0;
@@ -76,7 +76,7 @@ IceInternal::ObjectAdapterFactory::waitForShutdown()
// Now we wait for deactivation of each object adapter.
//
for_each(_adapters.begin(), _adapters.end(),
- Ice::secondVoidMemFun<string, ObjectAdapter>(&ObjectAdapter::waitForDeactivate));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::waitForDeactivate));
//
// We're done, now we can throw away the object adapters.
diff --git a/cpp/src/Ice/ObjectFactoryManager.cpp b/cpp/src/Ice/ObjectFactoryManager.cpp
index 8414337507b..75b6381d96d 100644
--- a/cpp/src/Ice/ObjectFactoryManager.cpp
+++ b/cpp/src/Ice/ObjectFactoryManager.cpp
@@ -31,7 +31,7 @@ IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const st
{
IceUtil::Mutex::Lock sync(*this);
- if( (_factoryMapHint != _factoryMap.end() && _factoryMapHint->first == id)
+ if((_factoryMapHint != _factoryMap.end() && _factoryMapHint->first == id)
|| _factoryMap.find(id) != _factoryMap.end())
{
AlreadyRegisteredException ex(__FILE__, __LINE__);
@@ -40,7 +40,7 @@ IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const st
throw ex;
}
- _factoryMapHint = _factoryMap.insert(_factoryMapHint, make_pair(id, factory));
+ _factoryMapHint = _factoryMap.insert(_factoryMapHint, pair<const string, ObjectFactoryPtr>(id, factory));
}
void
@@ -125,7 +125,7 @@ IceInternal::ObjectFactoryManager::destroy()
{
IceUtil::Mutex::Lock sync(*this);
for_each(_factoryMap.begin(), _factoryMap.end(),
- Ice::secondVoidMemFun<string, ObjectFactory>(&ObjectFactory::destroy));
+ Ice::secondVoidMemFun<const string, ObjectFactory>(&ObjectFactory::destroy));
_factoryMap.clear();
_factoryMapHint = _factoryMap.end();
}
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp
index e3847a989c4..b849e285293 100644
--- a/cpp/src/Ice/RouterInfo.cpp
+++ b/cpp/src/Ice/RouterInfo.cpp
@@ -38,7 +38,7 @@ IceInternal::RouterManager::destroy()
{
IceUtil::Mutex::Lock sync(*this);
- for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<RouterPrx, RouterInfo>(&RouterInfo::destroy));
+ for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<const RouterPrx, RouterInfo>(&RouterInfo::destroy));
_table.clear();
_tableHint = _table.end();
@@ -73,7 +73,7 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
if(p == _table.end())
{
- _tableHint = _table.insert(_tableHint, make_pair(router, new RouterInfo(router)));
+ _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
}
else
{
diff --git a/cpp/src/Ice/RoutingTable.cpp b/cpp/src/Ice/RoutingTable.cpp
index b9ed35d9a92..d3016d3b00b 100644
--- a/cpp/src/Ice/RoutingTable.cpp
+++ b/cpp/src/Ice/RoutingTable.cpp
@@ -65,7 +65,7 @@ IceInternal::RoutingTable::add(const ObjectPrx& prx)
if(p == _table.end())
{
- _tableHint = _table.insert(_tableHint, make_pair(proxy->ice_getIdentity(), proxy));
+ _tableHint = _table.insert(_tableHint, pair<const Identity, ObjectPrx>(proxy->ice_getIdentity(), proxy));
return true;
}
else
diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp
index 544a95a873e..6b01f5f74ae 100644
--- a/cpp/src/Ice/ServantManager.cpp
+++ b/cpp/src/Ice/ServantManager.cpp
@@ -41,7 +41,7 @@ IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity&
throw ex;
}
- _servantMapHint = _servantMap.insert(_servantMapHint, make_pair(ident, object));
+ _servantMapHint = _servantMap.insert(_servantMapHint, ObjectDict::value_type(ident, object));
}
void
@@ -71,7 +71,7 @@ IceInternal::ServantManager::findServant(const Identity& ident) const
assert(_instance); // Must not be called after destruction.
- if(_servantMapHint != _servantMap.end())
+ if(_servantMap.end() != _servantMapHint)
{
if(_servantMapHint->first == ident)
{
@@ -80,7 +80,7 @@ IceInternal::ServantManager::findServant(const Identity& ident) const
}
ObjectDict::iterator p = const_cast<Ice::ObjectDict&>(_servantMap).find(ident);
- if(p != _servantMap.end())
+ if(_servantMap.end() != p)
{
_servantMapHint = p;
return p->second;
@@ -106,7 +106,7 @@ IceInternal::ServantManager::addServantLocator(const ServantLocatorPtr& locator,
throw ex;
}
- _locatorMapHint = _locatorMap.insert(_locatorMapHint, make_pair(prefix, locator));
+ _locatorMapHint = _locatorMap.insert(_locatorMapHint, pair<const string, ServantLocatorPtr>(prefix, locator));
}
void
@@ -144,7 +144,7 @@ IceInternal::ServantManager::findServantLocator(const string& prefix) const
assert(_instance); // Must not be called after destruction.
- if(_locatorMapHint != _locatorMap.end())
+ if(_locatorMap.end() != _locatorMapHint)
{
if(_locatorMapHint->first == prefix)
{
@@ -153,7 +153,7 @@ IceInternal::ServantManager::findServantLocator(const string& prefix) const
}
map<string, ServantLocatorPtr>::iterator p = const_cast<map<string, ServantLocatorPtr>&>(_locatorMap).find(prefix);
- if(p != _locatorMap.end())
+ if(_locatorMap.end() != p)
{
_locatorMapHint = p;
return p->second;
diff --git a/cpp/src/Ice/UserExceptionFactoryManager.cpp b/cpp/src/Ice/UserExceptionFactoryManager.cpp
index 8153d83a241..c23a485a3d9 100644
--- a/cpp/src/Ice/UserExceptionFactoryManager.cpp
+++ b/cpp/src/Ice/UserExceptionFactoryManager.cpp
@@ -37,7 +37,7 @@ IceInternal::UserExceptionFactoryManager::add(const UserExceptionFactoryPtr& fac
throw ex;
}
- _factoryMapHint = _factoryMap.insert(_factoryMapHint, make_pair(id, factory));
+ _factoryMapHint = _factoryMap.insert(_factoryMapHint, pair<const string, UserExceptionFactoryPtr>(id, factory));
}
void
@@ -101,7 +101,7 @@ IceInternal::UserExceptionFactoryManager::destroy()
{
IceUtil::Mutex::Lock sync(*this);
for_each(_factoryMap.begin(), _factoryMap.end(),
- Ice::secondVoidMemFun<string, UserExceptionFactory>(&UserExceptionFactory::destroy));
+ Ice::secondVoidMemFun<const string, UserExceptionFactory>(&UserExceptionFactory::destroy));
_factoryMap.clear();
_factoryMapHint = _factoryMap.end();
}
diff --git a/cpp/src/IcePack/AdapterRegistryI.cpp b/cpp/src/IcePack/AdapterRegistryI.cpp
index a09cf98b747..3250017201e 100644
--- a/cpp/src/IcePack/AdapterRegistryI.cpp
+++ b/cpp/src/IcePack/AdapterRegistryI.cpp
@@ -51,7 +51,7 @@ IcePack::AdapterRegistryI::add(const string& id, const AdapterPrx& adapter, cons
}
throw AdapterExistsException();
}
- _dict.insert(make_pair(id, adapter));
+ _dict.insert(pair<const string, const Ice::ObjectPrx>(id, adapter));
if(_traceLevels->adapterRegistry > 0)
{
diff --git a/cpp/src/IcePack/ComponentBuilder.cpp b/cpp/src/IcePack/ComponentBuilder.cpp
index 1e745d66eec..33ce7489957 100644
--- a/cpp/src/IcePack/ComponentBuilder.cpp
+++ b/cpp/src/IcePack/ComponentBuilder.cpp
@@ -12,6 +12,10 @@
//
// **********************************************************************
+#ifdef __sun
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+
#include <Ice/Ice.h>
#include <IcePack/ComponentBuilder.h>
#include <IcePack/Internal.h>
@@ -81,51 +85,52 @@ public:
// through this task so other directories should be
// removed by another task).
//
- struct dirent **namelist;
- int n = ::scandir(_name.c_str(), &namelist, 0, alphasort);
- if(n > 0)
+
+ DIR* dir = opendir(_name.c_str());
+
+ if (dir == 0)
{
- Ice::StringSeq entries;
- entries.reserve(n);
- for(int i = 0; i < n; ++i)
- {
- string name = namelist[i]->d_name;
- free(namelist[i]);
- entries.push_back(_name + "/" + name);
- }
- free(namelist);
+ // TODO: log a warning, throw an exception?
+ return;
+ }
+
+
+ // TODO: make the allocation/deallocation exception-safe
+ struct dirent* entry = static_cast<struct dirent*>(malloc(pathconf(_name.c_str(), _PC_NAME_MAX) + 1));
+
+ Ice::StringSeq entries;
+
+ while(readdir_r(dir, entry, &entry) == 0 && entry != 0)
+ {
+ string name = entry->d_name;
+ entries.push_back(_name + "/" + name);
+ }
+ free(entry);
+ closedir(dir);
- for(Ice::StringSeq::iterator p = entries.begin(); p != entries.end(); ++p)
+ for(Ice::StringSeq::iterator p = entries.begin(); p != entries.end(); ++p)
+ {
+ struct stat buf;
+
+ if(::stat(p->c_str(), &buf) != 0)
{
- struct stat buf;
-
- if(::stat(p->c_str(), &buf) != 0)
+ if(errno != ENOENT)
{
- if(errno != ENOENT)
- {
- //
- // TODO: log error
- //
- }
+ //
+ // TODO: log error
+ //
}
- else if(S_ISREG(buf.st_mode))
+ }
+ else if(S_ISREG(buf.st_mode))
+ {
+ if(unlink(p->c_str()) != 0)
{
- if(unlink(p->c_str()) != 0)
- {
- //
- // TODO: log error
- //
- }
+ //
+ // TODO: log error
+ //
}
}
}
- else if(n < 0)
- {
- //
- // TODO: something seems to be wrong if we can't scan
- // the directory. Print a warning.
- //
- }
}
if(rmdir(_name.c_str()) != 0)
@@ -254,10 +259,10 @@ public:
ostringstream os;
os << "couldn't remove the object:\n" << ex << ends;
- ObjectDeploymentException ex;
- ex.reason = os.str();
- ex.proxy = _desc.proxy;
- throw ex;
+ ObjectDeploymentException ode;
+ ode.reason = os.str();
+ ode.proxy = _desc.proxy;
+ throw ode;
}
catch(const Ice::LocalException& lex)
{
@@ -280,7 +285,7 @@ private:
}
IcePack::DeploySAXParseException::DeploySAXParseException(const string& msg,
- const ICE_XERCES_NS Locator*const locator)
+ const ICE_XERCES_NS Locator* locator)
: SAXParseException(ICE_XERCES_NS XMLString::transcode(msg.c_str()), *locator)
{
}
diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile
index 5cf9d6df36a..f7d4c33e9be 100644
--- a/cpp/src/IcePack/Makefile
+++ b/cpp/src/IcePack/Makefile
@@ -106,7 +106,7 @@ $(VERSIONED_NAME): $(LIB_OBJS)
$(ADMIN): $(ADMIN_OBJS) $(NAME)
rm -f $@
- $(CXX) $(LDFLAGS) -o $@ $(ADMIN_OBJS) -lIcePack -lIceBox $(LIBS) -lreadline -lncurses
+ $(CXX) $(LDFLAGS) -o $@ $(ADMIN_OBJS) -lIcePack -lIceBox $(LIBS) $(READLINE_LIBS)
$(REGISTRY_SERVER): $(REGISTRY_SVR_OBJS) $(NAME)
rm -f $@
diff --git a/cpp/src/IcePack/NodeRegistryI.cpp b/cpp/src/IcePack/NodeRegistryI.cpp
index e4c49ba023d..4816de9caa9 100644
--- a/cpp/src/IcePack/NodeRegistryI.cpp
+++ b/cpp/src/IcePack/NodeRegistryI.cpp
@@ -74,7 +74,7 @@ IcePack::NodeRegistryI::add(const string& name, const NodePrx& node, const Ice::
}
else
{
- _dict.insert(make_pair(name, node));
+ _dict.insert(pair<const string, const Ice::ObjectPrx>(name, node));
if(_traceLevels->nodeRegistry > 0)
{
diff --git a/cpp/src/IcePack/ObjectRegistryI.cpp b/cpp/src/IcePack/ObjectRegistryI.cpp
index c1c7f8d9c78..b26d0c4105e 100644
--- a/cpp/src/IcePack/ObjectRegistryI.cpp
+++ b/cpp/src/IcePack/ObjectRegistryI.cpp
@@ -42,7 +42,7 @@ IcePack::ObjectRegistryI::add(const ObjectDescription& obj, const Ice::Current&)
//
// Add the object to the object dictionary.
//
- _objects.insert(make_pair(id, obj));
+ _objects.insert(pair<const Ice::Identity, const ObjectDescription>(id, obj));
//
// Add the object to the interface dictionary.
@@ -61,7 +61,7 @@ IcePack::ObjectRegistryI::add(const ObjectDescription& obj, const Ice::Current&)
if(q == _types.end())
{
- _types.insert(make_pair(obj.type, seq));
+ _types.insert(pair<const string, const Ice::ObjectProxySeq>(obj.type, seq));
}
else
{
diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp
index c7a07bd6b17..541c3e5923d 100644
--- a/cpp/src/IcePack/Parser.cpp
+++ b/cpp/src/IcePack/Parser.cpp
@@ -22,12 +22,13 @@
#include <iterator>
+extern FILE* yyin;
+extern int yydebug;
+
using namespace std;
using namespace Ice;
using namespace IcePack;
-extern FILE* yyin;
-
namespace IcePack
{
@@ -867,7 +868,6 @@ IcePack::Parser::warning(const string& s)
int
IcePack::Parser::parse(FILE* file, bool debug)
{
- extern int yydebug;
yydebug = debug ? 1 : 0;
assert(!parser);
@@ -896,7 +896,6 @@ IcePack::Parser::parse(FILE* file, bool debug)
int
IcePack::Parser::parse(const std::string& commands, bool debug)
{
- extern int yydebug;
yydebug = debug ? 1 : 0;
assert(!parser);
diff --git a/cpp/src/IcePack/ServerRegistryI.cpp b/cpp/src/IcePack/ServerRegistryI.cpp
index 157a4289125..f6e248f1067 100644
--- a/cpp/src/IcePack/ServerRegistryI.cpp
+++ b/cpp/src/IcePack/ServerRegistryI.cpp
@@ -52,7 +52,7 @@ IcePack::ServerRegistryI::add(const string& name, const ServerPrx& server, const
throw ServerExistsException();
}
- _dict.insert(make_pair(name, server));
+ _dict.insert(pair<const string, const Ice::ObjectPrx>(name, server));
if(_traceLevels->serverRegistry > 0)
{
diff --git a/cpp/src/IcePatch/IcePatchI.cpp b/cpp/src/IcePatch/IcePatchI.cpp
index ca3b53fb8f5..ffb7490cbc2 100644
--- a/cpp/src/IcePatch/IcePatchI.cpp
+++ b/cpp/src/IcePatch/IcePatchI.cpp
@@ -124,7 +124,7 @@ IcePatch::DirectoryI::getContents(const Current& current) const
{
if(ignoreSuffix(*p))
{
- pair<StringSeq::const_iterator, StringSeq::const_iterator> r =
+ pair<StringSeq::iterator, StringSeq::iterator> r =
equal_range(paths.begin(), paths.end(), removeSuffix(*p));
if(r.first == r.second)
{
@@ -134,7 +134,7 @@ IcePatch::DirectoryI::getContents(const Current& current) const
syncUpgraded = true;
}
StringSeq paths2 = readDirectory(path);
- pair<StringSeq::const_iterator, StringSeq::const_iterator> r2 =
+ pair<StringSeq::iterator, StringSeq::iterator> r2 =
equal_range(paths2.begin(), paths2.end(), removeSuffix(*p));
if(r2.first == r2.second)
{
diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp
index 691fb7c1ad4..48c036586ed 100644
--- a/cpp/src/IcePatch/Util.cpp
+++ b/cpp/src/IcePatch/Util.cpp
@@ -44,7 +44,7 @@
//
// Sun-OS doesn't have scandir() or alphasort().
//
-#ifdef SUNOS
+#ifdef __sun
static int
scandir(const char* dir, struct dirent*** namelist,
diff --git a/cpp/src/IceStorm/Makefile b/cpp/src/IceStorm/Makefile
index 61ff5fd31b8..87847374d9b 100644
--- a/cpp/src/IceStorm/Makefile
+++ b/cpp/src/IceStorm/Makefile
@@ -78,7 +78,7 @@ $(VERSIONED_SNAME): $(SERVICE_OBJS)
$(ADMIN): $(AOBJS) $(NAME)
rm -f $@
- $(CXX) $(LDFLAGS) -o $@ $(AOBJS) -lIceStorm $(LIBS) $(XERCESC_LIBS) -lreadline -lncurses
+ $(CXX) $(LDFLAGS) -o $@ $(AOBJS) -lIceStorm $(XERCESC_LIBS) $(READLINE_LIBS) $(LIBS)
StringStringDict.h StringStringDict.cpp: $(SLICE2FREEZE)
rm -f StringStringDict.h StringStringDict.cpp
diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp
index f7b67b7303f..6d412c0d9e6 100644
--- a/cpp/src/IceStorm/Parser.cpp
+++ b/cpp/src/IceStorm/Parser.cpp
@@ -22,12 +22,13 @@
# include <readline/history.h>
#endif
+extern FILE* yyin;
+extern int yydebug;
+
using namespace std;
using namespace Ice;
using namespace IceStorm;
-extern FILE* yyin;
-
namespace IceStorm
{
@@ -593,7 +594,6 @@ Parser::warning(const string& s)
int
Parser::parse(FILE* file, bool debug)
{
- extern int yydebug;
yydebug = debug ? 1 : 0;
assert(!parser);
@@ -622,7 +622,6 @@ Parser::parse(FILE* file, bool debug)
int
Parser::parse(const std::string& commands, bool debug)
{
- extern int yydebug;
yydebug = debug ? 1 : 0;
assert(!parser);
diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp
index 90658ba7470..16e3620a1ae 100644
--- a/cpp/src/IceStorm/TopicManagerI.cpp
+++ b/cpp/src/IceStorm/TopicManagerI.cpp
@@ -88,7 +88,7 @@ TopicManagerI::create(const string& name, const string& type, const Ice::Current
}
installTopic("create", name, type, true);
- _topics.insert(make_pair(name, type));
+ _topics.insert(pair<const string, const string>(name, type));
//
// The identity is the name of the Topic.
diff --git a/cpp/src/IceStorm/WeightedGraph.cpp b/cpp/src/IceStorm/WeightedGraph.cpp
index e706e45e75e..6f006893dce 100644
--- a/cpp/src/IceStorm/WeightedGraph.cpp
+++ b/cpp/src/IceStorm/WeightedGraph.cpp
@@ -386,7 +386,7 @@ WeightedGraph::addEdge(const string& from, const string& to, int cost)
_edges.resize(_vertices.size()*_vertices.size(), -1);
for(unsigned int i = 0; i < _vertices.size(); ++i)
{
- _vlookup.insert(make_pair(_vertices[i], i));
+ _vlookup.insert(pair<const string, int>(_vertices[i], i));
}
}
diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp
index bec7a8d81c3..39fe38546ed 100644
--- a/cpp/src/IceXML/StreamI.cpp
+++ b/cpp/src/IceXML/StreamI.cpp
@@ -1217,7 +1217,7 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
// Add the object to the readObjects map, move to the first
// child node & unmarshal the object.
//
- _input->readObjects.insert(map<string, ::Ice::ObjectPtr>::value_type(id, value));
+ _input->readObjects.insert(pair<const string, ::Ice::ObjectPtr>(id, value));
_input->current = _input->current->getFirstChild();
value->__unmarshal(this);
}
diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y
index 4060c569362..01266703ecf 100644
--- a/cpp/src/Slice/Grammar.y
+++ b/cpp/src/Slice/Grammar.y
@@ -31,7 +31,17 @@ using namespace Slice;
void
yyerror(const char* s)
{
- unit->error(s);
+ // yacc and recent versions of Bison use "syntax error" instead
+ // of "parse error".
+
+ if (strcmp(s, "parse error") == 0)
+ {
+ unit->error("syntax error");
+ }
+ else
+ {
+ unit->error(s);
+ }
}
%}
@@ -1391,7 +1401,7 @@ const_initializer
ostringstream sstr;
sstr << intVal->v;
SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok;
- basestring->v = make_pair(type, sstr.str());
+ basestring->v = pair<SyntaxTreeBasePtr,string>(type, sstr.str());
$$ = basestring;
}
| ICE_FLOATING_POINT_LITERAL
@@ -1401,7 +1411,7 @@ const_initializer
ostringstream sstr;
sstr << floatVal->v;
SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok;
- basestring->v = make_pair(type, sstr.str());
+ basestring->v = pair<SyntaxTreeBasePtr,string>(type, sstr.str());
$$ = basestring;
}
| scoped_name
@@ -1411,7 +1421,7 @@ const_initializer
ContainedList cl = unit->currentContainer()->lookupContained(scoped->v);
if(cl.empty())
{
- basestring->v = make_pair(TypePtr(0), scoped->v);
+ basestring->v = pair<SyntaxTreeBasePtr,string>(TypePtr(0), scoped->v);
}
else
{
@@ -1429,7 +1439,7 @@ const_initializer
unit->error(msg);
}
unit->currentContainer()->checkIntroduced(scoped->v, enumerator);
- basestring->v = make_pair(enumerator, scoped->v);
+ basestring->v = pair<SyntaxTreeBasePtr,string>(enumerator, scoped->v);
}
$$ = basestring;
}
@@ -1438,7 +1448,7 @@ const_initializer
BuiltinPtr type = unit->builtin(Builtin::KindString);
StringTokPtr literal = StringTokPtr::dynamicCast($1);
SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok;
- basestring->v = make_pair(type, literal->v);
+ basestring->v = pair<SyntaxTreeBasePtr,string>(type, literal->v);
$$ = basestring;
}
| ICE_FALSE
@@ -1446,7 +1456,7 @@ const_initializer
BuiltinPtr type = unit->builtin(Builtin::KindBool);
StringTokPtr literal = StringTokPtr::dynamicCast($1);
SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok;
- basestring->v = make_pair(type, literal->v);
+ basestring->v = pair<SyntaxTreeBasePtr,string>(type, literal->v);
$$ = basestring;
}
| ICE_TRUE
@@ -1454,7 +1464,7 @@ const_initializer
BuiltinPtr type = unit->builtin(Builtin::KindBool);
StringTokPtr literal = StringTokPtr::dynamicCast($1);
SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok;
- basestring->v = make_pair(type, literal->v);
+ basestring->v = pair<SyntaxTreeBasePtr,string>(type, literal->v);
$$ = basestring;
}
;
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index aa48414bbec..c3d9a1958b1 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -232,7 +232,7 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) :
void
Slice::Container::destroy()
{
- for_each(_contents.begin(), _contents.end(), ::IceUtil::voidMemFun(&Contained::destroy));
+ for_each(_contents.begin(), _contents.end(), ::IceUtil::voidMemFun(&SyntaxTreeBase::destroy));
_contents.clear();
_introducedMap.clear();
SyntaxTreeBase::destroy();
@@ -313,7 +313,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
}
if(!differsOnlyInCase)
{
- string msg = "redefinition of ";
+ msg = "redefinition of ";
msg += intf ? "interface" : "class";
msg += " `" + name + "'";
_unit->error(msg);
@@ -1535,9 +1535,21 @@ Slice::Constructed::isLocal() const
ConstructedList
Slice::Constructed::dependencies()
{
- set<ConstructedPtr> result;
- recDependencies(result);
- return ConstructedList(result.begin(), result.end());
+ set<ConstructedPtr> resultSet;
+ recDependencies(resultSet);
+
+#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES)
+ // TODO: find a more usable work-around for this std lib limitation
+ ConstructedList result;
+ set<ConstructedPtr>::iterator it = resultSet.begin();
+ while(it != resultSet.end())
+ {
+ result.push_back(*it++);
+ }
+ return result;
+#else
+ return ConstructedList(resultSet.begin(), resultSet.end());
+#endif
}
Slice::Constructed::Constructed(const ContainerPtr& container, const string& name, bool local) :
diff --git a/cpp/src/XMLTransform/XMLTransform.cpp b/cpp/src/XMLTransform/XMLTransform.cpp
index c5e20e1b444..4a7e4171c4a 100644
--- a/cpp/src/XMLTransform/XMLTransform.cpp
+++ b/cpp/src/XMLTransform/XMLTransform.cpp
@@ -12,6 +12,11 @@
//
// **********************************************************************
+// For readdir_r
+#ifdef __sun
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+
#include <IceUtil/InputUtil.h>
#include <Ice/Ice.h>
#include <XMLTransform/XMLTransform.h>
@@ -1386,8 +1391,10 @@ public:
void create(ICE_XERCES_NS DOMDocument*, ICE_XERCES_NS DOMDocument*, const Ice::StringSeq&, const Ice::StringSeq&,
const Ice::StringSeq&, const Ice::StringSeq&, TransformMap*, TransformMap*);
-private:
+
+ // COMPILERBUG: Should be private but with Sun C++ 5.4, can't use Type in
+ // StringTypeTable below unless it's public.
enum Type
{
TypeBoolean,
@@ -1405,6 +1412,8 @@ private:
TypeInternal
};
+private:
+
//
// Load all schemas in a list of directories.
//
@@ -1623,8 +1632,8 @@ XMLTransform::TransformFactory::create(ICE_XERCES_NS DOMDocument* fromDoc, ICE_X
assert(toSchema);
DocumentInfoPtr toInfo = new DocumentInfo(toDoc, false, toSchema);
- _fromDocs.insert(make_pair(fromInfo->getTargetNamespace(), fromInfo));
- _toDocs.insert(make_pair(toInfo->getTargetNamespace(), toInfo));
+ _fromDocs.insert(pair<const string, DocumentInfoPtr>(fromInfo->getTargetNamespace(), fromInfo));
+ _toDocs.insert(pair<const string, DocumentInfoPtr>(toInfo->getTargetNamespace(), toInfo));
//
// Process the import/include declarations for the source schema documents.
@@ -1715,26 +1724,30 @@ XMLTransform::TransformFactory::load(DocumentMap& documents, set<string>& import
#else
- struct dirent **namelist;
- int n = ::scandir(path.c_str(), &namelist, 0, alphasort);
- if(n < 0)
- {
- InvalidSchema ex(__FILE__, __LINE__);
+ DIR* dir = opendir(path.c_str());
+
+ if (dir == 0)
+ {
+ InvalidSchema ex(__FILE__, __LINE__);
ex.reason = "cannot read directory `" + path + "': " + strerror(errno);
throw ex;
- }
+ }
+
+
+ // TODO: make the allocation/deallocation exception-safe
+ struct dirent* entry = static_cast<struct dirent*>(malloc(pathconf(path.c_str(), _PC_NAME_MAX) + 1));
- for(int i = 0; i < n; ++i)
- {
- string name = namelist[i]->d_name;
+ while(readdir_r(dir, entry, &entry) == 0 && entry != 0)
+ {
+ string name = entry->d_name;
assert(!name.empty());
- free(namelist[i]);
-
struct stat buf;
string fullPath = path + '/' + name;
if(::stat(fullPath.c_str(), &buf) == -1)
{
+ free(entry);
+ closedir(dir);
InvalidSchema ex(__FILE__, __LINE__);
ex.reason = "cannot stat `" + fullPath + "': " + strerror(errno);
throw ex;
@@ -1752,8 +1765,9 @@ XMLTransform::TransformFactory::load(DocumentMap& documents, set<string>& import
import(documents, importedFiles, "", fullPath, paths);
}
}
-
- free(namelist);
+
+ free(entry);
+ closedir(dir);
#endif
}
@@ -1830,7 +1844,7 @@ XMLTransform::TransformFactory::import(DocumentMap& documents, set<string>& impo
parser.adoptDocument();
DocumentInfoPtr info = new DocumentInfo(document, true, schema, ns);
- documents.insert(make_pair(info->getTargetNamespace(), info));
+ documents.insert(pair<const string, DocumentInfoPtr>(info->getTargetNamespace(), info));
//
// Add the file to the list of imported files.
@@ -2277,7 +2291,7 @@ XMLTransform::TransformFactory::createTransform(const DocumentInfoPtr& fromTypeI
if(_staticClassTransforms->find(type) == _staticClassTransforms->end())
{
StructTransform* st = new StructTransform;
- _staticClassTransforms->insert(make_pair(type, st));
+ _staticClassTransforms->insert(pair<const string, TransformPtr>(type, st));
vector<ElementTransformPtr> v;
createClassContentTransform(fromInfo, from, toInfo, to, v);
diff --git a/cpp/src/icecpp/config.h b/cpp/src/icecpp/config.h
index 1c13ee2855a..b1949ec2d0b 100644
--- a/cpp/src/icecpp/config.h
+++ b/cpp/src/icecpp/config.h
@@ -17,7 +17,7 @@
// configure script from the gcc-2.8.1 distribution.
//
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
# define HAVE_INTTYPES_H 1
# define TIME_WITH_SYS_TIME 1
# define HAVE_BCMP 1
@@ -35,6 +35,12 @@
# define alloca _alloca
#endif
+#if defined(__sun)
+#include <alloca.h>
+#include <malloc.h>
+#include <strings.h>
+#endif
+
#define HAVE_SETRLIMIT 1
#define HAVE_STRERROR 1
#define HAVE_VPRINTF 1
@@ -51,7 +57,7 @@
#define LONG_TYPE_SIZE 4
#if defined(_WIN32)
# define WCHAR_TYPE_SIZE 2
-#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386)
+#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) || defined (__sun)
# define WCHAR_TYPE_SIZE 4
#else
# error "unsupported operating system or platform"
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 9b64c588518..665ec5e59f5 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -16,7 +16,7 @@
#include <Slice/CPlusPlusUtil.h>
#include <Gen.h>
#include <limits>
-#include <iterator>
+#include <IceUtil/Iterator.h>
#include <sys/stat.h>
@@ -398,7 +398,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
ExceptionList allBases = p->allBases();
StringList exceptionIds;
transform(allBases.begin(), allBases.end(), back_inserter(exceptionIds),
- ::IceUtil::constMemFun(&Exception::scoped));
+ ::IceUtil::constMemFun(&Contained::scoped));
exceptionIds.push_front(p->scoped());
exceptionIds.push_back("::Ice::UserException");
@@ -787,8 +787,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
C << nl << "__is->readSize(sz);";
C << nl << "while(sz--)";
C << sb;
- C << nl << "::std::pair<" << ks << ", " << vs << "> pair;";
- writeMarshalUnmarshalCode(C, keyType, "pair.first", false);
+ C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
+ string pf = string("const_cast<") + ks + "&>(pair.first)";
+ writeMarshalUnmarshalCode(C, keyType, pf, false);
writeMarshalUnmarshalCode(C, valueType, "pair.second", false);
C << nl << "v.insert(v.end(), pair);";
C << eb;
@@ -816,9 +817,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
C << nl << "::Ice::Int sz = __is->startReadDictionary(__name);";
C << nl << "while(sz--)";
C << sb;
- C << nl << "::std::pair<" << ks << ", " << vs << "> pair;";
+ C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
C << nl << "__is->startReadDictionaryElement();";
- writeGenericMarshalUnmarshalCode(C, keyType, "pair.first", false, "\"key\"");
+ writeGenericMarshalUnmarshalCode(C, keyType, pf, false, "\"key\"");
writeGenericMarshalUnmarshalCode(C, valueType, "pair.second", false, "\"value\"");
C << nl << "__is->endReadDictionaryElement();";
C << nl << "v.insert(v.end(), pair);";
@@ -2061,7 +2062,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
{
ClassList allBases = p->allBases();
StringList ids;
- transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&ClassDef::scoped));
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped));
StringList other;
other.push_back(p->scoped());
other.push_back("::Ice::Object");
@@ -2071,7 +2072,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 = distance(firstIter, scopedIter);
+ int scopedPos = ice_distance(firstIter, scopedIter);
StringList::const_iterator q;
@@ -2164,7 +2165,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
StringList allOpNames;
transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
- ::IceUtil::constMemFun(&Operation::name));
+ ::IceUtil::constMemFun(&Contained::name));
allOpNames.push_back("ice_facets");
allOpNames.push_back("ice_id");
allOpNames.push_back("ice_ids");
@@ -2196,7 +2197,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2)
<< "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
C << sb;
- C << nl << "::std::pair<const ::std::string*, const ::std::string*> r = "
+
+ // COMPILERBUG: Sun C++ 5.4 and GCC 3.2 won't compile without a
+ // space between < and ::
+ C << nl << "::std::pair< ::std::string*, ::std::string*> r = "
<< "::std::equal_range(__all, __all + " << allOpNames.size() << ", current.operation);";
C << nl << "if(r.first == r.second)";
C << sb;
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index d0def6e3a0f..79294d858e9 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -15,6 +15,8 @@
#include <IceUtil/Functional.h>
#include <Gen.h>
#include <limits>
+#include <IceUtil/Algorithm.h>
+#include <IceUtil/Iterator.h>
using namespace std;
using namespace Slice;
@@ -204,8 +206,8 @@ Slice::JavaVisitor::writeThrowsClause(const string& scope, const ExceptionList&
//
// Don't include local exceptions in the throws clause
//
- ExceptionList::size_type localCount = count_if(throws.begin(), throws.end(),
- IceUtil::constMemFun(&Exception::isLocal));
+ ExceptionList::size_type localCount = ice_count_if(throws.begin(), throws.end(),
+ IceUtil::constMemFun(&Exception::isLocal));
Output& out = output();
if(throws.size() - localCount > 0)
@@ -375,7 +377,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
ClassList allBases = p->allBases();
StringList ids;
- transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&ClassDef::scoped));
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped));
StringList other;
other.push_back(scoped);
other.push_back("::Ice::Object");
@@ -385,7 +387,7 @@ 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 = distance(firstIter, scopedIter);
+ int scopedPos = ice_distance(firstIter, scopedIter);
StringList::const_iterator q;
@@ -616,7 +618,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
if(!allOps.empty())
{
StringList allOpNames;
- transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Operation::name));
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name));
allOpNames.push_back("ice_facets");
allOpNames.push_back("ice_id");
allOpNames.push_back("ice_ids");
@@ -1370,7 +1372,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
StringList exceptionIds;
transform(allBases.begin(), allBases.end(),
back_inserter(exceptionIds),
- ::IceUtil::constMemFun(&Exception::scoped));
+ ::IceUtil::constMemFun(&Contained::scoped));
exceptionIds.push_front(scoped);
exceptionIds.push_back("::Ice::UserException");