summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/Application.cpp2
-rw-r--r--cpp/src/Freeze/DBI.cpp100
-rw-r--r--cpp/src/Freeze/DBI.h314
-rw-r--r--cpp/src/Freeze/EvictorI.cpp58
-rw-r--r--cpp/src/Freeze/EvictorI.h152
-rw-r--r--cpp/src/Glacier/Blobject.cpp24
-rw-r--r--cpp/src/Glacier/Blobject.h106
-rw-r--r--cpp/src/Glacier/ClientBlobject.cpp10
-rw-r--r--cpp/src/Glacier/ClientBlobject.h78
-rw-r--r--cpp/src/Glacier/GlacierRouter.cpp30
-rw-r--r--cpp/src/Glacier/GlacierStarter.cpp18
-rw-r--r--cpp/src/Glacier/Missive.cpp36
-rw-r--r--cpp/src/Glacier/Missive.h148
-rw-r--r--cpp/src/Glacier/RouterI.cpp8
-rw-r--r--cpp/src/Glacier/RouterI.h110
-rw-r--r--cpp/src/Glacier/ServerBlobject.h74
-rw-r--r--cpp/src/Glacier/StarterI.cpp56
-rw-r--r--cpp/src/Glacier/StarterI.h132
-rw-r--r--cpp/src/Ice/Acceptor.h76
-rw-r--r--cpp/src/Ice/AcceptorF.h52
-rw-r--r--cpp/src/Ice/Application.cpp6
-rw-r--r--cpp/src/Ice/BasicStream.cpp144
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp44
-rw-r--r--cpp/src/Ice/CommunicatorI.h168
-rw-r--r--cpp/src/Ice/Connection.cpp144
-rw-r--r--cpp/src/Ice/Connection.h242
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp82
-rw-r--r--cpp/src/Ice/ConnectionFactory.h216
-rw-r--r--cpp/src/Ice/Connector.h62
-rw-r--r--cpp/src/Ice/ConnectorF.h52
-rw-r--r--cpp/src/Ice/DefaultsAndOverrides.cpp6
-rw-r--r--cpp/src/Ice/DefaultsAndOverrides.h78
-rw-r--r--cpp/src/Ice/DefaultsAndOverridesF.h52
-rw-r--r--cpp/src/Ice/Direct.cpp18
-rw-r--r--cpp/src/Ice/DynamicLibrary.cpp18
-rw-r--r--cpp/src/Ice/Endpoint.h240
-rw-r--r--cpp/src/Ice/EndpointFactoryManager.cpp24
-rw-r--r--cpp/src/Ice/EndpointFactoryManager.h94
-rw-r--r--cpp/src/Ice/EndpointFactoryManagerF.h52
-rw-r--r--cpp/src/Ice/EventHandler.h174
-rw-r--r--cpp/src/Ice/EventHandlerF.h52
-rw-r--r--cpp/src/Ice/Exception.cpp6
-rw-r--r--cpp/src/Ice/IdentityUtil.cpp4
-rw-r--r--cpp/src/Ice/Incoming.cpp58
-rw-r--r--cpp/src/Ice/Initialize.cpp18
-rw-r--r--cpp/src/Ice/Instance.cpp66
-rw-r--r--cpp/src/Ice/Instance.h210
-rw-r--r--cpp/src/Ice/LoggerI.cpp2
-rw-r--r--cpp/src/Ice/LoggerI.h62
-rw-r--r--cpp/src/Ice/LoggerUtil.cpp6
-rw-r--r--cpp/src/Ice/Network.cpp126
-rw-r--r--cpp/src/Ice/Network.h200
-rw-r--r--cpp/src/Ice/Object.cpp34
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.cpp6
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.h78
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp80
-rw-r--r--cpp/src/Ice/ObjectAdapterI.h172
-rw-r--r--cpp/src/Ice/ObjectFactoryManager.cpp18
-rw-r--r--cpp/src/Ice/ObjectFactoryManager.h84
-rw-r--r--cpp/src/Ice/ObjectFactoryManagerF.h52
-rw-r--r--cpp/src/Ice/Outgoing.cpp28
-rw-r--r--cpp/src/Ice/PicklerI.h78
-rw-r--r--cpp/src/Ice/PluginManagerI.cpp18
-rw-r--r--cpp/src/Ice/PluginManagerI.h110
-rw-r--r--cpp/src/Ice/PropertiesI.cpp62
-rw-r--r--cpp/src/Ice/PropertiesI.h108
-rw-r--r--cpp/src/Ice/Protocol.h96
-rw-r--r--cpp/src/Ice/Proxy.cpp112
-rw-r--r--cpp/src/Ice/ProxyFactory.cpp8
-rw-r--r--cpp/src/Ice/ProxyFactory.h98
-rw-r--r--cpp/src/Ice/Reference.cpp104
-rw-r--r--cpp/src/Ice/Reference.h192
-rw-r--r--cpp/src/Ice/ReferenceFactory.cpp80
-rw-r--r--cpp/src/Ice/ReferenceFactory.h102
-rw-r--r--cpp/src/Ice/ReferenceFactoryF.h52
-rw-r--r--cpp/src/Ice/RouterInfo.cpp20
-rw-r--r--cpp/src/Ice/RouterInfo.h148
-rw-r--r--cpp/src/Ice/RouterInfoF.h62
-rw-r--r--cpp/src/Ice/RoutingTable.cpp20
-rw-r--r--cpp/src/Ice/SysLoggerI.h62
-rw-r--r--cpp/src/Ice/TcpAcceptor.cpp8
-rw-r--r--cpp/src/Ice/TcpAcceptor.h116
-rw-r--r--cpp/src/Ice/TcpConnector.cpp4
-rw-r--r--cpp/src/Ice/TcpConnector.h100
-rw-r--r--cpp/src/Ice/TcpEndpoint.cpp56
-rw-r--r--cpp/src/Ice/TcpEndpoint.h164
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp62
-rw-r--r--cpp/src/Ice/TcpTransceiver.h106
-rw-r--r--cpp/src/Ice/ThreadPool.cpp98
-rw-r--r--cpp/src/Ice/ThreadPool.h186
-rw-r--r--cpp/src/Ice/ThreadPoolF.h52
-rw-r--r--cpp/src/Ice/TraceLevels.h78
-rw-r--r--cpp/src/Ice/TraceLevelsF.h52
-rw-r--r--cpp/src/Ice/TraceUtil.cpp32
-rw-r--r--cpp/src/Ice/TraceUtil.h58
-rw-r--r--cpp/src/Ice/Transceiver.h80
-rw-r--r--cpp/src/Ice/TransceiverF.h52
-rw-r--r--cpp/src/Ice/UdpEndpoint.cpp54
-rw-r--r--cpp/src/Ice/UdpEndpoint.h164
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp40
-rw-r--r--cpp/src/Ice/UdpTransceiver.h138
-rw-r--r--cpp/src/Ice/UnknownEndpoint.cpp20
-rw-r--r--cpp/src/Ice/UnknownEndpoint.h118
-rw-r--r--cpp/src/Ice/UserExceptionFactoryManager.cpp18
-rw-r--r--cpp/src/Ice/UserExceptionFactoryManager.h84
-rw-r--r--cpp/src/Ice/UserExceptionFactoryManagerF.h52
-rw-r--r--cpp/src/IceBox/Admin.cpp18
-rw-r--r--cpp/src/IceBox/Server.cpp10
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp32
-rw-r--r--cpp/src/IceBox/ServiceManagerI.h112
-rw-r--r--cpp/src/IcePack/Activator.cpp56
-rw-r--r--cpp/src/IcePack/Activator.h110
-rw-r--r--cpp/src/IcePack/AdminI.cpp4
-rw-r--r--cpp/src/IcePack/AdminI.h76
-rw-r--r--cpp/src/IcePack/Client.cpp48
-rw-r--r--cpp/src/IcePack/Forward.cpp14
-rw-r--r--cpp/src/IcePack/Forward.h92
-rw-r--r--cpp/src/IcePack/Parser.cpp58
-rw-r--r--cpp/src/IcePack/Parser.h214
-rw-r--r--cpp/src/IcePack/Server.cpp14
-rw-r--r--cpp/src/IcePack/dummyinclude/unistd.h8
-rw-r--r--cpp/src/IcePatch/Client.cpp62
-rw-r--r--cpp/src/IcePatch/FileDescFactory.cpp4
-rw-r--r--cpp/src/IcePatch/FileLocator.cpp12
-rw-r--r--cpp/src/IcePatch/FileLocator.h82
-rw-r--r--cpp/src/IcePatch/IcePatchI.cpp38
-rw-r--r--cpp/src/IcePatch/IcePatchI.h124
-rw-r--r--cpp/src/IcePatch/Server.cpp26
-rw-r--r--cpp/src/IcePatch/Util.cpp148
-rw-r--r--cpp/src/IceSSL/BaseCerts.h136
-rw-r--r--cpp/src/IceSSL/CertificateAuthority.h82
-rw-r--r--cpp/src/IceSSL/CertificateDesc.h238
-rw-r--r--cpp/src/IceSSL/ConfigParser.cpp84
-rw-r--r--cpp/src/IceSSL/ConfigParser.h178
-rw-r--r--cpp/src/IceSSL/ConfigParserErrorReporter.cpp2
-rw-r--r--cpp/src/IceSSL/ConfigParserErrorReporter.h126
-rw-r--r--cpp/src/IceSSL/ContextOpenSSL.cpp96
-rw-r--r--cpp/src/IceSSL/ContextOpenSSL.h240
-rw-r--r--cpp/src/IceSSL/ContextOpenSSLClient.cpp4
-rw-r--r--cpp/src/IceSSL/ContextOpenSSLClient.h88
-rw-r--r--cpp/src/IceSSL/ContextOpenSSLF.h74
-rw-r--r--cpp/src/IceSSL/ContextOpenSSLServer.cpp10
-rw-r--r--cpp/src/IceSSL/ContextOpenSSLServer.h92
-rw-r--r--cpp/src/IceSSL/Convert.h52
-rw-r--r--cpp/src/IceSSL/DHParams.cpp2
-rw-r--r--cpp/src/IceSSL/DHParams.h90
-rw-r--r--cpp/src/IceSSL/DHParamsF.h74
-rw-r--r--cpp/src/IceSSL/DefaultCertificateVerifier.cpp10
-rw-r--r--cpp/src/IceSSL/DefaultCertificateVerifier.h84
-rw-r--r--cpp/src/IceSSL/GeneralConfig.cpp36
-rw-r--r--cpp/src/IceSSL/GeneralConfig.h132
-rw-r--r--cpp/src/IceSSL/OpenSSL.h78
-rw-r--r--cpp/src/IceSSL/OpenSSLJanitors.cpp10
-rw-r--r--cpp/src/IceSSL/OpenSSLJanitors.h204
-rw-r--r--cpp/src/IceSSL/OpenSSLPluginI.cpp110
-rw-r--r--cpp/src/IceSSL/OpenSSLPluginI.h236
-rw-r--r--cpp/src/IceSSL/OpenSSLUtils.cpp38
-rw-r--r--cpp/src/IceSSL/OpenSSLUtils.h104
-rw-r--r--cpp/src/IceSSL/PluginBaseI.h142
-rw-r--r--cpp/src/IceSSL/PluginBaseIF.h64
-rw-r--r--cpp/src/IceSSL/RSACertificateGen.cpp12
-rw-r--r--cpp/src/IceSSL/RSAPrivateKey.cpp8
-rw-r--r--cpp/src/IceSSL/RSAPublicKey.cpp4
-rw-r--r--cpp/src/IceSSL/SingleCertificateVerifier.cpp6
-rw-r--r--cpp/src/IceSSL/SingleCertificateVerifier.h86
-rw-r--r--cpp/src/IceSSL/SslAcceptor.cpp8
-rw-r--r--cpp/src/IceSSL/SslAcceptor.h116
-rw-r--r--cpp/src/IceSSL/SslConnection.h92
-rw-r--r--cpp/src/IceSSL/SslConnectionF.h64
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSL.cpp102
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSL.h412
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSLClient.cpp52
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSLClient.h88
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSLF.h74
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp46
-rw-r--r--cpp/src/IceSSL/SslConnectionOpenSSLServer.h88
-rw-r--r--cpp/src/IceSSL/SslConnector.cpp4
-rw-r--r--cpp/src/IceSSL/SslConnector.h92
-rw-r--r--cpp/src/IceSSL/SslEndpoint.cpp56
-rw-r--r--cpp/src/IceSSL/SslEndpoint.h162
-rw-r--r--cpp/src/IceSSL/SslException.cpp2
-rw-r--r--cpp/src/IceSSL/SslTransceiver.cpp12
-rw-r--r--cpp/src/IceSSL/SslTransceiver.h112
-rw-r--r--cpp/src/IceSSL/TempCerts.h136
-rw-r--r--cpp/src/IceSSL/TraceLevels.h74
-rw-r--r--cpp/src/IceSSL/TraceLevelsF.h64
-rw-r--r--cpp/src/IceStorm/Admin.cpp48
-rw-r--r--cpp/src/IceStorm/Flushable.h100
-rw-r--r--cpp/src/IceStorm/Flusher.cpp12
-rw-r--r--cpp/src/IceStorm/Flusher.h112
-rw-r--r--cpp/src/IceStorm/LinkSubscriber.cpp16
-rw-r--r--cpp/src/IceStorm/LinkSubscriber.h94
-rw-r--r--cpp/src/IceStorm/OnewayBatchSubscriber.cpp10
-rw-r--r--cpp/src/IceStorm/OnewayBatchSubscriber.h100
-rw-r--r--cpp/src/IceStorm/OnewaySubscriber.cpp8
-rw-r--r--cpp/src/IceStorm/OnewaySubscriber.h78
-rw-r--r--cpp/src/IceStorm/Parser.cpp90
-rw-r--r--cpp/src/IceStorm/Parser.h216
-rw-r--r--cpp/src/IceStorm/Server.cpp6
-rw-r--r--cpp/src/IceStorm/Subscriber.h272
-rw-r--r--cpp/src/IceStorm/SubscriberFactory.cpp8
-rw-r--r--cpp/src/IceStorm/SubscriberFactory.h124
-rw-r--r--cpp/src/IceStorm/TopicI.cpp62
-rw-r--r--cpp/src/IceStorm/TopicI.h184
-rw-r--r--cpp/src/IceStorm/TopicManagerI.cpp30
-rw-r--r--cpp/src/IceStorm/TopicManagerI.h156
-rw-r--r--cpp/src/IceStorm/TraceLevels.h94
-rw-r--r--cpp/src/IceStorm/WeightedGraph.cpp54
-rw-r--r--cpp/src/IceStorm/WeightedGraph.h232
-rw-r--r--cpp/src/IceStorm/dummyinclude/unistd.h8
-rw-r--r--cpp/src/IceUtil/Base64.cpp60
-rw-r--r--cpp/src/IceUtil/Cond.cpp24
-rw-r--r--cpp/src/IceUtil/Exception.cpp2
-rw-r--r--cpp/src/IceUtil/OutputUtil.cpp28
-rw-r--r--cpp/src/IceUtil/RWRecMutex.cpp36
-rw-r--r--cpp/src/IceUtil/RecMutex.cpp22
-rw-r--r--cpp/src/IceUtil/Thread.cpp12
-rw-r--r--cpp/src/IceUtil/Unicode.cpp28
-rw-r--r--cpp/src/IceXML/StreamI.cpp164
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp122
-rw-r--r--cpp/src/Slice/GrammarUtil.h270
-rw-r--r--cpp/src/Slice/JavaUtil.cpp320
-rw-r--r--cpp/src/Slice/Parser.cpp418
-rw-r--r--cpp/src/Slice/dummyinclude/unistd.h8
-rw-r--r--cpp/src/slice2cpp/Gen.cpp400
-rw-r--r--cpp/src/slice2cpp/Gen.h588
-rw-r--r--cpp/src/slice2cpp/Main.cpp60
-rw-r--r--cpp/src/slice2docbook/Gen.cpp232
-rw-r--r--cpp/src/slice2docbook/Gen.h134
-rw-r--r--cpp/src/slice2docbook/Main.cpp54
-rw-r--r--cpp/src/slice2freeze/Main.cpp116
-rw-r--r--cpp/src/slice2freezej/Main.cpp88
-rw-r--r--cpp/src/slice2java/Gen.cpp506
-rw-r--r--cpp/src/slice2java/Gen.h488
-rw-r--r--cpp/src/slice2java/Main.cpp74
-rw-r--r--cpp/src/slice2wsdl/Gen.cpp22
-rw-r--r--cpp/src/slice2wsdl/Gen.h118
-rw-r--r--cpp/src/slice2wsdl/Main.cpp54
-rw-r--r--cpp/src/slice2xsd/Gen.cpp64
-rw-r--r--cpp/src/slice2xsd/Gen.h126
-rw-r--r--cpp/src/slice2xsd/Main.cpp50
-rw-r--r--cpp/src/slice2xsd/Validate.cpp4
242 files changed, 10721 insertions, 10721 deletions
diff --git a/cpp/src/Freeze/Application.cpp b/cpp/src/Freeze/Application.cpp
index c3088794a2b..807cd9c0449 100644
--- a/cpp/src/Freeze/Application.cpp
+++ b/cpp/src/Freeze/Application.cpp
@@ -53,7 +53,7 @@ Freeze::Application::run(int argc, char* argv[])
status = EXIT_FAILURE;
}
- if (dbEnv)
+ if(dbEnv)
{
try
{
diff --git a/cpp/src/Freeze/DBI.cpp b/cpp/src/Freeze/DBI.cpp
index 9e4b725b936..702814c3fd2 100644
--- a/cpp/src/Freeze/DBI.cpp
+++ b/cpp/src/Freeze/DBI.cpp
@@ -28,7 +28,7 @@ using namespace Freeze;
void
Freeze::checkBerkeleyDBReturn(int ret, const string& prefix, const string& op)
{
- if (ret == 0)
+ if(ret == 0)
{
return; // Everything ok
}
@@ -36,7 +36,7 @@ Freeze::checkBerkeleyDBReturn(int ret, const string& prefix, const string& op)
ostringstream s;
s << prefix << op << ": " << db_strerror(ret);
- switch (ret)
+ switch(ret)
{
case DB_LOCK_DEADLOCK:
{
@@ -71,7 +71,7 @@ Freeze::DBEnvironmentI::DBEnvironmentI(const CommunicatorPtr& communicator, cons
_errorPrefix = "Freeze::DBEnvironment(\"" + _name + "\"): ";
_trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.DB");
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "opening database environment \"" << _name << "\"";
@@ -91,7 +91,7 @@ Freeze::DBEnvironmentI::DBEnvironmentI(const CommunicatorPtr& communicator, cons
Freeze::DBEnvironmentI::~DBEnvironmentI()
{
- if (_dbEnv)
+ if(_dbEnv)
{
Warning out(_communicator->getLogger());
out << _errorPrefix << "\"" << _name << "\" has not been closed";
@@ -117,7 +117,7 @@ Freeze::DBEnvironmentI::openDB(const string& name, bool create)
{
IceUtil::RecMutex::Lock sync(*this);
- if (!_dbEnv)
+ if(!_dbEnv)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -127,7 +127,7 @@ Freeze::DBEnvironmentI::openDB(const string& name, bool create)
}
map<string, DBPtr>::iterator p = _dbMap.find(name);
- if (p != _dbMap.end())
+ if(p != _dbMap.end())
{
return p->second;
}
@@ -146,7 +146,7 @@ Freeze::DBEnvironmentI::openDB(const string& name, bool create)
// errors.
//
p = _dbMap.find(name);
- if (p != _dbMap.end())
+ if(p != _dbMap.end())
{
_dbMap.erase(p);
}
@@ -168,7 +168,7 @@ Freeze::DBEnvironmentI::close()
{
IceUtil::RecMutex::Lock sync(*this);
- if (!_dbEnv)
+ if(!_dbEnv)
{
return;
}
@@ -179,7 +179,7 @@ Freeze::DBEnvironmentI::close()
db->close();
}
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "closing database environment \"" << _name << "\"";
@@ -241,7 +241,7 @@ Freeze::DBTransactionI::DBTransactionI(const CommunicatorPtr& communicator, ::DB
_errorPrefix = "Freeze::DBTransaction(\"" + _name + "\"): ";
_trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.DB");
- if (_trace >= 2)
+ if(_trace >= 2)
{
Trace out(_communicator->getLogger(), "DB");
out << "starting transaction for environment \"" << _name << "\"";
@@ -252,7 +252,7 @@ Freeze::DBTransactionI::DBTransactionI(const CommunicatorPtr& communicator, ::DB
Freeze::DBTransactionI::~DBTransactionI()
{
- if (_tid)
+ if(_tid)
{
Warning out(_communicator->getLogger());
out << _errorPrefix << "transaction has not been committed or aborted";
@@ -264,7 +264,7 @@ Freeze::DBTransactionI::commit()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_tid)
+ if(!_tid)
{
ostringstream s;
s << _errorPrefix << "transaction has already been committed or aborted";
@@ -273,7 +273,7 @@ Freeze::DBTransactionI::commit()
throw ex;
}
- if (_trace >= 2)
+ if(_trace >= 2)
{
Trace out(_communicator->getLogger(), "DB");
out << "committing transaction for environment \"" << _name << "\"";
@@ -289,7 +289,7 @@ Freeze::DBTransactionI::abort()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_tid)
+ if(!_tid)
{
ostringstream s;
s << _errorPrefix << "transaction has already been committed or aborted";
@@ -298,7 +298,7 @@ Freeze::DBTransactionI::abort()
throw ex;
}
- if (_trace >= 2)
+ if(_trace >= 2)
{
Trace out(_communicator->getLogger(), "DB");
out << "aborting transaction for environment \"" << _name << "\" due to deadlock";
@@ -318,7 +318,7 @@ DBCursorI::DBCursorI(const ::Ice::CommunicatorPtr& communicator, const std::stri
_errorPrefix = "Freeze::DBCursor(\"" + _name += "\"): ";
_trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.DB");
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "creating cursor for \"" << _name << "\"";
@@ -327,7 +327,7 @@ DBCursorI::DBCursorI(const ::Ice::CommunicatorPtr& communicator, const std::stri
DBCursorI::~DBCursorI()
{
- if (_cursor != 0)
+ if(_cursor != 0)
{
Warning out(_communicator->getLogger());
out << _errorPrefix << "\"" << _name << "\" has not been closed";
@@ -346,7 +346,7 @@ DBCursorI::curr(Key& key, Value& value)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -359,7 +359,7 @@ DBCursorI::curr(Key& key, Value& value)
memset(&dbKey, 0, sizeof(dbKey));
memset(&dbData, 0, sizeof(dbData));
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "reading current value from database \"" << _name << "\"";
@@ -379,7 +379,7 @@ DBCursorI::set(const Value& value)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -394,7 +394,7 @@ DBCursorI::set(const Value& value)
dbData.data = const_cast<void*>(static_cast<const void*>(&value[0]));
dbData.size = value.size();
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "setting current value in database \"" << _name << "\"";
@@ -411,7 +411,7 @@ DBCursorI::next()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -430,7 +430,7 @@ DBCursorI::next()
memset(&dbData, 0, sizeof(dbData));
dbData.flags = DB_DBT_PARTIAL;
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "moving to next value in database \"" << _name << "\"";
@@ -452,7 +452,7 @@ DBCursorI::prev()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -471,7 +471,7 @@ DBCursorI::prev()
memset(&dbData, 0, sizeof(dbData));
dbData.flags = DB_DBT_PARTIAL;
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "moving to previous value in database \"" << _name << "\"";
@@ -493,7 +493,7 @@ DBCursorI::del()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -502,7 +502,7 @@ DBCursorI::del()
throw ex;
}
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "removing the current element in database \"" << _name << "\"";
@@ -516,7 +516,7 @@ DBCursorI::clone()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -535,12 +535,12 @@ DBCursorI::close()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_cursor)
+ if(!_cursor)
{
return;
}
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "closing cursor \"" << _name << "\"";
@@ -561,7 +561,7 @@ Freeze::DBI::DBI(const CommunicatorPtr& communicator, const DBEnvironmentIPtr& d
_errorPrefix = "Freeze::DB(\"" + _name + "\"): ";
_trace = _communicator->getProperties()->getPropertyAsInt("Freeze.Trace.DB");
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "opening database \"" << _name << "\" in environment \"" << _dbEnvObj->getName() << "\"";
@@ -576,7 +576,7 @@ Freeze::DBI::DBI(const CommunicatorPtr& communicator, const DBEnvironmentIPtr& d
Freeze::DBI::~DBI()
{
- if (_db)
+ if(_db)
{
Warning out(_communicator->getLogger());
out << _errorPrefix << "\"" << _name << "\" has not been closed";
@@ -602,7 +602,7 @@ Freeze::DBI::getNumberOfRecords()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -626,7 +626,7 @@ Freeze::DBI::getCursor()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -671,7 +671,7 @@ Freeze::DBI::getCursorAtKey(const Key& key)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -722,7 +722,7 @@ Freeze::DBI::put(const Key& key, const Value& value)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -739,7 +739,7 @@ Freeze::DBI::put(const Key& key, const Value& value)
dbData.data = const_cast<void*>(static_cast<const void*>(&value[0]));
dbData.size = value.size();
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "writing value in database \"" << _name << "\"";
@@ -753,7 +753,7 @@ Freeze::DBI::contains(const Key& key)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -771,14 +771,14 @@ Freeze::DBI::contains(const Key& key)
memset(&dbData, 0, sizeof(dbData));
dbData.flags = DB_DBT_PARTIAL;
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "checking key in database \"" << _name << "\"";
}
int rc = _db->get(_db, 0, &dbKey, &dbData, 0);
- if (rc == DB_NOTFOUND)
+ if(rc == DB_NOTFOUND)
{
return false;
}
@@ -792,7 +792,7 @@ Freeze::DBI::get(const Key& key)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -807,7 +807,7 @@ Freeze::DBI::get(const Key& key)
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
dbKey.size = key.size();
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "reading value from database \"" << _name << "\"";
@@ -823,7 +823,7 @@ Freeze::DBI::del(const Key& key)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -837,7 +837,7 @@ Freeze::DBI::del(const Key& key)
dbKey.data = const_cast<void*>(static_cast<const void*>(&key[0]));
dbKey.size = key.size();
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "deleting value from database \"" << _name << "\"";
@@ -851,7 +851,7 @@ Freeze::DBI::clear()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
@@ -869,12 +869,12 @@ Freeze::DBI::close()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
return;
}
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "closing database \"" << _name << "\"";
@@ -892,12 +892,12 @@ Freeze::DBI::remove()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
return;
}
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_communicator->getLogger(), "DB");
out << "removing database \"" << _name << "\"";
@@ -929,7 +929,7 @@ Freeze::DBI::createEvictor(EvictorPersistenceMode persistenceMode)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_db)
+ if(!_db)
{
ostringstream s;
s << _errorPrefix << "\"" << _name << "\" has been closed";
diff --git a/cpp/src/Freeze/DBI.h b/cpp/src/Freeze/DBI.h
index 448a7dfa680..7014a7f623a 100644
--- a/cpp/src/Freeze/DBI.h
+++ b/cpp/src/Freeze/DBI.h
@@ -1,157 +1,157 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef FREEZE_DB_I_H
-#define FREEZE_DB_I_H
-
-#include <IceUtil/IceUtil.h>
-#include <Ice/Ice.h>
-#include <Freeze/DB.h>
-#include <db.h>
-
-namespace Freeze
-{
-
-//
-// Check a Berkeley DB return result, and throw an apropriate
-// exception.
-//
-void checkBerkeleyDBReturn(int ret, const std::string&, const std::string&);
-
-class DBEnvironmentI;
-typedef IceUtil::Handle<DBEnvironmentI> DBEnvironmentIPtr;
-
-class DBEnvironmentI : public DBEnvironment, public IceUtil::RecMutex
-{
-public:
-
- DBEnvironmentI(const ::Ice::CommunicatorPtr&, const std::string&);
- virtual ~DBEnvironmentI();
-
- virtual std::string getName();
- virtual ::Ice::CommunicatorPtr getCommunicator();
-
- virtual DBPtr openDB(const std::string&, bool);
-
- virtual DBTransactionPtr startTransaction();
-
- virtual void close();
-
-private:
-
- // DBI needs access to add, remove & eraseDB
- friend class DBI;
- void add(const std::string&, const DBPtr&);
- void remove(const std::string&);
- void eraseDB(const std::string&);
-
- ::Ice::CommunicatorPtr _communicator;
- int _trace;
-
- ::DB_ENV* _dbEnv;
-
- std::string _name;
- std::string _errorPrefix;
-
- std::map<std::string, DBPtr> _dbMap;
-};
-
-class DBTransactionI : public DBTransaction, public IceUtil::Mutex
-{
-public:
-
- DBTransactionI(const ::Ice::CommunicatorPtr&, ::DB_ENV*, const std::string&);
- virtual ~DBTransactionI();
-
- virtual void commit();
- virtual void abort();
-
-private:
-
- ::Ice::CommunicatorPtr _communicator;
- int _trace;
-
- ::DB_TXN* _tid;
-
- std::string _name;
- std::string _errorPrefix;
-};
-
-class DBCursorI : public DBCursor, public IceUtil::Mutex
-{
-public:
-
- DBCursorI(const ::Ice::CommunicatorPtr&, const std::string&, DBC*);
- ~DBCursorI();
-
- virtual ::Ice::CommunicatorPtr getCommunicator();
-
- virtual void curr(Key& key, Value& value);
- virtual void set(const Value& value);
- virtual bool next();
- virtual bool prev();
- virtual void del();
-
- virtual DBCursorPtr clone();
- virtual void close();
-
-private:
-
- ::Ice::CommunicatorPtr _communicator;
- int _trace;
-
- std::string _name;
- std::string _errorPrefix;
-
- DBC* _cursor;
-};
-
-class DBI : public DB, public IceUtil::Mutex
-{
-public:
-
- DBI(const ::Ice::CommunicatorPtr&, const DBEnvironmentIPtr&, ::DB*, const std::string&, bool);
- virtual ~DBI();
-
- virtual std::string getName();
- virtual ::Ice::CommunicatorPtr getCommunicator();
-
- virtual ::Ice::Long getNumberOfRecords();
-
- virtual DBCursorPtr getCursor();
- virtual DBCursorPtr getCursorAtKey(const Key&);
-
- virtual void put(const Key&, const Value&);
- virtual bool contains(const Key&);
- virtual Value get(const Key&);
- virtual void del(const Key&);
-
- virtual void clear();
-
- virtual void close();
- virtual void remove();
-
- virtual EvictorPtr createEvictor(EvictorPersistenceMode);
-
-private:
-
- ::Ice::CommunicatorPtr _communicator;
- int _trace;
-
- DBEnvironmentIPtr _dbEnvObj;
- ::DB* _db;
-
- std::string _name;
- std::string _errorPrefix;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef FREEZE_DB_I_H
+#define FREEZE_DB_I_H
+
+#include <IceUtil/IceUtil.h>
+#include <Ice/Ice.h>
+#include <Freeze/DB.h>
+#include <db.h>
+
+namespace Freeze
+{
+
+//
+// Check a Berkeley DB return result, and throw an apropriate
+// exception.
+//
+void checkBerkeleyDBReturn(int ret, const std::string&, const std::string&);
+
+class DBEnvironmentI;
+typedef IceUtil::Handle<DBEnvironmentI> DBEnvironmentIPtr;
+
+class DBEnvironmentI : public DBEnvironment, public IceUtil::RecMutex
+{
+public:
+
+ DBEnvironmentI(const ::Ice::CommunicatorPtr&, const std::string&);
+ virtual ~DBEnvironmentI();
+
+ virtual std::string getName();
+ virtual ::Ice::CommunicatorPtr getCommunicator();
+
+ virtual DBPtr openDB(const std::string&, bool);
+
+ virtual DBTransactionPtr startTransaction();
+
+ virtual void close();
+
+private:
+
+ // DBI needs access to add, remove & eraseDB
+ friend class DBI;
+ void add(const std::string&, const DBPtr&);
+ void remove(const std::string&);
+ void eraseDB(const std::string&);
+
+ ::Ice::CommunicatorPtr _communicator;
+ int _trace;
+
+ ::DB_ENV* _dbEnv;
+
+ std::string _name;
+ std::string _errorPrefix;
+
+ std::map<std::string, DBPtr> _dbMap;
+};
+
+class DBTransactionI : public DBTransaction, public IceUtil::Mutex
+{
+public:
+
+ DBTransactionI(const ::Ice::CommunicatorPtr&, ::DB_ENV*, const std::string&);
+ virtual ~DBTransactionI();
+
+ virtual void commit();
+ virtual void abort();
+
+private:
+
+ ::Ice::CommunicatorPtr _communicator;
+ int _trace;
+
+ ::DB_TXN* _tid;
+
+ std::string _name;
+ std::string _errorPrefix;
+};
+
+class DBCursorI : public DBCursor, public IceUtil::Mutex
+{
+public:
+
+ DBCursorI(const ::Ice::CommunicatorPtr&, const std::string&, DBC*);
+ ~DBCursorI();
+
+ virtual ::Ice::CommunicatorPtr getCommunicator();
+
+ virtual void curr(Key& key, Value& value);
+ virtual void set(const Value& value);
+ virtual bool next();
+ virtual bool prev();
+ virtual void del();
+
+ virtual DBCursorPtr clone();
+ virtual void close();
+
+private:
+
+ ::Ice::CommunicatorPtr _communicator;
+ int _trace;
+
+ std::string _name;
+ std::string _errorPrefix;
+
+ DBC* _cursor;
+};
+
+class DBI : public DB, public IceUtil::Mutex
+{
+public:
+
+ DBI(const ::Ice::CommunicatorPtr&, const DBEnvironmentIPtr&, ::DB*, const std::string&, bool);
+ virtual ~DBI();
+
+ virtual std::string getName();
+ virtual ::Ice::CommunicatorPtr getCommunicator();
+
+ virtual ::Ice::Long getNumberOfRecords();
+
+ virtual DBCursorPtr getCursor();
+ virtual DBCursorPtr getCursorAtKey(const Key&);
+
+ virtual void put(const Key&, const Value&);
+ virtual bool contains(const Key&);
+ virtual Value get(const Key&);
+ virtual void del(const Key&);
+
+ virtual void clear();
+
+ virtual void close();
+ virtual void remove();
+
+ virtual EvictorPtr createEvictor(EvictorPersistenceMode);
+
+private:
+
+ ::Ice::CommunicatorPtr _communicator;
+ int _trace;
+
+ DBEnvironmentIPtr _dbEnvObj;
+ ::DB* _db;
+
+ std::string _name;
+ std::string _errorPrefix;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp
index ea4d8e3376f..c641682b780 100644
--- a/cpp/src/Freeze/EvictorI.cpp
+++ b/cpp/src/Freeze/EvictorI.cpp
@@ -50,7 +50,7 @@ Freeze::EvictorI::EvictorI(const DBPtr& db, EvictorPersistenceMode persistenceMo
Freeze::EvictorI::~EvictorI()
{
- if (!_deactivated)
+ if(!_deactivated)
{
Warning out(_db->getCommunicator()->getLogger());
out << "evictor has not been deactivated";
@@ -62,7 +62,7 @@ Freeze::EvictorI::getDB()
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -75,7 +75,7 @@ Freeze::EvictorI::setSize(Int evictorSize)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -83,7 +83,7 @@ Freeze::EvictorI::setSize(Int evictorSize)
//
// Ignore requests to set the evictor size to values smaller than zero.
//
- if (evictorSize < 0)
+ if(evictorSize < 0)
{
return;
}
@@ -104,7 +104,7 @@ Freeze::EvictorI::getSize()
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -117,7 +117,7 @@ Freeze::EvictorI::createObject(const Identity& ident, const ObjectPtr& servant)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -128,7 +128,7 @@ Freeze::EvictorI::createObject(const Identity& ident, const ObjectPtr& servant)
_dict.insert(make_pair(ident, servant));
add(ident, servant);
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_db->getCommunicator()->getLogger(), "Evictor");
out << "created \"" << ident << "\"";
@@ -145,7 +145,7 @@ Freeze::EvictorI::destroyObject(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -156,7 +156,7 @@ Freeze::EvictorI::destroyObject(const Identity& ident)
_dict.erase(ident);
remove(ident);
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_db->getCommunicator()->getLogger(), "Evictor");
out << "destroyed \"" << ident << "\"";
@@ -168,7 +168,7 @@ Freeze::EvictorI::installServantInitializer(const ServantInitializerPtr& initial
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -181,7 +181,7 @@ Freeze::EvictorI::getIterator()
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -194,7 +194,7 @@ Freeze::EvictorI::hasObject(const Ice::Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if(_deactivated)
{
throw EvictorDeactivatedException(__FILE__, __LINE__);
}
@@ -218,9 +218,9 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const Current& current
EvictorElementPtr element;
map<Identity, EvictorElementPtr>::iterator p = _evictorMap.find(current.identity);
- if (p != _evictorMap.end())
+ if(p != _evictorMap.end())
{
- if (_trace >= 2)
+ if(_trace >= 2)
{
Trace out(_db->getCommunicator()->getLogger(), "Evictor");
out << "found \"" << current.identity << "\" in the queue";
@@ -237,7 +237,7 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const Current& current
}
else
{
- if (_trace >= 2)
+ if(_trace >= 2)
{
Trace out(_db->getCommunicator()->getLogger(), "Evictor");
out << "couldn't find \"" << current.identity << "\" in the queue\n"
@@ -249,7 +249,7 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const Current& current
// Servant for it.
//
IdentityObjectDict::iterator p = _dict.find(current.identity);
- if (p == _dict.end())
+ if(p == _dict.end())
{
//
// The Ice Object with the given identity does not exist,
@@ -267,7 +267,7 @@ Freeze::EvictorI::locate(const ObjectAdapterPtr& adapter, const Current& current
//
// If an initializer is installed, call it now.
//
- if (_initializer)
+ if(_initializer)
{
_initializer->initialize(adapter, current.identity, servant);
}
@@ -317,9 +317,9 @@ Freeze::EvictorI::finished(const ObjectAdapterPtr&, const Current& current,
// If we are in SaveAfterMutatingOperation mode, we must save the
// Ice Object if this was a mutating call.
//
- if (_persistenceMode == SaveAfterMutatingOperation)
+ if(_persistenceMode == SaveAfterMutatingOperation)
{
- if (!current.nonmutating)
+ if(!current.nonmutating)
{
_dict.insert(make_pair(current.identity, servant));
}
@@ -336,11 +336,11 @@ Freeze::EvictorI::deactivate()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_deactivated)
+ if(!_deactivated)
{
_deactivated = true;
- if (_trace >= 1)
+ if(_trace >= 1)
{
Trace out(_db->getCommunicator()->getLogger(), "Evictor");
out << "deactivating, saving unsaved Ice Objects to the database";
@@ -364,7 +364,7 @@ Freeze::EvictorI::evict()
// With most STL implementations, _evictorMap.size() is faster
// than _evictorList.size().
//
- while (_evictorMap.size() > _evictorSize)
+ while(_evictorMap.size() > _evictorSize)
{
//
// Get the last unused element from the evictor queue.
@@ -374,7 +374,7 @@ Freeze::EvictorI::evict()
{
q = _evictorMap.find(*p);
assert(q != _evictorMap.end());
- if (q->second->usageCount == 0)
+ if(q->second->usageCount == 0)
{
break; // Fine, Servant is not in use.
}
@@ -394,7 +394,7 @@ Freeze::EvictorI::evict()
// If we are in SaveUponEviction mode, we must save the Ice
// Object that is about to be evicted to persistent store.
//
- if (_persistenceMode == SaveUponEviction)
+ if(_persistenceMode == SaveUponEviction)
{
_dict.insert(make_pair(ident, element->servant));
}
@@ -406,7 +406,7 @@ Freeze::EvictorI::evict()
_evictorMap.erase(q);
++p;
- if (_trace >= 2)
+ if(_trace >= 2)
{
Trace out(_db->getCommunicator()->getLogger(), "Evictor");
out << "evicted \"" << ident << "\" from the queue\n"
@@ -419,7 +419,7 @@ Freeze::EvictorI::evict()
// evict, set _db to zero to break cyclic object
// dependencies.
//
- if (_deactivated && _evictorMap.empty())
+ if(_deactivated && _evictorMap.empty())
{
assert(_evictorList.empty());
assert(_evictorSize == 0);
@@ -434,7 +434,7 @@ Freeze::EvictorI::add(const Identity& ident, const ObjectPtr& servant)
// Ignore the request if the Ice Object is already in the queue.
//
map<Identity, EvictorElementPtr>::const_iterator p = _evictorMap.find(ident);
- if (p != _evictorMap.end())
+ if(p != _evictorMap.end())
{
return p->second;
}
@@ -458,7 +458,7 @@ Freeze::EvictorI::remove(const Identity& ident)
// If the Ice Object is currently in the evictor, remove it.
//
map<Identity, EvictorElementPtr>::iterator p = _evictorMap.find(ident);
- if (p != _evictorMap.end())
+ if(p != _evictorMap.end())
{
_evictorList.erase(p->second->position);
_evictorMap.erase(p);
@@ -492,7 +492,7 @@ Freeze::EvictorIteratorI::hasNext()
Ice::Identity
Freeze::EvictorIteratorI::next()
{
- if (_curr == _end)
+ if(_curr == _end)
{
throw Freeze::NoSuchElementException(__FILE__, __LINE__);
}
diff --git a/cpp/src/Freeze/EvictorI.h b/cpp/src/Freeze/EvictorI.h
index 5c7a7304b2f..f113579dad5 100644
--- a/cpp/src/Freeze/EvictorI.h
+++ b/cpp/src/Freeze/EvictorI.h
@@ -1,76 +1,76 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef FREEZE_EVICTOR_I_H
-#define FREEZE_EVICTOR_I_H
-
-#include <IceUtil/IceUtil.h>
-#include <Ice/Ice.h>
-#include <Freeze/Evictor.h>
-#include <Freeze/IdentityObjectDict.h>
-
-#include <list>
-
-namespace Freeze
-{
-
-class EvictorI : public Evictor, public IceUtil::Mutex
-{
-public:
-
- EvictorI(const Freeze::DBPtr&, EvictorPersistenceMode);
- virtual ~EvictorI();
-
- virtual DBPtr getDB();
-
- virtual void setSize(Ice::Int);
- virtual Ice::Int getSize();
-
- virtual void createObject(const Ice::Identity&, const Ice::ObjectPtr&);
- virtual void destroyObject(const Ice::Identity&);
-
- virtual void installServantInitializer(const ServantInitializerPtr&);
- virtual EvictorIteratorPtr getIterator();
- virtual bool hasObject(const Ice::Identity&);
-
- virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&);
- virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&,
- const Ice::ObjectPtr&, const Ice::LocalObjectPtr&);
- virtual void deactivate();
-
-private:
-
- struct EvictorElement : public Ice::LocalObject
- {
- Ice::ObjectPtr servant;
- std::list<Ice::Identity>::iterator position;
- int usageCount;
- };
- typedef IceUtil::Handle<EvictorElement> EvictorElementPtr;
-
- void evict();
- EvictorElementPtr add(const Ice::Identity&, const Ice::ObjectPtr&);
- void remove(const Ice::Identity&);
-
- std::map<Ice::Identity, EvictorElementPtr> _evictorMap;
- std::list<Ice::Identity> _evictorList;
- std::map<Ice::Identity, EvictorElementPtr>::size_type _evictorSize;
-
- bool _deactivated;
- IdentityObjectDict _dict;
- Freeze::DBPtr _db;
- EvictorPersistenceMode _persistenceMode;
- ServantInitializerPtr _initializer;
- int _trace;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef FREEZE_EVICTOR_I_H
+#define FREEZE_EVICTOR_I_H
+
+#include <IceUtil/IceUtil.h>
+#include <Ice/Ice.h>
+#include <Freeze/Evictor.h>
+#include <Freeze/IdentityObjectDict.h>
+
+#include <list>
+
+namespace Freeze
+{
+
+class EvictorI : public Evictor, public IceUtil::Mutex
+{
+public:
+
+ EvictorI(const Freeze::DBPtr&, EvictorPersistenceMode);
+ virtual ~EvictorI();
+
+ virtual DBPtr getDB();
+
+ virtual void setSize(Ice::Int);
+ virtual Ice::Int getSize();
+
+ virtual void createObject(const Ice::Identity&, const Ice::ObjectPtr&);
+ virtual void destroyObject(const Ice::Identity&);
+
+ virtual void installServantInitializer(const ServantInitializerPtr&);
+ virtual EvictorIteratorPtr getIterator();
+ virtual bool hasObject(const Ice::Identity&);
+
+ virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&);
+ virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&,
+ const Ice::ObjectPtr&, const Ice::LocalObjectPtr&);
+ virtual void deactivate();
+
+private:
+
+ struct EvictorElement : public Ice::LocalObject
+ {
+ Ice::ObjectPtr servant;
+ std::list<Ice::Identity>::iterator position;
+ int usageCount;
+ };
+ typedef IceUtil::Handle<EvictorElement> EvictorElementPtr;
+
+ void evict();
+ EvictorElementPtr add(const Ice::Identity&, const Ice::ObjectPtr&);
+ void remove(const Ice::Identity&);
+
+ std::map<Ice::Identity, EvictorElementPtr> _evictorMap;
+ std::list<Ice::Identity> _evictorList;
+ std::map<Ice::Identity, EvictorElementPtr>::size_type _evictorSize;
+
+ bool _deactivated;
+ IdentityObjectDict _dict;
+ Freeze::DBPtr _db;
+ EvictorPersistenceMode _persistenceMode;
+ ServantInitializerPtr _initializer;
+ int _trace;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Glacier/Blobject.cpp b/cpp/src/Glacier/Blobject.cpp
index ca3c123dbe1..413a5088af4 100644
--- a/cpp/src/Glacier/Blobject.cpp
+++ b/cpp/src/Glacier/Blobject.cpp
@@ -39,7 +39,7 @@ Glacier::Blobject::destroy()
{
IceUtil::Mutex::Lock lock(_missiveQueueMutex);
- if (_missiveQueue)
+ if(_missiveQueue)
{
_missiveQueue->destroy();
_missiveQueueControl.join();
@@ -57,17 +57,17 @@ Glacier::Blobject::invoke(ObjectPrx& proxy, const vector<Byte>& inParams, vector
{
MissiveQueuePtr missiveQueue = modifyProxy(proxy, current);
- if (missiveQueue) // Batch routing?
+ if(missiveQueue) // Batch routing?
{
missiveQueue->add(new Missive(proxy, inParams, current, _forwardContext));
return true;
}
else // Regular routing.
{
- if (_traceLevel >= 2)
+ if(_traceLevel >= 2)
{
Trace out(_logger, "Glacier");
- if (reverse())
+ if(reverse())
{
out << "reverse ";
}
@@ -77,7 +77,7 @@ Glacier::Blobject::invoke(ObjectPrx& proxy, const vector<Byte>& inParams, vector
<< "nonmutating = " << (current.nonmutating ? "true" : "false");
}
- if (_forwardContext)
+ if(_forwardContext)
{
return proxy->ice_invoke(current.operation, current.nonmutating, inParams, outParams, current.context);
}
@@ -89,10 +89,10 @@ Glacier::Blobject::invoke(ObjectPrx& proxy, const vector<Byte>& inParams, vector
}
catch (const Exception& ex)
{
- if (_traceLevel >= 1)
+ if(_traceLevel >= 1)
{
Trace out(_logger, "Glacier");
- if (reverse())
+ if(reverse())
{
out << "reverse ";
}
@@ -109,19 +109,19 @@ Glacier::Blobject::invoke(ObjectPrx& proxy, const vector<Byte>& inParams, vector
MissiveQueuePtr
Glacier::Blobject::modifyProxy(ObjectPrx& proxy, const Current& current)
{
- if (!current.facet.empty())
+ if(!current.facet.empty())
{
proxy = proxy->ice_newFacet(current.facet);
}
MissiveQueuePtr missiveQueue;
Context::const_iterator p = current.context.find("_fwd");
- if (p != current.context.end())
+ if(p != current.context.end())
{
- for (unsigned int i = 0; i < p->second.length(); ++i)
+ for(unsigned int i = 0; i < p->second.length(); ++i)
{
char option = p->second[i];
- switch (option)
+ switch(option)
{
case 't':
{
@@ -184,7 +184,7 @@ Glacier::Blobject::getMissiveQueue()
// Lazy missive queue initialization.
//
IceUtil::Mutex::Lock lock(_missiveQueueMutex);
- if (!_missiveQueue)
+ if(!_missiveQueue)
{
_missiveQueue = new MissiveQueue(_communicator, _traceLevel, reverse(), _batchSleepTime);
_missiveQueueControl = _missiveQueue->start();
diff --git a/cpp/src/Glacier/Blobject.h b/cpp/src/Glacier/Blobject.h
index 3c362e771c0..ae550769290 100644
--- a/cpp/src/Glacier/Blobject.h
+++ b/cpp/src/Glacier/Blobject.h
@@ -1,53 +1,53 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef BLOBJECT_H
-#define BLOBJECT_H
-
-#include <Ice/Ice.h>
-#include <Glacier/Missive.h>
-
-namespace Glacier
-{
-
-class Blobject : public Ice::Blobject
-{
-public:
-
- Blobject(const Ice::CommunicatorPtr&);
- virtual ~Blobject();
-
- virtual bool reverse() = 0;
-
- void destroy();
- bool invoke(Ice::ObjectPrx&, const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
- MissiveQueuePtr modifyProxy(Ice::ObjectPrx&, const Ice::Current&);
-
-protected:
-
- Ice::CommunicatorPtr _communicator;
- Ice::LoggerPtr _logger;
-
- int _traceLevel;
- bool _forwardContext;
- IceUtil::Time _batchSleepTime;
-
-private:
-
- MissiveQueuePtr getMissiveQueue();
-
- MissiveQueuePtr _missiveQueue;
- IceUtil::ThreadControl _missiveQueueControl;
- IceUtil::Mutex _missiveQueueMutex;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef BLOBJECT_H
+#define BLOBJECT_H
+
+#include <Ice/Ice.h>
+#include <Glacier/Missive.h>
+
+namespace Glacier
+{
+
+class Blobject : public Ice::Blobject
+{
+public:
+
+ Blobject(const Ice::CommunicatorPtr&);
+ virtual ~Blobject();
+
+ virtual bool reverse() = 0;
+
+ void destroy();
+ bool invoke(Ice::ObjectPrx&, const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
+ MissiveQueuePtr modifyProxy(Ice::ObjectPrx&, const Ice::Current&);
+
+protected:
+
+ Ice::CommunicatorPtr _communicator;
+ Ice::LoggerPtr _logger;
+
+ int _traceLevel;
+ bool _forwardContext;
+ IceUtil::Time _batchSleepTime;
+
+private:
+
+ MissiveQueuePtr getMissiveQueue();
+
+ MissiveQueuePtr _missiveQueue;
+ IceUtil::ThreadControl _missiveQueueControl;
+ IceUtil::Mutex _missiveQueueMutex;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Glacier/ClientBlobject.cpp b/cpp/src/Glacier/ClientBlobject.cpp
index 4fca8a9d50a..e582b4e73c9 100644
--- a/cpp/src/Glacier/ClientBlobject.cpp
+++ b/cpp/src/Glacier/ClientBlobject.cpp
@@ -31,7 +31,7 @@ Glacier::ClientBlobject::ClientBlobject(const CommunicatorPtr& communicator,
const string ws = " \t";
string::size_type current = allowCategories.find_first_not_of(ws, 0);
- while (current != string::npos)
+ while(current != string::npos)
{
string::size_type pos = allowCategories.find_first_of(ws, current);
string::size_type len = (pos == string::npos) ? string::npos : pos - current;
@@ -68,11 +68,11 @@ Glacier::ClientBlobject::ice_invoke(const vector<Byte>& inParams, vector<Byte>&
//
// If there is an _allowCategories set then enforce it.
//
- if (!_allowCategories.empty())
+ if(!_allowCategories.empty())
{
- if (!binary_search(_allowCategories.begin(), _allowCategories.end(), current.identity.category))
+ if(!binary_search(_allowCategories.begin(), _allowCategories.end(), current.identity.category))
{
- if (_traceLevel >= 1)
+ if(_traceLevel >= 1)
{
Trace out(_logger, "Glacier");
out << "rejecting request\n";
@@ -85,7 +85,7 @@ Glacier::ClientBlobject::ice_invoke(const vector<Byte>& inParams, vector<Byte>&
}
ObjectPrx proxy = _routingTable->get(current.identity);
- if (!proxy)
+ if(!proxy)
{
ObjectNotExistException ex(__FILE__, __LINE__);
ex.identity = current.identity;
diff --git a/cpp/src/Glacier/ClientBlobject.h b/cpp/src/Glacier/ClientBlobject.h
index cb866f6a4ac..77d68adf86a 100644
--- a/cpp/src/Glacier/ClientBlobject.h
+++ b/cpp/src/Glacier/ClientBlobject.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef CLIENT_BLOBJECT_H
-#define CLIENT_BLOBJECT_H
-
-#include <Ice/RoutingTableF.h>
-#include <Glacier/Blobject.h>
-
-namespace Glacier
-{
-
-class ClientBlobject : public Glacier::Blobject
-{
-public:
-
- ClientBlobject(const Ice::CommunicatorPtr&, const IceInternal::RoutingTablePtr&, const std::string&);
-
- virtual bool reverse();
-
- void destroy();
- virtual bool ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
-
-private:
-
- IceInternal::RoutingTablePtr _routingTable;
- std::vector<std::string> _allowCategories;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef CLIENT_BLOBJECT_H
+#define CLIENT_BLOBJECT_H
+
+#include <Ice/RoutingTableF.h>
+#include <Glacier/Blobject.h>
+
+namespace Glacier
+{
+
+class ClientBlobject : public Glacier::Blobject
+{
+public:
+
+ ClientBlobject(const Ice::CommunicatorPtr&, const IceInternal::RoutingTablePtr&, const std::string&);
+
+ virtual bool reverse();
+
+ void destroy();
+ virtual bool ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
+
+private:
+
+ IceInternal::RoutingTablePtr _routingTable;
+ std::vector<std::string> _allowCategories;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Glacier/GlacierRouter.cpp b/cpp/src/Glacier/GlacierRouter.cpp
index 6f885d3c792..73fca122679 100644
--- a/cpp/src/Glacier/GlacierRouter.cpp
+++ b/cpp/src/Glacier/GlacierRouter.cpp
@@ -72,13 +72,13 @@ void
Glacier::ServantLocator::deactivate()
{
ClientBlobject* clientBlobject = dynamic_cast<ClientBlobject*>(_blobject.get());
- if (clientBlobject)
+ if(clientBlobject)
{
clientBlobject->destroy();
}
ServerBlobject* serverBlobject = dynamic_cast<ServerBlobject*>(_blobject.get());
- if (serverBlobject)
+ if(serverBlobject)
{
serverBlobject->destroy();
}
@@ -100,14 +100,14 @@ Glacier::RouterApp::usage()
int
Glacier::RouterApp::run(int argc, char* argv[])
{
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
@@ -128,7 +128,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
//
// Only do this if we've been configured for SSL.
//
- if (!clientConfig.empty() && !serverConfig.empty())
+ if(!clientConfig.empty() && !serverConfig.empty())
{
IceSSL::ContextType contextType = IceSSL::ClientServer;
@@ -147,7 +147,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
// If we have been told only to only accept a single certificate.
string clientCertBase64 = properties->getProperty("Glacier.Router.AcceptCert");
- if (!clientCertBase64.empty())
+ if(!clientCertBase64.empty())
{
// Install a Certificate Verifier that only accepts indicated certificate.
Ice::ByteSeq clientCert = IceUtil::Base64::decode(clientCertBase64);
@@ -168,7 +168,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
//
const char* clientEndpointsProperty = "Glacier.Router.Client.Endpoints";
string clientEndpoints = properties->getProperty(clientEndpointsProperty);
- if (clientEndpoints.empty())
+ if(clientEndpoints.empty())
{
cerr << appName() << ": property `" << clientEndpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -182,7 +182,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
const char* serverEndpointsProperty = "Glacier.Router.Server.Endpoints";
string serverEndpoints = properties->getProperty(serverEndpointsProperty);
ObjectAdapterPtr serverAdapter;
- if (!serverEndpoints.empty())
+ if(!serverEndpoints.empty())
{
serverAdapter = communicator()->createObjectAdapterFromProperty("Server", serverEndpointsProperty);
}
@@ -196,7 +196,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
ObjectPtr clientBlobject = new ClientBlobject(communicator(), routingTable, allowCategories);
Ice::ServantLocatorPtr clientServantLocator = new Glacier::ServantLocator(clientBlobject);
clientAdapter->addServantLocator(clientServantLocator, "");
- if (serverAdapter)
+ if(serverAdapter)
{
ObjectPtr serverBlobject = new ServerBlobject(clientAdapter);
Ice::ServantLocatorPtr serverServantLocator = new Glacier::ServantLocator(serverBlobject);
@@ -208,7 +208,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
//
const char* routerEndpointsProperty = "Glacier.Router.Endpoints";
string routerEndpoints = properties->getProperty(routerEndpointsProperty);
- if (routerEndpoints.empty())
+ if(routerEndpoints.empty())
{
cerr << appName() << ": property `" << routerEndpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -221,7 +221,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
string sessionManager = properties->getProperty(sessionManagerProperty);
SessionManagerPrx sessionManagerPrx;
- if (!sessionManager.empty())
+ if(!sessionManager.empty())
{
sessionManagerPrx = SessionManagerPrx::checkedCast(communicator()->stringToProxy(sessionManager));
}
@@ -240,13 +240,13 @@ Glacier::RouterApp::run(int argc, char* argv[])
// specified in the properties, if so requested.
//
string outputFd = properties->getProperty("Glacier.Router.PrintProxyOnFd");
- if (!outputFd.empty())
+ if(!outputFd.empty())
{
int fd = atoi(outputFd.c_str());
string ref = communicator()->proxyToString(routerAdapter->createProxy(stringToIdentity(routerIdentity)));
ref += "\n";
string::size_type sz = static_cast<string::size_type>(write(fd, ref.c_str(), ref.length()));
- if (sz != ref.length())
+ if(sz != ref.length())
{
cerr << appName() << ": cannot write stringified router proxy to filedescriptor " << fd << ": "
<< strerror(errno) << endl;
@@ -270,7 +270,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
//
shutdownOnInterrupt();
clientAdapter->activate();
- if (serverAdapter)
+ if(serverAdapter)
{
serverAdapter->activate();
}
diff --git a/cpp/src/Glacier/GlacierStarter.cpp b/cpp/src/Glacier/GlacierStarter.cpp
index 693cac79140..7a713364556 100644
--- a/cpp/src/Glacier/GlacierStarter.cpp
+++ b/cpp/src/Glacier/GlacierStarter.cpp
@@ -48,14 +48,14 @@ Glacier::RouterApp::usage()
int
Glacier::RouterApp::run(int argc, char* argv[])
{
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
@@ -75,7 +75,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
//
const char* endpointsProperty = "Glacier.Starter.Endpoints";
string endpoints = properties->getProperty(endpointsProperty);
- if (endpoints.empty())
+ if(endpoints.empty())
{
cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -88,10 +88,10 @@ Glacier::RouterApp::run(int argc, char* argv[])
//
string verifierProperty = properties->getProperty("Glacier.Starter.PasswordVerifier");
PasswordVerifierPrx verifier;
- if (!verifierProperty.empty())
+ if(!verifierProperty.empty())
{
verifier = PasswordVerifierPrx::checkedCast(communicator()->stringToProxy(verifierProperty));
- if (!verifier)
+ if(!verifier)
{
cerr << appName() << ": password verifier `" << verifierProperty << "' is invalid" << endl;
return EXIT_FAILURE;
@@ -102,7 +102,7 @@ Glacier::RouterApp::run(int argc, char* argv[])
string passwordsProperty = properties->getPropertyWithDefault("Glacier.Starter.CryptPasswords", "passwords");
ifstream passwordFile(passwordsProperty.c_str());
- if (!passwordFile)
+ if(!passwordFile)
{
cerr << appName() << ": cannot open `" << passwordsProperty << "' for reading: " << strerror(errno)
<< endl;
@@ -115,14 +115,14 @@ Glacier::RouterApp::run(int argc, char* argv[])
{
string userId;
passwordFile >> userId;
- if (!passwordFile)
+ if(!passwordFile)
{
break;
}
string password;
passwordFile >> password;
- if (!passwordFile)
+ if(!passwordFile)
{
break;
}
diff --git a/cpp/src/Glacier/Missive.cpp b/cpp/src/Glacier/Missive.cpp
index 4daa3165ab2..bdc46f1ec2f 100644
--- a/cpp/src/Glacier/Missive.cpp
+++ b/cpp/src/Glacier/Missive.cpp
@@ -22,7 +22,7 @@ Glacier::Missive::Missive(const ObjectPrx& proxy, const vector<Byte>& inParams,
_forwardContext(forwardContext)
{
Context::const_iterator p = current.context.find("_ovrd");
- if (p != current.context.end())
+ if(p != current.context.end())
{
_override = p->second;
}
@@ -32,7 +32,7 @@ void
Glacier::Missive::invoke()
{
std::vector<Byte> dummy;
- if (_forwardContext)
+ if(_forwardContext)
{
_proxy->ice_invoke(_current.operation, _current.nonmutating, _inParams, dummy, _current.context);
}
@@ -45,7 +45,7 @@ Glacier::Missive::invoke()
bool
Glacier::Missive::override(const MissivePtr& other)
{
- if (_override.empty() || other->_override.empty())
+ if(_override.empty() || other->_override.empty())
{
return false;
}
@@ -105,14 +105,14 @@ Glacier::MissiveQueue::add(const MissivePtr& missive)
assert(!_destroy);
- if (_missives.empty())
+ if(_missives.empty())
{
notify();
}
- for (std::vector<MissivePtr>::iterator p = _missives.begin(); p != _missives.end(); ++p)
+ for(std::vector<MissivePtr>::iterator p = _missives.begin(); p != _missives.end(); ++p)
{
- if (missive->override(*p))
+ if(missive->override(*p))
{
*p = missive; // Replace old missive if this is an override.
return;
@@ -125,36 +125,36 @@ Glacier::MissiveQueue::add(const MissivePtr& missive)
void
Glacier::MissiveQueue::run()
{
- while (true)
+ while(true)
{
vector<ObjectPrx> proxies;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- while (!_destroy && _missives.empty())
+ while(!_destroy && _missives.empty())
{
wait();
}
- if (_destroy)
+ if(_destroy)
{
return;
}
proxies.reserve(_missives.size());
vector<MissivePtr>::const_iterator p;
- for (p = _missives.begin(); p != _missives.end(); ++p)
+ for(p = _missives.begin(); p != _missives.end(); ++p)
{
try
{
const ObjectPrx& proxy = (*p)->getProxy();
const Current& current = (*p)->getCurrent();
- if (_traceLevel >= 2)
+ if(_traceLevel >= 2)
{
Trace out(_logger, "Glacier");
- if (_reverse)
+ if(_reverse)
{
out << "reverse ";
}
@@ -169,10 +169,10 @@ Glacier::MissiveQueue::run()
}
catch (const Ice::Exception& ex)
{
- if (_traceLevel >= 1)
+ if(_traceLevel >= 1)
{
Trace out(_logger, "Glacier");
- if (_reverse)
+ if(_reverse)
{
out << "reverse ";
}
@@ -197,7 +197,7 @@ Glacier::MissiveQueue::run()
// sort(proxies.begin(), proxies.end());
// proxies.erase(unique(proxies.begin(), proxies.end()), proxies.end());
vector<ObjectPrx>::const_iterator p;
- for (p = proxies.begin(); p != proxies.end(); ++p)
+ for(p = proxies.begin(); p != proxies.end(); ++p)
{
(*p)->ice_flush();
}
@@ -206,7 +206,7 @@ Glacier::MissiveQueue::run()
// In order to avoid flooding the missive receivers, we add
// a delay between sending missives.
//
- if (_sleepTime > IceUtil::Time())
+ if(_sleepTime > IceUtil::Time())
{
IceUtil::ThreadControl::sleep(_sleepTime);
}
@@ -215,10 +215,10 @@ Glacier::MissiveQueue::run()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- if (_traceLevel >= 1)
+ if(_traceLevel >= 1)
{
Trace out(_logger, "Glacier");
- if (_reverse)
+ if(_reverse)
{
out << "reverse ";
}
diff --git a/cpp/src/Glacier/Missive.h b/cpp/src/Glacier/Missive.h
index 96ec51c5762..534dee19f4f 100644
--- a/cpp/src/Glacier/Missive.h
+++ b/cpp/src/Glacier/Missive.h
@@ -1,74 +1,74 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef MISSIVE_H
-#define MISSIVE_H
-
-#include <Ice/Ice.h>
-#include <IceUtil/Thread.h>
-#include <IceUtil/Monitor.h>
-
-namespace Glacier
-{
-
-class Missive;
-typedef IceUtil::Handle<Missive> MissivePtr;
-
-class Missive : virtual public IceUtil::Shared
-{
-public:
-
- Missive(const Ice::ObjectPrx&, const std::vector<Ice::Byte>&, const Ice::Current&, bool);
-
- void invoke();
- bool override(const MissivePtr&);
- const Ice::ObjectPrx& getProxy() const;
- const Ice::Current& getCurrent() const;
-
-private:
-
- Ice::ObjectPrx _proxy;
- std::vector<Ice::Byte> _inParams;
- Ice::Current _current;
- bool _forwardContext;
- std::string _override;
-};
-
-class MissiveQueue;
-typedef IceUtil::Handle<MissiveQueue> MissiveQueuePtr;
-
-class MissiveQueue : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
-{
-public:
-
- MissiveQueue(const Ice::CommunicatorPtr&, int, bool, const IceUtil::Time&);
- virtual ~MissiveQueue();
-
- void destroy();
- void add(const MissivePtr&);
-
- virtual void run();
-
-private:
-
- Ice::CommunicatorPtr _communicator;
- Ice::LoggerPtr _logger;
- int _traceLevel;
- bool _reverse;
- IceUtil::Time _sleepTime;
-
- std::vector<MissivePtr> _missives;
- bool _destroy;
-};
-
-};
-
-#endif
-
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef MISSIVE_H
+#define MISSIVE_H
+
+#include <Ice/Ice.h>
+#include <IceUtil/Thread.h>
+#include <IceUtil/Monitor.h>
+
+namespace Glacier
+{
+
+class Missive;
+typedef IceUtil::Handle<Missive> MissivePtr;
+
+class Missive : virtual public IceUtil::Shared
+{
+public:
+
+ Missive(const Ice::ObjectPrx&, const std::vector<Ice::Byte>&, const Ice::Current&, bool);
+
+ void invoke();
+ bool override(const MissivePtr&);
+ const Ice::ObjectPrx& getProxy() const;
+ const Ice::Current& getCurrent() const;
+
+private:
+
+ Ice::ObjectPrx _proxy;
+ std::vector<Ice::Byte> _inParams;
+ Ice::Current _current;
+ bool _forwardContext;
+ std::string _override;
+};
+
+class MissiveQueue;
+typedef IceUtil::Handle<MissiveQueue> MissiveQueuePtr;
+
+class MissiveQueue : public IceUtil::Thread, public IceUtil::Monitor<IceUtil::Mutex>
+{
+public:
+
+ MissiveQueue(const Ice::CommunicatorPtr&, int, bool, const IceUtil::Time&);
+ virtual ~MissiveQueue();
+
+ void destroy();
+ void add(const MissivePtr&);
+
+ virtual void run();
+
+private:
+
+ Ice::CommunicatorPtr _communicator;
+ Ice::LoggerPtr _logger;
+ int _traceLevel;
+ bool _reverse;
+ IceUtil::Time _sleepTime;
+
+ std::vector<MissivePtr> _missives;
+ bool _destroy;
+};
+
+};
+
+#endif
+
diff --git a/cpp/src/Glacier/RouterI.cpp b/cpp/src/Glacier/RouterI.cpp
index 751a298eb89..ed3373cbdf1 100644
--- a/cpp/src/Glacier/RouterI.cpp
+++ b/cpp/src/Glacier/RouterI.cpp
@@ -51,7 +51,7 @@ Glacier::RouterI::destroy()
_serverAdapter = 0;
_logger = 0;
_routingTable = 0;
- for (vector<SessionPrx>::const_iterator p = _sessions.begin(); p != _sessions.end(); ++p)
+ for(vector<SessionPrx>::const_iterator p = _sessions.begin(); p != _sessions.end(); ++p)
{
try
{
@@ -78,7 +78,7 @@ Glacier::RouterI::getServerProxy(const Current&)
{
assert(_clientAdapter); // Destroyed?
- if (_serverAdapter)
+ if(_serverAdapter)
{
return _serverAdapter->createProxy(stringToIdentity("dummy"));
}
@@ -93,7 +93,7 @@ Glacier::RouterI::addProxy(const ObjectPrx& proxy, const Current&)
{
assert(_clientAdapter); // Destroyed?
- if (_routingTableTraceLevel)
+ if(_routingTableTraceLevel)
{
Trace out(_logger, "Glacier");
out << "adding proxy to routing table:\n" << _clientAdapter->getCommunicator()->proxyToString(proxy);
@@ -117,7 +117,7 @@ Glacier::RouterI::createSession(const Current&)
assert(_clientAdapter); // Destroyed?
IceUtil::Mutex::Lock lock(_sessionMutex);
- if (!_sessionManager)
+ if(!_sessionManager)
{
throw NoSessionManagerException();
}
diff --git a/cpp/src/Glacier/RouterI.h b/cpp/src/Glacier/RouterI.h
index 03a3aaee906..8dc57381f4a 100644
--- a/cpp/src/Glacier/RouterI.h
+++ b/cpp/src/Glacier/RouterI.h
@@ -1,55 +1,55 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GLACIER_ROUTER_I_H
-#define GLACIER_ROUTER_I_H
-
-#include <Ice/RoutingTableF.h>
-#include <Ice/Ice.h>
-#include <Glacier/Router.h>
-#include <Glacier/SessionManagerF.h>
-
-namespace Glacier
-{
-
-class RouterI : public Router
-{
-public:
-
- RouterI(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const ::IceInternal::RoutingTablePtr&,
- const SessionManagerPrx&, const std::string&);
-
- virtual ~RouterI();
-
- void destroy();
-
- virtual Ice::ObjectPrx getClientProxy(const Ice::Current&);
- virtual Ice::ObjectPrx getServerProxy(const Ice::Current&);
- virtual void addProxy(const Ice::ObjectPrx&, const Ice::Current&);
- virtual void shutdown(const Ice::Current&);
- virtual SessionPrx createSession(const Ice::Current&);
-
-private:
-
- Ice::ObjectAdapterPtr _clientAdapter;
- Ice::ObjectAdapterPtr _serverAdapter;
- Ice::LoggerPtr _logger;
- ::IceInternal::RoutingTablePtr _routingTable;
- int _routingTableTraceLevel;
-
- IceUtil::Mutex _sessionMutex;
- SessionManagerPrx _sessionManager;
- std::vector<SessionPrx> _sessions;
- std::string _userId;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GLACIER_ROUTER_I_H
+#define GLACIER_ROUTER_I_H
+
+#include <Ice/RoutingTableF.h>
+#include <Ice/Ice.h>
+#include <Glacier/Router.h>
+#include <Glacier/SessionManagerF.h>
+
+namespace Glacier
+{
+
+class RouterI : public Router
+{
+public:
+
+ RouterI(const Ice::ObjectAdapterPtr&, const Ice::ObjectAdapterPtr&, const ::IceInternal::RoutingTablePtr&,
+ const SessionManagerPrx&, const std::string&);
+
+ virtual ~RouterI();
+
+ void destroy();
+
+ virtual Ice::ObjectPrx getClientProxy(const Ice::Current&);
+ virtual Ice::ObjectPrx getServerProxy(const Ice::Current&);
+ virtual void addProxy(const Ice::ObjectPrx&, const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+ virtual SessionPrx createSession(const Ice::Current&);
+
+private:
+
+ Ice::ObjectAdapterPtr _clientAdapter;
+ Ice::ObjectAdapterPtr _serverAdapter;
+ Ice::LoggerPtr _logger;
+ ::IceInternal::RoutingTablePtr _routingTable;
+ int _routingTableTraceLevel;
+
+ IceUtil::Mutex _sessionMutex;
+ SessionManagerPrx _sessionManager;
+ std::vector<SessionPrx> _sessions;
+ std::string _userId;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Glacier/ServerBlobject.h b/cpp/src/Glacier/ServerBlobject.h
index d28ac9e9515..41d71726547 100644
--- a/cpp/src/Glacier/ServerBlobject.h
+++ b/cpp/src/Glacier/ServerBlobject.h
@@ -1,37 +1,37 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef SERVER_BLOBJECT_H
-#define SERVER_BLOBJECT_H
-
-#include <Glacier/Blobject.h>
-
-namespace Glacier
-{
-
-class ServerBlobject : public Glacier::Blobject
-{
-public:
-
- ServerBlobject(const Ice::ObjectAdapterPtr&);
-
- virtual bool reverse();
-
- void destroy();
- virtual bool ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
-
-private:
-
- Ice::ObjectAdapterPtr _clientAdapter;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef SERVER_BLOBJECT_H
+#define SERVER_BLOBJECT_H
+
+#include <Glacier/Blobject.h>
+
+namespace Glacier
+{
+
+class ServerBlobject : public Glacier::Blobject
+{
+public:
+
+ ServerBlobject(const Ice::ObjectAdapterPtr&);
+
+ virtual bool reverse();
+
+ void destroy();
+ virtual bool ice_invoke(const std::vector<Ice::Byte>&, std::vector<Ice::Byte>&, const Ice::Current&);
+
+private:
+
+ Ice::ObjectAdapterPtr _clientAdapter;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Glacier/StarterI.cpp b/cpp/src/Glacier/StarterI.cpp
index 1763e844336..ea85a1e3de5 100644
--- a/cpp/src/Glacier/StarterI.cpp
+++ b/cpp/src/Glacier/StarterI.cpp
@@ -75,7 +75,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
{
assert(_communicator); // Destroyed?
- if (!_verifier->checkPassword(userId, password))
+ if(!_verifier->checkPassword(userId, password))
{
throw InvalidPasswordException();
}
@@ -103,7 +103,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
string routerCertificateBase64;
string clientCertificateBase64;
- if (sslConfigured)
+ if(sslConfigured)
{
//
// Create a certificate for the client and the router.
@@ -130,14 +130,14 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
try
{
- if (pipe(fds) != 0)
+ if(pipe(fds) != 0)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
pid = fork();
- if (pid == -1)
+ if(pid == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -151,7 +151,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
ex.ice_throw();
}
- if (pid == 0) // Child process.
+ if(pid == 0) // Child process.
{
//
// Close all filedescriptors, except for standard input,
@@ -159,9 +159,9 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
// of the newly created pipe.
//
int maxFd = static_cast<int>(sysconf(_SC_OPEN_MAX));
- for (int fd = 3; fd < maxFd; ++fd)
+ for(int fd = 3; fd < maxFd; ++fd)
{
- if (fd != fds[1])
+ if(fd != fds[1])
{
close(fd);
}
@@ -178,7 +178,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
// be seen with `ps'. Keys and certificate should rather be
// passed through a pipe? (ML will take care of this...)
//
- if (sslConfigured)
+ if(sslConfigured)
{
args.push_back("--IceSSL.Server.Overrides.RSA.PrivateKey=" + routerPrivateKeyBase64);
args.push_back("--IceSSL.Server.Overrides.RSA.Certificate=" + routerCertificateBase64);
@@ -189,7 +189,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
args.push_back("--Glacier.Router.UserId=" + userId);
- if (!_properties->getProperty("Glacier.Starter.AddUserToAllowCategories").empty())
+ if(!_properties->getProperty("Glacier.Starter.AddUserToAllowCategories").empty())
{
args.push_back("--Glacier.Router.AllowCategories=" +
_properties->getProperty("Glacier.Router.AllowCategories") + " " + userId);
@@ -199,22 +199,22 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
s << "--Glacier.Router.PrintProxyOnFd=" << fds[1];
args.push_back(s.str());
string overwrite = _properties->getProperty("Glacier.Starter.PropertiesOverwrite");
- if (!overwrite.empty())
+ if(!overwrite.empty())
{
string::size_type end = 0;
- while (end != string::npos)
+ while(end != string::npos)
{
static const string delim = " \t\r\n";
string::size_type beg = overwrite.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
end = overwrite.find_first_of(delim, beg);
string arg;
- if (end == string::npos)
+ if(end == string::npos)
{
arg = overwrite.substr(beg);
}
@@ -222,7 +222,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
{
arg = overwrite.substr(beg, end - beg);
}
- if (arg.find("--") != 0)
+ if(arg.find("--") != 0)
{
arg = "--" + arg;
}
@@ -232,7 +232,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
/*
StringSeq::iterator seqElem = args.begin();
- while (seqElem != args.end())
+ while(seqElem != args.end())
{
cerr << *seqElem << endl;
seqElem++;
@@ -246,7 +246,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
char** argv = static_cast<char**>(malloc((argc + 1) * sizeof(char*)));
StringSeq::iterator p;
int i;
- for (p = args.begin(), i = 1; p != args.end(); ++p, ++i)
+ for(p = args.begin(), i = 1; p != args.end(); ++p, ++i)
{
assert(i < argc);
argv[i] = strdup(p->c_str());
@@ -258,7 +258,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
//
// Try to start the router.
//
- if (execvp(argv[0], argv) == -1)
+ if(execvp(argv[0], argv) == -1)
{
//
// Send any errors to the parent process, using the write
@@ -285,7 +285,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
//
int flags = fcntl(fds[0], F_GETFL);
flags |= O_NONBLOCK;
- if (fcntl(fds[0], F_SETFL, flags) == -1)
+ if(fcntl(fds[0], F_SETFL, flags) == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -298,16 +298,16 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
FD_SET(fds[0], &fdSet);
struct timeval tv;
tv.tv_sec = _properties->getPropertyAsIntWithDefault("Glacier.Starter.StartupTimeout", 10);
- if (tv.tv_sec < 1)
+ if(tv.tv_sec < 1)
{
tv.tv_sec = 1; // One second is minimum.
}
tv.tv_usec = 0;
int ret = ::select(fds[0] + 1, &fdSet, 0, 0, &tv);
- if (ret == -1)
+ if(ret == -1)
{
- if (errno == EINTR)
+ if(errno == EINTR)
{
goto repeatSelect;
}
@@ -317,7 +317,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
throw ex;
}
- if (ret == 0) // Timeout.
+ if(ret == 0) // Timeout.
{
CannotStartRouterException ex;
ex.reason = "timeout while starting `" + path + "'";
@@ -338,7 +338,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
throw ex;
}
- if (sz == 0) // EOF?
+ if(sz == 0) // EOF?
{
CannotStartRouterException ex;
ex.reason = "got EOF from `" + path + "'";
@@ -347,14 +347,14 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
buf[sz] = '\0'; // Terminate the string we got back.
- if (strncmp(buf, uuid.c_str(), uuid.length()) == 0)
+ if(strncmp(buf, uuid.c_str(), uuid.length()) == 0)
{
//
// We got the stringified router proxy.
//
RouterPrx router = RouterPrx::uncheckedCast(_communicator->stringToProxy(buf));
- if (_traceLevel >= 2)
+ if(_traceLevel >= 2)
{
Trace out(_logger, "Glacier");
out << "started new router:\n" << _communicator->proxyToString(router);
@@ -374,7 +374,7 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt
}
catch(const CannotStartRouterException& ex)
{
- if (_traceLevel >= 1)
+ if(_traceLevel >= 1)
{
Trace out(_logger, "Glacier");
out << "router starter exception:\n" << ex << ":\n" << ex.reason;
@@ -404,12 +404,12 @@ Glacier::CryptPasswordVerifierI::checkPassword(const string& userId, const strin
{
map<string, string>::const_iterator p = _passwords.find(userId);
- if (p == _passwords.end())
+ if(p == _passwords.end())
{
return false;
}
- if (p->second.size() != 13) // Crypt passwords are 13 characters long.
+ if(p->second.size() != 13) // Crypt passwords are 13 characters long.
{
return false;
}
diff --git a/cpp/src/Glacier/StarterI.h b/cpp/src/Glacier/StarterI.h
index 41ba2958f2a..1642d911604 100644
--- a/cpp/src/Glacier/StarterI.h
+++ b/cpp/src/Glacier/StarterI.h
@@ -1,66 +1,66 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GLACIER_GLACIER_I_H
-#define GLACIER_GLACIER_I_H
-
-#include <Ice/Ice.h>
-#include <IceSSL/RSACertificateGen.h>
-#include <Glacier/Starter.h>
-
-namespace Glacier
-{
-
-using IceSSL::OpenSSL::RSACertificateGenContext;
-using IceSSL::OpenSSL::RSACertificateGen;
-
-class StarterI : public Starter
-{
-public:
-
- StarterI(const Ice::CommunicatorPtr&, const PasswordVerifierPrx&);
-
- void destroy();
-
- RouterPrx startRouter(const std::string&,
- const std::string&,
- Ice::ByteSeq&,
- Ice::ByteSeq&,
- Ice::ByteSeq&,
- const Ice::Current&);
-
-private:
-
- Ice::CommunicatorPtr _communicator;
- Ice::LoggerPtr _logger;
- Ice::PropertiesPtr _properties;
- PasswordVerifierPrx _verifier;
- int _traceLevel;
- RSACertificateGenContext _certContext;
- RSACertificateGen _certificateGenerator;
-};
-
-class CryptPasswordVerifierI : public PasswordVerifier, public IceUtil::Mutex
-{
-public:
-
- CryptPasswordVerifierI(const std::map<std::string, std::string>&);
-
- virtual bool checkPassword(const std::string&, const std::string&, const Ice::Current&);
- virtual void destroy(const Ice::Current&);
-
-private:
-
- const std::map<std::string, std::string> _passwords;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GLACIER_GLACIER_I_H
+#define GLACIER_GLACIER_I_H
+
+#include <Ice/Ice.h>
+#include <IceSSL/RSACertificateGen.h>
+#include <Glacier/Starter.h>
+
+namespace Glacier
+{
+
+using IceSSL::OpenSSL::RSACertificateGenContext;
+using IceSSL::OpenSSL::RSACertificateGen;
+
+class StarterI : public Starter
+{
+public:
+
+ StarterI(const Ice::CommunicatorPtr&, const PasswordVerifierPrx&);
+
+ void destroy();
+
+ RouterPrx startRouter(const std::string&,
+ const std::string&,
+ Ice::ByteSeq&,
+ Ice::ByteSeq&,
+ Ice::ByteSeq&,
+ const Ice::Current&);
+
+private:
+
+ Ice::CommunicatorPtr _communicator;
+ Ice::LoggerPtr _logger;
+ Ice::PropertiesPtr _properties;
+ PasswordVerifierPrx _verifier;
+ int _traceLevel;
+ RSACertificateGenContext _certContext;
+ RSACertificateGen _certificateGenerator;
+};
+
+class CryptPasswordVerifierI : public PasswordVerifier, public IceUtil::Mutex
+{
+public:
+
+ CryptPasswordVerifierI(const std::map<std::string, std::string>&);
+
+ virtual bool checkPassword(const std::string&, const std::string&, const Ice::Current&);
+ virtual void destroy(const Ice::Current&);
+
+private:
+
+ const std::map<std::string, std::string> _passwords;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Acceptor.h b/cpp/src/Ice/Acceptor.h
index d690608903a..de2513c749b 100644
--- a/cpp/src/Ice/Acceptor.h
+++ b/cpp/src/Ice/Acceptor.h
@@ -1,38 +1,38 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ACCEPTOR_H
-#define ICE_ACCEPTOR_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/AcceptorF.h>
-#include <Ice/TransceiverF.h>
-
-#ifndef _WIN32
-# define SOCKET int
-#endif
-
-namespace IceInternal
-{
-
-class ICE_PROTOCOL_API Acceptor : public ::IceUtil::Shared
-{
-public:
-
- virtual SOCKET fd() = 0;
- virtual void close() = 0;
- virtual void listen() = 0;
- virtual TransceiverPtr accept(int) = 0;
- virtual std::string toString() const = 0;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ACCEPTOR_H
+#define ICE_ACCEPTOR_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/AcceptorF.h>
+#include <Ice/TransceiverF.h>
+
+#ifndef _WIN32
+# define SOCKET int
+#endif
+
+namespace IceInternal
+{
+
+class ICE_PROTOCOL_API Acceptor : public ::IceUtil::Shared
+{
+public:
+
+ virtual SOCKET fd() = 0;
+ virtual void close() = 0;
+ virtual void listen() = 0;
+ virtual TransceiverPtr accept(int) = 0;
+ virtual std::string toString() const = 0;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/AcceptorF.h b/cpp/src/Ice/AcceptorF.h
index b8eb80288d4..a5358606309 100644
--- a/cpp/src/Ice/AcceptorF.h
+++ b/cpp/src/Ice/AcceptorF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ACCEPTOR_F_H
-#define ICE_ACCEPTOR_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class Acceptor;
-ICE_PROTOCOL_API void incRef(Acceptor*);
-ICE_PROTOCOL_API void decRef(Acceptor*);
-typedef Handle<Acceptor> AcceptorPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ACCEPTOR_F_H
+#define ICE_ACCEPTOR_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class Acceptor;
+ICE_PROTOCOL_API void incRef(Acceptor*);
+ICE_PROTOCOL_API void decRef(Acceptor*);
+typedef Handle<Acceptor> AcceptorPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index 7d58a235725..a67707669a4 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -30,7 +30,7 @@ Ice::Application::~Application()
int
Ice::Application::main(int argc, char* argv[], const char* configFile)
{
- if (_communicator)
+ if(_communicator)
{
cerr << argv[0] << ": only one instance of the Application class can be used" << endl;
return EXIT_FAILURE;
@@ -42,7 +42,7 @@ Ice::Application::main(int argc, char* argv[], const char* configFile)
try
{
- if (configFile)
+ if(configFile)
{
PropertiesPtr properties = createProperties(argc, argv);
properties->load(configFile);
@@ -65,7 +65,7 @@ Ice::Application::main(int argc, char* argv[], const char* configFile)
status = EXIT_FAILURE;
}
- if (_communicator)
+ if(_communicator)
{
try
{
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index a960f1d27d8..123178503b6 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -52,7 +52,7 @@ IceInternal::BasicStream::swap(BasicStream& other)
void
IceInternal::BasicStream::resize(int total)
{
- if (total > 1024 * 1024) // TODO: configurable
+ if(total > 1024 * 1024) // TODO: configurable
{
throw MemoryLimitException(__FILE__, __LINE__);
}
@@ -62,7 +62,7 @@ IceInternal::BasicStream::resize(int total)
void
IceInternal::BasicStream::reserve(int total)
{
- if (total > 1024 * 1024) // TODO: configurable
+ if(total > 1024 * 1024) // TODO: configurable
{
throw MemoryLimitException(__FILE__, __LINE__);
}
@@ -85,7 +85,7 @@ IceInternal::BasicStream::endWriteEncaps()
assert(_currentWriteEncaps);
int start = _currentWriteEncaps->start;
_writeEncapsStack.pop_back();
- if (_writeEncapsStack.empty())
+ if(_writeEncapsStack.empty())
{
_currentWriteEncaps = 0;
}
@@ -107,7 +107,7 @@ IceInternal::BasicStream::startReadEncaps()
{
Byte encoding;
read(encoding);
- if (encoding != 0)
+ if(encoding != 0)
{
throw UnsupportedEncodingException(__FILE__, __LINE__);
}
@@ -120,7 +120,7 @@ IceInternal::BasicStream::startReadEncaps()
// readSize()/writeSize(), it could be 1 or 5 bytes.
//
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
@@ -136,7 +136,7 @@ IceInternal::BasicStream::endReadEncaps()
assert(_currentReadEncaps);
int start = _currentReadEncaps->start;
_readEncapsStack.pop_back();
- if (_readEncapsStack.empty())
+ if(_readEncapsStack.empty())
{
_currentReadEncaps = 0;
}
@@ -147,12 +147,12 @@ IceInternal::BasicStream::endReadEncaps()
i = b.begin() + start - sizeof(Int);
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -167,12 +167,12 @@ IceInternal::BasicStream::checkReadEncaps()
i = b.begin() + start - sizeof(Int);
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
i = save;
- if (sz != i - (b.begin() + start))
+ if(sz != i - (b.begin() + start))
{
throw EncapsulationException(__FILE__, __LINE__);
}
@@ -187,7 +187,7 @@ IceInternal::BasicStream::getReadEncapsSize()
i = b.begin() + start - sizeof(Int);
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
@@ -200,18 +200,18 @@ IceInternal::BasicStream::skipEncaps()
{
Byte encoding;
read(encoding);
- if (encoding != 0)
+ if(encoding != 0)
{
throw UnsupportedEncodingException(__FILE__, __LINE__);
}
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -220,7 +220,7 @@ IceInternal::BasicStream::skipEncaps()
void
IceInternal::BasicStream::writeSize(Int v)
{
- if (v > 127)
+ if(v > 127)
{
write(Byte(-1));
write(v);
@@ -236,10 +236,10 @@ IceInternal::BasicStream::readSize(Ice::Int& v)
{
Byte b;
read(b);
- if (b < 0)
+ if(b < 0)
{
read(v);
- if (v < 0)
+ if(v < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
@@ -263,7 +263,7 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
{
Container::iterator begin = i;
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -284,7 +284,7 @@ IceInternal::BasicStream::write(const vector<Byte>& v)
void
IceInternal::BasicStream::read(Byte& v)
{
- if (i >= b.end())
+ if(i >= b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -298,7 +298,7 @@ IceInternal::BasicStream::read(vector<Byte>& v)
readSize(sz);
Container::iterator begin = i;
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -319,7 +319,7 @@ IceInternal::BasicStream::write(const vector<bool>& v)
void
IceInternal::BasicStream::read(bool& v)
{
- if (i >= b.end())
+ if(i >= b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -333,7 +333,7 @@ IceInternal::BasicStream::read(vector<bool>& v)
readSize(sz);
Container::iterator begin = i;
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -359,13 +359,13 @@ IceInternal::BasicStream::write(const vector<Short>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Short));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Short), b.begin() + pos);
p += sizeof(Short);
@@ -382,7 +382,7 @@ IceInternal::BasicStream::read(Short& v)
{
Container::iterator begin = i;
i += sizeof(Short);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -400,15 +400,15 @@ IceInternal::BasicStream::read(vector<Short>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Short);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Short), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Short);
@@ -437,13 +437,13 @@ IceInternal::BasicStream::write(const vector<Int>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Int));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Int), b.begin() + pos);
p += sizeof(Int);
@@ -460,7 +460,7 @@ IceInternal::BasicStream::read(Int& v)
{
Container::iterator begin = i;
i += sizeof(Int);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -478,15 +478,15 @@ IceInternal::BasicStream::read(vector<Int>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Int);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Int), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Int);
@@ -515,13 +515,13 @@ IceInternal::BasicStream::write(const vector<Long>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Long));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Long), b.begin() + pos);
p += sizeof(Long);
@@ -538,7 +538,7 @@ IceInternal::BasicStream::read(Long& v)
{
Container::iterator begin = i;
i += sizeof(Long);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -556,15 +556,15 @@ IceInternal::BasicStream::read(vector<Long>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Long);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Long), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Long);
@@ -593,13 +593,13 @@ IceInternal::BasicStream::write(const vector<Float>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Float));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Float), b.begin() + pos);
p += sizeof(Float);
@@ -616,7 +616,7 @@ IceInternal::BasicStream::read(Float& v)
{
Container::iterator begin = i;
i += sizeof(Float);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -634,15 +634,15 @@ IceInternal::BasicStream::read(vector<Float>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Float);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Float), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Float);
@@ -671,13 +671,13 @@ IceInternal::BasicStream::write(const vector<Double>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Double));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Double), b.begin() + pos);
p += sizeof(Double);
@@ -694,7 +694,7 @@ IceInternal::BasicStream::read(Double& v)
{
Container::iterator begin = i;
i += sizeof(Double);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -712,15 +712,15 @@ IceInternal::BasicStream::read(vector<Double>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Double);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Double), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Double);
@@ -736,7 +736,7 @@ IceInternal::BasicStream::write(const string& v)
{
Int len = v.size();
writeSize(len);
- if (len > 0)
+ if(len > 0)
{
int pos = b.size();
resize(pos + len);
@@ -749,7 +749,7 @@ IceInternal::BasicStream::write(const vector<string>& v)
{
writeSize(Int(v.size()));
vector<string>::const_iterator p;
- for (p = v.begin(); p != v.end(); ++p)
+ for(p = v.begin(); p != v.end(); ++p)
{
write(*p);
}
@@ -761,7 +761,7 @@ IceInternal::BasicStream::read(string& v)
Int len;
readSize(len);
- if (len <= 0)
+ if(len <= 0)
{
v.erase();
}
@@ -769,7 +769,7 @@ IceInternal::BasicStream::read(string& v)
{
Container::iterator begin = i;
i += len;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -785,7 +785,7 @@ IceInternal::BasicStream::read(vector<string>& v)
readSize(sz);
// Don't use v.resize(sz) or v.reserve(sz) here, as it cannot be
// checked whether sz is a reasonable value
- while (sz--)
+ while(sz--)
{
string s;
read(s);
@@ -808,14 +808,14 @@ IceInternal::BasicStream::read(ObjectPrx& v)
void
IceInternal::BasicStream::write(const ObjectPtr& v)
{
- if (!_currentWriteEncaps) // Lazy initialization
+ if(!_currentWriteEncaps) // Lazy initialization
{
_writeEncapsStack.resize(1);
_currentWriteEncaps = &_writeEncapsStack.back();
}
map<ObjectPtr, Int>::const_iterator p = _currentWriteEncaps->objectsWritten.find(v.get());
- if (p != _currentWriteEncaps->objectsWritten.end())
+ if(p != _currentWriteEncaps->objectsWritten.end())
{
write(p->second);
}
@@ -823,7 +823,7 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
{
write(Int(-1));
- if (v)
+ if(v)
{
Int num = _currentWriteEncaps->objectsWritten.size();
_currentWriteEncaps->objectsWritten[v.get()] = num;
@@ -841,7 +841,7 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
void
IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryPtr& factory, ObjectPtr& v)
{
- if (!_currentReadEncaps) // Lazy initialization
+ if(!_currentReadEncaps) // Lazy initialization
{
_readEncapsStack.resize(1);
_currentReadEncaps = &_readEncapsStack.back();
@@ -850,9 +850,9 @@ IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryP
Int pos;
read(pos);
- if (pos >= 0)
+ if(pos >= 0)
{
- if (static_cast<vector<ObjectPtr>::size_type>(pos) >= _currentReadEncaps->objectsRead.size())
+ if(static_cast<vector<ObjectPtr>::size_type>(pos) >= _currentReadEncaps->objectsRead.size())
{
throw IllegalIndirectionException(__FILE__, __LINE__);
}
@@ -864,31 +864,31 @@ IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryP
string id;
read(id);
- if (id.empty())
+ if(id.empty())
{
v = 0;
return;
}
- else if (id == iceObject)
+ else if(id == iceObject)
{
v = new ::Ice::Object;
}
else
{
ObjectFactoryPtr userFactory = _instance->servantFactoryManager()->find(id);
- if (userFactory)
+ if(userFactory)
{
v = userFactory->create(id);
}
- if (!v && id == signatureType)
+ if(!v && id == signatureType)
{
assert(factory);
v = factory->create(id);
assert(v);
}
- if (!v)
+ if(!v)
{
throw NoObjectFactoryException(__FILE__, __LINE__);
}
@@ -912,7 +912,7 @@ IceInternal::BasicStream::throwException(const string* throwsBegin, const string
read(id);
UserExceptionFactoryPtr factory = _instance->userExceptionFactoryManager()->find(id);
- if (factory)
+ if(factory)
{
try
{
@@ -921,9 +921,9 @@ IceInternal::BasicStream::throwException(const string* throwsBegin, const string
catch (UserException& ex)
{
static const string userException("::Ice::UserException");
- for (const string* p = ex.__getExceptionIds(); *p != userException != 0; ++p)
+ for(const string* p = ex.__getExceptionIds(); *p != userException != 0; ++p)
{
- if (binary_search(throwsBegin, throwsEnd, string(*p)))
+ if(binary_search(throwsBegin, throwsEnd, string(*p)))
{
ex.__read(this);
ex.ice_throw();
@@ -935,7 +935,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)
+ if(p.first != p.second)
{
return p.first - throwsBegin;
}
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index 8a8249f8f2a..03777f69253 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -29,7 +29,7 @@ Ice::CommunicatorI::destroy()
{
RecMutex::Lock sync(*this);
- if (_instance)
+ if(_instance)
{
_instance->objectAdapterFactory()->shutdown();
_instance->destroy();
@@ -43,7 +43,7 @@ Ice::CommunicatorI::shutdown()
//
// No mutex locking here! This operation must be signal-safe.
//
- if (_serverThreadPool)
+ if(_serverThreadPool)
{
_serverThreadPool->initiateShutdown();
}
@@ -56,7 +56,7 @@ Ice::CommunicatorI::waitForShutdown()
// No mutex locking here, otherwise the communicator is blocked
// while waiting for shutdown.
//
- if (_serverThreadPool)
+ if(_serverThreadPool)
{
_serverThreadPool->waitUntilFinished();
}
@@ -66,7 +66,7 @@ ObjectPrx
Ice::CommunicatorI::stringToProxy(const string& s)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -77,7 +77,7 @@ string
Ice::CommunicatorI::proxyToString(const ObjectPrx& proxy)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -88,7 +88,7 @@ ObjectAdapterPtr
Ice::CommunicatorI::createObjectAdapter(const string& name)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -96,12 +96,12 @@ Ice::CommunicatorI::createObjectAdapter(const string& name)
ObjectAdapterPtr adapter = createObjectAdapterFromProperty(name, "Ice.Adapter." + name + ".Endpoints");
string router = _instance->properties()->getProperty("Ice.Adapter." + name + ".Router");
- if (!router.empty())
+ if(!router.empty())
{
adapter->addRouter(RouterPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(router)));
}
- if (!_serverThreadPool) // Lazy initialization of _serverThreadPool.
+ if(!_serverThreadPool) // Lazy initialization of _serverThreadPool.
{
_serverThreadPool = _instance->serverThreadPool();
}
@@ -113,7 +113,7 @@ ObjectAdapterPtr
Ice::CommunicatorI::createObjectAdapterFromProperty(const string& name, const string& property)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -127,14 +127,14 @@ ObjectAdapterPtr
Ice::CommunicatorI::createObjectAdapterWithEndpoints(const string& name, const string& endpts)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
ObjectAdapterPtr adapter = _instance->objectAdapterFactory()->createObjectAdapter(name, endpts);
- if (!_serverThreadPool) // Lazy initialization of _serverThreadPool.
+ if(!_serverThreadPool) // Lazy initialization of _serverThreadPool.
{
_serverThreadPool = _instance->serverThreadPool();
}
@@ -146,7 +146,7 @@ void
Ice::CommunicatorI::addObjectFactory(const ObjectFactoryPtr& factory, const string& id)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -157,7 +157,7 @@ void
Ice::CommunicatorI::removeObjectFactory(const string& id)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -168,7 +168,7 @@ ObjectFactoryPtr
Ice::CommunicatorI::findObjectFactory(const string& id)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -179,7 +179,7 @@ void
Ice::CommunicatorI::addUserExceptionFactory(const UserExceptionFactoryPtr& factory, const string& id)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -190,7 +190,7 @@ void
Ice::CommunicatorI::removeUserExceptionFactory(const string& id)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -201,7 +201,7 @@ UserExceptionFactoryPtr
Ice::CommunicatorI::findUserExceptionFactory(const string& id)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -212,7 +212,7 @@ PropertiesPtr
Ice::CommunicatorI::getProperties()
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -223,7 +223,7 @@ LoggerPtr
Ice::CommunicatorI::getLogger()
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -234,7 +234,7 @@ void
Ice::CommunicatorI::setLogger(const LoggerPtr& logger)
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -251,7 +251,7 @@ PluginManagerPtr
Ice::CommunicatorI::getPluginManager()
{
RecMutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -275,7 +275,7 @@ Ice::CommunicatorI::CommunicatorI(int& argc, char* argv[], const PropertiesPtr&
Ice::CommunicatorI::~CommunicatorI()
{
- if (_instance)
+ if(_instance)
{
Warning out(_instance->logger());
out << "communicator has not been destroyed";
diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h
index 7e78e07efab..51a585cafe3 100644
--- a/cpp/src/Ice/CommunicatorI.h
+++ b/cpp/src/Ice/CommunicatorI.h
@@ -1,84 +1,84 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_COMMUNICATOR_I_H
-#define ICE_COMMUNICATOR_I_H
-
-#include <IceUtil/RecMutex.h>
-
-#include <Ice/ThreadPoolF.h>
-#include <Ice/Initialize.h>
-#include <Ice/Communicator.h>
-
-namespace Ice
-{
-
-class CommunicatorI : public Communicator, public ::IceUtil::RecMutex
-{
-public:
-
- virtual void destroy();
- virtual void shutdown();
- virtual void waitForShutdown();
-
- virtual ObjectPrx stringToProxy(const std::string&);
- virtual std::string proxyToString(const ObjectPrx&);
-
- virtual ObjectAdapterPtr createObjectAdapter(const std::string&);
- virtual ObjectAdapterPtr createObjectAdapterFromProperty(const std::string&, const std::string&);
- virtual ObjectAdapterPtr createObjectAdapterWithEndpoints(const std::string&, const std::string&);
-
- virtual void addObjectFactory(const ObjectFactoryPtr&, const std::string&);
- virtual void removeObjectFactory(const std::string&);
- virtual ObjectFactoryPtr findObjectFactory(const std::string&);
-
- virtual void addUserExceptionFactory(const UserExceptionFactoryPtr&, const std::string&);
- virtual void removeUserExceptionFactory(const std::string&);
- virtual UserExceptionFactoryPtr findUserExceptionFactory(const std::string&);
-
- virtual PropertiesPtr getProperties();
-
- virtual LoggerPtr getLogger();
- virtual void setLogger(const LoggerPtr&);
-
- virtual void setDefaultRouter(const RouterPrx&);
-
- virtual PluginManagerPtr getPluginManager();
-
-private:
-
- CommunicatorI(int&, char*[], const PropertiesPtr&);
- virtual ~CommunicatorI();
-
- //
- // Certain initialization tasks need to be completed after the
- // constructor.
- //
- void finishSetup(int&, char*[]);
-
- friend ICE_API CommunicatorPtr initialize(int&, char*[], Int);
- friend ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&, Int);
- friend ICE_API ::IceInternal::InstancePtr IceInternal::getInstance(const ::Ice::CommunicatorPtr&);
-
- ::IceInternal::InstancePtr _instance;
-
- //
- // We need _serverThreadPool directly in CommunicatorI. That's
- // because the shutdown() operation is signal-safe, and thus must
- // not access any mutex locks or _instance. It may only access
- // _serverThreadPool->initiateShutdown(), which is signal-safe as
- // well.
- //
- ::IceInternal::ThreadPoolPtr _serverThreadPool;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_COMMUNICATOR_I_H
+#define ICE_COMMUNICATOR_I_H
+
+#include <IceUtil/RecMutex.h>
+
+#include <Ice/ThreadPoolF.h>
+#include <Ice/Initialize.h>
+#include <Ice/Communicator.h>
+
+namespace Ice
+{
+
+class CommunicatorI : public Communicator, public ::IceUtil::RecMutex
+{
+public:
+
+ virtual void destroy();
+ virtual void shutdown();
+ virtual void waitForShutdown();
+
+ virtual ObjectPrx stringToProxy(const std::string&);
+ virtual std::string proxyToString(const ObjectPrx&);
+
+ virtual ObjectAdapterPtr createObjectAdapter(const std::string&);
+ virtual ObjectAdapterPtr createObjectAdapterFromProperty(const std::string&, const std::string&);
+ virtual ObjectAdapterPtr createObjectAdapterWithEndpoints(const std::string&, const std::string&);
+
+ virtual void addObjectFactory(const ObjectFactoryPtr&, const std::string&);
+ virtual void removeObjectFactory(const std::string&);
+ virtual ObjectFactoryPtr findObjectFactory(const std::string&);
+
+ virtual void addUserExceptionFactory(const UserExceptionFactoryPtr&, const std::string&);
+ virtual void removeUserExceptionFactory(const std::string&);
+ virtual UserExceptionFactoryPtr findUserExceptionFactory(const std::string&);
+
+ virtual PropertiesPtr getProperties();
+
+ virtual LoggerPtr getLogger();
+ virtual void setLogger(const LoggerPtr&);
+
+ virtual void setDefaultRouter(const RouterPrx&);
+
+ virtual PluginManagerPtr getPluginManager();
+
+private:
+
+ CommunicatorI(int&, char*[], const PropertiesPtr&);
+ virtual ~CommunicatorI();
+
+ //
+ // Certain initialization tasks need to be completed after the
+ // constructor.
+ //
+ void finishSetup(int&, char*[]);
+
+ friend ICE_API CommunicatorPtr initialize(int&, char*[], Int);
+ friend ICE_API CommunicatorPtr initializeWithProperties(int&, char*[], const PropertiesPtr&, Int);
+ friend ICE_API ::IceInternal::InstancePtr IceInternal::getInstance(const ::Ice::CommunicatorPtr&);
+
+ ::IceInternal::InstancePtr _instance;
+
+ //
+ // We need _serverThreadPool directly in CommunicatorI. That's
+ // because the shutdown() operation is signal-safe, and thus must
+ // not access any mutex locks or _instance. It may only access
+ // _serverThreadPool->initiateShutdown(), which is signal-safe as
+ // well.
+ //
+ ::IceInternal::ThreadPoolPtr _serverThreadPool;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index dbebc358240..60efc551c80 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -66,7 +66,7 @@ IceInternal::Connection::decProxyUsageCount()
IceUtil::RecMutex::Lock sync(*this);
assert(_proxyUsageCount > 0);
--_proxyUsageCount;
- if (_proxyUsageCount == 0 && !_adapter)
+ if(_proxyUsageCount == 0 && !_adapter)
{
assert(_requests.empty());
setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
@@ -89,7 +89,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway, bool comp)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_exception.get())
+ if(_exception.get())
{
_exception->ice_throw();
}
@@ -104,10 +104,10 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway, bool comp)
//
// Fill in the request ID.
//
- if (!_endpoint->datagram() && !oneway)
+ if(!_endpoint->datagram() && !oneway)
{
requestId = _nextRequestId++;
- if (requestId <= 0)
+ if(requestId <= 0)
{
_nextRequestId = 1;
requestId = _nextRequestId++;
@@ -117,19 +117,19 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway, bool comp)
copy(p, p + sizeof(Int), os->b.begin() + headerSize);
}
- if (os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
+ if(os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
{
comp = false;
}
else
{
- if (_defaultsAndOverrides->overrideComppress)
+ if(_defaultsAndOverrides->overrideComppress)
{
comp = _defaultsAndOverrides->overrideComppressValue;
}
}
- if (comp)
+ if(comp)
{
//
// Change message type.
@@ -178,7 +178,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway, bool comp)
// Only add to the request map if there was no exception, and if
// the operation is not oneway.
//
- if (!_endpoint->datagram() && !oneway)
+ if(!_endpoint->datagram() && !oneway)
{
_requestsHint = _requests.insert(_requests.end(), make_pair(requestId, out));
}
@@ -189,7 +189,7 @@ IceInternal::Connection::prepareBatchRequest(Outgoing* out)
{
lock();
- if (_exception.get())
+ if(_exception.get())
{
unlock();
_exception->ice_throw();
@@ -201,7 +201,7 @@ IceInternal::Connection::prepareBatchRequest(Outgoing* out)
// is called.
//
- if (_batchStream.b.empty())
+ if(_batchStream.b.empty())
{
_batchStream.write(protocolVersion);
_batchStream.write(encodingVersion);
@@ -219,7 +219,7 @@ IceInternal::Connection::prepareBatchRequest(Outgoing* out)
void
IceInternal::Connection::finishBatchRequest(Outgoing* out)
{
- if (_exception.get())
+ if(_exception.get())
{
unlock();
_exception->ice_throw();
@@ -242,7 +242,7 @@ IceInternal::Connection::flushBatchRequest(bool comp)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_exception.get())
+ if(_exception.get())
{
_exception->ice_throw();
}
@@ -257,19 +257,19 @@ IceInternal::Connection::flushBatchRequest(bool comp)
_batchStream.i = _batchStream.b.begin();
- if (_batchStream.b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
+ if(_batchStream.b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
{
comp = false;
}
else
{
- if (_defaultsAndOverrides->overrideComppress)
+ if(_defaultsAndOverrides->overrideComppress)
{
comp = _defaultsAndOverrides->overrideComppressValue;
}
}
- if (comp)
+ if(comp)
{
//
// Change message type.
@@ -346,9 +346,9 @@ IceInternal::Connection::setAdapter(const ObjectAdapterPtr& adapter)
// mode. However, we only change subscription if we're in active
// mode, and thus ignore closing mode here.k
//
- if (_state == StateActive)
+ if(_state == StateActive)
{
- if (adapter && !_adapter)
+ if(adapter && !_adapter)
{
//
// Client is now server.
@@ -356,7 +356,7 @@ IceInternal::Connection::setAdapter(const ObjectAdapterPtr& adapter)
unregisterWithPool();
}
- if (!adapter && _adapter)
+ if(!adapter && _adapter)
{
//
// Server is now client.
@@ -399,7 +399,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
threadPool->promoteFollower();
- if (_state == StateClosed)
+ if(_state == StateClosed)
{
IceUtil::ThreadControl::yield();
return;
@@ -416,7 +416,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
//
// Uncompress if necessary.
//
- if (messageType == compressedRequestMsg ||
+ if(messageType == compressedRequestMsg ||
messageType == compressedRequestBatchMsg ||
messageType == compressedReplyMsg)
{
@@ -428,11 +428,11 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
stream.i = stream.b.begin() + headerSize;
- switch (messageType)
+ switch(messageType)
{
case requestMsg:
{
- if (_state == StateClosing)
+ if(_state == StateClosing)
{
traceRequest("received request during closing\n"
"(ignored by server, client will retry)",
@@ -448,7 +448,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
case compressedRequestMsg:
{
- if (_state == StateClosing)
+ if(_state == StateClosing)
{
traceRequest("received compressed request during closing\n"
"(ignored by server, client will retry)",
@@ -464,7 +464,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
case requestBatchMsg:
{
- if (_state == StateClosing)
+ if(_state == StateClosing)
{
traceBatchRequest("received batch request during closing\n"
"(ignored by server, client will retry)",
@@ -481,7 +481,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
case compressedRequestBatchMsg:
{
- if (_state == StateClosing)
+ if(_state == StateClosing)
{
traceBatchRequest("received compressed batch request during closing\n"
"(ignored by server, client will retry)",
@@ -499,7 +499,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
case replyMsg:
case compressedReplyMsg:
{
- if (messageType == compressedReplyMsg)
+ if(messageType == compressedReplyMsg)
{
traceReply("received compressed reply", stream, _logger, _traceLevels);
}
@@ -513,27 +513,27 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
map<Int, Outgoing*>::iterator p = _requests.end();
- if (_requestsHint != _requests.end())
+ if(_requestsHint != _requests.end())
{
- if (_requestsHint->first == requestId)
+ if(_requestsHint->first == requestId)
{
p = _requestsHint;
}
}
- if (p == _requests.end())
+ if(p == _requests.end())
{
p = _requests.find(requestId);
}
- if (p == _requests.end())
+ if(p == _requests.end())
{
throw UnknownRequestIdException(__FILE__, __LINE__);
}
p->second->finished(stream);
- if (p == _requestsHint)
+ if(p == _requestsHint)
{
_requests.erase(p++);
_requestsHint = p;
@@ -549,9 +549,9 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
case closeConnectionMsg:
{
traceHeader("received close connection", stream, _logger, _traceLevels);
- if (_endpoint->datagram())
+ if(_endpoint->datagram())
{
- if (_warn)
+ if(_warn)
{
Warning out(_logger);
out << "ignoring close connection message for datagram connection:\n"
@@ -586,7 +586,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
// Method invocation must be done outside the thread
// synchronization, so that nested callbacks are possible.
//
- if (invoke)
+ if(invoke)
{
Incoming in(_instance, _adapter);
BasicStream* is = in.is();
@@ -597,11 +597,11 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
try
{
- if (!batch)
+ if(!batch)
{
Int requestId;
is->read(requestId);
- if (!_endpoint->datagram() && requestId != 0) // 0 means oneway.
+ if(!_endpoint->datagram() && requestId != 0) // 0 means oneway.
{
response = true;
++_responseCount;
@@ -622,7 +622,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
catch (const LocalException& ex)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_warn)
+ if(_warn)
{
Warning out(_logger);
out << "connection exception:\n" << ex << '\n' << _transceiver->toString();
@@ -631,7 +631,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
catch (const UserException& ex)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_warn)
+ if(_warn)
{
Warning out(_logger);
out << "unknown user exception:\n" << ex << '\n' << _transceiver->toString();
@@ -640,14 +640,14 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
catch (...)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_warn)
+ if(_warn)
{
Warning out(_logger);
out << "unknown exception";
}
}
}
- while (batch && is->i < is->b.end());
+ while(batch && is->i < is->b.end());
}
catch (const LocalException& ex)
{
@@ -656,31 +656,31 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
return;
}
- if (response)
+ if(response)
{
IceUtil::RecMutex::Lock sync(*this);
try
{
- if (_state == StateClosed)
+ if(_state == StateClosed)
{
return;
}
- if (os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
+ if(os->b.size() < 100) // Don't compress if message size is smaller than 100 bytes.
{
comp = false;
}
else
{
- if (_defaultsAndOverrides->overrideComppress)
+ if(_defaultsAndOverrides->overrideComppress)
{
comp = _defaultsAndOverrides->overrideComppressValue;
}
}
- if (comp)
+ if(comp)
{
//
// Change message type.
@@ -721,7 +721,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
--_responseCount;
- if (_state == StateClosing && _responseCount == 0 && !_endpoint->datagram())
+ if(_state == StateClosing && _responseCount == 0 && !_endpoint->datagram())
{
closeConnection();
}
@@ -742,11 +742,11 @@ IceInternal::Connection::finished(const ThreadPoolPtr& threadPool)
threadPool->promoteFollower();
- if (_state == StateActive || _state == StateClosing)
+ if(_state == StateActive || _state == StateClosing)
{
registerWithPool();
}
- else if (_state == StateClosed)
+ else if(_state == StateClosed)
{
_transceiver->close();
}
@@ -818,7 +818,7 @@ IceInternal::Connection::destroy(DestructionReason reason)
{
RecMutex::Lock sync(*this);
- switch (reason)
+ switch(reason)
{
case ObjectAdapterDeactivated:
{
@@ -837,21 +837,21 @@ IceInternal::Connection::destroy(DestructionReason reason)
void
IceInternal::Connection::setState(State state, const LocalException& ex)
{
- if (_state == state) // Don't switch twice.
+ if(_state == state) // Don't switch twice.
{
return;
}
- if (!_exception.get())
+ if(!_exception.get())
{
_exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone()));
- if (_warn)
+ if(_warn)
{
//
// Don't warn about certain expected exceptions.
//
- if (!(dynamic_cast<const CloseConnectionException*>(&ex) ||
+ if(!(dynamic_cast<const CloseConnectionException*>(&ex) ||
dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) ||
(dynamic_cast<const ConnectionLostException*>(&ex) && _state == StateClosing)))
@@ -862,7 +862,7 @@ IceInternal::Connection::setState(State state, const LocalException& ex)
}
}
- for (std::map< ::Ice::Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
+ for(std::map< ::Ice::Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
{
p->second->finished(*_exception.get());
}
@@ -879,21 +879,21 @@ IceInternal::Connection::setState(State state)
// We don't want to send close connection messages if the endpoint
// only supports oneway transmission from client to server.
//
- if (_endpoint->datagram() && state == StateClosing)
+ if(_endpoint->datagram() && state == StateClosing)
{
state = StateClosed;
}
- if (_state == state) // Don't switch twice.
+ if(_state == state) // Don't switch twice.
{
return;
}
- switch (state)
+ switch(state)
{
case StateActive:
{
- if (_state != StateHolding) // Can only switch from holding to active.
+ if(_state != StateHolding) // Can only switch from holding to active.
{
return;
}
@@ -903,7 +903,7 @@ IceInternal::Connection::setState(State state)
case StateHolding:
{
- if (_state != StateActive) // Can only switch from active to holding.
+ if(_state != StateActive) // Can only switch from active to holding.
{
return;
}
@@ -913,11 +913,11 @@ IceInternal::Connection::setState(State state)
case StateClosing:
{
- if (_state == StateClosed) // Can't change back from closed.
+ if(_state == StateClosed) // Can't change back from closed.
{
return;
}
- if (_state == StateHolding)
+ if(_state == StateHolding)
{
//
// We need to continue to read data in closing state.
@@ -929,7 +929,7 @@ IceInternal::Connection::setState(State state)
case StateClosed:
{
- if (_state == StateHolding)
+ if(_state == StateHolding)
{
//
// If we come from holding state, we first need to
@@ -945,7 +945,7 @@ IceInternal::Connection::setState(State state)
_state = state;
- if (_state == StateClosing && _responseCount == 0 && !_endpoint->datagram())
+ if(_state == StateClosing && _responseCount == 0 && !_endpoint->datagram())
{
try
{
@@ -975,11 +975,11 @@ IceInternal::Connection::closeConnection()
void
IceInternal::Connection::registerWithPool()
{
- if (!_registeredWithPool)
+ if(!_registeredWithPool)
{
- if (_adapter)
+ if(_adapter)
{
- if (!_serverThreadPool)
+ if(!_serverThreadPool)
{
_serverThreadPool = _instance->serverThreadPool();
assert(_serverThreadPool);
@@ -988,7 +988,7 @@ IceInternal::Connection::registerWithPool()
}
else
{
- if (!_clientThreadPool)
+ if(!_clientThreadPool)
{
_clientThreadPool = _instance->clientThreadPool();
assert(_clientThreadPool);
@@ -1003,9 +1003,9 @@ IceInternal::Connection::registerWithPool()
void
IceInternal::Connection::unregisterWithPool()
{
- if (_registeredWithPool)
+ if(_registeredWithPool)
{
- if (_adapter)
+ if(_adapter)
{
assert(_serverThreadPool);
_serverThreadPool->unregister(_transceiver->fd());
@@ -1034,7 +1034,7 @@ IceInternal::Connection::compress(BasicStream& uncompressed, BasicStream& compre
int bzError = BZ2_bzBuffToBuffCompress(&compressed.b[0] + headerSize + sizeof(Int), &compressedLen,
&uncompressed.b[0] + headerSize, uncompressedLen,
1, 0, 0);
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
throw CompressionException(__FILE__, __LINE__);
}
@@ -1069,7 +1069,7 @@ IceInternal::Connection::uncompress(BasicStream& compressed, BasicStream& uncomp
Int uncompressedSize;
compressed.i = compressed.b.begin() + headerSize;
compressed.read(uncompressedSize);
- if (uncompressedSize <= headerSize)
+ if(uncompressedSize <= headerSize)
{
throw IllegalMessageSizeException(__FILE__, __LINE__);
}
@@ -1082,7 +1082,7 @@ IceInternal::Connection::uncompress(BasicStream& compressed, BasicStream& uncomp
&compressed.b[0] + headerSize + sizeof(Int),
compressedLen,
0, 0);
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
throw CompressionException(__FILE__, __LINE__);
}
diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h
index 0128cd029f8..010745d0dc1 100644
--- a/cpp/src/Ice/Connection.h
+++ b/cpp/src/Ice/Connection.h
@@ -1,121 +1,121 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_CONNECTION_H
-#define ICE_CONNECTION_H
-
-#include <IceUtil/RecMutex.h>
-
-#include <Ice/ConnectionF.h>
-#include <Ice/ConnectionFactoryF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/TransceiverF.h>
-#include <Ice/ObjectAdapterF.h>
-#include <Ice/EndpointF.h>
-#include <Ice/ThreadPoolF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/DefaultsAndOverridesF.h>
-#include <Ice/EventHandler.h>
-
-namespace Ice
-{
-
-class LocalException;
-
-}
-
-namespace IceInternal
-{
-
-class Outgoing;
-
-class Connection : public EventHandler, public ::IceUtil::RecMutex
-{
-public:
-
- bool destroyed() const;
- void hold();
- void activate();
- void incProxyUsageCount();
- void decProxyUsageCount();
- void prepareRequest(Outgoing*);
- void sendRequest(Outgoing*, bool, bool);
- void removeRequest(Outgoing*);
- void prepareBatchRequest(Outgoing*);
- void finishBatchRequest(Outgoing*);
- void abortBatchRequest();
- void flushBatchRequest(bool);
- int timeout() const;
- EndpointPtr endpoint() const;
- void setAdapter(const ::Ice::ObjectAdapterPtr&);
- ::Ice::ObjectAdapterPtr getAdapter() const;
-
- //
- // Operations from EventHandler
- //
- virtual bool readable() const;
- virtual void read(BasicStream&);
- virtual void message(BasicStream&, const ThreadPoolPtr&);
- virtual void finished(const ThreadPoolPtr&);
- virtual void exception(const ::Ice::LocalException&);
-
-private:
-
- Connection(const InstancePtr&, const TransceiverPtr&, const EndpointPtr&, const ::Ice::ObjectAdapterPtr&);
- virtual ~Connection();
- enum DestructionReason
- {
- ObjectAdapterDeactivated,
- CommunicatorDestroyed
- };
- void destroy(DestructionReason);
- friend class IncomingConnectionFactory;
- friend class OutgoingConnectionFactory;
-
- enum State
- {
- StateActive,
- StateHolding,
- StateClosing,
- StateClosed
- };
-
- void setState(State, const ::Ice::LocalException&);
- void setState(State);
- void closeConnection();
- void registerWithPool();
- void unregisterWithPool();
- void compress(BasicStream&, BasicStream&);
- void uncompress(BasicStream&, BasicStream&);
-
- TransceiverPtr _transceiver;
- EndpointPtr _endpoint;
- ::Ice::ObjectAdapterPtr _adapter;
- ::Ice::LoggerPtr _logger;
- TraceLevelsPtr _traceLevels;
- DefaultsAndOverridesPtr _defaultsAndOverrides;
- ThreadPoolPtr _clientThreadPool;
- ThreadPoolPtr _serverThreadPool;
- ::Ice::Int _nextRequestId;
- std::map< ::Ice::Int, Outgoing*> _requests;
- std::map< ::Ice::Int, Outgoing*>::iterator _requestsHint;
- std::auto_ptr< ::Ice::LocalException> _exception;
- BasicStream _batchStream;
- int _responseCount;
- int _proxyUsageCount;
- State _state;
- bool _warn;
- bool _registeredWithPool;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_CONNECTION_H
+#define ICE_CONNECTION_H
+
+#include <IceUtil/RecMutex.h>
+
+#include <Ice/ConnectionF.h>
+#include <Ice/ConnectionFactoryF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/TransceiverF.h>
+#include <Ice/ObjectAdapterF.h>
+#include <Ice/EndpointF.h>
+#include <Ice/ThreadPoolF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/DefaultsAndOverridesF.h>
+#include <Ice/EventHandler.h>
+
+namespace Ice
+{
+
+class LocalException;
+
+}
+
+namespace IceInternal
+{
+
+class Outgoing;
+
+class Connection : public EventHandler, public ::IceUtil::RecMutex
+{
+public:
+
+ bool destroyed() const;
+ void hold();
+ void activate();
+ void incProxyUsageCount();
+ void decProxyUsageCount();
+ void prepareRequest(Outgoing*);
+ void sendRequest(Outgoing*, bool, bool);
+ void removeRequest(Outgoing*);
+ void prepareBatchRequest(Outgoing*);
+ void finishBatchRequest(Outgoing*);
+ void abortBatchRequest();
+ void flushBatchRequest(bool);
+ int timeout() const;
+ EndpointPtr endpoint() const;
+ void setAdapter(const ::Ice::ObjectAdapterPtr&);
+ ::Ice::ObjectAdapterPtr getAdapter() const;
+
+ //
+ // Operations from EventHandler
+ //
+ virtual bool readable() const;
+ virtual void read(BasicStream&);
+ virtual void message(BasicStream&, const ThreadPoolPtr&);
+ virtual void finished(const ThreadPoolPtr&);
+ virtual void exception(const ::Ice::LocalException&);
+
+private:
+
+ Connection(const InstancePtr&, const TransceiverPtr&, const EndpointPtr&, const ::Ice::ObjectAdapterPtr&);
+ virtual ~Connection();
+ enum DestructionReason
+ {
+ ObjectAdapterDeactivated,
+ CommunicatorDestroyed
+ };
+ void destroy(DestructionReason);
+ friend class IncomingConnectionFactory;
+ friend class OutgoingConnectionFactory;
+
+ enum State
+ {
+ StateActive,
+ StateHolding,
+ StateClosing,
+ StateClosed
+ };
+
+ void setState(State, const ::Ice::LocalException&);
+ void setState(State);
+ void closeConnection();
+ void registerWithPool();
+ void unregisterWithPool();
+ void compress(BasicStream&, BasicStream&);
+ void uncompress(BasicStream&, BasicStream&);
+
+ TransceiverPtr _transceiver;
+ EndpointPtr _endpoint;
+ ::Ice::ObjectAdapterPtr _adapter;
+ ::Ice::LoggerPtr _logger;
+ TraceLevelsPtr _traceLevels;
+ DefaultsAndOverridesPtr _defaultsAndOverrides;
+ ThreadPoolPtr _clientThreadPool;
+ ThreadPoolPtr _serverThreadPool;
+ ::Ice::Int _nextRequestId;
+ std::map< ::Ice::Int, Outgoing*> _requests;
+ std::map< ::Ice::Int, Outgoing*>::iterator _requestsHint;
+ std::auto_ptr< ::Ice::LocalException> _exception;
+ BasicStream _batchStream;
+ int _responseCount;
+ int _proxyUsageCount;
+ State _state;
+ bool _warn;
+ bool _registeredWithPool;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index bd28f451dde..b8ad2339a69 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -41,7 +41,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -52,9 +52,9 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
// Reap destroyed connections.
//
std::map<EndpointPtr, ConnectionPtr>::iterator p = _connections.begin();
- while (p != _connections.end())
+ while(p != _connections.end())
{
- if (p->second->destroyed())
+ if(p->second->destroyed())
{
_connections.erase(p++);
}
@@ -69,16 +69,16 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
//
DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides();
vector<EndpointPtr>::const_iterator q;
- for (q = endpoints.begin(); q != endpoints.end(); ++q)
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
{
EndpointPtr endpoint = *q;
- if (defaultsAndOverrides->overrideTimeout)
+ if(defaultsAndOverrides->overrideTimeout)
{
endpoint = endpoint->timeout(defaultsAndOverrides->overrideTimeoutValue);
}
map<EndpointPtr, ConnectionPtr>::const_iterator r = _connections.find(endpoint);
- if (r != _connections.end())
+ if(r != _connections.end())
{
return r->second;
}
@@ -93,10 +93,10 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
ConnectionPtr connection;
auto_ptr<LocalException> exception;
q = endpoints.begin();
- while (q != endpoints.end())
+ while(q != endpoints.end())
{
EndpointPtr endpoint = *q;
- if (defaultsAndOverrides->overrideTimeout)
+ if(defaultsAndOverrides->overrideTimeout)
{
endpoint = endpoint->timeout(defaultsAndOverrides->overrideTimeoutValue);
}
@@ -104,7 +104,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
try
{
TransceiverPtr transceiver = endpoint->clientTransceiver();
- if (!transceiver)
+ if(!transceiver)
{
ConnectorPtr connector = endpoint->connector();
assert(connector);
@@ -131,11 +131,11 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
++q;
- if (traceLevels->retry >= 2)
+ if(traceLevels->retry >= 2)
{
Trace out(logger, traceLevels->retryCat);
out << "connection to endpoint failed";
- if (q != endpoints.end())
+ if(q != endpoints.end())
{
out << ", trying next endpoint\n";
}
@@ -147,7 +147,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpoi
}
}
- if (!connection)
+ if(!connection)
{
assert(exception.get());
exception->ice_throw();
@@ -161,13 +161,13 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
RouterInfoPtr routerInfo = _instance->routerManager()->get(router);
- if (routerInfo)
+ if(routerInfo)
{
//
// Search for connections to the router's client proxy
@@ -179,16 +179,16 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router)
ObjectAdapterPtr adapter = routerInfo->getAdapter();
DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides();
vector<EndpointPtr>::const_iterator p;
- for (p = proxy->__reference()->endpoints.begin(); p != proxy->__reference()->endpoints.end(); ++p)
+ for(p = proxy->__reference()->endpoints.begin(); p != proxy->__reference()->endpoints.end(); ++p)
{
EndpointPtr endpoint = *p;
- if (defaultsAndOverrides->overrideTimeout)
+ if(defaultsAndOverrides->overrideTimeout)
{
endpoint = endpoint->timeout(defaultsAndOverrides->overrideTimeoutValue);
}
map<EndpointPtr, ConnectionPtr>::const_iterator q = _connections.find(endpoint);
- if (q != _connections.end())
+ if(q != _connections.end())
{
q->second->setAdapter(adapter);
}
@@ -201,14 +201,14 @@ IceInternal::OutgoingConnectionFactory::removeAdapter(const ObjectAdapterPtr& ad
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
- for (map<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin(); p != _connections.end(); ++p)
+ for(map<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin(); p != _connections.end(); ++p)
{
- if (p->second->getAdapter() == adapter)
+ if(p->second->getAdapter() == adapter)
{
p->second->setAdapter(0);
}
@@ -230,7 +230,7 @@ IceInternal::OutgoingConnectionFactory::destroy()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
return;
}
@@ -273,7 +273,7 @@ IceInternal::IncomingConnectionFactory::endpoint() const
bool
IceInternal::IncomingConnectionFactory::equivalent(const EndpointPtr& endp) const
{
- if (_transceiver)
+ if(_transceiver)
{
return endp->equivalent(_transceiver);
}
@@ -316,7 +316,7 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
threadPool->promoteFollower();
- if (_state != StateActive)
+ if(_state != StateActive)
{
IceUtil::ThreadControl::yield();
return;
@@ -349,7 +349,7 @@ IceInternal::IncomingConnectionFactory::message(BasicStream&, const ThreadPoolPt
}
catch (const LocalException& ex)
{
- if (_warn)
+ if(_warn)
{
Warning out(_instance->logger());
out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
@@ -365,11 +365,11 @@ IceInternal::IncomingConnectionFactory::finished(const ThreadPoolPtr& threadPool
threadPool->promoteFollower();
- if (_state == StateActive)
+ if(_state == StateActive)
{
registerWithPool();
}
- else if (_state == StateClosed)
+ else if(_state == StateClosed)
{
try
{
@@ -377,7 +377,7 @@ IceInternal::IncomingConnectionFactory::finished(const ThreadPoolPtr& threadPool
// Clear listen() backlog properly by accepting all queued
// connections, and then shutting them down.
//
- while (true)
+ while(true)
{
try
{
@@ -393,7 +393,7 @@ IceInternal::IncomingConnectionFactory::finished(const ThreadPoolPtr& threadPool
}
catch (const LocalException& ex)
{
- if (_warn)
+ if(_warn)
{
Warning out(_instance->logger());
out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
@@ -441,7 +441,7 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
_registeredWithPool(false)
{
DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides();
- if (defaultsAndOverrides->overrideTimeout)
+ if(defaultsAndOverrides->overrideTimeout)
{
_endpoint = _endpoint->timeout(defaultsAndOverrides->overrideTimeoutValue);
}
@@ -451,7 +451,7 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
try
{
_transceiver = _endpoint->serverTransceiver(_endpoint);
- if (_transceiver)
+ if(_transceiver)
{
ConnectionPtr connection = new Connection(_instance, _transceiver, _endpoint, _adapter);
_connections.push_back(connection);
@@ -488,7 +488,7 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
{
::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
- while (_adapter)
+ while(_adapter)
{
wait();
}
@@ -497,16 +497,16 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
void
IceInternal::IncomingConnectionFactory::setState(State state)
{
- if (_state == state) // Don't switch twice.
+ if(_state == state) // Don't switch twice.
{
return;
}
- switch (state)
+ switch(state)
{
case StateActive:
{
- if (_state != StateHolding) // Can only switch from holding to active.
+ if(_state != StateHolding) // Can only switch from holding to active.
{
return;
}
@@ -517,7 +517,7 @@ IceInternal::IncomingConnectionFactory::setState(State state)
case StateHolding:
{
- if (_state != StateActive) // Can only switch from active to holding
+ if(_state != StateActive) // Can only switch from active to holding
{
return;
}
@@ -532,7 +532,7 @@ IceInternal::IncomingConnectionFactory::setState(State state)
// If we come from holding state, we first need to
// register again before we unregister.
//
- if (_state == StateHolding)
+ if(_state == StateHolding)
{
registerWithPool();
}
@@ -558,11 +558,11 @@ IceInternal::IncomingConnectionFactory::setState(State state)
void
IceInternal::IncomingConnectionFactory::registerWithPool()
{
- if (_acceptor)
+ if(_acceptor)
{
- if (!_registeredWithPool)
+ if(!_registeredWithPool)
{
- if (!_serverThreadPool)
+ if(!_serverThreadPool)
{
_serverThreadPool = _instance->serverThreadPool();
assert(_serverThreadPool);
@@ -576,9 +576,9 @@ IceInternal::IncomingConnectionFactory::registerWithPool()
void
IceInternal::IncomingConnectionFactory::unregisterWithPool()
{
- if (_acceptor)
+ if(_acceptor)
{
- if (_registeredWithPool)
+ if(_registeredWithPool)
{
assert(_serverThreadPool);
_serverThreadPool->unregister(_acceptor->fd());
diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h
index 15fadcf3ca8..b09862fdd61 100644
--- a/cpp/src/Ice/ConnectionFactory.h
+++ b/cpp/src/Ice/ConnectionFactory.h
@@ -1,108 +1,108 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_CONNECTION_FACTORY_H
-#define ICE_CONNECTION_FACTORY_H
-
-#include <IceUtil/RecMutex.h>
-#include <Ice/ConnectionFactoryF.h>
-#include <Ice/ConnectionF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/ObjectAdapterF.h>
-#include <Ice/EndpointF.h>
-#include <Ice/AcceptorF.h>
-#include <Ice/TransceiverF.h>
-#include <Ice/RouterF.h>
-#include <Ice/EventHandler.h>
-#include <list>
-
-namespace Ice
-{
-
-class LocalException;
-class ObjectAdapterI;
-
-}
-
-namespace IceInternal
-{
-
-class OutgoingConnectionFactory : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- ConnectionPtr create(const std::vector<EndpointPtr>&);
- void setRouter(const ::Ice::RouterPrx&);
- void removeAdapter(const ::Ice::ObjectAdapterPtr&);
-
-private:
-
- OutgoingConnectionFactory(const InstancePtr&);
- virtual ~OutgoingConnectionFactory();
- void destroy();
- friend class Instance;
-
- InstancePtr _instance;
- std::map<EndpointPtr, ConnectionPtr> _connections;
-};
-
-class IncomingConnectionFactory : public EventHandler, public ::IceUtil::Monitor< ::IceUtil::Mutex>
-{
-public:
-
- void hold();
- void activate();
-
- EndpointPtr endpoint() const;
- bool equivalent(const EndpointPtr&) const;
- std::list<ConnectionPtr> connections() const;
-
- //
- // Operations from EventHandler
- //
- virtual bool readable() const;
- virtual void read(BasicStream&);
- virtual void message(BasicStream&, const ThreadPoolPtr&);
- virtual void finished(const ThreadPoolPtr&);
- virtual void exception(const ::Ice::LocalException&);
-
-private:
-
- IncomingConnectionFactory(const InstancePtr&, const EndpointPtr&, const ::Ice::ObjectAdapterPtr&);
- virtual ~IncomingConnectionFactory();
- void destroy();
- void waitUntilFinished();
- friend class ::Ice::ObjectAdapterI;
-
- enum State
- {
- StateActive,
- StateHolding,
- StateClosed
- };
-
- void setState(State);
- void registerWithPool();
- void unregisterWithPool();
-
- EndpointPtr _endpoint;
- ::Ice::ObjectAdapterPtr _adapter;
- AcceptorPtr _acceptor;
- TransceiverPtr _transceiver;
- ThreadPoolPtr _serverThreadPool;
- std::list<ConnectionPtr> _connections;
- State _state;
- bool _warn;
- bool _registeredWithPool;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_CONNECTION_FACTORY_H
+#define ICE_CONNECTION_FACTORY_H
+
+#include <IceUtil/RecMutex.h>
+#include <Ice/ConnectionFactoryF.h>
+#include <Ice/ConnectionF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/ObjectAdapterF.h>
+#include <Ice/EndpointF.h>
+#include <Ice/AcceptorF.h>
+#include <Ice/TransceiverF.h>
+#include <Ice/RouterF.h>
+#include <Ice/EventHandler.h>
+#include <list>
+
+namespace Ice
+{
+
+class LocalException;
+class ObjectAdapterI;
+
+}
+
+namespace IceInternal
+{
+
+class OutgoingConnectionFactory : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ ConnectionPtr create(const std::vector<EndpointPtr>&);
+ void setRouter(const ::Ice::RouterPrx&);
+ void removeAdapter(const ::Ice::ObjectAdapterPtr&);
+
+private:
+
+ OutgoingConnectionFactory(const InstancePtr&);
+ virtual ~OutgoingConnectionFactory();
+ void destroy();
+ friend class Instance;
+
+ InstancePtr _instance;
+ std::map<EndpointPtr, ConnectionPtr> _connections;
+};
+
+class IncomingConnectionFactory : public EventHandler, public ::IceUtil::Monitor< ::IceUtil::Mutex>
+{
+public:
+
+ void hold();
+ void activate();
+
+ EndpointPtr endpoint() const;
+ bool equivalent(const EndpointPtr&) const;
+ std::list<ConnectionPtr> connections() const;
+
+ //
+ // Operations from EventHandler
+ //
+ virtual bool readable() const;
+ virtual void read(BasicStream&);
+ virtual void message(BasicStream&, const ThreadPoolPtr&);
+ virtual void finished(const ThreadPoolPtr&);
+ virtual void exception(const ::Ice::LocalException&);
+
+private:
+
+ IncomingConnectionFactory(const InstancePtr&, const EndpointPtr&, const ::Ice::ObjectAdapterPtr&);
+ virtual ~IncomingConnectionFactory();
+ void destroy();
+ void waitUntilFinished();
+ friend class ::Ice::ObjectAdapterI;
+
+ enum State
+ {
+ StateActive,
+ StateHolding,
+ StateClosed
+ };
+
+ void setState(State);
+ void registerWithPool();
+ void unregisterWithPool();
+
+ EndpointPtr _endpoint;
+ ::Ice::ObjectAdapterPtr _adapter;
+ AcceptorPtr _acceptor;
+ TransceiverPtr _transceiver;
+ ThreadPoolPtr _serverThreadPool;
+ std::list<ConnectionPtr> _connections;
+ State _state;
+ bool _warn;
+ bool _registeredWithPool;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Connector.h b/cpp/src/Ice/Connector.h
index 8a07584d761..93ac46c09ac 100644
--- a/cpp/src/Ice/Connector.h
+++ b/cpp/src/Ice/Connector.h
@@ -1,31 +1,31 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_CONNECTOR_H
-#define ICE_CONNECTOR_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/ConnectorF.h>
-#include <Ice/TransceiverF.h>
-
-namespace IceInternal
-{
-
-class ICE_PROTOCOL_API Connector : public ::IceUtil::Shared
-{
-public:
-
- virtual TransceiverPtr connect(int) = 0;
- virtual std::string toString() const = 0;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_CONNECTOR_H
+#define ICE_CONNECTOR_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/ConnectorF.h>
+#include <Ice/TransceiverF.h>
+
+namespace IceInternal
+{
+
+class ICE_PROTOCOL_API Connector : public ::IceUtil::Shared
+{
+public:
+
+ virtual TransceiverPtr connect(int) = 0;
+ virtual std::string toString() const = 0;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ConnectorF.h b/cpp/src/Ice/ConnectorF.h
index 532a2ad0339..5e682ec543d 100644
--- a/cpp/src/Ice/ConnectorF.h
+++ b/cpp/src/Ice/ConnectorF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_CONNECTOR_F_H
-#define ICE_CONNECTOR_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class Connector;
-ICE_PROTOCOL_API void incRef(Connector*);
-ICE_PROTOCOL_API void decRef(Connector*);
-typedef Handle<Connector> ConnectorPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_CONNECTOR_F_H
+#define ICE_CONNECTOR_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class Connector;
+ICE_PROTOCOL_API void incRef(Connector*);
+ICE_PROTOCOL_API void decRef(Connector*);
+typedef Handle<Connector> ConnectorPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp
index 66ffa96bab0..f04d9f2cb87 100644
--- a/cpp/src/Ice/DefaultsAndOverrides.cpp
+++ b/cpp/src/Ice/DefaultsAndOverrides.cpp
@@ -28,7 +28,7 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
const_cast<string&>(defaultProtocol) = properties->getPropertyWithDefault("Ice.Default.Protocol", "tcp");
const_cast<string&>(defaultHost) = properties->getProperty("Ice.Default.Host");
- if (defaultHost.empty())
+ if(defaultHost.empty())
{
const_cast<string&>(defaultHost) = getLocalHost(true);
}
@@ -38,14 +38,14 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
string value;
value = properties->getProperty("Ice.Override.Timeout");
- if (!value.empty())
+ if(!value.empty())
{
const_cast<bool&>(overrideTimeout) = true;
const_cast<Int&>(overrideTimeoutValue) = atoi(value.c_str());
}
value = properties->getProperty("Ice.Override.Compress");
- if (!value.empty())
+ if(!value.empty())
{
const_cast<bool&>(overrideComppress) = true;
const_cast<bool&>(overrideComppressValue) = atoi(value.c_str());
diff --git a/cpp/src/Ice/DefaultsAndOverrides.h b/cpp/src/Ice/DefaultsAndOverrides.h
index 38e39c8e2a0..7f865083e24 100644
--- a/cpp/src/Ice/DefaultsAndOverrides.h
+++ b/cpp/src/Ice/DefaultsAndOverrides.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_DEFAULTS_AND_OVERRIDES_H
-#define ICE_DEFAULTS_AND_OVERRIDES_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/DefaultsAndOverridesF.h>
-#include <Ice/PropertiesF.h>
-
-namespace IceInternal
-{
-
-class DefaultsAndOverrides : public ::IceUtil::Shared
-{
-public:
-
- DefaultsAndOverrides(const ::Ice::PropertiesPtr&);
-
- std::string defaultHost;
- std::string defaultProtocol;
- std::string defaultRouter;
-
- bool overrideTimeout;
- Ice::Int overrideTimeoutValue;
- bool overrideComppress;
- bool overrideComppressValue;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_DEFAULTS_AND_OVERRIDES_H
+#define ICE_DEFAULTS_AND_OVERRIDES_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/DefaultsAndOverridesF.h>
+#include <Ice/PropertiesF.h>
+
+namespace IceInternal
+{
+
+class DefaultsAndOverrides : public ::IceUtil::Shared
+{
+public:
+
+ DefaultsAndOverrides(const ::Ice::PropertiesPtr&);
+
+ std::string defaultHost;
+ std::string defaultProtocol;
+ std::string defaultRouter;
+
+ bool overrideTimeout;
+ Ice::Int overrideTimeoutValue;
+ bool overrideComppress;
+ bool overrideComppressValue;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/DefaultsAndOverridesF.h b/cpp/src/Ice/DefaultsAndOverridesF.h
index 0772a93ee72..bd5029e83e7 100644
--- a/cpp/src/Ice/DefaultsAndOverridesF.h
+++ b/cpp/src/Ice/DefaultsAndOverridesF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_DEFAULTS_AND_OVERRIDES_F_H
-#define ICE_DEFAULTS_AND_OVERRIDES_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class DefaultsAndOverrides;
-void incRef(DefaultsAndOverrides*);
-void decRef(DefaultsAndOverrides*);
-typedef Handle<DefaultsAndOverrides> DefaultsAndOverridesPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_DEFAULTS_AND_OVERRIDES_F_H
+#define ICE_DEFAULTS_AND_OVERRIDES_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class DefaultsAndOverrides;
+void incRef(DefaultsAndOverrides*);
+void decRef(DefaultsAndOverrides*);
+typedef Handle<DefaultsAndOverrides> DefaultsAndOverridesPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp
index 3e3416f4c6e..87f48b10516 100644
--- a/cpp/src/Ice/Direct.cpp
+++ b/cpp/src/Ice/Direct.cpp
@@ -27,28 +27,28 @@ IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const Current& curr
{
_servant = _adapter->identityToServant(_current.identity);
- if (!_servant && !_current.identity.category.empty())
+ if(!_servant && !_current.identity.category.empty())
{
_locator = _adapter->findServantLocator(_current.identity.category);
- if (_locator)
+ if(_locator)
{
_servant = _locator->locate(_adapter, _current, _cookie);
}
}
- if (!_servant)
+ if(!_servant)
{
_locator = _adapter->findServantLocator("");
- if (_locator)
+ if(_locator)
{
_servant = _locator->locate(_adapter, _current, _cookie);
}
}
- if (_servant && !_current.facet.empty())
+ if(_servant && !_current.facet.empty())
{
_facetServant = _servant->ice_findFacet(_current.facet);
- if (!_facetServant)
+ if(!_facetServant)
{
FacetNotExistException ex(__FILE__, __LINE__);
ex.facet = _current.facet;
@@ -58,7 +58,7 @@ IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const Current& curr
}
catch(...)
{
- if (_locator && _servant)
+ if(_locator && _servant)
{
_locator->finished(_adapter, _current, _servant, _cookie);
}
@@ -75,7 +75,7 @@ IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const Current& curr
IceInternal::Direct::~Direct()
{
- if (_locator && _servant)
+ if(_locator && _servant)
{
_locator->finished(_adapter, _current, _servant, _cookie);
}
@@ -84,7 +84,7 @@ IceInternal::Direct::~Direct()
const ObjectPtr&
IceInternal::Direct::facetServant()
{
- if (_facetServant)
+ if(_facetServant)
{
return _facetServant;
}
diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp
index e713ea2e5f0..79312c8cfbe 100644
--- a/cpp/src/Ice/DynamicLibrary.cpp
+++ b/cpp/src/Ice/DynamicLibrary.cpp
@@ -43,7 +43,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint)
{
string::size_type colon = entryPoint.rfind(':');
string::size_type comma = entryPoint.find(',');
- if (colon == string::npos || colon == entryPoint.size() - 1 ||
+ if(colon == string::npos || colon == entryPoint.size() - 1 ||
(comma != string::npos && (comma > colon || comma == colon - 1)))
{
_err = "invalid entry point format `" + entryPoint + "'";
@@ -52,7 +52,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint)
string libSpec = entryPoint.substr(0, colon);
string funcName = entryPoint.substr(colon + 1);
string libName, version, debug;
- if (comma == string::npos)
+ if(comma == string::npos)
{
libName = libSpec;
version = ICE_STRING_VERSION;
@@ -67,9 +67,9 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint)
#ifdef _WIN32
lib = libName;
- for (string::size_type n = 0; n < version.size(); n++)
+ for(string::size_type n = 0; n < version.size(); n++)
{
- if (version[n] != '.') // Remove periods
+ if(version[n] != '.') // Remove periods
{
lib += version[n];
}
@@ -82,7 +82,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint)
lib = "lib" + libName + ".so." + version;
#endif
- if (!load(lib))
+ if(!load(lib))
{
return 0;
}
@@ -97,13 +97,13 @@ IceInternal::DynamicLibrary::load(const string& lib)
_hnd = LoadLibrary(lib.c_str());
#else
_hnd = dlopen(lib.c_str(), RTLD_NOW);
- if (_hnd == 0)
+ if(_hnd == 0)
{
//
// Remember the most recent error in _err.
//
const char* err = dlerror();
- if (err)
+ if(err)
{
_err = err;
}
@@ -120,13 +120,13 @@ IceInternal::DynamicLibrary::getSymbol(const string& name)
return GetProcAddress(_hnd, name.c_str());
#else
symbol_type result = dlsym(_hnd, name.c_str());
- if (result == 0)
+ if(result == 0)
{
//
// Remember the most recent error in _err.
//
const char* err = dlerror();
- if (err)
+ if(err)
{
_err = err;
}
diff --git a/cpp/src/Ice/Endpoint.h b/cpp/src/Ice/Endpoint.h
index d667f956064..d66ce19a54f 100644
--- a/cpp/src/Ice/Endpoint.h
+++ b/cpp/src/Ice/Endpoint.h
@@ -1,120 +1,120 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ENDPOINT_H
-#define ICE_ENDPOINT_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/EndpointF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/TransceiverF.h>
-#include <Ice/ConnectorF.h>
-#include <Ice/AcceptorF.h>
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-class ICE_PROTOCOL_API Endpoint : public ::IceUtil::Shared
-{
-public:
-
- //
- // Marshal the endpoint
- //
- virtual void streamWrite(BasicStream*) const = 0;
-
- //
- // Convert the endpoint to its string form
- //
- virtual std::string toString() const = 0;
-
- //
- // Return the endpoint type
- //
- virtual ::Ice::Short type() const = 0;
-
- //
- // Return the timeout for the endpoint in milliseconds. 0 means
- // non-blocking, -1 means no timeout.
- //
- virtual ::Ice::Int timeout() const = 0;
-
- //
- // Return a new endpoint with a different timeout value, provided
- // that timeouts are supported by the endpoint. Otherwise the same
- // endpoint is returned.
- //
- virtual EndpointPtr timeout(::Ice::Int) const = 0;
-
- //
- // Return true if the endpoint is datagram-based.
- //
- virtual bool datagram() const = 0;
-
- //
- // Return true if the endpoint is secure.
- //
- virtual bool secure() const = 0;
-
- //
- // Return true if the endpoint type is unknown.
- //
- virtual bool unknown() const = 0;
-
- //
- // Return a client side transceiver for this endpoint, or null if a
- // transceiver can only be created by a connector.
- //
- virtual TransceiverPtr clientTransceiver() const = 0;
-
- //
- // Return a server side transceiver for this endpoint, or null if a
- // transceiver can only be created by an acceptor. In case a
- // transceiver is created, this operation also returns a new
- // "effective" endpoint, which might differ from this endpoint,
- // for example, if a dynamic port number is assigned.
- //
- virtual TransceiverPtr serverTransceiver(EndpointPtr&) const = 0;
-
- //
- // Return a connector for this endpoint, or null if no connector
- // is available.
- //
- virtual ConnectorPtr connector() const = 0;
-
- //
- // Return an acceptor for this endpoint, or null if no acceptors
- // is available. In case an acceptor is created, this operation
- // also returns a new "effective" endpoint, which might differ
- // from this endpoint, for example, if a dynamic port number is
- // assigned.
- //
- virtual AcceptorPtr acceptor(EndpointPtr&) const = 0;
-
- //
- // Check whether the endpoint is equivalent to a specific
- // Transceiver or Acceptor
- //
- virtual bool equivalent(const TransceiverPtr&) const = 0;
- virtual bool equivalent(const AcceptorPtr&) const = 0;
-
- //
- // Compare endpoints for sorting purposes
- //
- virtual bool operator==(const Endpoint&) const = 0;
- virtual bool operator!=(const Endpoint&) const = 0;
- virtual bool operator<(const Endpoint&) const = 0;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ENDPOINT_H
+#define ICE_ENDPOINT_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/EndpointF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/TransceiverF.h>
+#include <Ice/ConnectorF.h>
+#include <Ice/AcceptorF.h>
+
+namespace IceInternal
+{
+
+class BasicStream;
+
+class ICE_PROTOCOL_API Endpoint : public ::IceUtil::Shared
+{
+public:
+
+ //
+ // Marshal the endpoint
+ //
+ virtual void streamWrite(BasicStream*) const = 0;
+
+ //
+ // Convert the endpoint to its string form
+ //
+ virtual std::string toString() const = 0;
+
+ //
+ // Return the endpoint type
+ //
+ virtual ::Ice::Short type() const = 0;
+
+ //
+ // Return the timeout for the endpoint in milliseconds. 0 means
+ // non-blocking, -1 means no timeout.
+ //
+ virtual ::Ice::Int timeout() const = 0;
+
+ //
+ // Return a new endpoint with a different timeout value, provided
+ // that timeouts are supported by the endpoint. Otherwise the same
+ // endpoint is returned.
+ //
+ virtual EndpointPtr timeout(::Ice::Int) const = 0;
+
+ //
+ // Return true if the endpoint is datagram-based.
+ //
+ virtual bool datagram() const = 0;
+
+ //
+ // Return true if the endpoint is secure.
+ //
+ virtual bool secure() const = 0;
+
+ //
+ // Return true if the endpoint type is unknown.
+ //
+ virtual bool unknown() const = 0;
+
+ //
+ // Return a client side transceiver for this endpoint, or null if a
+ // transceiver can only be created by a connector.
+ //
+ virtual TransceiverPtr clientTransceiver() const = 0;
+
+ //
+ // Return a server side transceiver for this endpoint, or null if a
+ // transceiver can only be created by an acceptor. In case a
+ // transceiver is created, this operation also returns a new
+ // "effective" endpoint, which might differ from this endpoint,
+ // for example, if a dynamic port number is assigned.
+ //
+ virtual TransceiverPtr serverTransceiver(EndpointPtr&) const = 0;
+
+ //
+ // Return a connector for this endpoint, or null if no connector
+ // is available.
+ //
+ virtual ConnectorPtr connector() const = 0;
+
+ //
+ // Return an acceptor for this endpoint, or null if no acceptors
+ // is available. In case an acceptor is created, this operation
+ // also returns a new "effective" endpoint, which might differ
+ // from this endpoint, for example, if a dynamic port number is
+ // assigned.
+ //
+ virtual AcceptorPtr acceptor(EndpointPtr&) const = 0;
+
+ //
+ // Check whether the endpoint is equivalent to a specific
+ // Transceiver or Acceptor
+ //
+ virtual bool equivalent(const TransceiverPtr&) const = 0;
+ virtual bool equivalent(const AcceptorPtr&) const = 0;
+
+ //
+ // Compare endpoints for sorting purposes
+ //
+ virtual bool operator==(const Endpoint&) const = 0;
+ virtual bool operator!=(const Endpoint&) const = 0;
+ virtual bool operator<(const Endpoint&) const = 0;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp
index d8f3cc93a07..b8c58ae96df 100644
--- a/cpp/src/Ice/EndpointFactoryManager.cpp
+++ b/cpp/src/Ice/EndpointFactoryManager.cpp
@@ -36,9 +36,9 @@ IceInternal::EndpointFactoryManager::add(const EndpointFactoryPtr& factory)
//
// TODO: Optimize with a map?
//
- for (vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
+ for(vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
{
- if (_factories[i]->type() == factory->type())
+ if(_factories[i]->type() == factory->type())
{
assert(false); // TODO: Exception?
}
@@ -54,9 +54,9 @@ IceInternal::EndpointFactoryManager::get(Short type) const
//
// TODO: Optimize with a map?
//
- for (vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
+ for(vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
{
- if (_factories[i]->type() == type)
+ if(_factories[i]->type() == type)
{
return _factories[i];
}
@@ -72,20 +72,20 @@ IceInternal::EndpointFactoryManager::create(const string& str) const
static const string delim = " \t\n\r";
string::size_type beg = str.find_first_not_of(delim);
- if (beg == string::npos)
+ if(beg == string::npos)
{
throw EndpointParseException(__FILE__, __LINE__);
}
string::size_type end = str.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
string protocol = str.substr(beg, end - beg);
- if (protocol == "default")
+ if(protocol == "default")
{
protocol = _instance->defaultsAndOverrides()->defaultProtocol;
}
@@ -93,9 +93,9 @@ IceInternal::EndpointFactoryManager::create(const string& str) const
//
// TODO: Optimize with a map?
//
- for (vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
+ for(vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
{
- if (_factories[i]->protocol() == protocol)
+ if(_factories[i]->protocol() == protocol)
{
return _factories[i]->create(str.substr(end));
}
@@ -115,9 +115,9 @@ IceInternal::EndpointFactoryManager::read(BasicStream* s) const
//
// TODO: Optimize with a map?
//
- for (vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
+ for(vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
{
- if (_factories[i]->type() == type)
+ if(_factories[i]->type() == type)
{
return _factories[i]->read(s);
}
@@ -129,7 +129,7 @@ IceInternal::EndpointFactoryManager::read(BasicStream* s) const
void
IceInternal::EndpointFactoryManager::destroy()
{
- for (vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
+ for(vector<EndpointFactoryPtr>::size_type i = 0; i < _factories.size(); i++)
{
_factories[i]->destroy();
}
diff --git a/cpp/src/Ice/EndpointFactoryManager.h b/cpp/src/Ice/EndpointFactoryManager.h
index 34f953f199c..807982cd61c 100644
--- a/cpp/src/Ice/EndpointFactoryManager.h
+++ b/cpp/src/Ice/EndpointFactoryManager.h
@@ -1,47 +1,47 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ENDPOINT_FACTORY_MANAGER_H
-#define ICE_ENDPOINT_FACTORY_MANAGER_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/InstanceF.h>
-#include <Ice/EndpointF.h>
-#include <Ice/EndpointFactoryF.h>
-#include <Ice/EndpointFactoryManagerF.h>
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-class EndpointFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- void add(const EndpointFactoryPtr&);
- EndpointFactoryPtr get(::Ice::Short) const;
- EndpointPtr create(const std::string&) const;
- EndpointPtr read(BasicStream*) const;
-
-private:
-
- EndpointFactoryManager(const InstancePtr&);
- void destroy();
- friend class Instance;
-
- InstancePtr _instance;
- std::vector<EndpointFactoryPtr> _factories;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ENDPOINT_FACTORY_MANAGER_H
+#define ICE_ENDPOINT_FACTORY_MANAGER_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/InstanceF.h>
+#include <Ice/EndpointF.h>
+#include <Ice/EndpointFactoryF.h>
+#include <Ice/EndpointFactoryManagerF.h>
+
+namespace IceInternal
+{
+
+class BasicStream;
+
+class EndpointFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ void add(const EndpointFactoryPtr&);
+ EndpointFactoryPtr get(::Ice::Short) const;
+ EndpointPtr create(const std::string&) const;
+ EndpointPtr read(BasicStream*) const;
+
+private:
+
+ EndpointFactoryManager(const InstancePtr&);
+ void destroy();
+ friend class Instance;
+
+ InstancePtr _instance;
+ std::vector<EndpointFactoryPtr> _factories;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/EndpointFactoryManagerF.h b/cpp/src/Ice/EndpointFactoryManagerF.h
index 2f5363e9eed..afeea66cf24 100644
--- a/cpp/src/Ice/EndpointFactoryManagerF.h
+++ b/cpp/src/Ice/EndpointFactoryManagerF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ENDPOINT_FACTORY_MANAGER_F_H
-#define ICE_ENDPOINT_FACTORY_MANAGER_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class EndpointFactoryManager;
-void incRef(EndpointFactoryManager*);
-void decRef(EndpointFactoryManager*);
-typedef Handle<EndpointFactoryManager> EndpointFactoryManagerPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ENDPOINT_FACTORY_MANAGER_F_H
+#define ICE_ENDPOINT_FACTORY_MANAGER_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class EndpointFactoryManager;
+void incRef(EndpointFactoryManager*);
+void decRef(EndpointFactoryManager*);
+typedef Handle<EndpointFactoryManager> EndpointFactoryManagerPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h
index 3205f077489..02dbece7c9d 100644
--- a/cpp/src/Ice/EventHandler.h
+++ b/cpp/src/Ice/EventHandler.h
@@ -1,87 +1,87 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_EVENT_HANDLER_H
-#define ICE_EVENT_HANDLER_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/EventHandlerF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/ThreadPoolF.h>
-#include <Ice/BasicStream.h>
-
-namespace Ice
-{
-
-class LocalException;
-
-}
-
-namespace IceInternal
-{
-
-class EventHandler : public ::IceUtil::Shared
-{
-public:
-
- //
- // Return true if read() must be called before calling message().
- //
- virtual bool readable() const = 0;
-
- //
- // Read data via the event handler. May only be called if
- // readable() returns true.
- //
- virtual void read(BasicStream&) = 0;
-
- //
- // A complete message has been received.
- //
- virtual void message(BasicStream&, const ThreadPoolPtr&) = 0;
-
- //
- // Will be called if the event handler is finally
- // unregistered. (Calling unregister() does not unregister
- // immediately.)
- //
- virtual void finished(const ThreadPoolPtr&) = 0;
-
- //
- // Propagate an exception to the event handler.
- //
- virtual void exception(const ::Ice::LocalException&) = 0;
-
- //
- // Try to destroy the event handler. Returns false if the event
- // handler cannot be destroyed because it is in use, or true
- // otherwise.
- //
-// virtual bool tryDestroy(const ThreadPoolPtr&) = 0;
-
-protected:
-
- EventHandler(const InstancePtr&);
- virtual ~EventHandler();
-
- InstancePtr _instance;
-
-private:
-
- //
- // The _stream data member is for use by ThreadPool only
- //
- BasicStream _stream;
- friend class ThreadPool;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_EVENT_HANDLER_H
+#define ICE_EVENT_HANDLER_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/EventHandlerF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/ThreadPoolF.h>
+#include <Ice/BasicStream.h>
+
+namespace Ice
+{
+
+class LocalException;
+
+}
+
+namespace IceInternal
+{
+
+class EventHandler : public ::IceUtil::Shared
+{
+public:
+
+ //
+ // Return true if read() must be called before calling message().
+ //
+ virtual bool readable() const = 0;
+
+ //
+ // Read data via the event handler. May only be called if
+ // readable() returns true.
+ //
+ virtual void read(BasicStream&) = 0;
+
+ //
+ // A complete message has been received.
+ //
+ virtual void message(BasicStream&, const ThreadPoolPtr&) = 0;
+
+ //
+ // Will be called if the event handler is finally
+ // unregistered. (Calling unregister() does not unregister
+ // immediately.)
+ //
+ virtual void finished(const ThreadPoolPtr&) = 0;
+
+ //
+ // Propagate an exception to the event handler.
+ //
+ virtual void exception(const ::Ice::LocalException&) = 0;
+
+ //
+ // Try to destroy the event handler. Returns false if the event
+ // handler cannot be destroyed because it is in use, or true
+ // otherwise.
+ //
+// virtual bool tryDestroy(const ThreadPoolPtr&) = 0;
+
+protected:
+
+ EventHandler(const InstancePtr&);
+ virtual ~EventHandler();
+
+ InstancePtr _instance;
+
+private:
+
+ //
+ // The _stream data member is for use by ThreadPool only
+ //
+ BasicStream _stream;
+ friend class ThreadPool;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/EventHandlerF.h b/cpp/src/Ice/EventHandlerF.h
index 32a1379edfd..1bf5aa9aa8b 100644
--- a/cpp/src/Ice/EventHandlerF.h
+++ b/cpp/src/Ice/EventHandlerF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_EVENT_HANDLER_F_H
-#define ICE_EVENT_HANDLER_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class EventHandler;
-void incRef(EventHandler*);
-void decRef(EventHandler*);
-typedef Handle<EventHandler> EventHandlerPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_EVENT_HANDLER_F_H
+#define ICE_EVENT_HANDLER_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class EventHandler;
+void incRef(EventHandler*);
+void decRef(EventHandler*);
+typedef Handle<EventHandler> EventHandlerPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index ae8b67ffaaf..817c1764ce4 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -127,7 +127,7 @@ void
Ice::SystemException::ice_print(ostream& out) const
{
Exception::ice_print(out);
- if (error != 0)
+ if(error != 0)
{
out << ":\nsystem exception: " << errorToString(error);
}
@@ -152,7 +152,7 @@ Ice::ConnectionLostException::ice_print(ostream& out) const
{
Exception::ice_print(out);
out << ":\nconnection lost: ";
- if (error == 0)
+ if(error == 0)
{
out << "recv() returned zero";
}
@@ -328,7 +328,7 @@ Ice::PluginInitializationException::ice_print(ostream& out) const
{
Exception::ice_print(out);
out << ":\nplug-in initialization failed";
- if (!reason.empty())
+ if(!reason.empty())
{
out << ": " << reason;
}
diff --git a/cpp/src/Ice/IdentityUtil.cpp b/cpp/src/Ice/IdentityUtil.cpp
index 4dba3a78841..54e1ab40de5 100644
--- a/cpp/src/Ice/IdentityUtil.cpp
+++ b/cpp/src/Ice/IdentityUtil.cpp
@@ -25,7 +25,7 @@ Ice::stringToIdentity(const string& s)
{
Identity ident;
string::size_type pos = s.find_first_of("/");
- if (pos != string::npos)
+ if(pos != string::npos)
{
ident.category = s.substr(0, pos);
ident.name = s.substr(pos + 1);
@@ -40,7 +40,7 @@ Ice::stringToIdentity(const string& s)
string
Ice::identityToString(const Identity& ident)
{
- if (ident.category.empty())
+ if(ident.category.empty())
{
return ident.name;
}
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 5ccfdea59d9..e75ed427c2b 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -35,7 +35,7 @@ IceInternal::Incoming::invoke(bool response)
_is.read(current.nonmutating);
Int sz;
_is.readSize(sz);
- while (sz--)
+ while(sz--)
{
pair<string, string> pair;
_is.read(pair.first);
@@ -44,7 +44,7 @@ IceInternal::Incoming::invoke(bool response)
}
BasicStream::Container::size_type statusPos = 0; // Initialize, to keep the compiler happy.
- if (response)
+ if(response)
{
statusPos = _os.b.size();
_os.write(static_cast<Byte>(0));
@@ -56,7 +56,7 @@ IceInternal::Incoming::invoke(bool response)
// blobs.
//
_is.startReadEncaps();
- if (response)
+ if(response)
{
_os.startWriteEncaps();
}
@@ -67,23 +67,23 @@ IceInternal::Incoming::invoke(bool response)
try
{
- if (_adapter)
+ if(_adapter)
{
servant = _adapter->identityToServant(current.identity);
- if (!servant && !current.identity.category.empty())
+ if(!servant && !current.identity.category.empty())
{
locator = _adapter->findServantLocator(current.identity.category);
- if (locator)
+ if(locator)
{
servant = locator->locate(_adapter, current, cookie);
}
}
- if (!servant)
+ if(!servant)
{
locator = _adapter->findServantLocator("");
- if (locator)
+ if(locator)
{
servant = locator->locate(_adapter, current, cookie);
}
@@ -92,16 +92,16 @@ IceInternal::Incoming::invoke(bool response)
DispatchStatus status;
- if (!servant)
+ if(!servant)
{
status = DispatchObjectNotExist;
}
else
{
- if (!current.facet.empty())
+ if(!current.facet.empty())
{
ObjectPtr facetServant = servant->ice_findFacet(current.facet);
- if (!facetServant)
+ if(!facetServant)
{
status = DispatchFacetNotExist;
}
@@ -116,23 +116,23 @@ IceInternal::Incoming::invoke(bool response)
}
}
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
- if (status != DispatchOK && status != DispatchUserException)
+ if(status != DispatchOK && status != DispatchUserException)
{
_os.b.resize(statusPos);
_os.write(static_cast<Byte>(status));
- if (status == DispatchObjectNotExist)
+ if(status == DispatchObjectNotExist)
{
current.identity.__write(&_os);
}
@@ -153,14 +153,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (const LocationForward& ex)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
@@ -170,14 +170,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (const ObjectNotExistException& ex)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
@@ -192,14 +192,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (const FacetNotExistException& ex)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
@@ -214,14 +214,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (const OperationNotExistException& ex)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
@@ -236,14 +236,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (const LocalException& ex)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
@@ -255,14 +255,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (const UserException& ex)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
@@ -274,14 +274,14 @@ IceInternal::Incoming::invoke(bool response)
}
catch (...)
{
- if (locator && servant)
+ if(locator && servant)
{
assert(_adapter);
locator->finished(_adapter, current, servant, cookie);
}
_is.endReadEncaps();
- if (response)
+ if(response)
{
_os.endWriteEncaps();
_os.b.resize(statusPos);
diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp
index dcb044b42e4..fa3ad904841 100644
--- a/cpp/src/Ice/Initialize.cpp
+++ b/cpp/src/Ice/Initialize.cpp
@@ -21,7 +21,7 @@ CommunicatorPtr
Ice::initialize(int& argc, char* argv[], Int version)
{
#ifndef ICE_IGNORE_VERSION
- if (version != ICE_INT_VERSION)
+ if(version != ICE_INT_VERSION)
{
throw VersionMismatchException(__FILE__, __LINE__);
}
@@ -38,7 +38,7 @@ CommunicatorPtr
Ice::initializeWithProperties(int& argc, char* argv[], const PropertiesPtr& properties, Int version)
{
#ifndef ICE_IGNORE_VERSION
- if (version != ICE_INT_VERSION)
+ if(version != ICE_INT_VERSION)
{
throw VersionMismatchException(__FILE__, __LINE__);
}
@@ -65,7 +65,7 @@ static DefaultPropertiesDestroyer defaultPropertiesDestroyer;
PropertiesPtr
Ice::getDefaultProperties()
{
- if (!defaultProperties)
+ if(!defaultProperties)
{
defaultProperties = createProperties();
}
@@ -75,7 +75,7 @@ Ice::getDefaultProperties()
PropertiesPtr
Ice::getDefaultProperties(StringSeq& args)
{
- if (!defaultProperties)
+ if(!defaultProperties)
{
defaultProperties = createProperties(args);
}
@@ -85,7 +85,7 @@ Ice::getDefaultProperties(StringSeq& args)
PropertiesPtr
Ice::getDefaultProperties(int& argc, char* argv[])
{
- if (!defaultProperties)
+ if(!defaultProperties)
{
defaultProperties = createProperties(argc, argv);
}
@@ -114,7 +114,7 @@ StringSeq
Ice::argsToStringSeq(int argc, char* argv[])
{
StringSeq result;
- for (int i = 0; i < argc; i++)
+ for(int i = 0; i < argc; i++)
{
result.push_back(argv[i]);
}
@@ -129,11 +129,11 @@ Ice::stringSeqToArgs(const StringSeq& args, int& argc, char* argv[])
// beginning of argv.
//
int i = 0;
- while (i < argc)
+ while(i < argc)
{
- if (find(args.begin(), args.end(), argv[i]) == args.end())
+ if(find(args.begin(), args.end(), argv[i]) == args.end())
{
- for (int j = i; j < argc - 1; j++)
+ for(int j = i; j < argc - 1; j++)
{
argv[j] = argv[j + 1];
}
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index e1c87922d90..62bc82a4486 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -168,9 +168,9 @@ IceInternal::Instance::clientThreadPool()
{
IceUtil::RecMutex::Lock sync(*this);
- if (_communicator) // Not destroyed?
+ if(_communicator) // Not destroyed?
{
- if (!_clientThreadPool) // Lazy initialization.
+ if(!_clientThreadPool) // Lazy initialization.
{
_clientThreadPool = new ThreadPool(this, false);
}
@@ -184,9 +184,9 @@ IceInternal::Instance::serverThreadPool()
{
IceUtil::RecMutex::Lock sync(*this);
- if (_communicator) // Not destroyed?
+ if(_communicator) // Not destroyed?
{
- if (!_serverThreadPool) // Lazy initialization.
+ if(!_serverThreadPool) // Lazy initialization.
{
_serverThreadPool = new ThreadPool(this, true);
}
@@ -228,14 +228,14 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
{
__setNoDelete(true);
- if (_globalStateCounter == 1) // Only on first call
+ if(_globalStateCounter == 1) // Only on first call
{
srand(static_cast<timeval>(IceUtil::Time::now()).tv_usec);
#ifdef _WIN32
WORD version = MAKEWORD(1, 1);
WSADATA data;
- if (WSAStartup(version, &data) != 0)
+ if(WSAStartup(version, &data) != 0)
{
_globalStateMutex->unlock();
SocketException ex(__FILE__, __LINE__);
@@ -252,24 +252,24 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
sigaction(SIGPIPE, &action, 0);
string newUser = _properties->getProperty("Ice.ChangeUser");
- if (!newUser.empty())
+ if(!newUser.empty())
{
struct passwd* pw = getpwnam(newUser.c_str());
- if (!pw)
+ if(!pw)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
- if (setgid(pw->pw_gid) == -1)
+ if(setgid(pw->pw_gid) == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
- if (setuid(pw->pw_uid) == -1)
+ if(setuid(pw->pw_uid) == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -277,10 +277,10 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
}
}
- if (_properties->getPropertyAsInt("Ice.UseSyslog") > 0)
+ if(_properties->getPropertyAsInt("Ice.UseSyslog") > 0)
{
_identForOpenlog = _properties->getProperty("Ice.ProgramName");
- if (_identForOpenlog.empty())
+ if(_identForOpenlog.empty())
{
_identForOpenlog = "<Unknown Ice Program>";
}
@@ -290,7 +290,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
}
#ifndef _WIN32
- if (_properties->getPropertyAsInt("Ice.UseSyslog") > 0)
+ if(_properties->getPropertyAsInt("Ice.UseSyslog") > 0)
{
_logger = new SysLoggerI;
}
@@ -320,7 +320,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc,
_pluginManager = new PluginManagerI(this);
- if (!_defaultsAndOverrides->defaultRouter.empty())
+ if(!_defaultsAndOverrides->defaultRouter.empty())
{
_referenceFactory->setDefaultRouter(
RouterPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultRouter)));
@@ -360,13 +360,13 @@ IceInternal::Instance::~Instance()
assert(!_endpointFactoryManager);
assert(!_pluginManager);
- if (_globalStateMutex != 0)
+ if(_globalStateMutex != 0)
{
_globalStateMutex->lock();
}
assert(_globalStateCounter > 0);
- if (--_globalStateCounter == 0) // Only on last call
+ if(--_globalStateCounter == 0) // Only on last call
{
#ifdef _WIN32
WSACleanup();
@@ -381,7 +381,7 @@ IceInternal::Instance::~Instance()
#endif
#ifndef _WIN32
- if (!_identForOpenlog.empty())
+ if(!_identForOpenlog.empty())
{
closelog();
_identForOpenlog.clear();
@@ -389,7 +389,7 @@ IceInternal::Instance::~Instance()
#endif
}
- if (_globalStateMutex != 0)
+ if(_globalStateMutex != 0)
{
_globalStateMutex->unlock();
}
@@ -415,12 +415,12 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
// threads, etc. Perhaps we need a two-stage plug-in
// initialization?
//
- if (_properties->getPropertyAsInt("Ice.Daemon") > 0)
+ if(_properties->getPropertyAsInt("Ice.Daemon") > 0)
{
int noclose = _properties->getPropertyAsInt("Ice.DaemonNoClose");
int nochdir = _properties->getPropertyAsInt("Ice.DaemonNoChdir");
- if (daemon(nochdir, noclose) == -1)
+ if(daemon(nochdir, noclose) == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -434,7 +434,7 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
// forks. Does not work together with Ice.Daemon if
// Ice.DaemonNoClose is not set.
//
- if (_properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
+ if(_properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
{
#ifdef _WIN32
cout << _getpid() << endl;
@@ -469,58 +469,58 @@ IceInternal::Instance::destroy()
// to avoid cyclic object dependencies.
//
- if (_communicator)
+ if(_communicator)
{
// Don't destroy the communicator -- the communicator destroys
// this object, not the other way.
_communicator = 0;
}
- if (_objectAdapterFactory)
+ if(_objectAdapterFactory)
{
// Don't shut down the object adapters -- the communicator
// must do this before it destroys this object.
_objectAdapterFactory = 0;
}
- if (_servantFactoryManager)
+ if(_servantFactoryManager)
{
_servantFactoryManager->destroy();
_servantFactoryManager = 0;
}
- if (_userExceptionFactoryManager)
+ if(_userExceptionFactoryManager)
{
_userExceptionFactoryManager->destroy();
_userExceptionFactoryManager = 0;
}
- if (_referenceFactory)
+ if(_referenceFactory)
{
_referenceFactory->destroy();
_referenceFactory = 0;
}
- if (_proxyFactory)
+ if(_proxyFactory)
{
// No destroy function defined
// _proxyFactory->destroy();
_proxyFactory = 0;
}
- if (_outgoingConnectionFactory)
+ if(_outgoingConnectionFactory)
{
_outgoingConnectionFactory->destroy();
_outgoingConnectionFactory = 0;
}
- if (_routerManager)
+ if(_routerManager)
{
_routerManager->destroy();
_routerManager = 0;
}
- if (_endpointFactoryManager)
+ if(_endpointFactoryManager)
{
_endpointFactoryManager->destroy();
_endpointFactoryManager = 0;
@@ -542,21 +542,21 @@ IceInternal::Instance::destroy()
_pluginManager = 0;
}
- if (clientThreadPool)
+ if(clientThreadPool)
{
clientThreadPool->waitUntilFinished();
clientThreadPool->destroy();
clientThreadPool->joinWithAllThreads();
}
- if (serverThreadPool)
+ if(serverThreadPool)
{
serverThreadPool->waitUntilFinished();
serverThreadPool->destroy();
serverThreadPool->joinWithAllThreads();
}
- if (pluginManager)
+ if(pluginManager)
{
pluginManager->destroy();
}
diff --git a/cpp/src/Ice/Instance.h b/cpp/src/Ice/Instance.h
index 7cc4ec3ff0b..f69a8e40f38 100644
--- a/cpp/src/Ice/Instance.h
+++ b/cpp/src/Ice/Instance.h
@@ -1,105 +1,105 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_INSTANCE_H
-#define ICE_INSTANCE_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <IceUtil/RecMutex.h>
-#include <Ice/InstanceF.h>
-#include <Ice/CommunicatorF.h>
-#include <Ice/PropertiesF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/DefaultsAndOverridesF.h>
-#include <Ice/RouterInfoF.h>
-#include <Ice/ReferenceFactoryF.h>
-#include <Ice/ProxyFactoryF.h>
-#include <Ice/ThreadPoolF.h>
-#include <Ice/ConnectionFactoryF.h>
-#include <Ice/ObjectFactoryManagerF.h>
-#include <Ice/UserExceptionFactoryManagerF.h>
-#include <Ice/ObjectAdapterFactoryF.h>
-#include <Ice/EndpointFactoryManagerF.h>
-#include <Ice/PluginF.h>
-#include <list>
-
-namespace Ice
-{
-
-class CommunicatorI;
-
-}
-
-namespace IceInternal
-{
-
-class Instance : public ::IceUtil::Shared, public ::IceUtil::RecMutex
-{
-public:
-
- ::Ice::CommunicatorPtr communicator();
- ::Ice::PropertiesPtr properties();
- ::Ice::LoggerPtr logger();
- void logger(const ::Ice::LoggerPtr&);
- TraceLevelsPtr traceLevels();
- DefaultsAndOverridesPtr defaultsAndOverrides();
- RouterManagerPtr routerManager();
- ReferenceFactoryPtr referenceFactory();
- ProxyFactoryPtr proxyFactory();
- OutgoingConnectionFactoryPtr outgoingConnectionFactory();
- ObjectFactoryManagerPtr servantFactoryManager();
- UserExceptionFactoryManagerPtr userExceptionFactoryManager();
- ObjectAdapterFactoryPtr objectAdapterFactory();
- ThreadPoolPtr clientThreadPool();
- ThreadPoolPtr serverThreadPool();
- EndpointFactoryManagerPtr endpointFactoryManager();
- ::Ice::PluginManagerPtr pluginManager();
-
-private:
-
- Instance(const ::Ice::CommunicatorPtr&, int&, char*[], const ::Ice::PropertiesPtr&);
- virtual ~Instance();
- void finishSetup(int&, char*[]);
- void destroy();
- friend class ::Ice::CommunicatorI;
-
- ::Ice::CommunicatorPtr _communicator;
- ::Ice::PropertiesPtr _properties; // Immutable, not reset by destroy().
- ::Ice::LoggerPtr _logger; // Not reset by destroy().
- TraceLevelsPtr _traceLevels; // Immutable, not reset by destroy().
- DefaultsAndOverridesPtr _defaultsAndOverrides; // Immutable, not reset by destroy().
- RouterManagerPtr _routerManager;
- ReferenceFactoryPtr _referenceFactory;
- ProxyFactoryPtr _proxyFactory;
- OutgoingConnectionFactoryPtr _outgoingConnectionFactory;
- ObjectFactoryManagerPtr _servantFactoryManager;
- UserExceptionFactoryManagerPtr _userExceptionFactoryManager;
- ObjectAdapterFactoryPtr _objectAdapterFactory;
- ThreadPoolPtr _clientThreadPool;
- ThreadPoolPtr _serverThreadPool;
- EndpointFactoryManagerPtr _endpointFactoryManager;
- ::Ice::PluginManagerPtr _pluginManager;
-
- //
- // Global state management
- //
- friend class GlobalStateMutexDestroyer;
- static int _globalStateCounter;
- static ::IceUtil::Mutex* _globalStateMutex;
-#ifndef _WIN32
- static std::string _identForOpenlog;
-#endif
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_INSTANCE_H
+#define ICE_INSTANCE_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <IceUtil/RecMutex.h>
+#include <Ice/InstanceF.h>
+#include <Ice/CommunicatorF.h>
+#include <Ice/PropertiesF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/DefaultsAndOverridesF.h>
+#include <Ice/RouterInfoF.h>
+#include <Ice/ReferenceFactoryF.h>
+#include <Ice/ProxyFactoryF.h>
+#include <Ice/ThreadPoolF.h>
+#include <Ice/ConnectionFactoryF.h>
+#include <Ice/ObjectFactoryManagerF.h>
+#include <Ice/UserExceptionFactoryManagerF.h>
+#include <Ice/ObjectAdapterFactoryF.h>
+#include <Ice/EndpointFactoryManagerF.h>
+#include <Ice/PluginF.h>
+#include <list>
+
+namespace Ice
+{
+
+class CommunicatorI;
+
+}
+
+namespace IceInternal
+{
+
+class Instance : public ::IceUtil::Shared, public ::IceUtil::RecMutex
+{
+public:
+
+ ::Ice::CommunicatorPtr communicator();
+ ::Ice::PropertiesPtr properties();
+ ::Ice::LoggerPtr logger();
+ void logger(const ::Ice::LoggerPtr&);
+ TraceLevelsPtr traceLevels();
+ DefaultsAndOverridesPtr defaultsAndOverrides();
+ RouterManagerPtr routerManager();
+ ReferenceFactoryPtr referenceFactory();
+ ProxyFactoryPtr proxyFactory();
+ OutgoingConnectionFactoryPtr outgoingConnectionFactory();
+ ObjectFactoryManagerPtr servantFactoryManager();
+ UserExceptionFactoryManagerPtr userExceptionFactoryManager();
+ ObjectAdapterFactoryPtr objectAdapterFactory();
+ ThreadPoolPtr clientThreadPool();
+ ThreadPoolPtr serverThreadPool();
+ EndpointFactoryManagerPtr endpointFactoryManager();
+ ::Ice::PluginManagerPtr pluginManager();
+
+private:
+
+ Instance(const ::Ice::CommunicatorPtr&, int&, char*[], const ::Ice::PropertiesPtr&);
+ virtual ~Instance();
+ void finishSetup(int&, char*[]);
+ void destroy();
+ friend class ::Ice::CommunicatorI;
+
+ ::Ice::CommunicatorPtr _communicator;
+ ::Ice::PropertiesPtr _properties; // Immutable, not reset by destroy().
+ ::Ice::LoggerPtr _logger; // Not reset by destroy().
+ TraceLevelsPtr _traceLevels; // Immutable, not reset by destroy().
+ DefaultsAndOverridesPtr _defaultsAndOverrides; // Immutable, not reset by destroy().
+ RouterManagerPtr _routerManager;
+ ReferenceFactoryPtr _referenceFactory;
+ ProxyFactoryPtr _proxyFactory;
+ OutgoingConnectionFactoryPtr _outgoingConnectionFactory;
+ ObjectFactoryManagerPtr _servantFactoryManager;
+ UserExceptionFactoryManagerPtr _userExceptionFactoryManager;
+ ObjectAdapterFactoryPtr _objectAdapterFactory;
+ ThreadPoolPtr _clientThreadPool;
+ ThreadPoolPtr _serverThreadPool;
+ EndpointFactoryManagerPtr _endpointFactoryManager;
+ ::Ice::PluginManagerPtr _pluginManager;
+
+ //
+ // Global state management
+ //
+ friend class GlobalStateMutexDestroyer;
+ static int _globalStateCounter;
+ static ::IceUtil::Mutex* _globalStateMutex;
+#ifndef _WIN32
+ static std::string _identForOpenlog;
+#endif
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp
index b37819a6387..06472990f26 100644
--- a/cpp/src/Ice/LoggerI.cpp
+++ b/cpp/src/Ice/LoggerI.cpp
@@ -20,7 +20,7 @@ Ice::LoggerI::trace(const string& category, const string& message)
IceUtil::Mutex::Lock sync(*this);
string s = "[ " + category + ": " + message + " ]";
string::size_type idx = 0;
- while ((idx = s.find("\n", idx)) != string::npos)
+ while((idx = s.find("\n", idx)) != string::npos)
{
s.insert(idx + 1, " ");
++idx;
diff --git a/cpp/src/Ice/LoggerI.h b/cpp/src/Ice/LoggerI.h
index d7866b8e462..25ac67eebe1 100644
--- a/cpp/src/Ice/LoggerI.h
+++ b/cpp/src/Ice/LoggerI.h
@@ -1,31 +1,31 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_LOGGER_I_H
-#define ICE_LOGGER_I_H
-
-#include <IceUtil/Mutex.h>
-#include <Ice/Logger.h>
-
-namespace Ice
-{
-
-class LoggerI : public Logger, public ::IceUtil::Mutex
-{
-public:
-
- virtual void trace(const std::string&, const std::string&);
- virtual void warning(const std::string&);
- virtual void error(const std::string&);
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_LOGGER_I_H
+#define ICE_LOGGER_I_H
+
+#include <IceUtil/Mutex.h>
+#include <Ice/Logger.h>
+
+namespace Ice
+{
+
+class LoggerI : public Logger, public ::IceUtil::Mutex
+{
+public:
+
+ virtual void trace(const std::string&, const std::string&);
+ virtual void warning(const std::string&);
+ virtual void error(const std::string&);
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/LoggerUtil.cpp b/cpp/src/Ice/LoggerUtil.cpp
index 1b803bc304a..ca19aea13dd 100644
--- a/cpp/src/Ice/LoggerUtil.cpp
+++ b/cpp/src/Ice/LoggerUtil.cpp
@@ -29,7 +29,7 @@ void
Ice::Warning::flush()
{
string s = _str.str();
- if (!s.empty())
+ if(!s.empty())
{
_logger->warning(s);
}
@@ -63,7 +63,7 @@ void
Ice::Error::flush()
{
string s = _str.str();
- if (!s.empty())
+ if(!s.empty())
{
_logger->error(s);
}
@@ -98,7 +98,7 @@ void
Ice::Trace::flush()
{
string s = _str.str();
- if (!s.empty())
+ if(!s.empty())
{
_logger->trace(_category, s);
}
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 4c8007df1f5..9bbb26d9bdf 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -21,12 +21,12 @@ IceInternal::interrupted()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAEINTR)
+ if(error == WSAEINTR)
{
return true;
}
#else
- if (errno == EINTR ||
+ if(errno == EINTR ||
errno == EPROTO)
{
return true;
@@ -41,21 +41,21 @@ IceInternal::interrupted()
bool
IceInternal::acceptInterrupted()
{
- if (interrupted())
+ if(interrupted())
{
return true;
}
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAECONNABORTED ||
+ if(error == WSAECONNABORTED ||
error == WSAECONNRESET ||
error == WSAETIMEDOUT)
{
return true;
}
#else
- if (errno == ECONNABORTED ||
+ if(errno == ECONNABORTED ||
errno == ECONNRESET ||
errno == ETIMEDOUT)
{
@@ -73,13 +73,13 @@ IceInternal::noBuffers()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAENOBUFS ||
+ if(error == WSAENOBUFS ||
error == WSAEFAULT)
{
return true;
}
#else
- if (errno == ENOBUFS)
+ if(errno == ENOBUFS)
{
return true;
}
@@ -95,12 +95,12 @@ IceInternal::wouldBlock()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAEWOULDBLOCK)
+ if(error == WSAEWOULDBLOCK)
{
return true;
}
#else
- if (errno == EAGAIN ||
+ if(errno == EAGAIN ||
errno == EWOULDBLOCK)
{
return true;
@@ -117,7 +117,7 @@ IceInternal::connectFailed()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAECONNREFUSED ||
+ if(error == WSAECONNREFUSED ||
error == WSAETIMEDOUT ||
error == WSAENETUNREACH ||
error == WSAECONNRESET ||
@@ -127,7 +127,7 @@ IceInternal::connectFailed()
return true;
}
#else
- if (errno == ECONNREFUSED ||
+ if(errno == ECONNREFUSED ||
errno == ETIMEDOUT ||
errno == ENETUNREACH ||
errno == ECONNRESET ||
@@ -148,12 +148,12 @@ IceInternal::connectInProgress()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAEWOULDBLOCK)
+ if(error == WSAEWOULDBLOCK)
{
return true;
}
#else
- if (errno == EINPROGRESS)
+ if(errno == EINPROGRESS)
{
return true;
}
@@ -169,14 +169,14 @@ IceInternal::connectionLost()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAECONNRESET ||
+ if(error == WSAECONNRESET ||
error == WSAESHUTDOWN ||
error == WSAECONNABORTED)
{
return true;
}
#else
- if (errno == ECONNRESET ||
+ if(errno == ECONNRESET ||
errno == ESHUTDOWN ||
errno == ECONNABORTED)
{
@@ -194,12 +194,12 @@ IceInternal::notConnected()
{
#ifdef _WIN32
int error = WSAGetLastError();
- if (error == WSAENOTCONN)
+ if(error == WSAENOTCONN)
{
return true;
}
#else
- if (errno == ENOTCONN)
+ if(errno == ENOTCONN)
{
return true;
}
@@ -215,7 +215,7 @@ IceInternal::createSocket(bool udp)
{
SOCKET fd;
- if (udp)
+ if(udp)
{
fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
@@ -224,14 +224,14 @@ IceInternal::createSocket(bool udp)
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
}
- if (fd == INVALID_SOCKET)
+ if(fd == INVALID_SOCKET)
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
- if (!udp)
+ if(!udp)
{
setTcpNoDelay(fd);
setKeepAlive(fd);
@@ -257,7 +257,7 @@ IceInternal::closeSocket(SOCKET fd)
void
IceInternal::setBlock(SOCKET fd, bool block)
{
- if (block)
+ if(block)
{
#ifdef _WIN32
unsigned long arg = 0;
@@ -285,7 +285,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, sizeof(int)) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -298,7 +298,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, sizeof(int)) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -310,7 +310,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, sizeof(int)) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -324,7 +324,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, sizeof(int)) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -333,7 +333,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), sizeof(addr)) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -354,9 +354,9 @@ void
IceInternal::doListen(SOCKET fd, int backlog)
{
repeatListen:
- if (::listen(fd, backlog) == SOCKET_ERROR)
+ if(::listen(fd, backlog) == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatListen;
}
@@ -380,14 +380,14 @@ 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), sizeof(addr)) == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatConnect;
}
- if (connectInProgress())
+ if(connectInProgress())
{
repeatSelect:
int ret;
@@ -403,7 +403,7 @@ repeatConnect:
FD_ZERO(&xFdSet);
FD_SET(fd, &xFdSet);
#endif
- if (timeout >= 0)
+ if(timeout >= 0)
{
struct timeval tv;
tv.tv_sec = timeout / 1000;
@@ -423,14 +423,14 @@ repeatConnect:
#endif
}
- if (ret == 0)
+ if(ret == 0)
{
closeSocket(fd);
throw ConnectTimeoutException(__FILE__, __LINE__);
}
- else if (ret == SOCKET_ERROR)
+ else if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -450,7 +450,7 @@ repeatConnect:
#endif
socklen_t len = sizeof(socklen_t);
int val;
- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
+ if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -458,7 +458,7 @@ repeatConnect:
throw ex;
}
- if (val > 0)
+ if(val > 0)
{
closeSocket(fd);
#ifdef _WIN32
@@ -466,7 +466,7 @@ repeatConnect:
#else
errno = val;
#endif
- if (connectFailed())
+ if(connectFailed())
{
ConnectFailedException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -484,7 +484,7 @@ repeatConnect:
}
closeSocket(fd);
- if (connectFailed())
+ if(connectFailed())
{
ConnectFailedException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -505,21 +505,21 @@ IceInternal::doAccept(SOCKET fd, int timeout)
int ret;
repeatAccept:
- if ((ret = ::accept(fd, 0, 0)) == INVALID_SOCKET)
+ if((ret = ::accept(fd, 0, 0)) == INVALID_SOCKET)
{
- if (acceptInterrupted())
+ if(acceptInterrupted())
{
goto repeatAccept;
}
- if (wouldBlock())
+ if(wouldBlock())
{
repeatSelect:
int ret;
fd_set fdSet;
FD_ZERO(&fdSet);
FD_SET(fd, &fdSet);
- if (timeout >= 0)
+ if(timeout >= 0)
{
struct timeval tv;
tv.tv_sec = timeout / 1000;
@@ -531,9 +531,9 @@ repeatAccept:
ret = ::select(fd + 1, 0, &fdSet, 0, 0);
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -543,7 +543,7 @@ repeatAccept:
throw ex;
}
- if (ret == 0)
+ if(ret == 0)
{
throw TimeoutException(__FILE__, __LINE__);
}
@@ -581,7 +581,7 @@ 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());
- if (addr.sin_addr.s_addr == INADDR_NONE)
+ if(addr.sin_addr.s_addr == INADDR_NONE)
{
IceUtil::Mutex::Lock sync(getHostByNameMutex);
@@ -593,12 +593,12 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
entry = gethostbyname(host.c_str());
}
#ifdef _WIN32
- while (!entry && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
+ while(!entry && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
#else
- while (!entry && h_errno == TRY_AGAIN && --retry >= 0);
+ while(!entry && h_errno == TRY_AGAIN && --retry >= 0);
#endif
- if (!entry)
+ if(!entry)
{
DNSException ex(__FILE__, __LINE__);
ex.error = getDNSErrno();
@@ -613,7 +613,7 @@ string
IceInternal::getLocalHost(bool numeric)
{
char host[1024 + 1];
- if (gethostname(host, 1024) == SOCKET_ERROR)
+ if(gethostname(host, 1024) == SOCKET_ERROR)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -631,19 +631,19 @@ IceInternal::getLocalHost(bool numeric)
entry = gethostbyname(host);
}
#ifdef _WIN32
- while (!entry && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
+ while(!entry && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
#else
- while (!entry && h_errno == TRY_AGAIN && --retry >= 0);
+ while(!entry && h_errno == TRY_AGAIN && --retry >= 0);
#endif
- if (!entry)
+ if(!entry)
{
DNSException ex(__FILE__, __LINE__);
ex.error = getDNSErrno();
throw ex;
}
- if (numeric)
+ if(numeric)
{
struct sockaddr_in addr;
memset(&addr, 0, sizeof(struct sockaddr_in));
@@ -710,7 +710,7 @@ IceInternal::createPipe(SOCKET fds[2])
#else
- if (::pipe(fds) != 0)
+ if(::pipe(fds) != 0)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -728,7 +728,7 @@ IceInternal::createPipe(SOCKET fds[2])
string
IceInternal::errorToString(int error)
{
- if (error < WSABASEERR)
+ if(error < WSABASEERR)
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -743,7 +743,7 @@ IceInternal::errorToString(int error)
return result;
}
- switch (error)
+ switch(error)
{
case WSAEINTR:
return "WSAEINTR";
@@ -920,7 +920,7 @@ IceInternal::errorToString(int error)
string
IceInternal::errorToStringDNS(int error)
{
- switch (error)
+ switch(error)
{
case NETDB_SUCCESS:
return "no problem";
@@ -979,7 +979,7 @@ IceInternal::fdToString(SOCKET fd)
socklen_t localLen = sizeof(struct sockaddr_in);
struct sockaddr_in localAddr;
- if (getsockname(fd, reinterpret_cast<struct sockaddr*>(&localAddr), &localLen) == SOCKET_ERROR)
+ if(getsockname(fd, reinterpret_cast<struct sockaddr*>(&localAddr), &localLen) == SOCKET_ERROR)
{
closeSocket(fd);
SocketException ex(__FILE__, __LINE__);
@@ -990,9 +990,9 @@ IceInternal::fdToString(SOCKET fd)
bool peerNotConnected = false;
socklen_t remoteLen = sizeof(struct sockaddr_in);
struct sockaddr_in remoteAddr;
- if (getpeername(fd, reinterpret_cast<struct sockaddr*>(&remoteAddr), &remoteLen) == SOCKET_ERROR)
+ if(getpeername(fd, reinterpret_cast<struct sockaddr*>(&remoteAddr), &remoteLen) == SOCKET_ERROR)
{
- if (notConnected())
+ if(notConnected())
{
peerNotConnected = true;
}
@@ -1011,7 +1011,7 @@ IceInternal::fdToString(SOCKET fd)
IceUtil::Mutex::Lock sync(inetNtoaMutex);
s << "local address = " << inet_ntoa(localAddr.sin_addr) << ':' << ntohs(localAddr.sin_port);
- if (peerNotConnected)
+ if(peerNotConnected)
{
s << "\nremote address = <not connected>";
}
diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h
index 4196c109080..ac57f0b15ae 100644
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -1,100 +1,100 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_NETWORK_H
-#define ICE_NETWORK_H
-
-#include <Ice/Config.h>
-
-#ifdef _WIN32
-# include <winsock.h>
-#else
-# include <unistd.h>
-# include <fcntl.h>
-# include <sys/socket.h>
-# include <sys/select.h>
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# include <arpa/inet.h>
-# include <netdb.h>
-#endif
-
-#ifdef _WIN32
-typedef int socklen_t;
-#endif
-
-#ifndef _WIN32
-# define SOCKET int
-# define SOCKET_ERROR -1
-# define INVALID_SOCKET -1
-#endif
-
-#ifndef SHUT_RD
-# define SHUT_RD 0
-#endif
-
-#ifndef SHUT_WR
-# define SHUT_WR 1
-#endif
-
-#ifndef SHUT_RDWR
-# define SHUT_RDWR 2
-#endif
-
-#ifndef NETDB_INTERNAL
-# define NETDB_INTERNAL -1
-#endif
-
-#ifndef NETDB_SUCCESS
-# define NETDB_SUCCESS 0
-#endif
-
-namespace IceInternal
-{
-
-ICE_PROTOCOL_API bool interrupted();
-ICE_PROTOCOL_API bool acceptInterrupted();
-ICE_PROTOCOL_API bool noBuffers();
-ICE_PROTOCOL_API bool wouldBlock();
-ICE_PROTOCOL_API bool connectFailed();
-ICE_PROTOCOL_API bool connectInProgress();
-ICE_PROTOCOL_API bool connectionLost();
-ICE_PROTOCOL_API bool notConnected();
-
-ICE_PROTOCOL_API SOCKET createSocket(bool);
-ICE_PROTOCOL_API void closeSocket(SOCKET);
-
-ICE_PROTOCOL_API void setBlock(SOCKET, bool);
-ICE_PROTOCOL_API void setTcpNoDelay(SOCKET);
-ICE_PROTOCOL_API void setKeepAlive(SOCKET);
-ICE_PROTOCOL_API void setSendBufferSize(SOCKET, int);
-
-ICE_PROTOCOL_API void doBind(SOCKET, struct sockaddr_in&);
-ICE_PROTOCOL_API void doListen(SOCKET, int);
-ICE_PROTOCOL_API void doConnect(SOCKET, struct sockaddr_in&, int);
-ICE_PROTOCOL_API SOCKET doAccept(SOCKET, int);
-
-ICE_PROTOCOL_API void getAddress(const std::string&, int, struct sockaddr_in&);
-ICE_PROTOCOL_API std::string getLocalHost(bool);
-ICE_PROTOCOL_API bool compareAddress(const struct sockaddr_in&, const struct sockaddr_in&);
-
-ICE_PROTOCOL_API void createPipe(SOCKET fds[2]);
-
-ICE_PROTOCOL_API std::string errorToString(int);
-ICE_PROTOCOL_API std::string errorToStringDNS(int);
-ICE_PROTOCOL_API std::string lastErrorToString();
-ICE_PROTOCOL_API std::string lastErrorToStringDNS();
-
-ICE_PROTOCOL_API std::string fdToString(SOCKET);
-ICE_PROTOCOL_API std::string addrToString(const struct sockaddr_in&);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_NETWORK_H
+#define ICE_NETWORK_H
+
+#include <Ice/Config.h>
+
+#ifdef _WIN32
+# include <winsock.h>
+#else
+# include <unistd.h>
+# include <fcntl.h>
+# include <sys/socket.h>
+# include <sys/select.h>
+# include <netinet/in.h>
+# include <netinet/tcp.h>
+# include <arpa/inet.h>
+# include <netdb.h>
+#endif
+
+#ifdef _WIN32
+typedef int socklen_t;
+#endif
+
+#ifndef _WIN32
+# define SOCKET int
+# define SOCKET_ERROR -1
+# define INVALID_SOCKET -1
+#endif
+
+#ifndef SHUT_RD
+# define SHUT_RD 0
+#endif
+
+#ifndef SHUT_WR
+# define SHUT_WR 1
+#endif
+
+#ifndef SHUT_RDWR
+# define SHUT_RDWR 2
+#endif
+
+#ifndef NETDB_INTERNAL
+# define NETDB_INTERNAL -1
+#endif
+
+#ifndef NETDB_SUCCESS
+# define NETDB_SUCCESS 0
+#endif
+
+namespace IceInternal
+{
+
+ICE_PROTOCOL_API bool interrupted();
+ICE_PROTOCOL_API bool acceptInterrupted();
+ICE_PROTOCOL_API bool noBuffers();
+ICE_PROTOCOL_API bool wouldBlock();
+ICE_PROTOCOL_API bool connectFailed();
+ICE_PROTOCOL_API bool connectInProgress();
+ICE_PROTOCOL_API bool connectionLost();
+ICE_PROTOCOL_API bool notConnected();
+
+ICE_PROTOCOL_API SOCKET createSocket(bool);
+ICE_PROTOCOL_API void closeSocket(SOCKET);
+
+ICE_PROTOCOL_API void setBlock(SOCKET, bool);
+ICE_PROTOCOL_API void setTcpNoDelay(SOCKET);
+ICE_PROTOCOL_API void setKeepAlive(SOCKET);
+ICE_PROTOCOL_API void setSendBufferSize(SOCKET, int);
+
+ICE_PROTOCOL_API void doBind(SOCKET, struct sockaddr_in&);
+ICE_PROTOCOL_API void doListen(SOCKET, int);
+ICE_PROTOCOL_API void doConnect(SOCKET, struct sockaddr_in&, int);
+ICE_PROTOCOL_API SOCKET doAccept(SOCKET, int);
+
+ICE_PROTOCOL_API void getAddress(const std::string&, int, struct sockaddr_in&);
+ICE_PROTOCOL_API std::string getLocalHost(bool);
+ICE_PROTOCOL_API bool compareAddress(const struct sockaddr_in&, const struct sockaddr_in&);
+
+ICE_PROTOCOL_API void createPipe(SOCKET fds[2]);
+
+ICE_PROTOCOL_API std::string errorToString(int);
+ICE_PROTOCOL_API std::string errorToStringDNS(int);
+ICE_PROTOCOL_API std::string lastErrorToString();
+ICE_PROTOCOL_API std::string lastErrorToStringDNS();
+
+ICE_PROTOCOL_API std::string fdToString(SOCKET);
+ICE_PROTOCOL_API std::string addrToString(const struct sockaddr_in&);
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index 66f63eb84ce..9543d7b6f85 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -92,7 +92,7 @@ vector<string>
Ice::Object::ice_facets(const Current&)
{
vector<string> v;
- for (map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
+ for(map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
{
v.push_back(p->first);
}
@@ -168,12 +168,12 @@ Ice::Object::__dispatch(Incoming& in, const Current& current)
pair<const string*, const string*> r =
equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
- if (r.first == r.second)
+ if(r.first == r.second)
{
return DispatchOperationNotExist;
}
- switch (r.first - __all)
+ switch(r.first - __all)
{
case 0:
{
@@ -207,7 +207,7 @@ Ice::Object::__write(::IceInternal::BasicStream* __os) const
IceUtil::Mutex::Lock sync(_activeFacetMapMutex);
__os->writeSize(Int(_activeFacetMap.size()));
- for (map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
+ for(map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
{
__os->write(p->first);
__os->write(p->second);
@@ -225,7 +225,7 @@ Ice::Object::__read(::IceInternal::BasicStream* __is)
_activeFacetMap.clear();
_activeFacetMapHint = _activeFacetMap.end();
- while (sz-- > 0)
+ while(sz-- > 0)
{
pair<string, ObjectPtr> v;
__is->read(v.first);
@@ -240,7 +240,7 @@ Ice::Object::__marshal(const ::Ice::StreamPtr& __os) const
IceUtil::Mutex::Lock sync(_activeFacetMapMutex);
__os->startWriteDictionary("ice:facets", _activeFacetMap.size());
- for (map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
+ for(map<string, ObjectPtr>::const_iterator p = _activeFacetMap.begin(); p != _activeFacetMap.end(); ++p)
{
__os->startWriteDictionaryElement();
__os->writeString("key", p->first);
@@ -265,7 +265,7 @@ Ice::Object::__unmarshal(const ::Ice::StreamPtr& __is)
_activeFacetMap.clear();
_activeFacetMapHint = _activeFacetMap.end();
- while (sz-- > 0)
+ while(sz-- > 0)
{
__is->startReadDictionaryElement();
pair<string, ObjectPtr> v;
@@ -304,22 +304,22 @@ Ice::Object::ice_removeFacet(const string& name)
map<string, ObjectPtr>::iterator p = _activeFacetMap.end();
- if (_activeFacetMapHint != _activeFacetMap.end())
+ if(_activeFacetMapHint != _activeFacetMap.end())
{
- if (_activeFacetMapHint->first == name)
+ if(_activeFacetMapHint->first == name)
{
p = _activeFacetMapHint;
}
}
- if (p == _activeFacetMap.end())
+ if(p == _activeFacetMap.end())
{
p = _activeFacetMap.find(name);
}
- if (p != _activeFacetMap.end())
+ if(p != _activeFacetMap.end())
{
- if (p == _activeFacetMapHint)
+ if(p == _activeFacetMapHint)
{
_activeFacetMap.erase(p++);
_activeFacetMapHint = p;
@@ -347,20 +347,20 @@ Ice::Object::ice_findFacet(const string& name)
map<string, ObjectPtr>::iterator p = _activeFacetMap.end();
- if (_activeFacetMapHint != _activeFacetMap.end())
+ if(_activeFacetMapHint != _activeFacetMap.end())
{
- if (_activeFacetMapHint->first == name)
+ if(_activeFacetMapHint->first == name)
{
p = _activeFacetMapHint;
}
}
- if (p == _activeFacetMap.end())
+ if(p == _activeFacetMap.end())
{
p = _activeFacetMap.find(name);
}
- if (p != _activeFacetMap.end())
+ if(p != _activeFacetMap.end())
{
_activeFacetMapHint = p;
return p->second;
@@ -380,7 +380,7 @@ Ice::Blobject::__dispatch(Incoming& in, const Current& current)
in.is()->readBlob(inParams, sz);
bool ok = ice_invoke(inParams, outParams, current);
in.os()->writeBlob(outParams);
- if (ok)
+ if(ok)
{
return ::IceInternal::DispatchOK;
}
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp
index ba2e6604c07..0933965b2da 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.cpp
+++ b/cpp/src/Ice/ObjectAdapterFactory.cpp
@@ -34,7 +34,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const
{
IceUtil::RecMutex::Lock sync(*this);
map<string, ObjectAdapterIPtr>::iterator p = _adapters.find(name);
- if (p != _adapters.end())
+ if(p != _adapters.end())
{
return p->second;
}
@@ -47,9 +47,9 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const
ObjectAdapterPtr
IceInternal::ObjectAdapterFactory::findObjectAdapter(const ObjectPrx& proxy)
{
- for (map<string, ObjectAdapterIPtr>::iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ for(map<string, ObjectAdapterIPtr>::iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- if (p->second->isLocal(proxy))
+ if(p->second->isLocal(proxy))
{
return p->second;
}
diff --git a/cpp/src/Ice/ObjectAdapterFactory.h b/cpp/src/Ice/ObjectAdapterFactory.h
index b9a10c46aa2..0eeb03c956f 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.h
+++ b/cpp/src/Ice/ObjectAdapterFactory.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_OBJECT_ADAPTER_FACTORY_H
-#define ICE_OBJECT_ADAPTER_FACTORY_H
-
-#include <Ice/ObjectAdapterI.h>
-#include <IceUtil/RecMutex.h>
-
-namespace IceInternal
-{
-
-class ObjectAdapterFactory : public ::IceUtil::Shared, public ::IceUtil::RecMutex
-{
-public:
-
- void shutdown();
- ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&);
- ::Ice::ObjectAdapterPtr findObjectAdapter(const ::Ice::ObjectPrx&);
-
-private:
-
- ObjectAdapterFactory(const InstancePtr&);
- friend class Instance;
-
- InstancePtr _instance;
- std::map<std::string, ::Ice::ObjectAdapterIPtr> _adapters;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_OBJECT_ADAPTER_FACTORY_H
+#define ICE_OBJECT_ADAPTER_FACTORY_H
+
+#include <Ice/ObjectAdapterI.h>
+#include <IceUtil/RecMutex.h>
+
+namespace IceInternal
+{
+
+class ObjectAdapterFactory : public ::IceUtil::Shared, public ::IceUtil::RecMutex
+{
+public:
+
+ void shutdown();
+ ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&);
+ ::Ice::ObjectAdapterPtr findObjectAdapter(const ::Ice::ObjectPrx&);
+
+private:
+
+ ObjectAdapterFactory(const InstancePtr&);
+ friend class Instance;
+
+ InstancePtr _instance;
+ std::map<std::string, ::Ice::ObjectAdapterIPtr> _adapters;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index 638b62b0823..0a496e35d0f 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -45,7 +45,7 @@ Ice::ObjectAdapterI::getCommunicator()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -58,7 +58,7 @@ Ice::ObjectAdapterI::activate()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -66,9 +66,9 @@ Ice::ObjectAdapterI::activate()
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
Ice::voidMemFun(&IncomingConnectionFactory::activate));
- if (!_printAdapterReadyDone)
+ if(!_printAdapterReadyDone)
{
- if (_instance->properties()->getPropertyAsInt("Ice.PrintAdapterReady") > 0)
+ if(_instance->properties()->getPropertyAsInt("Ice.PrintAdapterReady") > 0)
{
cout << _name << " ready" << endl;
}
@@ -82,7 +82,7 @@ Ice::ObjectAdapterI::hold()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -96,7 +96,7 @@ Ice::ObjectAdapterI::deactivate()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
//
// Ignore deactivation requests if the Object Adapter has
@@ -138,7 +138,7 @@ Ice::ObjectAdapterI::add(const ObjectPtr& object, const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -153,7 +153,7 @@ Ice::ObjectAdapterI::addWithUUID(const ObjectPtr& object)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -171,7 +171,7 @@ Ice::ObjectAdapterI::remove(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -185,7 +185,7 @@ Ice::ObjectAdapterI::addServantLocator(const ServantLocatorPtr& locator, const s
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -198,31 +198,31 @@ Ice::ObjectAdapterI::removeServantLocator(const string& prefix)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
map<string, ServantLocatorPtr>::iterator p = _locatorMap.end();
- if (_locatorMapHint != _locatorMap.end())
+ if(_locatorMapHint != _locatorMap.end())
{
- if (_locatorMapHint->first == prefix)
+ if(_locatorMapHint->first == prefix)
{
p = _locatorMapHint;
}
}
- if (p == _locatorMap.end())
+ if(p == _locatorMap.end())
{
p = _locatorMap.find(prefix);
}
- if (p != _locatorMap.end())
+ if(p != _locatorMap.end())
{
p->second->deactivate();
- if (p == _locatorMapHint)
+ if(p == _locatorMapHint)
{
_locatorMap.erase(p++);
_locatorMapHint = p;
@@ -239,27 +239,27 @@ Ice::ObjectAdapterI::findServantLocator(const string& prefix)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
map<string, ServantLocatorPtr>::iterator p = _locatorMap.end();
- if (_locatorMapHint != _locatorMap.end())
+ if(_locatorMapHint != _locatorMap.end())
{
- if (_locatorMapHint->first == prefix)
+ if(_locatorMapHint->first == prefix)
{
p = _locatorMapHint;
}
}
- if (p == _locatorMap.end())
+ if(p == _locatorMap.end())
{
p = _locatorMap.find(prefix);
}
- if (p != _locatorMap.end())
+ if(p != _locatorMap.end())
{
_locatorMapHint = p;
return p->second;
@@ -275,16 +275,16 @@ Ice::ObjectAdapterI::identityToServant(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_activeServantMapHint != _activeServantMap.end())
+ if(_activeServantMapHint != _activeServantMap.end())
{
- if (_activeServantMapHint->first == ident)
+ if(_activeServantMapHint->first == ident)
{
return _activeServantMapHint->second;
}
}
ObjectDict::iterator p = _activeServantMap.find(ident);
- if (p != _activeServantMap.end())
+ if(p != _activeServantMap.end())
{
_activeServantMapHint = p;
return p->second;
@@ -307,7 +307,7 @@ Ice::ObjectAdapterI::createProxy(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -320,7 +320,7 @@ Ice::ObjectAdapterI::createReverseProxy(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -339,13 +339,13 @@ Ice::ObjectAdapterI::addRouter(const RouterPrx& router)
{
IceUtil::Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
RouterInfoPtr routerInfo = _instance->routerManager()->get(router);
- if (routerInfo)
+ if(routerInfo)
{
//
// Add the router's server proxy endpoints to this object
@@ -386,7 +386,7 @@ Ice::ObjectAdapterI::getIncomingConnections() const
//
list<ConnectionPtr> connections;
vector<IncomingConnectionFactoryPtr>::const_iterator p;
- for (p = _incomingConnectionFactories.begin(); p != _incomingConnectionFactories.end(); ++p)
+ for(p = _incomingConnectionFactories.begin(); p != _incomingConnectionFactories.end(); ++p)
{
list<ConnectionPtr> cons = (*p)->connections();
connections.splice(connections.end(), cons);
@@ -410,23 +410,23 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const string& n
string::size_type beg;
string::size_type end = 0;
- while (end < s.length())
+ while(end < s.length())
{
static const string delim = " \t\n\r";
beg = s.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
end = s.find(':', beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = s.length();
}
- if (end == beg)
+ if(end == beg)
{
break;
}
@@ -458,7 +458,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const string& n
// router. (See addRouter.)
//
/*
- if (_incomingConnectionFactories.empty())
+ if(_incomingConnectionFactories.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -467,7 +467,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const string& n
Ice::ObjectAdapterI::~ObjectAdapterI()
{
- if (_instance)
+ if(_instance)
{
Warning out(_instance->logger());
out << "object adapter has not been deactivated";
@@ -515,12 +515,12 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
// endpoints used by this object adapter's incoming connection
// factories are considered local.
//
- for (p = ref->endpoints.begin(); p != ref->endpoints.end(); ++p)
+ for(p = ref->endpoints.begin(); p != ref->endpoints.end(); ++p)
{
vector<IncomingConnectionFactoryPtr>::const_iterator q;
- for (q = _incomingConnectionFactories.begin(); q != _incomingConnectionFactories.end(); ++q)
+ for(q = _incomingConnectionFactories.begin(); q != _incomingConnectionFactories.end(); ++q)
{
- if ((*q)->equivalent(*p))
+ if((*q)->equivalent(*p))
{
return true;
}
@@ -535,9 +535,9 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const
// router's server proxy endpoints (if any), are also considered
// local.
//
- for (p = ref->endpoints.begin(); p != ref->endpoints.end(); ++p)
+ for(p = ref->endpoints.begin(); p != ref->endpoints.end(); ++p)
{
- if (binary_search(_routerEndpoints.begin(), _routerEndpoints.end(), *p)) // _routerEndpoints is sorted.
+ if(binary_search(_routerEndpoints.begin(), _routerEndpoints.end(), *p)) // _routerEndpoints is sorted.
{
return true;
}
diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h
index e9378be1c67..b31e15626f4 100644
--- a/cpp/src/Ice/ObjectAdapterI.h
+++ b/cpp/src/Ice/ObjectAdapterI.h
@@ -1,86 +1,86 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_OBJECT_ADAPTER_I_H
-#define ICE_OBJECT_ADAPTER_I_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/ObjectAdapter.h>
-#include <Ice/InstanceF.h>
-#include <Ice/ObjectAdapterFactoryF.h>
-#include <Ice/CommunicatorF.h>
-#include <Ice/ConnectionFactoryF.h>
-#include <Ice/ProxyF.h>
-#include <Ice/ObjectF.h>
-#include <Ice/Exception.h>
-#include <Ice/EndpointF.h>
-#include <list>
-
-namespace Ice
-{
-
-class ObjectAdapterI;
-typedef IceUtil::Handle<ObjectAdapterI> ObjectAdapterIPtr;
-
-class ObjectAdapterI : public ObjectAdapter, public ::IceUtil::Mutex
-{
-public:
-
- virtual std::string getName();
- virtual CommunicatorPtr getCommunicator();
-
- virtual void activate();
- virtual void hold();
- virtual void deactivate();
- virtual void waitForDeactivate();
-
- virtual ObjectPrx add(const ObjectPtr&, const Identity&);
- virtual ObjectPrx addWithUUID(const ObjectPtr&);
- virtual void remove(const Identity&);
-
- virtual void addServantLocator(const ServantLocatorPtr&, const std::string&);
- virtual void removeServantLocator(const std::string&);
- virtual ServantLocatorPtr findServantLocator(const std::string&);
-
- virtual ObjectPtr identityToServant(const Identity&);
- virtual ObjectPtr proxyToServant(const ObjectPrx&);
-
- virtual ObjectPrx createProxy(const Identity&);
- virtual ObjectPrx createReverseProxy(const Identity&);
-
- virtual void addRouter(const RouterPrx&);
-
- std::list< ::IceInternal::ConnectionPtr> getIncomingConnections() const;
-
-private:
-
- ObjectAdapterI(const ::IceInternal::InstancePtr&, const std::string&, const std::string&);
- virtual ~ObjectAdapterI();
- friend class ::IceInternal::ObjectAdapterFactory;
-
- ObjectPrx newProxy(const Identity&) const;
- bool isLocal(const ObjectPrx&) const;
-
- ::IceInternal::InstancePtr _instance;
- bool _printAdapterReadyDone;
- std::string _name;
- ObjectDict _activeServantMap;
- ObjectDict::iterator _activeServantMapHint;
- std::map<std::string, ServantLocatorPtr> _locatorMap;
- std::map<std::string, ServantLocatorPtr>::iterator _locatorMapHint;
- std::vector< ::IceInternal::IncomingConnectionFactoryPtr> _incomingConnectionFactories;
- std::vector< ::IceInternal::EndpointPtr> _routerEndpoints;
- IceUtil::Mutex _routerEndpointsMutex;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_OBJECT_ADAPTER_I_H
+#define ICE_OBJECT_ADAPTER_I_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/ObjectAdapter.h>
+#include <Ice/InstanceF.h>
+#include <Ice/ObjectAdapterFactoryF.h>
+#include <Ice/CommunicatorF.h>
+#include <Ice/ConnectionFactoryF.h>
+#include <Ice/ProxyF.h>
+#include <Ice/ObjectF.h>
+#include <Ice/Exception.h>
+#include <Ice/EndpointF.h>
+#include <list>
+
+namespace Ice
+{
+
+class ObjectAdapterI;
+typedef IceUtil::Handle<ObjectAdapterI> ObjectAdapterIPtr;
+
+class ObjectAdapterI : public ObjectAdapter, public ::IceUtil::Mutex
+{
+public:
+
+ virtual std::string getName();
+ virtual CommunicatorPtr getCommunicator();
+
+ virtual void activate();
+ virtual void hold();
+ virtual void deactivate();
+ virtual void waitForDeactivate();
+
+ virtual ObjectPrx add(const ObjectPtr&, const Identity&);
+ virtual ObjectPrx addWithUUID(const ObjectPtr&);
+ virtual void remove(const Identity&);
+
+ virtual void addServantLocator(const ServantLocatorPtr&, const std::string&);
+ virtual void removeServantLocator(const std::string&);
+ virtual ServantLocatorPtr findServantLocator(const std::string&);
+
+ virtual ObjectPtr identityToServant(const Identity&);
+ virtual ObjectPtr proxyToServant(const ObjectPrx&);
+
+ virtual ObjectPrx createProxy(const Identity&);
+ virtual ObjectPrx createReverseProxy(const Identity&);
+
+ virtual void addRouter(const RouterPrx&);
+
+ std::list< ::IceInternal::ConnectionPtr> getIncomingConnections() const;
+
+private:
+
+ ObjectAdapterI(const ::IceInternal::InstancePtr&, const std::string&, const std::string&);
+ virtual ~ObjectAdapterI();
+ friend class ::IceInternal::ObjectAdapterFactory;
+
+ ObjectPrx newProxy(const Identity&) const;
+ bool isLocal(const ObjectPrx&) const;
+
+ ::IceInternal::InstancePtr _instance;
+ bool _printAdapterReadyDone;
+ std::string _name;
+ ObjectDict _activeServantMap;
+ ObjectDict::iterator _activeServantMapHint;
+ std::map<std::string, ServantLocatorPtr> _locatorMap;
+ std::map<std::string, ServantLocatorPtr>::iterator _locatorMapHint;
+ std::vector< ::IceInternal::IncomingConnectionFactoryPtr> _incomingConnectionFactories;
+ std::vector< ::IceInternal::EndpointPtr> _routerEndpoints;
+ IceUtil::Mutex _routerEndpointsMutex;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ObjectFactoryManager.cpp b/cpp/src/Ice/ObjectFactoryManager.cpp
index 49bb6537e1b..ffc4b9a4099 100644
--- a/cpp/src/Ice/ObjectFactoryManager.cpp
+++ b/cpp/src/Ice/ObjectFactoryManager.cpp
@@ -33,24 +33,24 @@ IceInternal::ObjectFactoryManager::remove(const string& id)
map<string, ::Ice::ObjectFactoryPtr>::iterator p = _factoryMap.end();
- if (_factoryMapHint != _factoryMap.end())
+ if(_factoryMapHint != _factoryMap.end())
{
- if (_factoryMapHint->first == id)
+ if(_factoryMapHint->first == id)
{
p = _factoryMapHint;
}
}
- if (p == _factoryMap.end())
+ if(p == _factoryMap.end())
{
p = _factoryMap.find(id);
}
- if (p != _factoryMap.end())
+ if(p != _factoryMap.end())
{
p->second->destroy();
- if (p == _factoryMapHint)
+ if(p == _factoryMapHint)
{
_factoryMap.erase(p++);
_factoryMapHint = p;
@@ -69,20 +69,20 @@ IceInternal::ObjectFactoryManager::find(const string& id)
map<string, ::Ice::ObjectFactoryPtr>::iterator p = _factoryMap.end();
- if (_factoryMapHint != _factoryMap.end())
+ if(_factoryMapHint != _factoryMap.end())
{
- if (_factoryMapHint->first == id)
+ if(_factoryMapHint->first == id)
{
p = _factoryMapHint;
}
}
- if (p == _factoryMap.end())
+ if(p == _factoryMap.end())
{
p = _factoryMap.find(id);
}
- if (p != _factoryMap.end())
+ if(p != _factoryMap.end())
{
_factoryMapHint = p;
return p->second;
diff --git a/cpp/src/Ice/ObjectFactoryManager.h b/cpp/src/Ice/ObjectFactoryManager.h
index c10cd4fe09c..df0415714a3 100644
--- a/cpp/src/Ice/ObjectFactoryManager.h
+++ b/cpp/src/Ice/ObjectFactoryManager.h
@@ -1,42 +1,42 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SERVANT_FACTORY_MANAGER_H
-#define ICE_SERVANT_FACTORY_MANAGER_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/ObjectFactoryManagerF.h>
-#include <Ice/ObjectFactoryF.h>
-
-namespace IceInternal
-{
-
-class ObjectFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- void add(const ::Ice::ObjectFactoryPtr&, const std::string&);
- void remove(const std::string&);
- ::Ice::ObjectFactoryPtr find(const std::string&);
-
-private:
-
- ObjectFactoryManager();
- void destroy();
- friend class Instance;
-
- std::map<std::string, ::Ice::ObjectFactoryPtr> _factoryMap;
- std::map<std::string, ::Ice::ObjectFactoryPtr>::iterator _factoryMapHint;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SERVANT_FACTORY_MANAGER_H
+#define ICE_SERVANT_FACTORY_MANAGER_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/ObjectFactoryManagerF.h>
+#include <Ice/ObjectFactoryF.h>
+
+namespace IceInternal
+{
+
+class ObjectFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ void add(const ::Ice::ObjectFactoryPtr&, const std::string&);
+ void remove(const std::string&);
+ ::Ice::ObjectFactoryPtr find(const std::string&);
+
+private:
+
+ ObjectFactoryManager();
+ void destroy();
+ friend class Instance;
+
+ std::map<std::string, ::Ice::ObjectFactoryPtr> _factoryMap;
+ std::map<std::string, ::Ice::ObjectFactoryPtr>::iterator _factoryMapHint;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ObjectFactoryManagerF.h b/cpp/src/Ice/ObjectFactoryManagerF.h
index c9d1bd79004..7f61f76cc2f 100644
--- a/cpp/src/Ice/ObjectFactoryManagerF.h
+++ b/cpp/src/Ice/ObjectFactoryManagerF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SERVANT_FACTORY_MANAGER_F_H
-#define ICE_SERVANT_FACTORY_MANAGER_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class ObjectFactoryManager;
-void incRef(ObjectFactoryManager*);
-void decRef(ObjectFactoryManager*);
-typedef Handle<ObjectFactoryManager> ObjectFactoryManagerPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SERVANT_FACTORY_MANAGER_F_H
+#define ICE_SERVANT_FACTORY_MANAGER_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class ObjectFactoryManager;
+void incRef(ObjectFactoryManager*);
+void decRef(ObjectFactoryManager*);
+typedef Handle<ObjectFactoryManager> ObjectFactoryManagerPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 77304c9dd0d..58902503b48 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -44,7 +44,7 @@ IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const Reference
_is(ref->instance),
_os(ref->instance)
{
- switch (_reference->mode)
+ switch(_reference->mode)
{
case Reference::ModeTwoway:
case Reference::ModeOneway:
@@ -68,7 +68,7 @@ IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const Reference
_os.write(nonmutating);
_os.writeSize(Int(context.size()));
Context::const_iterator p;
- for (p = context.begin(); p != context.end(); ++p)
+ for(p = context.begin(); p != context.end(); ++p)
{
_os.write(p->first);
_os.write(p->second);
@@ -84,7 +84,7 @@ IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const Reference
IceInternal::Outgoing::~Outgoing()
{
- if (_state == StateUnsent &&
+ if(_state == StateUnsent &&
(_reference->mode == Reference::ModeBatchOneway || _reference->mode == Reference::ModeBatchDatagram))
{
_connection->abortBatchRequest();
@@ -96,7 +96,7 @@ IceInternal::Outgoing::invoke()
{
_os.endWriteEncaps();
- switch (_reference->mode)
+ switch(_reference->mode)
{
case Reference::ModeTwoway:
{
@@ -109,12 +109,12 @@ IceInternal::Outgoing::invoke()
_state = StateInProgress;
Int timeout = _connection->timeout();
- while (_state == StateInProgress)
+ while(_state == StateInProgress)
{
- if (timeout >= 0)
+ if(timeout >= 0)
{
timedWait(IceUtil::Time::milliSeconds(timeout));
- if (_state == StateInProgress)
+ if(_state == StateInProgress)
{
timedOut = true;
_state = StateLocalException;
@@ -128,7 +128,7 @@ IceInternal::Outgoing::invoke()
}
}
- if (timedOut)
+ if(timedOut)
{
//
// Must be called outside the synchronization of this
@@ -137,7 +137,7 @@ IceInternal::Outgoing::invoke()
_connection->exception(*_exception.get());
}
- if (_exception.get())
+ if(_exception.get())
{
//
// A CloseConnectionException indicates graceful
@@ -160,12 +160,12 @@ IceInternal::Outgoing::invoke()
throw NonRepeatable(*_exception.get());
}
- if (_state == StateUserException)
+ if(_state == StateUserException)
{
return false;
}
- if (_state == StateLocationForward)
+ if(_state == StateLocationForward)
{
ObjectPrx p;
_is.read(p);
@@ -209,12 +209,12 @@ IceInternal::Outgoing::finished(BasicStream& is)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if (_state == StateInProgress)
+ if(_state == StateInProgress)
{
_is.swap(is);
Byte status;
_is.read(status);
- switch (static_cast<DispatchStatus>(status))
+ switch(static_cast<DispatchStatus>(status))
{
case DispatchOK:
{
@@ -323,7 +323,7 @@ IceInternal::Outgoing::finished(const LocalException& ex)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if (_state == StateInProgress)
+ if(_state == StateInProgress)
{
_state = StateLocalException;
_exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone()));
diff --git a/cpp/src/Ice/PicklerI.h b/cpp/src/Ice/PicklerI.h
index cbe7358bae4..41d694dceb3 100644
--- a/cpp/src/Ice/PicklerI.h
+++ b/cpp/src/Ice/PicklerI.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PICKLER_I_H
-#define ICE_PICKLER_I_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/Pickler.h>
-#include <Ice/InstanceF.h>
-
-namespace Ice
-{
-
-class ICE_API PicklerI : public Pickler
-{
-public:
-
- void pickle(const ObjectPtr&, std::ostream&);
- ObjectPtr unpickle(const std::string&, std::istream&);
-
-private:
-
- PicklerI(const ::IceInternal::InstancePtr&);
- friend ::IceInternal::Instance;
-
- ::IceInternal::InstancePtr _instance;
-};
-
-}
-
-#endif
-
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PICKLER_I_H
+#define ICE_PICKLER_I_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/Pickler.h>
+#include <Ice/InstanceF.h>
+
+namespace Ice
+{
+
+class ICE_API PicklerI : public Pickler
+{
+public:
+
+ void pickle(const ObjectPtr&, std::ostream&);
+ ObjectPtr unpickle(const std::string&, std::istream&);
+
+private:
+
+ PicklerI(const ::IceInternal::InstancePtr&);
+ friend ::IceInternal::Instance;
+
+ ::IceInternal::InstancePtr _instance;
+};
+
+}
+
+#endif
+
diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp
index f69c751fae4..c585dab36f1 100644
--- a/cpp/src/Ice/PluginManagerI.cpp
+++ b/cpp/src/Ice/PluginManagerI.cpp
@@ -33,7 +33,7 @@ Ice::PluginManagerI::getPlugin(const string& name)
IceUtil::Mutex::Lock sync(*this);
map<string, PluginInfo>::const_iterator r = _plugins.find(name);
- if (r != _plugins.end())
+ if(r != _plugins.end())
{
return (*r).second.plugin;
}
@@ -46,7 +46,7 @@ Ice::PluginManagerI::addPlugin(const string& name, const PluginPtr& plugin)
IceUtil::Mutex::Lock sync(*this);
map<string, PluginInfo>::const_iterator r = _plugins.find(name);
- if (r != _plugins.end())
+ if(r != _plugins.end())
{
throw PluginExistsException(__FILE__, __LINE__);
}
@@ -61,7 +61,7 @@ Ice::PluginManagerI::destroy()
IceUtil::Mutex::Lock sync(*this);
map<string, PluginInfo>::iterator r;
- for (r = _plugins.begin(); r != _plugins.end(); ++r)
+ for(r = _plugins.begin(); r != _plugins.end(); ++r)
{
(*r).second.plugin->destroy();
(*r).second.plugin = 0;
@@ -85,7 +85,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
PropertiesPtr properties = _instance->properties();
PropertyDict plugins = properties->getPropertiesForPrefix(prefix);
PropertyDict::const_iterator p;
- for (p = plugins.begin(); p != plugins.end(); ++p)
+ for(p = plugins.begin(); p != plugins.end(); ++p)
{
string name = p->first.substr(prefix.size());
const string& value = p->second;
@@ -96,7 +96,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
string entryPoint;
StringSeq args;
string::size_type pos = value.find_first_of(" \t\n");
- if (pos == string::npos)
+ if(pos == string::npos)
{
entryPoint = value;
}
@@ -104,10 +104,10 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
{
entryPoint = value.substr(0, pos);
string::size_type beg = value.find_first_not_of(" \t\n", pos);
- while (beg != string::npos)
+ while(beg != string::npos)
{
string::size_type end = value.find_first_of(" \t\n", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
args.push_back(value.substr(beg));
beg = end;
@@ -143,12 +143,12 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& entryPoint, co
PluginInfo info;
info.library = new DynamicLibrary();
DynamicLibrary::symbol_type sym = info.library->loadEntryPoint(entryPoint);
- if (sym == 0)
+ if(sym == 0)
{
ostringstream out;
string msg = info.library->getErrorMessage();
out << "unable to load entry point `" << entryPoint << "'";
- if (!msg.empty())
+ if(!msg.empty())
{
out << ": " + msg;
}
diff --git a/cpp/src/Ice/PluginManagerI.h b/cpp/src/Ice/PluginManagerI.h
index 60663ffdc38..e668b6afc4d 100644
--- a/cpp/src/Ice/PluginManagerI.h
+++ b/cpp/src/Ice/PluginManagerI.h
@@ -1,55 +1,55 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PLUGIN_MANAGER_I_H
-#define ICE_PLUGIN_MANAGER_I_H
-
-#include <Ice/Plugin.h>
-#include <Ice/InstanceF.h>
-#include <Ice/CommunicatorF.h>
-#include <Ice/DynamicLibraryF.h>
-#include <Ice/BuiltinSequences.h>
-#include <IceUtil/Mutex.h>
-#include <map>
-
-namespace Ice
-{
-
-class PluginManagerI : public PluginManager, public IceUtil::Mutex
-{
-public:
-
- virtual PluginPtr getPlugin(const std::string&);
-
- virtual void addPlugin(const std::string&, const PluginPtr&);
-
- virtual void destroy();
-
- struct PluginInfo
- {
- PluginPtr plugin;
- IceInternal::DynamicLibraryPtr library;
- };
-
-private:
-
- PluginManagerI(const IceInternal::InstancePtr&);
- void loadPlugins(int&, char*[]);
- friend class IceInternal::Instance;
-
- void loadPlugin(const std::string&, const std::string&, const StringSeq&);
-
- IceInternal::InstancePtr _instance;
- std::map<std::string, PluginInfo> _plugins;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PLUGIN_MANAGER_I_H
+#define ICE_PLUGIN_MANAGER_I_H
+
+#include <Ice/Plugin.h>
+#include <Ice/InstanceF.h>
+#include <Ice/CommunicatorF.h>
+#include <Ice/DynamicLibraryF.h>
+#include <Ice/BuiltinSequences.h>
+#include <IceUtil/Mutex.h>
+#include <map>
+
+namespace Ice
+{
+
+class PluginManagerI : public PluginManager, public IceUtil::Mutex
+{
+public:
+
+ virtual PluginPtr getPlugin(const std::string&);
+
+ virtual void addPlugin(const std::string&, const PluginPtr&);
+
+ virtual void destroy();
+
+ struct PluginInfo
+ {
+ PluginPtr plugin;
+ IceInternal::DynamicLibraryPtr library;
+ };
+
+private:
+
+ PluginManagerI(const IceInternal::InstancePtr&);
+ void loadPlugins(int&, char*[]);
+ friend class IceInternal::Instance;
+
+ void loadPlugin(const std::string&, const std::string&, const StringSeq&);
+
+ IceInternal::InstancePtr _instance;
+ std::map<std::string, PluginInfo> _plugins;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 0306455ce54..9a4f492eaeb 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -22,7 +22,7 @@ Ice::PropertiesI::getProperty(const string& key)
IceUtil::Mutex::Lock sync(*this);
map<string, string>::const_iterator p = _properties.find(key);
- if (p != _properties.end())
+ if(p != _properties.end())
{
return p->second;
}
@@ -38,7 +38,7 @@ Ice::PropertiesI::getPropertyWithDefault(const string& key, const string& value)
IceUtil::Mutex::Lock sync(*this);
map<string, string>::const_iterator p = _properties.find(key);
- if (p != _properties.end())
+ if(p != _properties.end())
{
return p->second;
}
@@ -60,7 +60,7 @@ Ice::PropertiesI::getPropertyAsIntWithDefault(const string& key, Int value)
IceUtil::Mutex::Lock sync(*this);
map<string, string>::const_iterator p = _properties.find(key);
- if (p != _properties.end())
+ if(p != _properties.end())
{
return static_cast<Int>(atoi(p->second.c_str()));
}
@@ -77,9 +77,9 @@ Ice::PropertiesI::getPropertiesForPrefix(const string& prefix)
PropertyDict result;
map<string, string>::const_iterator p;
- for (p = _properties.begin(); p != _properties.end(); ++p)
+ for(p = _properties.begin(); p != _properties.end(); ++p)
{
- if (prefix.empty() || p->first.compare(0, prefix.size(), prefix) == 0)
+ if(prefix.empty() || p->first.compare(0, prefix.size(), prefix) == 0)
{
result.insert(*p);
}
@@ -104,7 +104,7 @@ Ice::PropertiesI::getCommandLineOptions()
StringSeq result;
result.reserve(_properties.size());
map<string, string>::const_iterator p;
- for (p = _properties.begin(); p != _properties.end(); ++p)
+ for(p = _properties.begin(); p != _properties.end(); ++p)
{
result.push_back("--" + p->first + "=" + p->second);
}
@@ -116,12 +116,12 @@ Ice::PropertiesI::parseCommandLineOptions(const string& prefix, const StringSeq&
{
StringSeq result;
StringSeq::size_type i;
- for (i = 0; i < options.size(); i++)
+ for(i = 0; i < options.size(); i++)
{
string opt = options[i];
- if (opt.find("--" + prefix + ".") == 0)
+ if(opt.find("--" + prefix + ".") == 0)
{
- if (opt.find('=') == string::npos)
+ if(opt.find('=') == string::npos)
{
opt += "=1";
}
@@ -140,7 +140,7 @@ void
Ice::PropertiesI::load(const std::string& file)
{
ifstream in(file.c_str());
- if (!in)
+ if(!in)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -148,7 +148,7 @@ Ice::PropertiesI::load(const std::string& file)
}
char line[1024];
- while (in.getline(line, 1024))
+ while(in.getline(line, 1024))
{
parseLine(line);
}
@@ -172,12 +172,12 @@ Ice::PropertiesI::PropertiesI()
Ice::PropertiesI::PropertiesI(StringSeq& args)
{
StringSeq::iterator q = args.begin();
- while (q != args.end())
+ while(q != args.end())
{
string s = *q;
- if (s.find("--Ice.Config") == 0)
+ if(s.find("--Ice.Config") == 0)
{
- if (s.find('=') == string::npos)
+ if(s.find('=') == string::npos)
{
s += "=1";
}
@@ -195,17 +195,17 @@ Ice::PropertiesI::PropertiesI(StringSeq& args)
Ice::PropertiesI::PropertiesI(int& argc, char* argv[])
{
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strncmp(argv[i], "--Ice.Config", 12) == 0)
+ if(strncmp(argv[i], "--Ice.Config", 12) == 0)
{
string line = argv[i];
- if (line.find('=') == string::npos)
+ if(line.find('=') == string::npos)
{
line += "=1";
}
parseLine(line.substr(2));
- for (int j = i; j + 1 < argc; ++j)
+ for(int j = i; j + 1 < argc; ++j)
{
argv[j] = argv[j + 1];
}
@@ -215,10 +215,10 @@ Ice::PropertiesI::PropertiesI(int& argc, char* argv[])
loadConfig();
- if (argc > 0)
+ if(argc > 0)
{
string name = getProperty("Ice.ProgramName");
- if (name.empty())
+ if(name.empty())
{
setProperty("Ice.ProgramName", argv[0]);
}
@@ -232,25 +232,25 @@ Ice::PropertiesI::parseLine(const string& line)
string s = line;
string::size_type idx = s.find('#');
- if (idx != string::npos)
+ if(idx != string::npos)
{
s.erase(idx);
}
idx = s.find_last_not_of(delim);
- if (idx != string::npos && idx + 1 < s.length())
+ if(idx != string::npos && idx + 1 < s.length())
{
s.erase(idx + 1);
}
string::size_type beg = s.find_first_not_of(delim);
- if (beg == string::npos)
+ if(beg == string::npos)
{
return;
}
string::size_type end = s.find_first_of(delim + "=", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
return;
}
@@ -258,7 +258,7 @@ Ice::PropertiesI::parseLine(const string& line)
string key = s.substr(beg, end - beg);
end = s.find('=', end);
- if (end == string::npos)
+ if(end == string::npos)
{
return;
}
@@ -266,7 +266,7 @@ Ice::PropertiesI::parseLine(const string& line)
string value;
beg = s.find_first_not_of(delim, end);
- if (beg != string::npos)
+ if(beg != string::npos)
{
end = s.length();
value = s.substr(beg, end - beg);
@@ -280,24 +280,24 @@ Ice::PropertiesI::loadConfig()
{
string value = getProperty("Ice.Config");
- if (value.empty() || value == "1")
+ if(value.empty() || value == "1")
{
const char* s = getenv("ICE_CONFIG");
- if (s && *s != '\0')
+ if(s && *s != '\0')
{
value = s;
}
}
- if (!value.empty())
+ if(!value.empty())
{
static const string delim = " \t\r\n";
string::size_type beg = value.find_first_not_of(delim);
- while (beg != string::npos)
+ while(beg != string::npos)
{
string::size_type end = value.find(",", beg);
string file;
- if (end == string::npos)
+ if(end == string::npos)
{
file = value.substr(beg);
beg = end;
diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h
index da843b70611..954e3d37d75 100644
--- a/cpp/src/Ice/PropertiesI.h
+++ b/cpp/src/Ice/PropertiesI.h
@@ -1,54 +1,54 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PROPERTIES_I_H
-#define ICE_PROPERTIES_I_H
-
-#include <IceUtil/Mutex.h>
-#include <Ice/Properties.h>
-#include <set>
-
-namespace Ice
-{
-
-class ICE_API PropertiesI : public Properties, public IceUtil::Mutex
-{
-public:
-
- virtual std::string getProperty(const std::string&);
- virtual std::string getPropertyWithDefault(const std::string&, const std::string&);
- virtual Ice::Int getPropertyAsInt(const std::string&);
- virtual Ice::Int getPropertyAsIntWithDefault(const std::string&, Ice::Int);
- virtual PropertyDict getPropertiesForPrefix(const std::string&);
- virtual void setProperty(const std::string&, const std::string&);
- virtual StringSeq getCommandLineOptions();
- virtual StringSeq parseCommandLineOptions(const std::string&, const StringSeq&);
- virtual void load(const std::string&);
- virtual PropertiesPtr clone();
-
-private:
-
- PropertiesI();
- PropertiesI(StringSeq&);
- PropertiesI(int&, char*[]);
- friend ICE_API PropertiesPtr createProperties();
- friend ICE_API PropertiesPtr createProperties(StringSeq&);
- friend ICE_API PropertiesPtr createProperties(int&, char*[]);
-
- void parseLine(const std::string&);
-
- void loadConfig();
-
- std::map<std::string, std::string> _properties;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PROPERTIES_I_H
+#define ICE_PROPERTIES_I_H
+
+#include <IceUtil/Mutex.h>
+#include <Ice/Properties.h>
+#include <set>
+
+namespace Ice
+{
+
+class ICE_API PropertiesI : public Properties, public IceUtil::Mutex
+{
+public:
+
+ virtual std::string getProperty(const std::string&);
+ virtual std::string getPropertyWithDefault(const std::string&, const std::string&);
+ virtual Ice::Int getPropertyAsInt(const std::string&);
+ virtual Ice::Int getPropertyAsIntWithDefault(const std::string&, Ice::Int);
+ virtual PropertyDict getPropertiesForPrefix(const std::string&);
+ virtual void setProperty(const std::string&, const std::string&);
+ virtual StringSeq getCommandLineOptions();
+ virtual StringSeq parseCommandLineOptions(const std::string&, const StringSeq&);
+ virtual void load(const std::string&);
+ virtual PropertiesPtr clone();
+
+private:
+
+ PropertiesI();
+ PropertiesI(StringSeq&);
+ PropertiesI(int&, char*[]);
+ friend ICE_API PropertiesPtr createProperties();
+ friend ICE_API PropertiesPtr createProperties(StringSeq&);
+ friend ICE_API PropertiesPtr createProperties(int&, char*[]);
+
+ void parseLine(const std::string&);
+
+ void loadConfig();
+
+ std::map<std::string, std::string> _properties;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Protocol.h b/cpp/src/Ice/Protocol.h
index 4d9c879b3b6..e9bbdf3d185 100644
--- a/cpp/src/Ice/Protocol.h
+++ b/cpp/src/Ice/Protocol.h
@@ -1,48 +1,48 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PROTOCOL_H
-#define ICE_PROTOCOL_H
-
-#include <Ice/Config.h>
-
-namespace IceInternal
-{
-
-//
-// Size of the Ice protocol header
-//
-// Protocol version (Byte)
-// Encoding version (Byte)
-// Message type (Byte)
-// Message size (Int)
-//
-const ::Ice::Int headerSize = 7;
-
-//
-// The current Ice protocol and encoding version
-//
-const ::Ice::Byte protocolVersion = 0;
-const ::Ice::Byte encodingVersion = 0;
-
-//
-// The Ice protocol message types
-//
-const ::Ice::Byte requestMsg = 0;
-const ::Ice::Byte requestBatchMsg = 1;
-const ::Ice::Byte replyMsg = 2;
-const ::Ice::Byte closeConnectionMsg = 3;
-const ::Ice::Byte compressedRequestMsg = 4;
-const ::Ice::Byte compressedRequestBatchMsg = 5;
-const ::Ice::Byte compressedReplyMsg = 6;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PROTOCOL_H
+#define ICE_PROTOCOL_H
+
+#include <Ice/Config.h>
+
+namespace IceInternal
+{
+
+//
+// Size of the Ice protocol header
+//
+// Protocol version (Byte)
+// Encoding version (Byte)
+// Message type (Byte)
+// Message size (Int)
+//
+const ::Ice::Int headerSize = 7;
+
+//
+// The current Ice protocol and encoding version
+//
+const ::Ice::Byte protocolVersion = 0;
+const ::Ice::Byte encodingVersion = 0;
+
+//
+// The Ice protocol message types
+//
+const ::Ice::Byte requestMsg = 0;
+const ::Ice::Byte requestBatchMsg = 1;
+const ::Ice::Byte replyMsg = 2;
+const ::Ice::Byte closeConnectionMsg = 3;
+const ::Ice::Byte compressedRequestMsg = 4;
+const ::Ice::Byte compressedRequestBatchMsg = 5;
+const ::Ice::Byte compressedReplyMsg = 6;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 9828955df81..0adbf4d522e 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -47,9 +47,9 @@ void
IceInternal::checkedCast(const ObjectPrx& b, const string& f, ObjectPrx& d)
{
d = 0;
- if (b)
+ if(b)
{
- if (f == b->ice_getFacet())
+ if(f == b->ice_getFacet())
{
d = b;
}
@@ -77,7 +77,7 @@ void
IceInternal::uncheckedCast(const ObjectPrx& b, const string& f, ObjectPrx& d)
{
d = 0;
- if (b)
+ if(b)
{
d = b->ice_newFacet(f);
}
@@ -110,7 +110,7 @@ bool
IceProxy::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
int __cnt = 0;
- while (true)
+ while(true)
{
try
{
@@ -136,7 +136,7 @@ void
IceProxy::Ice::Object::ice_ping(const Context& __context)
{
int __cnt = 0;
- while (true)
+ while(true)
{
try
{
@@ -163,7 +163,7 @@ vector<string>
IceProxy::Ice::Object::ice_ids(const Context& __context)
{
int __cnt = 0;
- while (true)
+ while(true)
{
try
{
@@ -189,7 +189,7 @@ string
IceProxy::Ice::Object::ice_id(const Context& __context)
{
int __cnt = 0;
- while (true)
+ while(true)
{
try
{
@@ -215,7 +215,7 @@ vector<string>
IceProxy::Ice::Object::ice_facets(const Context& __context)
{
int __cnt = 0;
- while (true)
+ while(true)
{
try
{
@@ -245,7 +245,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
const Context& context)
{
int __cnt = 0;
- while (true)
+ while(true)
{
try
{
@@ -258,7 +258,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation,
}
catch (const NonRepeatable& __ex)
{
- if (nonmutating)
+ if(nonmutating)
{
__handleException(*__ex.get(), __cnt);
}
@@ -283,7 +283,7 @@ IceProxy::Ice::Object::ice_getIdentity() const
ObjectPrx
IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const
{
- if (newIdentity == _reference->identity)
+ if(newIdentity == _reference->identity)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -304,7 +304,7 @@ IceProxy::Ice::Object::ice_getFacet() const
ObjectPrx
IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const
{
- if (newFacet == _reference->facet)
+ if(newFacet == _reference->facet)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -320,7 +320,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_twoway() const
{
ReferencePtr ref = _reference->changeMode(Reference::ModeTwoway);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -336,7 +336,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_oneway() const
{
ReferencePtr ref = _reference->changeMode(Reference::ModeOneway);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -352,7 +352,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_batchOneway() const
{
ReferencePtr ref = _reference->changeMode(Reference::ModeBatchOneway);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -368,7 +368,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_datagram() const
{
ReferencePtr ref = _reference->changeMode(Reference::ModeDatagram);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -384,7 +384,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_batchDatagram() const
{
ReferencePtr ref = _reference->changeMode(Reference::ModeBatchDatagram);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -400,7 +400,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_secure(bool b) const
{
ReferencePtr ref = _reference->changeSecure(b);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -416,7 +416,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_compress(bool b) const
{
ReferencePtr ref = _reference->changeCompress(b);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -432,7 +432,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_timeout(int t) const
{
ReferencePtr ref = _reference->changeTimeout(t);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -448,7 +448,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_router(const RouterPrx& router) const
{
ReferencePtr ref = _reference->changeRouter(router);
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -464,7 +464,7 @@ ObjectPrx
IceProxy::Ice::Object::ice_default() const
{
ReferencePtr ref = _reference->changeDefault();
- if (ref == _reference)
+ if(ref == _reference)
{
return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
@@ -511,13 +511,13 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from)
_reference = ref;
- if (delegateD)
+ if(delegateD)
{
Handle< ::IceDelegateD::Ice::Object> delegate = __createDelegateD();
delegate->__copyFrom(delegateD);
_delegate = delegate;
}
- else if (delegateM)
+ else if(delegateM)
{
Handle< ::IceDelegateM::Ice::Object> delegate = __createDelegateM();
delegate->__copyFrom(delegateM);
@@ -564,7 +564,7 @@ IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt)
if(cnt > max)
{
- if (traceLevels->retry >= 1)
+ if(traceLevels->retry >= 1)
{
Trace out(logger, traceLevels->retryCat);
out << "cannot retry operation call because retry limit has been exceeded\n" << ex;
@@ -572,7 +572,7 @@ IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt)
ex.ice_throw();
}
- if (traceLevels->retry >= 1)
+ if(traceLevels->retry >= 1)
{
Trace out(logger, traceLevels->retryCat);
out << "re-trying operation call because of exception\n" << ex;
@@ -591,7 +591,7 @@ IceProxy::Ice::Object::__locationForward(const LocationForward& ex)
_delegate = 0;
- if (_reference->identity != ex._prx->_reference->identity)
+ if(_reference->identity != ex._prx->_reference->identity)
{
throw LocationForwardIdentityException(__FILE__, __LINE__);
}
@@ -602,7 +602,7 @@ IceProxy::Ice::Object::__locationForward(const LocationForward& ex)
TraceLevelsPtr traceLevels = _reference->instance->traceLevels();
LoggerPtr logger = _reference->instance->logger();
- if (traceLevels->locationForward >= 1)
+ if(traceLevels->locationForward >= 1)
{
Trace out(logger, traceLevels->retryCat);
out << "location forward for object with identity `" << _reference.identity << "'";
@@ -625,10 +625,10 @@ IceProxy::Ice::Object::__getDelegate()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_delegate)
+ if(!_delegate)
{
ObjectAdapterPtr adapter = _reference->instance->objectAdapterFactory()->findObjectAdapter(this);
- if (adapter)
+ if(adapter)
{
Handle< ::IceDelegateD::Ice::Object> delegate = __createDelegateD();
delegate->setup(_reference, adapter);
@@ -645,7 +645,7 @@ IceProxy::Ice::Object::__getDelegate()
// using a router, then add this proxy to the router info
// object.
//
- if (_reference->routerInfo)
+ if(_reference->routerInfo)
{
_reference->routerInfo->addProxy(this);
}
@@ -679,7 +679,7 @@ IceProxy::Ice::Object::setup(const ReferencePtr& ref)
IceDelegateM::Ice::Object::~Object()
{
- if (__connection)
+ if(__connection)
{
__connection->decProxyUsageCount();
}
@@ -693,7 +693,7 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
BasicStream* __is = __out.is();
BasicStream* __os = __out.os();
__os->write(__id);
- if (!__out.invoke())
+ if(!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
}
@@ -707,7 +707,7 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
{
static const string __operation("ice_ping");
Outgoing __out(__connection, __reference, __operation, true, __context);
- if (!__out.invoke())
+ if(!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
}
@@ -719,7 +719,7 @@ IceDelegateM::Ice::Object::ice_ids(const Context& __context)
static const string __operation("ice_ids");
Outgoing __out(__connection, __reference, __operation, true, __context);
BasicStream* __is = __out.is();
- if (!__out.invoke())
+ if(!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
}
@@ -734,7 +734,7 @@ IceDelegateM::Ice::Object::ice_id(const Context& __context)
static const string __operation("ice_id");
Outgoing __out(__connection, __reference, __operation, true, __context);
BasicStream* __is = __out.is();
- if (!__out.invoke())
+ if(!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
}
@@ -749,7 +749,7 @@ IceDelegateM::Ice::Object::ice_facets(const Context& __context)
static const string __operation("ice_facets");
Outgoing __out(__connection, __reference, __operation, true, __context);
BasicStream* __is = __out.is();
- if (!__out.invoke())
+ if(!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
}
@@ -769,7 +769,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
BasicStream* __os = __out.os();
__os->writeBlob(inParams);
bool ok = __out.invoke();
- if (__reference->mode == Reference::ModeTwoway)
+ if(__reference->mode == Reference::ModeTwoway)
{
BasicStream* __is = __out.is();
Int sz = __is->getReadEncapsSize();
@@ -799,12 +799,12 @@ IceDelegateM::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate
__reference = from->__reference;
- if (from->__connection)
+ if(from->__connection)
{
from->__connection->incProxyUsageCount();
}
- if (__connection)
+ if(__connection)
{
__connection->decProxyUsageCount();
}
@@ -821,7 +821,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
//
__reference = ref;
- if (__reference->reverseAdapter)
+ if(__reference->reverseAdapter)
{
//
// If we have a reverse object adapter, we use the incoming
@@ -837,15 +837,15 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
::Ice::constMemFun(&Connection::endpoint));
endpoints = filterEndpoints(endpoints);
- if (endpoints.empty())
+ if(endpoints.empty())
{
throw NoEndpointException(__FILE__, __LINE__);
}
list<ConnectionPtr>::iterator p;
- for (p = connections.begin(); p != connections.end(); ++p)
+ for(p = connections.begin(); p != connections.end(); ++p)
{
- if ((*p)->endpoint() == endpoints.front())
+ if((*p)->endpoint() == endpoints.front())
{
break;
}
@@ -857,7 +857,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
else
{
vector<EndpointPtr> endpoints;
- if (__reference->routerInfo)
+ if(__reference->routerInfo)
{
//
// If we route, we send everything to the router's client
@@ -871,7 +871,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
endpoints = filterEndpoints(__reference->endpoints);
}
- if (endpoints.empty())
+ if(endpoints.empty())
{
throw NoEndpointException(__FILE__, __LINE__);
}
@@ -886,7 +886,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref)
// (if any) to the new connection, so that callbacks from the
// router can be received over this new connection.
//
- if (__reference->routerInfo)
+ if(__reference->routerInfo)
{
__connection->setAdapter(__reference->routerInfo->getAdapter());
}
@@ -904,7 +904,7 @@ IceDelegateM::Ice::Object::filterEndpoints(const vector<EndpointPtr>& allEndpoin
endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), ::Ice::constMemFun(&Endpoint::unknown)),
endpoints.end());
- switch (__reference->mode)
+ switch(__reference->mode)
{
case Reference::ModeTwoway:
case Reference::ModeOneway:
@@ -942,7 +942,7 @@ IceDelegateM::Ice::Object::filterEndpoints(const vector<EndpointPtr>& allEndpoin
// secure endpoints by partitioning the endpoint vector, so that
// non-secure endpoints come first.
//
- if (__reference->secure)
+ if(__reference->secure)
{
endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(::Ice::constMemFun(&Endpoint::secure))),
endpoints.end());
@@ -960,7 +960,7 @@ IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
Current __current;
__initCurrent(__current, "ice_isA", true, __context);
- while (true)
+ while(true)
{
Direct __direct(__adapter, __current);
try
@@ -987,7 +987,7 @@ IceDelegateD::Ice::Object::ice_ping(const ::Ice::Context& __context)
{
Current __current;
__initCurrent(__current, "ice_ping", true, __context);
- while (true)
+ while(true)
{
Direct __direct(__adapter, __current);
try
@@ -1015,7 +1015,7 @@ IceDelegateD::Ice::Object::ice_ids(const ::Ice::Context& __context)
{
Current __current;
__initCurrent(__current, "ice_ids", true, __context);
- while (true)
+ while(true)
{
Direct __direct(__adapter, __current);
try
@@ -1042,7 +1042,7 @@ IceDelegateD::Ice::Object::ice_id(const ::Ice::Context& __context)
{
Current __current;
__initCurrent(__current, "ice_id", true, __context);
- while (true)
+ while(true)
{
Direct __direct(__adapter, __current);
try
@@ -1069,7 +1069,7 @@ IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context)
{
Current __current;
__initCurrent(__current, "ice_facets", true, __context);
- while (true)
+ while(true)
{
Direct __direct(__adapter, __current);
try
@@ -1100,11 +1100,11 @@ IceDelegateD::Ice::Object::ice_invoke(const string& operation,
{
Current current;
__initCurrent(current, operation, nonmutating, context);
- while (true)
+ while(true)
{
Direct __direct(__adapter, current);
Blobject* __servant = dynamic_cast<Blobject*>(__direct.facetServant().get());
- if (!__servant)
+ if(!__servant)
{
OperationNotExistException ex(__FILE__, __LINE__);
ex.operation = current.operation;
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp
index a718fa78b3e..e51b56c8a58 100644
--- a/cpp/src/Ice/ProxyFactory.cpp
+++ b/cpp/src/Ice/ProxyFactory.cpp
@@ -24,7 +24,7 @@ void IceInternal::decRef(ProxyFactory* p) { p->__decRef(); }
ObjectPrx
IceInternal::ProxyFactory::stringToProxy(const string& str) const
{
- if (str.empty())
+ if(str.empty())
{
return 0;
}
@@ -39,7 +39,7 @@ string
IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy) const
{
static const string nilProxy("");
- if (proxy)
+ if(proxy)
{
return proxy->__reference()->toString();
}
@@ -55,7 +55,7 @@ IceInternal::ProxyFactory::streamToProxy(BasicStream* s) const
Identity ident;
ident.__read(s);
- if (ident.name.empty())
+ if(ident.name.empty())
{
return 0;
}
@@ -69,7 +69,7 @@ IceInternal::ProxyFactory::streamToProxy(BasicStream* s) const
void
IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s) const
{
- if (proxy)
+ if(proxy)
{
proxy->__reference()->identity.__write(s);
proxy->__reference()->streamWrite(s);
diff --git a/cpp/src/Ice/ProxyFactory.h b/cpp/src/Ice/ProxyFactory.h
index 1154d5e767a..0eb5eaef0fe 100644
--- a/cpp/src/Ice/ProxyFactory.h
+++ b/cpp/src/Ice/ProxyFactory.h
@@ -1,49 +1,49 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PROXY_FACTORY_H
-#define ICE_PROXY_FACTORY_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/ProxyFactoryF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/ReferenceF.h>
-#include <Ice/ProxyF.h>
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-class ProxyFactory : public ::IceUtil::Shared
-{
-public:
-
- ::Ice::ObjectPrx stringToProxy(const std::string&) const;
- std::string proxyToString(const ::Ice::ObjectPrx&) const;
-
- ::Ice::ObjectPrx streamToProxy(BasicStream*) const;
- void proxyToStream(const ::Ice::ObjectPrx&, BasicStream*) const;
-
- ::Ice::ObjectPrx referenceToProxy(const ReferencePtr&) const;
-
-private:
-
- ProxyFactory(const InstancePtr&);
- virtual ~ProxyFactory();
- friend class Instance;
-
- InstancePtr _instance;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PROXY_FACTORY_H
+#define ICE_PROXY_FACTORY_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/ProxyFactoryF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/ReferenceF.h>
+#include <Ice/ProxyF.h>
+
+namespace IceInternal
+{
+
+class BasicStream;
+
+class ProxyFactory : public ::IceUtil::Shared
+{
+public:
+
+ ::Ice::ObjectPrx stringToProxy(const std::string&) const;
+ std::string proxyToString(const ::Ice::ObjectPrx&) const;
+
+ ::Ice::ObjectPrx streamToProxy(BasicStream*) const;
+ void proxyToStream(const ::Ice::ObjectPrx&, BasicStream*) const;
+
+ ::Ice::ObjectPrx referenceToProxy(const ReferencePtr&) const;
+
+private:
+
+ ProxyFactory(const InstancePtr&);
+ virtual ~ProxyFactory();
+ friend class Instance;
+
+ InstancePtr _instance;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 5d454d063c0..4174baad0be 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -28,52 +28,52 @@ void IceInternal::decRef(::IceInternal::Reference* p) { p->__decRef(); }
bool
IceInternal::Reference::operator==(const Reference& r) const
{
- if (this == &r)
+ if(this == &r)
{
return true;
}
- if (identity != r.identity)
+ if(identity != r.identity)
{
return false;
}
- if (facet != r.facet)
+ if(facet != r.facet)
{
return false;
}
- if (mode != r.mode)
+ if(mode != r.mode)
{
return false;
}
- if (secure != r.secure)
+ if(secure != r.secure)
{
return false;
}
- if (compress != r.compress)
+ if(compress != r.compress)
{
return false;
}
- if (origEndpoints != r.origEndpoints)
+ if(origEndpoints != r.origEndpoints)
{
return false;
}
- if (endpoints != r.endpoints)
+ if(endpoints != r.endpoints)
{
return false;
}
- if (routerInfo != r.routerInfo)
+ if(routerInfo != r.routerInfo)
{
return false;
}
- if (reverseAdapter != r.reverseAdapter)
+ if(reverseAdapter != r.reverseAdapter)
{
return false;
}
@@ -90,88 +90,88 @@ IceInternal::Reference::operator!=(const Reference& r) const
bool
IceInternal::Reference::operator<(const Reference& r) const
{
- if (this == &r)
+ if(this == &r)
{
return false;
}
- if (identity < r.identity)
+ if(identity < r.identity)
{
return true;
}
- else if (r.identity < identity)
+ else if(r.identity < identity)
{
return false;
}
- if (facet < r.facet)
+ if(facet < r.facet)
{
return true;
}
- else if (r.facet < facet)
+ else if(r.facet < facet)
{
return false;
}
- if (mode < r.mode)
+ if(mode < r.mode)
{
return true;
}
- else if (r.mode < mode)
+ else if(r.mode < mode)
{
return false;
}
- if (!secure && r.secure)
+ if(!secure && r.secure)
{
return true;
}
- else if (r.secure < secure)
+ else if(r.secure < secure)
{
return false;
}
- if (!compress && r.compress)
+ if(!compress && r.compress)
{
return true;
}
- else if (r.compress < compress)
+ else if(r.compress < compress)
{
return false;
}
- if (origEndpoints < r.origEndpoints)
+ if(origEndpoints < r.origEndpoints)
{
return true;
}
- else if (r.origEndpoints < origEndpoints)
+ else if(r.origEndpoints < origEndpoints)
{
return false;
}
- if (endpoints < r.endpoints)
+ if(endpoints < r.endpoints)
{
return true;
}
- else if (r.endpoints < endpoints)
+ else if(r.endpoints < endpoints)
{
return false;
}
- if (routerInfo < r.routerInfo)
+ if(routerInfo < r.routerInfo)
{
return true;
}
- else if (r.routerInfo < routerInfo)
+ else if(r.routerInfo < routerInfo)
{
return false;
}
- if (reverseAdapter < r.reverseAdapter)
+ if(reverseAdapter < r.reverseAdapter)
{
return true;
}
- else if (r.reverseAdapter < reverseAdapter)
+ else if(r.reverseAdapter < reverseAdapter)
{
return false;
}
@@ -198,12 +198,12 @@ IceInternal::Reference::streamWrite(BasicStream* s) const
vector<EndpointPtr>::const_iterator p;
s->writeSize(Ice::Int(origEndpoints.size()));
- for (p = origEndpoints.begin(); p != origEndpoints.end(); ++p)
+ for(p = origEndpoints.begin(); p != origEndpoints.end(); ++p)
{
(*p)->streamWrite(s);
}
- if (endpoints == origEndpoints)
+ if(endpoints == origEndpoints)
{
s->write(true);
}
@@ -211,7 +211,7 @@ IceInternal::Reference::streamWrite(BasicStream* s) const
{
s->write(false);
s->writeSize(Ice::Int(endpoints.size()));
- for (p = endpoints.begin(); p != endpoints.end(); ++p)
+ for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
(*p)->streamWrite(s);
}
@@ -225,12 +225,12 @@ IceInternal::Reference::toString() const
s << identity;
- if (!facet.empty())
+ if(!facet.empty())
{
s << " -f " << facet;
}
- switch (mode)
+ switch(mode)
{
case ModeTwoway:
{
@@ -263,27 +263,27 @@ IceInternal::Reference::toString() const
}
}
- if (secure)
+ if(secure)
{
s << " -s";
}
- if (compress)
+ if(compress)
{
s << " -s";
}
vector<EndpointPtr>::const_iterator p;
- for (p = origEndpoints.begin(); p != origEndpoints.end(); ++p)
+ for(p = origEndpoints.begin(); p != origEndpoints.end(); ++p)
{
s << ':' << (*p)->toString();
}
- if (endpoints != origEndpoints)
+ if(endpoints != origEndpoints)
{
s << ':';
- for (p = endpoints.begin(); p != endpoints.end(); ++p)
+ for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
s << ':' << (*p)->toString();
}
@@ -295,7 +295,7 @@ IceInternal::Reference::toString() const
ReferencePtr
IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
{
- if (newIdentity == identity)
+ if(newIdentity == identity)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -310,7 +310,7 @@ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
ReferencePtr
IceInternal::Reference::changeFacet(const string& newFacet) const
{
- if (newFacet == facet)
+ if(newFacet == facet)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -331,13 +331,13 @@ IceInternal::Reference::changeTimeout(int timeout) const
vector<EndpointPtr>::const_iterator p;
vector<EndpointPtr> newOrigEndpoints;
- for (p = origEndpoints.begin(); p != origEndpoints.end(); ++p)
+ for(p = origEndpoints.begin(); p != origEndpoints.end(); ++p)
{
newOrigEndpoints.push_back((*p)->timeout(timeout));
}
vector<EndpointPtr> newEndpoints;
- for (p = endpoints.begin(); p != endpoints.end(); ++p)
+ for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
newEndpoints.push_back((*p)->timeout(timeout));
}
@@ -347,7 +347,7 @@ IceInternal::Reference::changeTimeout(int timeout) const
// router and the router's client proxy.
//
RouterInfoPtr newRouterInfo;
- if (routerInfo)
+ if(routerInfo)
{
try
{
@@ -370,7 +370,7 @@ IceInternal::Reference::changeTimeout(int timeout) const
ReferencePtr
IceInternal::Reference::changeMode(Mode newMode) const
{
- if (newMode == mode)
+ if(newMode == mode)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -385,7 +385,7 @@ IceInternal::Reference::changeMode(Mode newMode) const
ReferencePtr
IceInternal::Reference::changeSecure(bool newSecure) const
{
- if (newSecure == secure)
+ if(newSecure == secure)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -400,7 +400,7 @@ IceInternal::Reference::changeSecure(bool newSecure) const
ReferencePtr
IceInternal::Reference::changeCompress(bool newCompress) const
{
- if (newCompress == compress)
+ if(newCompress == compress)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -415,7 +415,7 @@ IceInternal::Reference::changeCompress(bool newCompress) const
ReferencePtr
IceInternal::Reference::changeEndpoints(const vector<EndpointPtr>& newEndpoints) const
{
- if (newEndpoints == endpoints)
+ if(newEndpoints == endpoints)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -432,7 +432,7 @@ IceInternal::Reference::changeRouter(const RouterPrx& newRouter) const
{
RouterInfoPtr newRouterInfo = instance->routerManager()->get(newRouter);
- if (newRouterInfo == routerInfo)
+ if(newRouterInfo == routerInfo)
{
return ReferencePtr(const_cast<Reference*>(this));
}
@@ -478,17 +478,17 @@ IceInternal::Reference::Reference(const InstancePtr& inst,
string::const_iterator p;
- for (p = identity.name.begin(); p != identity.name.end(); ++p)
+ for(p = identity.name.begin(); p != identity.name.end(); ++p)
{
h = 5 * h + *p;
}
- for (p = identity.category.begin(); p != identity.category.end(); ++p)
+ for(p = identity.category.begin(); p != identity.category.end(); ++p)
{
h = 5 * h + *p;
}
- for (p = facet.begin(); p != facet.end(); ++p)
+ for(p = facet.begin(); p != facet.end(); ++p)
{
h = 5 * h + *p;
}
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index 1c64e87c3d2..88a1bde88a5 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -1,96 +1,96 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_REFERENCE_H
-#define ICE_REFERENCE_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/ReferenceF.h>
-#include <Ice/ReferenceFactoryF.h>
-#include <Ice/EndpointF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/RouterF.h>
-#include <Ice/RouterInfoF.h>
-#include <Ice/ObjectAdapterF.h>
-#include <Ice/Identity.h>
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-class Reference : public ::IceUtil::Shared
-{
-public:
-
- enum Mode
- {
- ModeTwoway,
- ModeOneway,
- ModeBatchOneway,
- ModeDatagram,
- ModeBatchDatagram,
- ModeLast = ModeBatchDatagram
- };
-
- bool operator==(const Reference&) const;
- bool operator!=(const Reference&) const;
- bool operator<(const Reference&) const;
-
- //
- // Marshal the reference
- //
- void streamWrite(BasicStream*) const;
-
- //
- // Convert the reference to its string form
- //
- std::string toString() const;
-
- //
- // All members are const, because References are immutable.
- //
- const InstancePtr instance;
- const Ice::Identity identity;
- const std::string facet;
- const Mode mode;
- const bool secure;
- const bool compress;
- const std::vector<EndpointPtr> origEndpoints; // Original endpoints.
- const std::vector<EndpointPtr> endpoints; // Actual endpoints, changed by a location forwards.
- const RouterInfoPtr routerInfo; // Null if no router is used.
- const Ice::ObjectAdapterPtr reverseAdapter; // For reverse communications using the adapter's incoming connections.
- const Ice::Int hashValue;
-
- //
- // Get a new reference, based on the existing one, overwriting
- // certain values.
- //
- ReferencePtr changeIdentity(const Ice::Identity&) const;
- ReferencePtr changeFacet(const std::string&) const;
- ReferencePtr changeTimeout(int) const;
- ReferencePtr changeMode(Mode) const;
- ReferencePtr changeSecure(bool) const;
- ReferencePtr changeCompress(bool) const;
- ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const;
- ReferencePtr changeRouter(const ::Ice::RouterPrx&) const;
- ReferencePtr changeDefault() const;
-
-private:
-
- Reference(const InstancePtr&, const Ice::Identity&, const std::string&, Mode, bool, bool,
- const std::vector<EndpointPtr>&, const std::vector<EndpointPtr>&,
- const RouterInfoPtr&, const Ice::ObjectAdapterPtr&);
- friend class ReferenceFactory;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_REFERENCE_H
+#define ICE_REFERENCE_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/ReferenceF.h>
+#include <Ice/ReferenceFactoryF.h>
+#include <Ice/EndpointF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/RouterF.h>
+#include <Ice/RouterInfoF.h>
+#include <Ice/ObjectAdapterF.h>
+#include <Ice/Identity.h>
+
+namespace IceInternal
+{
+
+class BasicStream;
+
+class Reference : public ::IceUtil::Shared
+{
+public:
+
+ enum Mode
+ {
+ ModeTwoway,
+ ModeOneway,
+ ModeBatchOneway,
+ ModeDatagram,
+ ModeBatchDatagram,
+ ModeLast = ModeBatchDatagram
+ };
+
+ bool operator==(const Reference&) const;
+ bool operator!=(const Reference&) const;
+ bool operator<(const Reference&) const;
+
+ //
+ // Marshal the reference
+ //
+ void streamWrite(BasicStream*) const;
+
+ //
+ // Convert the reference to its string form
+ //
+ std::string toString() const;
+
+ //
+ // All members are const, because References are immutable.
+ //
+ const InstancePtr instance;
+ const Ice::Identity identity;
+ const std::string facet;
+ const Mode mode;
+ const bool secure;
+ const bool compress;
+ const std::vector<EndpointPtr> origEndpoints; // Original endpoints.
+ const std::vector<EndpointPtr> endpoints; // Actual endpoints, changed by a location forwards.
+ const RouterInfoPtr routerInfo; // Null if no router is used.
+ const Ice::ObjectAdapterPtr reverseAdapter; // For reverse communications using the adapter's incoming connections.
+ const Ice::Int hashValue;
+
+ //
+ // Get a new reference, based on the existing one, overwriting
+ // certain values.
+ //
+ ReferencePtr changeIdentity(const Ice::Identity&) const;
+ ReferencePtr changeFacet(const std::string&) const;
+ ReferencePtr changeTimeout(int) const;
+ ReferencePtr changeMode(Mode) const;
+ ReferencePtr changeSecure(bool) const;
+ ReferencePtr changeCompress(bool) const;
+ ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const;
+ ReferencePtr changeRouter(const ::Ice::RouterPrx&) const;
+ ReferencePtr changeDefault() const;
+
+private:
+
+ Reference(const InstancePtr&, const Ice::Identity&, const std::string&, Mode, bool, bool,
+ const std::vector<EndpointPtr>&, const std::vector<EndpointPtr>&,
+ const RouterInfoPtr&, const Ice::ObjectAdapterPtr&);
+ friend class ReferenceFactory;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp
index e3d157ab2e4..aff3f9193b8 100644
--- a/cpp/src/Ice/ReferenceFactory.cpp
+++ b/cpp/src/Ice/ReferenceFactory.cpp
@@ -37,7 +37,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
{
Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
@@ -56,20 +56,20 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
//
set<ReferencePtr>::iterator p = _references.end();
- if (_referencesHint != _references.end())
+ if(_referencesHint != _references.end())
{
- if (*_referencesHint == ref)
+ if(*_referencesHint == ref)
{
p = _referencesHint;
}
}
- if (p == _references.end())
+ if(p == _references.end())
{
p = _references.find(ref);
}
- if (p == _references.end())
+ if(p == _references.end())
{
_referencesHint = _references.insert(_referencesHint, ref);
}
@@ -82,13 +82,13 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
//
// At every 10th call, evict references which are not in use anymore.
//
- if (++_evict >= 10)
+ if(++_evict >= 10)
{
_evict = 0;
p = _references.begin();
- while (p != _references.end())
+ while(p != _references.end())
{
- if ((*p)->__getRef() == 1)
+ if((*p)->__getRef() == 1)
{
assert(p != _referencesHint);
_references.erase(p++);
@@ -113,18 +113,18 @@ IceInternal::ReferenceFactory::create(const string& str)
string::size_type end = 0;
beg = s.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
throw ProxyParseException(__FILE__, __LINE__);
}
end = s.find_first_of(delim + ":", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = s.length();
}
- if (beg == end)
+ if(beg == end)
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -135,43 +135,43 @@ IceInternal::ReferenceFactory::create(const string& str)
bool secure = false;
bool compress = false;
- while (true)
+ while(true)
{
beg = s.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
- if (s[beg] == ':')
+ if(s[beg] == ':')
{
break;
}
end = s.find_first_of(delim + ":", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = s.length();
}
- if (beg == end)
+ if(beg == end)
{
break;
}
string option = s.substr(beg, end - beg);
- if (option.length() != 2 || option[0] != '-')
+ if(option.length() != 2 || option[0] != '-')
{
throw ProxyParseException(__FILE__, __LINE__);
}
string argument;
string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if (argumentBeg != string::npos && str[argumentBeg] != '-')
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
{
beg = argumentBeg;
end = str.find_first_of(delim + ":", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
@@ -182,11 +182,11 @@ IceInternal::ReferenceFactory::create(const string& str)
// If any new options are added here,
// IceInternal::Reference::toString() must be updated as well.
//
- switch (option[1])
+ switch(option[1])
{
case 'f':
{
- if (argument.empty())
+ if(argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -196,7 +196,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 't':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -206,7 +206,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 'o':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -216,7 +216,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 'O':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -226,7 +226,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 'd':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -236,7 +236,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 'D':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -246,7 +246,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 's':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -256,7 +256,7 @@ IceInternal::ReferenceFactory::create(const string& str)
case 'c':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -275,19 +275,19 @@ IceInternal::ReferenceFactory::create(const string& str)
vector<EndpointPtr> endpoints;
bool orig = true;
- while (end < s.length() && s[end] == ':')
+ while(end < s.length() && s[end] == ':')
{
beg = end + 1;
end = s.find(':', beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = s.length();
}
- if (beg == end) // "::"
+ if(beg == end) // "::"
{
- if (!orig)
+ if(!orig)
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -299,7 +299,7 @@ IceInternal::ReferenceFactory::create(const string& str)
string es = s.substr(beg, end - beg);
EndpointPtr endp = _instance->endpointFactoryManager()->create(es);
- if (orig)
+ if(orig)
{
origEndpoints.push_back(endp);
}
@@ -309,12 +309,12 @@ IceInternal::ReferenceFactory::create(const string& str)
}
}
- if (orig)
+ if(orig)
{
endpoints = origEndpoints;
}
- if (!origEndpoints.size() || !endpoints.size())
+ if(!origEndpoints.size() || !endpoints.size())
{
throw ProxyParseException(__FILE__, __LINE__);
}
@@ -337,7 +337,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
Byte modeAsByte;
s->read(modeAsByte);
Reference::Mode mode = static_cast<Reference::Mode>(modeAsByte);
- if (mode < 0 || mode > Reference::ModeLast)
+ if(mode < 0 || mode > Reference::ModeLast)
{
throw ProxyUnmarshalException(__FILE__, __LINE__);
}
@@ -354,7 +354,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
Ice::Int sz;
s->readSize(sz);
origEndpoints.reserve(sz);
- while (sz--)
+ while(sz--)
{
EndpointPtr endpoint = _instance->endpointFactoryManager()->read(s);
origEndpoints.push_back(endpoint);
@@ -362,7 +362,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
bool same;
s->read(same);
- if (same) // origEndpoints == endpoints
+ if(same) // origEndpoints == endpoints
{
endpoints = origEndpoints;
}
@@ -370,7 +370,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
{
s->readSize(sz);
endpoints.reserve(sz);
- while (sz--)
+ while(sz--)
{
EndpointPtr endpoint = _instance->endpointFactoryManager()->read(s);
endpoints.push_back(endpoint);
@@ -407,7 +407,7 @@ IceInternal::ReferenceFactory::destroy()
{
Mutex::Lock sync(*this);
- if (!_instance)
+ if(!_instance)
{
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
diff --git a/cpp/src/Ice/ReferenceFactory.h b/cpp/src/Ice/ReferenceFactory.h
index cd7bd723c26..84bd3bd17d1 100644
--- a/cpp/src/Ice/ReferenceFactory.h
+++ b/cpp/src/Ice/ReferenceFactory.h
@@ -1,51 +1,51 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_REFERENCE_FACTORY_H
-#define ICE_REFERENCE_FACTORY_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/ReferenceFactoryF.h>
-#include <Ice/Reference.h> // For Reference::Mode
-#include <set>
-
-namespace IceInternal
-{
-
-class ReferenceFactory : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- ReferencePtr create(const Ice::Identity&, const std::string&, Reference::Mode, bool, bool,
- const std::vector<EndpointPtr>&, const std::vector<EndpointPtr>&,
- const RouterInfoPtr&, const Ice::ObjectAdapterPtr&);
- ReferencePtr create(const std::string&);
- ReferencePtr create(const Ice::Identity&, BasicStream*);
-
- void setDefaultRouter(const ::Ice::RouterPrx&);
- Ice::RouterPrx getDefaultRouter() const;
-
-private:
-
- ReferenceFactory(const InstancePtr&);
- void destroy();
- friend class Instance;
-
- InstancePtr _instance;
- Ice::RouterPrx _defaultRouter;
- std::set<ReferencePtr> _references;
- std::set<ReferencePtr>::iterator _referencesHint;
- int _evict;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_REFERENCE_FACTORY_H
+#define ICE_REFERENCE_FACTORY_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/ReferenceFactoryF.h>
+#include <Ice/Reference.h> // For Reference::Mode
+#include <set>
+
+namespace IceInternal
+{
+
+class ReferenceFactory : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ ReferencePtr create(const Ice::Identity&, const std::string&, Reference::Mode, bool, bool,
+ const std::vector<EndpointPtr>&, const std::vector<EndpointPtr>&,
+ const RouterInfoPtr&, const Ice::ObjectAdapterPtr&);
+ ReferencePtr create(const std::string&);
+ ReferencePtr create(const Ice::Identity&, BasicStream*);
+
+ void setDefaultRouter(const ::Ice::RouterPrx&);
+ Ice::RouterPrx getDefaultRouter() const;
+
+private:
+
+ ReferenceFactory(const InstancePtr&);
+ void destroy();
+ friend class Instance;
+
+ InstancePtr _instance;
+ Ice::RouterPrx _defaultRouter;
+ std::set<ReferencePtr> _references;
+ std::set<ReferencePtr>::iterator _referencesHint;
+ int _evict;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ReferenceFactoryF.h b/cpp/src/Ice/ReferenceFactoryF.h
index ffeaebc5a68..840723ceb94 100644
--- a/cpp/src/Ice/ReferenceFactoryF.h
+++ b/cpp/src/Ice/ReferenceFactoryF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_REFERENCE_FACTORY_F_H
-#define ICE_REFERENCE_FACTORY_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class ReferenceFactory;
-void incRef(ReferenceFactory*);
-void decRef(ReferenceFactory*);
-typedef Handle<ReferenceFactory> ReferenceFactoryPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_REFERENCE_FACTORY_F_H
+#define ICE_REFERENCE_FACTORY_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class ReferenceFactory;
+void incRef(ReferenceFactory*);
+void decRef(ReferenceFactory*);
+typedef Handle<ReferenceFactory> ReferenceFactoryPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp
index 736737f8806..412032f4dc9 100644
--- a/cpp/src/Ice/RouterInfo.cpp
+++ b/cpp/src/Ice/RouterInfo.cpp
@@ -40,7 +40,7 @@ IceInternal::RouterManager::destroy()
RouterInfoPtr
IceInternal::RouterManager::get(const RouterPrx& rtr)
{
- if (!rtr)
+ if(!rtr)
{
return 0;
}
@@ -51,20 +51,20 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
- if (_tableHint != _table.end())
+ if(_tableHint != _table.end())
{
- if (_tableHint->first == router)
+ if(_tableHint->first == router)
{
p = _tableHint;
}
}
- if (p == _table.end())
+ if(p == _table.end())
{
p = _table.find(router);
}
- if (p == _table.end())
+ if(p == _table.end())
{
_tableHint = _table.insert(_tableHint, make_pair(router, new RouterInfo(router)));
}
@@ -115,10 +115,10 @@ IceInternal::RouterInfo::getClientProxy()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_clientProxy) // Lazy initialization.
+ if(!_clientProxy) // Lazy initialization.
{
_clientProxy = _router->getClientProxy();
- if (!_clientProxy)
+ if(!_clientProxy)
{
throw NoEndpointException(__FILE__, __LINE__);
}
@@ -140,10 +140,10 @@ IceInternal::RouterInfo::getServerProxy()
{
IceUtil::Mutex::Lock sync(*this);
- if (!_serverProxy) // Lazy initialization.
+ if(!_serverProxy) // Lazy initialization.
{
_serverProxy = _router->getServerProxy();
- if (!_serverProxy)
+ if(!_serverProxy)
{
throw NoEndpointException(__FILE__, __LINE__);
}
@@ -167,7 +167,7 @@ IceInternal::RouterInfo::addProxy(const ObjectPrx& proxy)
// No mutex lock necessary, _routingTable is immutable, and
// RoutingTable is mutex protected.
//
- if (_routingTable->add(proxy)) // Only add the proxy to the router if it's not already in the routing table.
+ if(_routingTable->add(proxy)) // Only add the proxy to the router if it's not already in the routing table.
{
_router->addProxy(proxy);
}
diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h
index 15fa489175e..b7d3791bea9 100644
--- a/cpp/src/Ice/RouterInfo.h
+++ b/cpp/src/Ice/RouterInfo.h
@@ -1,74 +1,74 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ROUTER_INFO_H
-#define ICE_ROUTER_INFO_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/RouterInfoF.h>
-#include <Ice/RouterF.h>
-#include <Ice/ProxyF.h>
-#include <Ice/RoutingTableF.h>
-
-namespace IceInternal
-{
-
-class RouterManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- RouterManager();
-
- void destroy();
-
- //
- // Returns router info for a given router. Automatically creates
- // the router info if it doesn't exist yet.
- //
- RouterInfoPtr get(const ::Ice::RouterPrx&);
-
-private:
-
- std::map< ::Ice::RouterPrx, RouterInfoPtr> _table;
- std::map< ::Ice::RouterPrx, RouterInfoPtr>::iterator _tableHint;
-};
-
-class RouterInfo : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- RouterInfo(const ::Ice::RouterPrx&);
-
- bool operator==(const RouterInfo&) const;
- bool operator!=(const RouterInfo&) const;
- bool operator<(const RouterInfo&) const;
-
- ::Ice::RouterPrx getRouter();
- ::Ice::ObjectPrx getClientProxy();
- void setClientProxy(const ::Ice::ObjectPrx&);
- ::Ice::ObjectPrx getServerProxy();
- void setServerProxy(const ::Ice::ObjectPrx&);
- void addProxy(const ::Ice::ObjectPrx&);
- void setAdapter(const ::Ice::ObjectAdapterPtr&);
- ::Ice::ObjectAdapterPtr getAdapter();
-
-private:
-
- ::Ice::RouterPrx _router;
- ::Ice::ObjectPrx _clientProxy;
- ::Ice::ObjectPrx _serverProxy;
- RoutingTablePtr _routingTable;
- ::Ice::ObjectAdapterPtr _adapter;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ROUTER_INFO_H
+#define ICE_ROUTER_INFO_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/RouterInfoF.h>
+#include <Ice/RouterF.h>
+#include <Ice/ProxyF.h>
+#include <Ice/RoutingTableF.h>
+
+namespace IceInternal
+{
+
+class RouterManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ RouterManager();
+
+ void destroy();
+
+ //
+ // Returns router info for a given router. Automatically creates
+ // the router info if it doesn't exist yet.
+ //
+ RouterInfoPtr get(const ::Ice::RouterPrx&);
+
+private:
+
+ std::map< ::Ice::RouterPrx, RouterInfoPtr> _table;
+ std::map< ::Ice::RouterPrx, RouterInfoPtr>::iterator _tableHint;
+};
+
+class RouterInfo : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ RouterInfo(const ::Ice::RouterPrx&);
+
+ bool operator==(const RouterInfo&) const;
+ bool operator!=(const RouterInfo&) const;
+ bool operator<(const RouterInfo&) const;
+
+ ::Ice::RouterPrx getRouter();
+ ::Ice::ObjectPrx getClientProxy();
+ void setClientProxy(const ::Ice::ObjectPrx&);
+ ::Ice::ObjectPrx getServerProxy();
+ void setServerProxy(const ::Ice::ObjectPrx&);
+ void addProxy(const ::Ice::ObjectPrx&);
+ void setAdapter(const ::Ice::ObjectAdapterPtr&);
+ ::Ice::ObjectAdapterPtr getAdapter();
+
+private:
+
+ ::Ice::RouterPrx _router;
+ ::Ice::ObjectPrx _clientProxy;
+ ::Ice::ObjectPrx _serverProxy;
+ RoutingTablePtr _routingTable;
+ ::Ice::ObjectAdapterPtr _adapter;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/RouterInfoF.h b/cpp/src/Ice/RouterInfoF.h
index 72afbc70e7f..1db2e9bb606 100644
--- a/cpp/src/Ice/RouterInfoF.h
+++ b/cpp/src/Ice/RouterInfoF.h
@@ -1,31 +1,31 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_ROUTER_INFO_F_H
-#define ICE_ROUTER_INFO_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class RouterManager;
-void incRef(RouterManager*);
-void decRef(RouterManager*);
-typedef Handle<RouterManager> RouterManagerPtr;
-
-class RouterInfo;
-void incRef(RouterInfo*);
-void decRef(RouterInfo*);
-typedef Handle<RouterInfo> RouterInfoPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_ROUTER_INFO_F_H
+#define ICE_ROUTER_INFO_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class RouterManager;
+void incRef(RouterManager*);
+void decRef(RouterManager*);
+typedef Handle<RouterManager> RouterManagerPtr;
+
+class RouterInfo;
+void incRef(RouterInfo*);
+void decRef(RouterInfo*);
+typedef Handle<RouterInfo> RouterInfoPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/RoutingTable.cpp b/cpp/src/Ice/RoutingTable.cpp
index e1e88f5804c..79d13233636 100644
--- a/cpp/src/Ice/RoutingTable.cpp
+++ b/cpp/src/Ice/RoutingTable.cpp
@@ -26,7 +26,7 @@ IceInternal::RoutingTable::RoutingTable() :
bool
IceInternal::RoutingTable::add(const ObjectPrx& prx)
{
- if (!prx)
+ if(!prx)
{
return false;
}
@@ -37,20 +37,20 @@ IceInternal::RoutingTable::add(const ObjectPrx& prx)
map<Identity, ObjectPrx>::iterator p = _table.end();
- if (_tableHint != _table.end())
+ if(_tableHint != _table.end())
{
- if (_tableHint->first == proxy->ice_getIdentity())
+ if(_tableHint->first == proxy->ice_getIdentity())
{
p = _tableHint;
}
}
- if (p == _table.end())
+ if(p == _table.end())
{
p = _table.find(proxy->ice_getIdentity());
}
- if (p == _table.end())
+ if(p == _table.end())
{
_tableHint = _table.insert(_tableHint, make_pair(proxy->ice_getIdentity(), proxy));
return true;
@@ -64,7 +64,7 @@ IceInternal::RoutingTable::add(const ObjectPrx& prx)
ObjectPrx
IceInternal::RoutingTable::get(const Identity& ident)
{
- if (ident.name.empty())
+ if(ident.name.empty())
{
return 0;
}
@@ -73,20 +73,20 @@ IceInternal::RoutingTable::get(const Identity& ident)
map<Identity, ObjectPrx>::iterator p = _table.end();
- if (_tableHint != _table.end())
+ if(_tableHint != _table.end())
{
- if (_tableHint->first == ident)
+ if(_tableHint->first == ident)
{
p = _tableHint;
}
}
- if (p == _table.end())
+ if(p == _table.end())
{
p = _table.find(ident);
}
- if (p == _table.end())
+ if(p == _table.end())
{
return 0;
}
diff --git a/cpp/src/Ice/SysLoggerI.h b/cpp/src/Ice/SysLoggerI.h
index 8ddde95cf7e..f7d14c324e2 100644
--- a/cpp/src/Ice/SysLoggerI.h
+++ b/cpp/src/Ice/SysLoggerI.h
@@ -1,31 +1,31 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SYS_LOGGER_I_H
-#define ICE_SYS_LOGGER_I_H
-
-#include <IceUtil/Mutex.h>
-#include <Ice/Logger.h>
-
-namespace Ice
-{
-
-class SysLoggerI : public Logger, public ::IceUtil::Mutex
-{
-public:
-
- virtual void trace(const std::string&, const std::string&);
- virtual void warning(const std::string&);
- virtual void error(const std::string&);
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SYS_LOGGER_I_H
+#define ICE_SYS_LOGGER_I_H
+
+#include <IceUtil/Mutex.h>
+#include <Ice/Logger.h>
+
+namespace Ice
+{
+
+class SysLoggerI : public Logger, public ::IceUtil::Mutex
+{
+public:
+
+ virtual void trace(const std::string&, const std::string&);
+ virtual void warning(const std::string&);
+ virtual void error(const std::string&);
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp
index 4217668f956..7a5b63aa229 100644
--- a/cpp/src/Ice/TcpAcceptor.cpp
+++ b/cpp/src/Ice/TcpAcceptor.cpp
@@ -29,7 +29,7 @@ IceInternal::TcpAcceptor::fd()
void
IceInternal::TcpAcceptor::close()
{
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "stopping to accept tcp connections at " << toString();
@@ -53,7 +53,7 @@ IceInternal::TcpAcceptor::listen()
throw;
}
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "accepting tcp connections at " << toString();
@@ -66,7 +66,7 @@ IceInternal::TcpAcceptor::accept(int timeout)
SOCKET fd = doAccept(_fd, timeout);
setBlock(fd, false);
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "accepted tcp connection\n" << fdToString(fd);
@@ -101,7 +101,7 @@ IceInternal::TcpAcceptor::TcpAcceptor(const InstancePtr& instance, const string&
_logger(instance->logger()),
_backlog(0)
{
- if (_backlog <= 0)
+ if(_backlog <= 0)
{
_backlog = 5;
}
diff --git a/cpp/src/Ice/TcpAcceptor.h b/cpp/src/Ice/TcpAcceptor.h
index e98a222f401..2cb462f7864 100644
--- a/cpp/src/Ice/TcpAcceptor.h
+++ b/cpp/src/Ice/TcpAcceptor.h
@@ -1,58 +1,58 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TCP_ACCEPTOR_H
-#define ICE_TCP_ACCEPTOR_H
-
-#include <Ice/TransceiverF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/Acceptor.h>
-
-#ifndef _WIN32
-# include <netinet/in.h> // For struct sockaddr_in
-#endif
-
-namespace IceInternal
-{
-
-class TcpEndpoint;
-
-class TcpAcceptor : public Acceptor
-{
-public:
-
- virtual SOCKET fd();
- virtual void close();
- virtual void listen();
- virtual TransceiverPtr accept(int);
- virtual std::string toString() const;
-
- bool equivalent(const std::string&, int) const;
- int effectivePort();
-
-private:
-
- TcpAcceptor(const InstancePtr&, const std::string&, int);
- virtual ~TcpAcceptor();
- friend class TcpEndpoint;
-
- InstancePtr _instance;
- TraceLevelsPtr _traceLevels;
- ::Ice::LoggerPtr _logger;
- SOCKET _fd;
- int _backlog;
- struct sockaddr_in _addr;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TCP_ACCEPTOR_H
+#define ICE_TCP_ACCEPTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/Acceptor.h>
+
+#ifndef _WIN32
+# include <netinet/in.h> // For struct sockaddr_in
+#endif
+
+namespace IceInternal
+{
+
+class TcpEndpoint;
+
+class TcpAcceptor : public Acceptor
+{
+public:
+
+ virtual SOCKET fd();
+ virtual void close();
+ virtual void listen();
+ virtual TransceiverPtr accept(int);
+ virtual std::string toString() const;
+
+ bool equivalent(const std::string&, int) const;
+ int effectivePort();
+
+private:
+
+ TcpAcceptor(const InstancePtr&, const std::string&, int);
+ virtual ~TcpAcceptor();
+ friend class TcpEndpoint;
+
+ InstancePtr _instance;
+ TraceLevelsPtr _traceLevels;
+ ::Ice::LoggerPtr _logger;
+ SOCKET _fd;
+ int _backlog;
+ struct sockaddr_in _addr;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TcpConnector.cpp b/cpp/src/Ice/TcpConnector.cpp
index 236198804a7..52dcb8475f1 100644
--- a/cpp/src/Ice/TcpConnector.cpp
+++ b/cpp/src/Ice/TcpConnector.cpp
@@ -23,7 +23,7 @@ using namespace IceInternal;
TransceiverPtr
IceInternal::TcpConnector::connect(int timeout)
{
- if (_traceLevels->network >= 2)
+ if(_traceLevels->network >= 2)
{
Trace out(_logger, _traceLevels->networkCat);
out << "trying to establish tcp connection to " << toString();
@@ -33,7 +33,7 @@ IceInternal::TcpConnector::connect(int timeout)
setBlock(fd, false);
doConnect(fd, _addr, timeout);
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "tcp connection established\n" << fdToString(fd);
diff --git a/cpp/src/Ice/TcpConnector.h b/cpp/src/Ice/TcpConnector.h
index e554d7210b5..79dfea97455 100644
--- a/cpp/src/Ice/TcpConnector.h
+++ b/cpp/src/Ice/TcpConnector.h
@@ -1,50 +1,50 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TCP_CONNECTOR_H
-#define ICE_TCP_CONNECTOR_H
-
-#include <Ice/TransceiverF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/Connector.h>
-
-#ifndef _WIN32
-# include <netinet/in.h> // For struct sockaddr_in
-#endif
-
-namespace IceInternal
-{
-
-class TcpEndpoint;
-
-class TcpConnector : public Connector
-{
-public:
-
- virtual TransceiverPtr connect(int);
- virtual std::string toString() const;
-
-private:
-
- TcpConnector(const InstancePtr&, const std::string&, int);
- virtual ~TcpConnector();
- friend class TcpEndpoint;
-
- InstancePtr _instance;
- TraceLevelsPtr _traceLevels;
- ::Ice::LoggerPtr _logger;
- struct sockaddr_in _addr;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TCP_CONNECTOR_H
+#define ICE_TCP_CONNECTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/Connector.h>
+
+#ifndef _WIN32
+# include <netinet/in.h> // For struct sockaddr_in
+#endif
+
+namespace IceInternal
+{
+
+class TcpEndpoint;
+
+class TcpConnector : public Connector
+{
+public:
+
+ virtual TransceiverPtr connect(int);
+ virtual std::string toString() const;
+
+private:
+
+ TcpConnector(const InstancePtr&, const std::string&, int);
+ virtual ~TcpConnector();
+ friend class TcpEndpoint;
+
+ InstancePtr _instance;
+ TraceLevelsPtr _traceLevels;
+ ::Ice::LoggerPtr _logger;
+ struct sockaddr_in _addr;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TcpEndpoint.cpp b/cpp/src/Ice/TcpEndpoint.cpp
index 8f2a21b8b32..7ffb353d33f 100644
--- a/cpp/src/Ice/TcpEndpoint.cpp
+++ b/cpp/src/Ice/TcpEndpoint.cpp
@@ -40,44 +40,44 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
string::size_type beg;
string::size_type end = 0;
- while (true)
+ while(true)
{
beg = str.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
end = str.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
string option = str.substr(beg, end - beg);
- if (option.length() != 2 || option[0] != '-')
+ if(option.length() != 2 || option[0] != '-')
{
throw EndpointParseException(__FILE__, __LINE__);
}
string argument;
string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if (argumentBeg != string::npos && str[argumentBeg] != '-')
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
{
beg = argumentBeg;
end = str.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
argument = str.substr(beg, end - beg);
}
- switch (option[1])
+ switch(option[1])
{
case 'h':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -87,7 +87,7 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
case 'p':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -97,7 +97,7 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
case 't':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -112,7 +112,7 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
}
}
- if (_host.empty())
+ if(_host.empty())
{
const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost;
}
@@ -146,7 +146,7 @@ IceInternal::TcpEndpoint::toString() const
{
ostringstream s;
s << "tcp -h " << _host << " -p " << _port;
- if (_timeout != -1)
+ if(_timeout != -1)
{
s << " -t " << _timeout;
}
@@ -168,7 +168,7 @@ IceInternal::TcpEndpoint::timeout() const
EndpointPtr
IceInternal::TcpEndpoint::timeout(Int timeout) const
{
- if (timeout == _timeout)
+ if(timeout == _timeout)
{
return const_cast<TcpEndpoint*>(this);
}
@@ -233,7 +233,7 @@ bool
IceInternal::TcpEndpoint::equivalent(const AcceptorPtr& acceptor) const
{
const TcpAcceptor* tcpAcceptor = dynamic_cast<const TcpAcceptor*>(acceptor.get());
- if (!tcpAcceptor)
+ if(!tcpAcceptor)
{
return false;
}
@@ -244,27 +244,27 @@ bool
IceInternal::TcpEndpoint::operator==(const Endpoint& r) const
{
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return false;
}
- if (this == p)
+ if(this == p)
{
return true;
}
- if (_port != p->_port)
+ if(_port != p->_port)
{
return false;
}
- if (_timeout != p->_timeout)
+ if(_timeout != p->_timeout)
{
return false;
}
- if (_host != p->_host)
+ if(_host != p->_host)
{
//
// We do the most time-consuming part of the comparison last.
@@ -289,35 +289,35 @@ bool
IceInternal::TcpEndpoint::operator<(const Endpoint& r) const
{
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return type() < r.type();
}
- if (this == p)
+ if(this == p)
{
return false;
}
- if (_port < p->_port)
+ if(_port < p->_port)
{
return true;
}
- else if (p->_port < _port)
+ else if(p->_port < _port)
{
return false;
}
- if (_timeout < p->_timeout)
+ if(_timeout < p->_timeout)
{
return true;
}
- else if (p->_timeout < _timeout)
+ else if(p->_timeout < _timeout)
{
return false;
}
- if (_host != p->_host)
+ if(_host != p->_host)
{
//
// We do the most time-consuming part of the comparison last.
@@ -326,11 +326,11 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const
struct sockaddr_in raddr;
getAddress(_host, _port, laddr);
getAddress(p->_host, p->_port, raddr);
- if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
{
return true;
}
- else if (raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
{
return false;
}
diff --git a/cpp/src/Ice/TcpEndpoint.h b/cpp/src/Ice/TcpEndpoint.h
index 55c7b371132..9ef58fe6eaa 100644
--- a/cpp/src/Ice/TcpEndpoint.h
+++ b/cpp/src/Ice/TcpEndpoint.h
@@ -1,82 +1,82 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TCP_ENDPOINT_H
-#define ICE_TCP_ENDPOINT_H
-
-#include <Ice/Endpoint.h>
-#include <Ice/EndpointFactory.h>
-
-namespace IceInternal
-{
-
-const ::Ice::Short TcpEndpointType = 1;
-
-class TcpEndpoint : public Endpoint
-{
-public:
-
- TcpEndpoint(const InstancePtr&, const std::string&, ::Ice::Int, ::Ice::Int);
- TcpEndpoint(const InstancePtr&, const std::string&);
- TcpEndpoint(BasicStream*);
-
- virtual void streamWrite(BasicStream*) const;
- virtual std::string toString() const;
- virtual ::Ice::Short type() const;
- virtual ::Ice::Int timeout() const;
- virtual EndpointPtr timeout(::Ice::Int) const;
- virtual bool datagram() const;
- virtual bool secure() const;
- virtual bool unknown() const;
- virtual TransceiverPtr clientTransceiver() const;
- virtual TransceiverPtr serverTransceiver(EndpointPtr&) const;
- virtual ConnectorPtr connector() const;
- virtual AcceptorPtr acceptor(EndpointPtr&) const;
- virtual bool equivalent(const TransceiverPtr&) const;
- virtual bool equivalent(const AcceptorPtr&) const;
-
- virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
- virtual bool operator<(const Endpoint&) const;
-
-private:
-
- //
- // All members are const, because endpoints are immutable.
- //
- const InstancePtr _instance;
- const std::string _host;
- const ::Ice::Int _port;
- const ::Ice::Int _timeout;
-};
-
-class TcpEndpointFactory : public EndpointFactory
-{
-public:
-
- virtual ~TcpEndpointFactory();
-
- virtual ::Ice::Short type() const;
- virtual const ::std::string& protocol() const;
- virtual EndpointPtr create(const std::string&) const;
- virtual EndpointPtr read(BasicStream*) const;
- virtual void destroy();
-
-private:
-
- TcpEndpointFactory(const InstancePtr&);
- friend class Instance;
-
- InstancePtr _instance;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TCP_ENDPOINT_H
+#define ICE_TCP_ENDPOINT_H
+
+#include <Ice/Endpoint.h>
+#include <Ice/EndpointFactory.h>
+
+namespace IceInternal
+{
+
+const ::Ice::Short TcpEndpointType = 1;
+
+class TcpEndpoint : public Endpoint
+{
+public:
+
+ TcpEndpoint(const InstancePtr&, const std::string&, ::Ice::Int, ::Ice::Int);
+ TcpEndpoint(const InstancePtr&, const std::string&);
+ TcpEndpoint(BasicStream*);
+
+ virtual void streamWrite(BasicStream*) const;
+ virtual std::string toString() const;
+ virtual ::Ice::Short type() const;
+ virtual ::Ice::Int timeout() const;
+ virtual EndpointPtr timeout(::Ice::Int) const;
+ virtual bool datagram() const;
+ virtual bool secure() const;
+ virtual bool unknown() const;
+ virtual TransceiverPtr clientTransceiver() const;
+ virtual TransceiverPtr serverTransceiver(EndpointPtr&) const;
+ virtual ConnectorPtr connector() const;
+ virtual AcceptorPtr acceptor(EndpointPtr&) const;
+ virtual bool equivalent(const TransceiverPtr&) const;
+ virtual bool equivalent(const AcceptorPtr&) const;
+
+ virtual bool operator==(const Endpoint&) const;
+ virtual bool operator!=(const Endpoint&) const;
+ virtual bool operator<(const Endpoint&) const;
+
+private:
+
+ //
+ // All members are const, because endpoints are immutable.
+ //
+ const InstancePtr _instance;
+ const std::string _host;
+ const ::Ice::Int _port;
+ const ::Ice::Int _timeout;
+};
+
+class TcpEndpointFactory : public EndpointFactory
+{
+public:
+
+ virtual ~TcpEndpointFactory();
+
+ virtual ::Ice::Short type() const;
+ virtual const ::std::string& protocol() const;
+ virtual EndpointPtr create(const std::string&) const;
+ virtual EndpointPtr read(BasicStream*) const;
+ virtual void destroy();
+
+private:
+
+ TcpEndpointFactory(const InstancePtr&);
+ friend class Instance;
+
+ InstancePtr _instance;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index 6c8cf640dd8..3014b25161b 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -29,7 +29,7 @@ IceInternal::TcpTransceiver::fd()
void
IceInternal::TcpTransceiver::close()
{
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "closing tcp connection\n" << toString();
@@ -44,7 +44,7 @@ IceInternal::TcpTransceiver::close()
void
IceInternal::TcpTransceiver::shutdown()
{
- if (_traceLevels->network >= 2)
+ if(_traceLevels->network >= 2)
{
Trace out(_logger, _traceLevels->networkCat);
out << "shutting down tcp connection\n" << toString();
@@ -62,45 +62,45 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
//
// Limit packet size to avoid performance problems on WIN32
//
- if (packetSize > 64 * 1024)
+ if(packetSize > 64 * 1024)
{
packetSize = 64 * 1024;
}
#endif
- while (buf.i != buf.b.end())
+ while(buf.i != buf.b.end())
{
int ret = ::send(_fd, &*buf.i, packetSize, 0);
- if (ret == 0)
+ if(ret == 0)
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = 0;
throw ex;
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
continue;
}
- if (noBuffers() && packetSize > 1024)
+ if(noBuffers() && packetSize > 1024)
{
packetSize /= 2;
continue;
}
- if (wouldBlock())
+ if(wouldBlock())
{
SOCKET fd = _fd; // Copy fd, in case another thread calls close()
- if (fd != INVALID_SOCKET)
+ if(fd != INVALID_SOCKET)
{
repeatSelect:
int ret;
FD_SET(fd, &_wFdSet);
- if (timeout >= 0)
+ if(timeout >= 0)
{
struct timeval tv;
tv.tv_sec = timeout / 1000;
@@ -112,9 +112,9 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
ret = ::select(fd + 1, 0, &_wFdSet, 0, 0);
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -124,7 +124,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
throw ex;
}
- if (ret == 0)
+ if(ret == 0)
{
throw TimeoutException(__FILE__, __LINE__);
}
@@ -133,7 +133,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
continue;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -147,7 +147,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
}
}
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "sent " << ret << " of " << packetSize << " bytes via tcp\n" << toString();
@@ -155,7 +155,7 @@ IceInternal::TcpTransceiver::write(Buffer& buf, int timeout)
buf.i += ret;
- if (packetSize > buf.b.end() - buf.i)
+ if(packetSize > buf.b.end() - buf.i)
{
packetSize = buf.b.end() - buf.i;
}
@@ -167,39 +167,39 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
{
int packetSize = buf.b.end() - buf.i;
- while (buf.i != buf.b.end())
+ while(buf.i != buf.b.end())
{
int ret = ::recv(_fd, &*buf.i, packetSize, 0);
- if (ret == 0)
+ if(ret == 0)
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = 0;
throw ex;
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
continue;
}
- if (noBuffers() && packetSize > 1024)
+ if(noBuffers() && packetSize > 1024)
{
packetSize /= 2;
continue;
}
- if (wouldBlock())
+ if(wouldBlock())
{
SOCKET fd = _fd; // Copy fd, in case another thread calls close()
- if (fd != INVALID_SOCKET)
+ if(fd != INVALID_SOCKET)
{
repeatSelect:
int ret;
FD_SET(fd, &_rFdSet);
- if (timeout >= 0)
+ if(timeout >= 0)
{
struct timeval tv;
tv.tv_sec = timeout / 1000;
@@ -211,9 +211,9 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
ret = ::select(fd + 1, &_rFdSet, 0, 0, 0);
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -223,7 +223,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
throw ex;
}
- if (ret == 0)
+ if(ret == 0)
{
throw TimeoutException(__FILE__, __LINE__);
}
@@ -232,7 +232,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
continue;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -246,7 +246,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
}
}
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "received " << ret << " of " << packetSize << " bytes via tcp\n" << toString();
@@ -254,7 +254,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, int timeout)
buf.i += ret;
- if (packetSize > buf.b.end() - buf.i)
+ if(packetSize > buf.b.end() - buf.i)
{
packetSize = buf.b.end() - buf.i;
}
diff --git a/cpp/src/Ice/TcpTransceiver.h b/cpp/src/Ice/TcpTransceiver.h
index 9809f68a60b..c3daa2fdb37 100644
--- a/cpp/src/Ice/TcpTransceiver.h
+++ b/cpp/src/Ice/TcpTransceiver.h
@@ -1,53 +1,53 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TCP_TRANSCEIVER_H
-#define ICE_TCP_TRANSCEIVER_H
-
-#include <Ice/InstanceF.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/Transceiver.h>
-
-namespace IceInternal
-{
-
-class TcpConnector;
-class TcpAcceptor;
-
-class TcpTransceiver : public Transceiver
-{
-public:
-
- virtual SOCKET fd();
- virtual void close();
- virtual void shutdown();
- virtual void write(Buffer&, int);
- virtual void read(Buffer&, int);
- virtual std::string toString() const;
-
-private:
-
- TcpTransceiver(const InstancePtr&, SOCKET);
- virtual ~TcpTransceiver();
- friend class TcpConnector;
- friend class TcpAcceptor;
-
- InstancePtr _instance;
- TraceLevelsPtr _traceLevels;
- ::Ice::LoggerPtr _logger;
- SOCKET _fd;
- fd_set _rFdSet;
- fd_set _wFdSet;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TCP_TRANSCEIVER_H
+#define ICE_TCP_TRANSCEIVER_H
+
+#include <Ice/InstanceF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/Transceiver.h>
+
+namespace IceInternal
+{
+
+class TcpConnector;
+class TcpAcceptor;
+
+class TcpTransceiver : public Transceiver
+{
+public:
+
+ virtual SOCKET fd();
+ virtual void close();
+ virtual void shutdown();
+ virtual void write(Buffer&, int);
+ virtual void read(Buffer&, int);
+ virtual std::string toString() const;
+
+private:
+
+ TcpTransceiver(const InstancePtr&, SOCKET);
+ virtual ~TcpTransceiver();
+ friend class TcpConnector;
+ friend class TcpAcceptor;
+
+ InstancePtr _instance;
+ TraceLevelsPtr _traceLevels;
+ ::Ice::LoggerPtr _logger;
+ SOCKET _fd;
+ fd_set _rFdSet;
+ fd_set _wFdSet;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index c372fbb29de..dbcc65a2e6a 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -46,7 +46,7 @@ IceInternal::ThreadPool::unregister(SOCKET fd)
void
IceInternal::ThreadPool::promoteFollower()
{
- if (_multipleThreads)
+ if(_multipleThreads)
{
_threadMutex.unlock();
}
@@ -63,12 +63,12 @@ IceInternal::ThreadPool::waitUntilFinished()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while (_handlers != 0 && _threadNum != 0)
+ while(_handlers != 0 && _threadNum != 0)
{
wait();
}
- if (_handlers != 0)
+ if(_handlers != 0)
{
Error out(_instance->logger());
out << "can't wait for graceful application termination in thread pool\n"
@@ -89,7 +89,7 @@ IceInternal::ThreadPool::joinWithAllThreads()
// needed. (Synchronization wouldn't be possible here anyway,
// because otherwise the other threads would never terminate.)
//
- for (vector<IceUtil::ThreadControl>::iterator p = _threads.begin(); p != _threads.end(); ++p)
+ for(vector<IceUtil::ThreadControl>::iterator p = _threads.begin(); p != _threads.end(); ++p)
{
p->join();
}
@@ -114,7 +114,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, bool server) :
_maxFd = _fdIntrRead;
_minFd = _fdIntrRead;
- if (server)
+ if(server)
{
_timeout = _instance->properties()->getPropertyAsInt("Ice.ServerIdleTime");
_threadNum = _instance->properties()->getPropertyAsIntWithDefault("Ice.ServerThreadPool.Size", 10);
@@ -124,12 +124,12 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, bool server) :
_threadNum = _instance->properties()->getPropertyAsIntWithDefault("Ice.ClientThreadPool.Size", 1);
}
- if (_threadNum < 1)
+ if(_threadNum < 1)
{
_threadNum = 1;
}
- if (_threadNum > 1)
+ if(_threadNum > 1)
{
_multipleThreads = true;
}
@@ -137,7 +137,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, bool server) :
__setNoDelete(true);
try
{
- for (int i = 0 ; i < _threadNum ; ++i)
+ for(int i = 0 ; i < _threadNum ; ++i)
{
IceUtil::ThreadPtr thread = new EventHandlerThread(this);
_threads.push_back(thread->start());
@@ -187,9 +187,9 @@ IceInternal::ThreadPool::clearInterrupt()
repeat:
#ifdef _WIN32
- if (::recv(_fdIntrRead, &c, 1, 0) == SOCKET_ERROR)
+ if(::recv(_fdIntrRead, &c, 1, 0) == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeat;
}
@@ -199,9 +199,9 @@ repeat:
throw ex;
}
#else
- if (::read(_fdIntrRead, &c, 1) == -1)
+ if(::read(_fdIntrRead, &c, 1) == -1)
{
- if (interrupted())
+ if(interrupted())
{
goto repeat;
}
@@ -221,9 +221,9 @@ IceInternal::ThreadPool::setInterrupt(char c)
repeat:
#ifdef _WIN32
- if (::send(_fdIntrWrite, &c, 1, 0) == SOCKET_ERROR)
+ if(::send(_fdIntrWrite, &c, 1, 0) == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeat;
}
@@ -233,9 +233,9 @@ repeat:
throw ex;
}
#else
- if (::write(_fdIntrWrite, &c, 1) == -1)
+ if(::write(_fdIntrWrite, &c, 1) == -1)
{
- if (interrupted())
+ if(interrupted())
{
goto repeat;
}
@@ -253,20 +253,20 @@ IceInternal::ThreadPool::run()
ThreadPoolPtr self = this;
bool shutdown = false;
- while (true)
+ while(true)
{
- if (_multipleThreads)
+ if(_multipleThreads)
{
_threadMutex.lock();
}
repeatSelect:
- if (shutdown) // Shutdown has been initiated.
+ if(shutdown) // Shutdown has been initiated.
{
shutdown = false;
ObjectAdapterFactoryPtr factory = _instance->objectAdapterFactory();
- if (factory)
+ if(factory)
{
factory->shutdown();
}
@@ -275,7 +275,7 @@ IceInternal::ThreadPool::run()
fd_set fdSet;
memcpy(&fdSet, &_fdSet, sizeof(fd_set));
int ret;
- if (_timeout)
+ if(_timeout)
{
struct timeval tv;
tv.tv_sec = _timeout;
@@ -287,7 +287,7 @@ IceInternal::ThreadPool::run()
ret = ::select(_maxFd + 1, &fdSet, 0, 0, 0);
}
- if (ret == 0) // Timeout.
+ if(ret == 0) // Timeout.
{
assert(_timeout);
_timeout = 0;
@@ -295,9 +295,9 @@ IceInternal::ThreadPool::run()
goto repeatSelect;
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -313,7 +313,7 @@ IceInternal::ThreadPool::run()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if (FD_ISSET(_fdIntrRead, &fdSet))
+ if(FD_ISSET(_fdIntrRead, &fdSet))
{
//
// There are three possiblities for an interrupt:
@@ -328,7 +328,7 @@ IceInternal::ThreadPool::run()
//
// Thread pool destroyed?
//
- if (_destroyed)
+ if(_destroyed)
{
//
// Don't clear the interrupt if destroyed, so that
@@ -342,7 +342,7 @@ IceInternal::ThreadPool::run()
//
// Server shutdown?
//
- if (shutdown)
+ if(shutdown)
{
goto repeatSelect;
}
@@ -355,7 +355,7 @@ IceInternal::ThreadPool::run()
pair<SOCKET, EventHandlerPtr> change = _changes.front();
_changes.pop_front();
- if (change.second) // Addition if handler is set.
+ if(change.second) // Addition if handler is set.
{
_handlerMap.insert(change);
FD_SET(change.first, &_fdSet);
@@ -373,7 +373,7 @@ IceInternal::ThreadPool::run()
FD_CLR(change.first, &_fdSet);
_maxFd = _fdIntrRead;
_minFd = _fdIntrRead;
- if (!_handlerMap.empty())
+ if(!_handlerMap.empty())
{
_maxFd = max(_maxFd, (--_handlerMap.end())->first);
_minFd = min(_minFd, _handlerMap.begin()->first);
@@ -393,7 +393,7 @@ IceInternal::ThreadPool::run()
//
// Round robin for the filedescriptors.
//
- if (fdSet.fd_count == 0)
+ if(fdSet.fd_count == 0)
{
Error out(_instance->logger());
out << "select() in thread pool returned " << ret << " but no filedescriptor is readable";
@@ -402,12 +402,12 @@ IceInternal::ThreadPool::run()
SOCKET largerFd = _maxFd + 1;
SOCKET smallestFd = _maxFd + 1;
- for (u_short i = 0; i < fdSet.fd_count; ++i)
+ for(u_short i = 0; i < fdSet.fd_count; ++i)
{
SOCKET fd = fdSet.fd_array[i];
assert(fd != INVALID_SOCKET);
- if (fd > _lastFd || _lastFd == INVALID_SOCKET)
+ if(fd > _lastFd || _lastFd == INVALID_SOCKET)
{
largerFd = min(largerFd, fd);
}
@@ -415,7 +415,7 @@ IceInternal::ThreadPool::run()
smallestFd = min(smallestFd, fd);
}
- if (largerFd <= _maxFd)
+ if(largerFd <= _maxFd)
{
assert(largerFd >= _minFd);
_lastFd = largerFd;
@@ -429,7 +429,7 @@ IceInternal::ThreadPool::run()
//
// Round robin for the filedescriptors.
//
- if (_lastFd < _minFd - 1 || _lastFd == INVALID_SOCKET)
+ if(_lastFd < _minFd - 1 || _lastFd == INVALID_SOCKET)
{
_lastFd = _minFd - 1;
}
@@ -437,15 +437,15 @@ IceInternal::ThreadPool::run()
int loops = 0;
do
{
- if (++_lastFd > _maxFd)
+ if(++_lastFd > _maxFd)
{
++loops;
_lastFd = _minFd;
}
}
- while (!FD_ISSET(_lastFd, &fdSet) && loops <= 1);
+ while(!FD_ISSET(_lastFd, &fdSet) && loops <= 1);
- if (loops > 1)
+ if(loops > 1)
{
Error out(_instance->logger());
out << "select() in thread pool returned " << ret << " but no filedescriptor is readable";
@@ -469,7 +469,7 @@ IceInternal::ThreadPool::run()
assert(handler);
- if (finished)
+ if(finished)
{
//
// Notify a handler about it's removal from the thread
@@ -480,7 +480,7 @@ IceInternal::ThreadPool::run()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
assert(_handlers > 0);
- if (--_handlers == 0)
+ if(--_handlers == 0)
{
notifyAll(); // For waitUntilFinished().
}
@@ -492,7 +492,7 @@ IceInternal::ThreadPool::run()
// If the handler is "readable", try to read a message.
//
BasicStream stream(_instance);
- if (handler->readable())
+ if(handler->readable())
{
try
{
@@ -522,13 +522,13 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
{
BasicStream& stream = handler->_stream;
- if (stream.b.size() == 0)
+ if(stream.b.size() == 0)
{
stream.b.resize(headerSize);
stream.i = stream.b.begin();
}
- if (stream.i != stream.b.end())
+ if(stream.i != stream.b.end())
{
handler->read(stream);
assert(stream.i == stream.b.end());
@@ -539,13 +539,13 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
stream.i = stream.b.begin();
Byte protVer;
stream.read(protVer);
- if (protVer != protocolVersion)
+ if(protVer != protocolVersion)
{
throw UnsupportedProtocolException(__FILE__, __LINE__);
}
Byte encVer;
stream.read(encVer);
- if (encVer != encodingVersion)
+ if(encVer != encodingVersion)
{
throw UnsupportedEncodingException(__FILE__, __LINE__);
}
@@ -553,21 +553,21 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
stream.read(messageType);
Int size;
stream.read(size);
- if (size < headerSize)
+ if(size < headerSize)
{
throw IllegalMessageSizeException(__FILE__, __LINE__);
}
- if (size > 1024 * 1024) // TODO: configurable
+ if(size > 1024 * 1024) // TODO: configurable
{
throw MemoryLimitException(__FILE__, __LINE__);
}
- if (size > static_cast<Int>(stream.b.size()))
+ if(size > static_cast<Int>(stream.b.size()))
{
stream.b.resize(size);
}
stream.i = stream.b.begin() + pos;
- if (stream.i != stream.b.end())
+ if(stream.i != stream.b.end())
{
handler->read(stream);
assert(stream.i == stream.b.end());
@@ -610,7 +610,7 @@ IceInternal::ThreadPool::EventHandlerThread::run()
// "defensive" programming approach when it comes to
// multithreading.
//
- if (_pool->_threadNum == 0)
+ if(_pool->_threadNum == 0)
{
_pool->notifyAll(); // For waitUntil...Finished() methods.
}
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h
index dfdb3aa7d53..9343ab54dd5 100644
--- a/cpp/src/Ice/ThreadPool.h
+++ b/cpp/src/Ice/ThreadPool.h
@@ -1,93 +1,93 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_THREAD_POOL_H
-#define ICE_THREAD_POOL_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <IceUtil/Monitor.h>
-#include <IceUtil/Thread.h>
-
-#include <Ice/ThreadPoolF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/PropertiesF.h>
-#include <Ice/EventHandlerF.h>
-#include <list>
-
-#ifndef _WIN32
-# define SOCKET int
-#endif
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-class ThreadPool : public ::IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
-{
-public:
-
- void _register(SOCKET, const EventHandlerPtr&);
- void unregister(SOCKET);
- void promoteFollower();
- void initiateShutdown(); // Signal-safe shutdown initiation.
- void waitUntilFinished();
- void joinWithAllThreads();
-
-private:
-
- ThreadPool(const InstancePtr&, bool);
- virtual ~ThreadPool();
- void destroy();
- friend class Instance;
-
- bool clearInterrupt();
- void setInterrupt(char);
-
- void run();
- void read(const EventHandlerPtr&);
-
- InstancePtr _instance;
- bool _destroyed;
- SOCKET _maxFd;
- SOCKET _minFd;
- SOCKET _lastFd;
- SOCKET _fdIntrRead;
- SOCKET _fdIntrWrite;
- fd_set _fdSet;
- std::list<std::pair<SOCKET, EventHandlerPtr> > _changes; // Event handler set for addition; null for removal.
- std::map<SOCKET, EventHandlerPtr> _handlerMap;
- int _handlers;
- int _timeout;
- ::IceUtil::Mutex _threadMutex;
- bool _multipleThreads;
-
- class EventHandlerThread : public ::IceUtil::Thread
- {
- public:
-
- EventHandlerThread(const ThreadPoolPtr&);
- virtual void run();
-
- private:
-
- ThreadPoolPtr _pool;
- };
- friend class EventHandlerThread;
-
- std::vector<IceUtil::ThreadControl> _threads; // Control for all threads, running or not.
- int _threadNum; // Number of running threads.
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_THREAD_POOL_H
+#define ICE_THREAD_POOL_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <IceUtil/Monitor.h>
+#include <IceUtil/Thread.h>
+
+#include <Ice/ThreadPoolF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/PropertiesF.h>
+#include <Ice/EventHandlerF.h>
+#include <list>
+
+#ifndef _WIN32
+# define SOCKET int
+#endif
+
+namespace IceInternal
+{
+
+class BasicStream;
+
+class ThreadPool : public ::IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex>
+{
+public:
+
+ void _register(SOCKET, const EventHandlerPtr&);
+ void unregister(SOCKET);
+ void promoteFollower();
+ void initiateShutdown(); // Signal-safe shutdown initiation.
+ void waitUntilFinished();
+ void joinWithAllThreads();
+
+private:
+
+ ThreadPool(const InstancePtr&, bool);
+ virtual ~ThreadPool();
+ void destroy();
+ friend class Instance;
+
+ bool clearInterrupt();
+ void setInterrupt(char);
+
+ void run();
+ void read(const EventHandlerPtr&);
+
+ InstancePtr _instance;
+ bool _destroyed;
+ SOCKET _maxFd;
+ SOCKET _minFd;
+ SOCKET _lastFd;
+ SOCKET _fdIntrRead;
+ SOCKET _fdIntrWrite;
+ fd_set _fdSet;
+ std::list<std::pair<SOCKET, EventHandlerPtr> > _changes; // Event handler set for addition; null for removal.
+ std::map<SOCKET, EventHandlerPtr> _handlerMap;
+ int _handlers;
+ int _timeout;
+ ::IceUtil::Mutex _threadMutex;
+ bool _multipleThreads;
+
+ class EventHandlerThread : public ::IceUtil::Thread
+ {
+ public:
+
+ EventHandlerThread(const ThreadPoolPtr&);
+ virtual void run();
+
+ private:
+
+ ThreadPoolPtr _pool;
+ };
+ friend class EventHandlerThread;
+
+ std::vector<IceUtil::ThreadControl> _threads; // Control for all threads, running or not.
+ int _threadNum; // Number of running threads.
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ThreadPoolF.h b/cpp/src/Ice/ThreadPoolF.h
index 44332d6c413..18628f56397 100644
--- a/cpp/src/Ice/ThreadPoolF.h
+++ b/cpp/src/Ice/ThreadPoolF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_THREAD_POOL_F_H
-#define ICE_THREAD_POOL_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class ThreadPool;
-void incRef(ThreadPool*);
-void decRef(ThreadPool*);
-typedef Handle<ThreadPool> ThreadPoolPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_THREAD_POOL_F_H
+#define ICE_THREAD_POOL_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class ThreadPool;
+void incRef(ThreadPool*);
+void decRef(ThreadPool*);
+typedef Handle<ThreadPool> ThreadPoolPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TraceLevels.h b/cpp/src/Ice/TraceLevels.h
index ea2cec28fb9..80217412055 100644
--- a/cpp/src/Ice/TraceLevels.h
+++ b/cpp/src/Ice/TraceLevels.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TRACE_LEVELS_H
-#define ICE_TRACE_LEVELS_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/PropertiesF.h>
-
-namespace IceInternal
-{
-
-class TraceLevels : public ::IceUtil::Shared
-{
-public:
-
- TraceLevels(const ::Ice::PropertiesPtr&);
-
- const int network;
- const char* networkCat;
-
- const int protocol;
- const char* protocolCat;
-
- const int retry;
- const char* retryCat;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TRACE_LEVELS_H
+#define ICE_TRACE_LEVELS_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/PropertiesF.h>
+
+namespace IceInternal
+{
+
+class TraceLevels : public ::IceUtil::Shared
+{
+public:
+
+ TraceLevels(const ::Ice::PropertiesPtr&);
+
+ const int network;
+ const char* networkCat;
+
+ const int protocol;
+ const char* protocolCat;
+
+ const int retry;
+ const char* retryCat;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TraceLevelsF.h b/cpp/src/Ice/TraceLevelsF.h
index 8b6e37218b6..16648060987 100644
--- a/cpp/src/Ice/TraceLevelsF.h
+++ b/cpp/src/Ice/TraceLevelsF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TRACE_LEVELS_F_H
-#define ICE_TRACE_LEVELS_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class TraceLevels;
-void incRef(TraceLevels*);
-void decRef(TraceLevels*);
-typedef Handle<TraceLevels> TraceLevelsPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TRACE_LEVELS_F_H
+#define ICE_TRACE_LEVELS_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class TraceLevels;
+void incRef(TraceLevels*);
+void decRef(TraceLevels*);
+typedef Handle<TraceLevels> TraceLevelsPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp
index e29609825c6..ac4069fc36f 100644
--- a/cpp/src/Ice/TraceUtil.cpp
+++ b/cpp/src/Ice/TraceUtil.cpp
@@ -100,13 +100,13 @@ printRequestHeader(ostream& s, BasicStream& stream)
Int sz;
stream.readSize(sz);
s << "\ncontext = ";
- while (sz--)
+ while(sz--)
{
pair<string, string> pair;
stream.read(pair.first);
stream.read(pair.second);
s << pair.first << '/' << pair.second;
- if (sz)
+ if(sz)
{
s << ", ";
}
@@ -122,22 +122,22 @@ dumpOctets(const char* cat, const BasicStream& stream, const ::Ice::LoggerPtr& l
const BasicStream::Container::size_type inc = 8;
- for (BasicStream::Container::size_type i = 0; i < stream.b.size(); i += inc)
+ for(BasicStream::Container::size_type i = 0; i < stream.b.size(); i += inc)
{
- for (BasicStream::Container::size_type j = i; j - i < inc; j++)
+ for(BasicStream::Container::size_type j = i; j - i < inc; j++)
{
- if (j < stream.b.size())
+ if(j < stream.b.size())
{
int n = stream.b[j];
- if (n < 0)
+ if(n < 0)
{
n += 256;
}
- if (n < 10)
+ if(n < 10)
{
s << " " << n;
}
- else if (n < 100)
+ else if(n < 100)
{
s << " " << n;
}
@@ -155,9 +155,9 @@ dumpOctets(const char* cat, const BasicStream& stream, const ::Ice::LoggerPtr& l
s << '"';
- for (BasicStream::Container::size_type j = i; j < stream.b.size() && j - i < inc; j++)
+ for(BasicStream::Container::size_type j = i; j < stream.b.size() && j - i < inc; j++)
{
- if (stream.b[j] >= 32 && stream.b[j] < 127)
+ if(stream.b[j] >= 32 && stream.b[j] < 127)
{
s << (char)stream.b[j];
}
@@ -178,7 +178,7 @@ void
IceInternal::traceHeader(const char* heading, const BasicStream& str, const ::Ice::LoggerPtr& logger,
const TraceLevelsPtr& tl)
{
- if (tl->protocol >= 1)
+ if(tl->protocol >= 1)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -195,7 +195,7 @@ void
IceInternal::traceRequest(const char* heading, const BasicStream& str, const ::Ice::LoggerPtr& logger,
const TraceLevelsPtr& tl)
{
- if (tl->protocol >= 1)
+ if(tl->protocol >= 1)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -206,7 +206,7 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const ::I
Int requestId;
stream.read(requestId);
s << "\nrequest id = " << requestId;
- if (requestId == 0)
+ if(requestId == 0)
{
s << " (oneway)";
}
@@ -220,7 +220,7 @@ void
IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, const ::Ice::LoggerPtr& logger,
const TraceLevelsPtr& tl)
{
- if (tl->protocol >= 1)
+ if(tl->protocol >= 1)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -229,7 +229,7 @@ IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, cons
s << heading;
printHeader(s, stream);
int cnt = 0;
- while (stream.i != stream.b.end())
+ while(stream.i != stream.b.end())
{
s << "\nrequest #" << cnt++ << ':';
printRequestHeader(s, stream);
@@ -244,7 +244,7 @@ void
IceInternal::traceReply(const char* heading, const BasicStream& str, const ::Ice::LoggerPtr& logger,
const TraceLevelsPtr& tl)
{
- if (tl->protocol >= 1)
+ if(tl->protocol >= 1)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
diff --git a/cpp/src/Ice/TraceUtil.h b/cpp/src/Ice/TraceUtil.h
index 8841561ad82..d76da5378ac 100644
--- a/cpp/src/Ice/TraceUtil.h
+++ b/cpp/src/Ice/TraceUtil.h
@@ -1,29 +1,29 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TRACE_UTIL_H
-#define ICE_TRACE_UTIL_H
-
-#include <Ice/LoggerF.h>
-#include <Ice/TraceLevelsF.h>
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-void traceHeader(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
-void traceRequest(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
-void traceBatchRequest(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
-void traceReply(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TRACE_UTIL_H
+#define ICE_TRACE_UTIL_H
+
+#include <Ice/LoggerF.h>
+#include <Ice/TraceLevelsF.h>
+
+namespace IceInternal
+{
+
+class BasicStream;
+
+void traceHeader(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
+void traceRequest(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
+void traceBatchRequest(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
+void traceReply(const char*, const BasicStream&, const ::Ice::LoggerPtr&, const TraceLevelsPtr&);
+
+}
+
+#endif
diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h
index 244e2743415..2238527f8b1 100644
--- a/cpp/src/Ice/Transceiver.h
+++ b/cpp/src/Ice/Transceiver.h
@@ -1,40 +1,40 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TRANSCEIVER_H
-#define ICE_TRANSCEIVER_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/TransceiverF.h>
-
-#ifndef _WIN32
-# define SOCKET int
-#endif
-
-namespace IceInternal
-{
-
-class Buffer;
-
-class ICE_PROTOCOL_API Transceiver : public ::IceUtil::Shared
-{
-public:
-
- virtual SOCKET fd() = 0;
- virtual void close() = 0;
- virtual void shutdown() = 0;
- virtual void write(Buffer&, int) = 0;
- virtual void read(Buffer&, int) = 0;
- virtual std::string toString() const = 0;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TRANSCEIVER_H
+#define ICE_TRANSCEIVER_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/TransceiverF.h>
+
+#ifndef _WIN32
+# define SOCKET int
+#endif
+
+namespace IceInternal
+{
+
+class Buffer;
+
+class ICE_PROTOCOL_API Transceiver : public ::IceUtil::Shared
+{
+public:
+
+ virtual SOCKET fd() = 0;
+ virtual void close() = 0;
+ virtual void shutdown() = 0;
+ virtual void write(Buffer&, int) = 0;
+ virtual void read(Buffer&, int) = 0;
+ virtual std::string toString() const = 0;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/TransceiverF.h b/cpp/src/Ice/TransceiverF.h
index 80f3293f0e2..45b1bde641b 100644
--- a/cpp/src/Ice/TransceiverF.h
+++ b/cpp/src/Ice/TransceiverF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_TRANSCEIVER_F_H
-#define ICE_TRANSCEIVER_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class Transceiver;
-ICE_PROTOCOL_API void incRef(Transceiver*);
-ICE_PROTOCOL_API void decRef(Transceiver*);
-typedef Handle<Transceiver> TransceiverPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_TRANSCEIVER_F_H
+#define ICE_TRANSCEIVER_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class Transceiver;
+ICE_PROTOCOL_API void incRef(Transceiver*);
+ICE_PROTOCOL_API void decRef(Transceiver*);
+typedef Handle<Transceiver> TransceiverPtr;
+
+}
+
+#endif
diff --git a/cpp/src/Ice/UdpEndpoint.cpp b/cpp/src/Ice/UdpEndpoint.cpp
index 62c84ff7aca..8bed2486497 100644
--- a/cpp/src/Ice/UdpEndpoint.cpp
+++ b/cpp/src/Ice/UdpEndpoint.cpp
@@ -38,44 +38,44 @@ IceInternal::UdpEndpoint::UdpEndpoint(const InstancePtr& instance, const string&
string::size_type beg;
string::size_type end = 0;
- while (true)
+ while(true)
{
beg = str.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
end = str.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
string option = str.substr(beg, end - beg);
- if (option.length() != 2 || option[0] != '-')
+ if(option.length() != 2 || option[0] != '-')
{
throw EndpointParseException(__FILE__, __LINE__);
}
string argument;
string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if (argumentBeg != string::npos && str[argumentBeg] != '-')
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
{
beg = argumentBeg;
end = str.find_first_of(delim + ":", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
argument = str.substr(beg, end - beg);
}
- switch (option[1])
+ switch(option[1])
{
case 'h':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -85,7 +85,7 @@ IceInternal::UdpEndpoint::UdpEndpoint(const InstancePtr& instance, const string&
case 'p':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -95,7 +95,7 @@ IceInternal::UdpEndpoint::UdpEndpoint(const InstancePtr& instance, const string&
case 'c':
{
- if (!argument.empty())
+ if(!argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -110,7 +110,7 @@ IceInternal::UdpEndpoint::UdpEndpoint(const InstancePtr& instance, const string&
}
}
- if (_host.empty())
+ if(_host.empty())
{
const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost;
}
@@ -146,7 +146,7 @@ IceInternal::UdpEndpoint::toString() const
{
ostringstream s;
s << "udp -h " << _host << " -p " << _port;
- if (_connect)
+ if(_connect)
{
s << " -c";
}
@@ -220,7 +220,7 @@ bool
IceInternal::UdpEndpoint::equivalent(const TransceiverPtr& transceiver) const
{
const UdpTransceiver* udpTransceiver = dynamic_cast<const UdpTransceiver*>(transceiver.get());
- if (!udpTransceiver)
+ if(!udpTransceiver)
{
return false;
}
@@ -237,27 +237,27 @@ bool
IceInternal::UdpEndpoint::operator==(const Endpoint& r) const
{
const UdpEndpoint* p = dynamic_cast<const UdpEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return false;
}
- if (this == p)
+ if(this == p)
{
return true;
}
- if (_port != p->_port)
+ if(_port != p->_port)
{
return false;
}
- if (_connect != p->_connect)
+ if(_connect != p->_connect)
{
return false;
}
- if (_host != p->_host)
+ if(_host != p->_host)
{
//
// We do the most time-consuming part of the comparison last.
@@ -282,35 +282,35 @@ bool
IceInternal::UdpEndpoint::operator<(const Endpoint& r) const
{
const UdpEndpoint* p = dynamic_cast<const UdpEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return type() < r.type();
}
- if (this == p)
+ if(this == p)
{
return false;
}
- if (_port < p->_port)
+ if(_port < p->_port)
{
return true;
}
- else if (p->_port < _port)
+ else if(p->_port < _port)
{
return false;
}
- if (!_connect && p->_connect)
+ if(!_connect && p->_connect)
{
return true;
}
- else if (!p->_connect && _connect)
+ else if(!p->_connect && _connect)
{
return false;
}
- if (_host != p->_host)
+ if(_host != p->_host)
{
//
// We do the most time-consuming part of the comparison last.
@@ -319,11 +319,11 @@ IceInternal::UdpEndpoint::operator<(const Endpoint& r) const
struct sockaddr_in raddr;
getAddress(_host, _port, laddr);
getAddress(p->_host, p->_port, raddr);
- if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
{
return true;
}
- else if (raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
{
return false;
}
diff --git a/cpp/src/Ice/UdpEndpoint.h b/cpp/src/Ice/UdpEndpoint.h
index 321b9214f9e..fe0d3233951 100644
--- a/cpp/src/Ice/UdpEndpoint.h
+++ b/cpp/src/Ice/UdpEndpoint.h
@@ -1,82 +1,82 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_UDP_ENDPOINT_H
-#define ICE_UDP_ENDPOINT_H
-
-#include <Ice/Endpoint.h>
-#include <Ice/EndpointFactory.h>
-
-namespace IceInternal
-{
-
-const ::Ice::Short UdpEndpointType = 3;
-
-class UdpEndpoint : public Endpoint
-{
-public:
-
- UdpEndpoint(const InstancePtr&, const std::string&, ::Ice::Int);
- UdpEndpoint(const InstancePtr&, const std::string&);
- UdpEndpoint(BasicStream*);
-
- virtual void streamWrite(BasicStream*) const;
- virtual std::string toString() const;
- virtual ::Ice::Short type() const;
- virtual ::Ice::Int timeout() const;
- virtual EndpointPtr timeout(::Ice::Int) const;
- virtual bool datagram() const;
- virtual bool secure() const;
- virtual bool unknown() const;
- virtual TransceiverPtr clientTransceiver() const;
- virtual TransceiverPtr serverTransceiver(EndpointPtr&) const;
- virtual ConnectorPtr connector() const;
- virtual AcceptorPtr acceptor(EndpointPtr&) const;
- virtual bool equivalent(const TransceiverPtr&) const;
- virtual bool equivalent(const AcceptorPtr&) const;
-
- virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
- virtual bool operator<(const Endpoint&) const;
-
-private:
-
- //
- // All members are const, because endpoints are immutable.
- //
- const InstancePtr _instance;
- const std::string _host;
- const ::Ice::Int _port;
- const bool _connect;
-};
-
-class UdpEndpointFactory : public EndpointFactory
-{
-public:
-
- virtual ~UdpEndpointFactory();
-
- virtual ::Ice::Short type() const;
- virtual const ::std::string& protocol() const;
- virtual EndpointPtr create(const std::string&) const;
- virtual EndpointPtr read(BasicStream*) const;
- virtual void destroy();
-
-private:
-
- UdpEndpointFactory(const InstancePtr&);
- friend class Instance;
-
- InstancePtr _instance;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_UDP_ENDPOINT_H
+#define ICE_UDP_ENDPOINT_H
+
+#include <Ice/Endpoint.h>
+#include <Ice/EndpointFactory.h>
+
+namespace IceInternal
+{
+
+const ::Ice::Short UdpEndpointType = 3;
+
+class UdpEndpoint : public Endpoint
+{
+public:
+
+ UdpEndpoint(const InstancePtr&, const std::string&, ::Ice::Int);
+ UdpEndpoint(const InstancePtr&, const std::string&);
+ UdpEndpoint(BasicStream*);
+
+ virtual void streamWrite(BasicStream*) const;
+ virtual std::string toString() const;
+ virtual ::Ice::Short type() const;
+ virtual ::Ice::Int timeout() const;
+ virtual EndpointPtr timeout(::Ice::Int) const;
+ virtual bool datagram() const;
+ virtual bool secure() const;
+ virtual bool unknown() const;
+ virtual TransceiverPtr clientTransceiver() const;
+ virtual TransceiverPtr serverTransceiver(EndpointPtr&) const;
+ virtual ConnectorPtr connector() const;
+ virtual AcceptorPtr acceptor(EndpointPtr&) const;
+ virtual bool equivalent(const TransceiverPtr&) const;
+ virtual bool equivalent(const AcceptorPtr&) const;
+
+ virtual bool operator==(const Endpoint&) const;
+ virtual bool operator!=(const Endpoint&) const;
+ virtual bool operator<(const Endpoint&) const;
+
+private:
+
+ //
+ // All members are const, because endpoints are immutable.
+ //
+ const InstancePtr _instance;
+ const std::string _host;
+ const ::Ice::Int _port;
+ const bool _connect;
+};
+
+class UdpEndpointFactory : public EndpointFactory
+{
+public:
+
+ virtual ~UdpEndpointFactory();
+
+ virtual ::Ice::Short type() const;
+ virtual const ::std::string& protocol() const;
+ virtual EndpointPtr create(const std::string&) const;
+ virtual EndpointPtr read(BasicStream*) const;
+ virtual void destroy();
+
+private:
+
+ UdpEndpointFactory(const InstancePtr&);
+ friend class Instance;
+
+ InstancePtr _instance;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index c62a75f11a2..5ccc6c5d333 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -29,7 +29,7 @@ IceInternal::UdpTransceiver::fd()
void
IceInternal::UdpTransceiver::close()
{
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "closing " << _protocolName << " connection\n" << toString();
@@ -57,26 +57,26 @@ IceInternal::UdpTransceiver::write(Buffer& buf, int)
repeat:
int ret = ::send(_fd, &buf.b[0], buf.b.size(), 0);
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeat;
}
- if (wouldBlock())
+ if(wouldBlock())
{
SOCKET fd = _fd; // Copy fd, in case another thread calls close()
- if (fd != INVALID_SOCKET)
+ if(fd != INVALID_SOCKET)
{
repeatSelect:
FD_SET(fd, &_wFdSet);
int ret = ::select(fd + 1, 0, &_wFdSet, 0, 0);
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -95,7 +95,7 @@ repeat:
throw ex;
}
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "sent " << ret << " bytes via " << _protocolName << "\n" << toString();
@@ -116,7 +116,7 @@ IceInternal::UdpTransceiver::read(Buffer& buf, int)
repeat:
int ret;
- if (_connect)
+ if(_connect)
{
//
// If we must connect, then we connect to the first peer that
@@ -126,12 +126,12 @@ repeat:
memset(&peerAddr, 0, sizeof(struct sockaddr_in));
socklen_t len = sizeof(peerAddr);
ret = recvfrom(_fd, &buf.b[0], packetSize, 0, reinterpret_cast<struct sockaddr*>(&peerAddr), &len);
- if (ret != SOCKET_ERROR)
+ if(ret != SOCKET_ERROR)
{
doConnect(_fd, peerAddr, -1);
_connect = false; // We're connected now
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "connected " << _protocolName << " socket\n" << toString();
@@ -143,26 +143,26 @@ repeat:
ret = ::recv(_fd, &buf.b[0], packetSize, 0);
}
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeat;
}
- if (wouldBlock())
+ if(wouldBlock())
{
SOCKET fd = _fd; // Copy fd, in case another thread calls close()
- if (fd != INVALID_SOCKET)
+ if(fd != INVALID_SOCKET)
{
repeatSelect:
FD_SET(fd, &_rFdSet);
int ret = ::select(fd + 1, &_rFdSet, 0, 0, 0);
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
- if (interrupted())
+ if(interrupted())
{
goto repeatSelect;
}
@@ -181,7 +181,7 @@ repeat:
throw ex;
}
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
out << "received " << ret << " bytes via " << _protocolName << "\n" << toString();
@@ -234,7 +234,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
doConnect(_fd, _addr, -1);
_connect = false; // We're connected now
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "starting to send " << _protocolName << " packets\n" << toString();
@@ -266,7 +266,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
getAddress(host, port, _addr);
doBind(_fd, _addr);
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
out << "starting to receive " << _protocolName << " packets\n" << toString();
diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h
index 5a979dc9ac1..215f8a6bc74 100644
--- a/cpp/src/Ice/UdpTransceiver.h
+++ b/cpp/src/Ice/UdpTransceiver.h
@@ -1,69 +1,69 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_UDP_TRANSCEIVER_H
-#define ICE_UDP_TRANSCEIVER_H
-
-#include <Ice/InstanceF.h>
-#include <Ice/TraceLevelsF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/Transceiver.h>
-
-#ifndef _WIN32
-# include <netinet/in.h> // For struct sockaddr_in
-#endif
-
-namespace IceInternal
-{
-
-class UdpEndpoint;
-
-class SUdpTransceiver;
-
-class UdpTransceiver : public Transceiver
-{
-public:
-
- virtual SOCKET fd();
- virtual void close();
- virtual void shutdown();
- virtual void write(Buffer&, int);
- virtual void read(Buffer&, int);
- virtual std::string toString() const;
-
- bool equivalent(const std::string&, int) const;
- int effectivePort();
- void setProtocolName(const std::string&);
-
-private:
-
- UdpTransceiver(const InstancePtr&, const std::string&, int, const std::string& protocolName = "udp");
- UdpTransceiver(const InstancePtr&, const std::string&, int, bool, const std::string& protocolName = "udp");
- virtual ~UdpTransceiver();
-
- friend class UdpEndpoint;
-// friend class SUdpEndpoint; // TODO: Remove as soon as SUdpEndpoint uses SUdpTransceiver.
-// friend class SUdpTransceiver;
-
- InstancePtr _instance;
- TraceLevelsPtr _traceLevels;
- ::Ice::LoggerPtr _logger;
- bool _incoming;
- bool _connect;
- SOCKET _fd;
- struct sockaddr_in _addr;
- fd_set _rFdSet;
- fd_set _wFdSet;
- std::string _protocolName;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_UDP_TRANSCEIVER_H
+#define ICE_UDP_TRANSCEIVER_H
+
+#include <Ice/InstanceF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/Transceiver.h>
+
+#ifndef _WIN32
+# include <netinet/in.h> // For struct sockaddr_in
+#endif
+
+namespace IceInternal
+{
+
+class UdpEndpoint;
+
+class SUdpTransceiver;
+
+class UdpTransceiver : public Transceiver
+{
+public:
+
+ virtual SOCKET fd();
+ virtual void close();
+ virtual void shutdown();
+ virtual void write(Buffer&, int);
+ virtual void read(Buffer&, int);
+ virtual std::string toString() const;
+
+ bool equivalent(const std::string&, int) const;
+ int effectivePort();
+ void setProtocolName(const std::string&);
+
+private:
+
+ UdpTransceiver(const InstancePtr&, const std::string&, int, const std::string& protocolName = "udp");
+ UdpTransceiver(const InstancePtr&, const std::string&, int, bool, const std::string& protocolName = "udp");
+ virtual ~UdpTransceiver();
+
+ friend class UdpEndpoint;
+// friend class SUdpEndpoint; // TODO: Remove as soon as SUdpEndpoint uses SUdpTransceiver.
+// friend class SUdpTransceiver;
+
+ InstancePtr _instance;
+ TraceLevelsPtr _traceLevels;
+ ::Ice::LoggerPtr _logger;
+ bool _incoming;
+ bool _connect;
+ SOCKET _fd;
+ struct sockaddr_in _addr;
+ fd_set _rFdSet;
+ fd_set _wFdSet;
+ std::string _protocolName;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/UnknownEndpoint.cpp b/cpp/src/Ice/UnknownEndpoint.cpp
index 76c4cc3c690..f7c8cf5f57f 100644
--- a/cpp/src/Ice/UnknownEndpoint.cpp
+++ b/cpp/src/Ice/UnknownEndpoint.cpp
@@ -120,22 +120,22 @@ bool
IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const
{
const UnknownEndpoint* p = dynamic_cast<const UnknownEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return false;
}
- if (this == p)
+ if(this == p)
{
return true;
}
- if (_type != p->_type)
+ if(_type != p->_type)
{
return false;
}
- if (_rawBytes != p->_rawBytes)
+ if(_rawBytes != p->_rawBytes)
{
return false;
}
@@ -153,30 +153,30 @@ bool
IceInternal::UnknownEndpoint::operator<(const Endpoint& r) const
{
const UnknownEndpoint* p = dynamic_cast<const UnknownEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return type() < r.type();
}
- if (this == p)
+ if(this == p)
{
return false;
}
- if (_type < p->_type)
+ if(_type < p->_type)
{
return true;
}
- else if (p->_type < _type)
+ else if(p->_type < _type)
{
return false;
}
- if (_rawBytes < p->_rawBytes)
+ if(_rawBytes < p->_rawBytes)
{
return true;
}
- else if (p->_rawBytes < _rawBytes)
+ else if(p->_rawBytes < _rawBytes)
{
return false;
}
diff --git a/cpp/src/Ice/UnknownEndpoint.h b/cpp/src/Ice/UnknownEndpoint.h
index 17ea13a7320..ed48fde8fb6 100644
--- a/cpp/src/Ice/UnknownEndpoint.h
+++ b/cpp/src/Ice/UnknownEndpoint.h
@@ -1,59 +1,59 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_UNKNOWN_ENDPOINT_H
-#define ICE_UNKNOWN_ENDPOINT_H
-
-#include <Ice/Endpoint.h>
-#include <Ice/EndpointFactory.h>
-
-namespace IceInternal
-{
-
-const ::Ice::Short UnknownEndpointType = 0;
-
-class UnknownEndpoint : public Endpoint
-{
-public:
-
- UnknownEndpoint(::Ice::Short, BasicStream*);
-
- virtual void streamWrite(BasicStream*) const;
- virtual std::string toString() const;
- virtual ::Ice::Short type() const;
- virtual ::Ice::Int timeout() const;
- virtual EndpointPtr timeout(::Ice::Int) const;
- virtual bool datagram() const;
- virtual bool secure() const;
- virtual bool unknown() const;
- virtual TransceiverPtr clientTransceiver() const;
- virtual TransceiverPtr serverTransceiver(EndpointPtr&) const;
- virtual ConnectorPtr connector() const;
- virtual AcceptorPtr acceptor(EndpointPtr&) const;
- virtual bool equivalent(const TransceiverPtr&) const;
- virtual bool equivalent(const AcceptorPtr&) const;
-
- virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
- virtual bool operator<(const Endpoint&) const;
-
-private:
-
- //
- // All members are const, because endpoints are immutable.
- //
- const InstancePtr _instance;
- ::Ice::Short _type;
- const std::vector< ::Ice::Byte> _rawBytes;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_UNKNOWN_ENDPOINT_H
+#define ICE_UNKNOWN_ENDPOINT_H
+
+#include <Ice/Endpoint.h>
+#include <Ice/EndpointFactory.h>
+
+namespace IceInternal
+{
+
+const ::Ice::Short UnknownEndpointType = 0;
+
+class UnknownEndpoint : public Endpoint
+{
+public:
+
+ UnknownEndpoint(::Ice::Short, BasicStream*);
+
+ virtual void streamWrite(BasicStream*) const;
+ virtual std::string toString() const;
+ virtual ::Ice::Short type() const;
+ virtual ::Ice::Int timeout() const;
+ virtual EndpointPtr timeout(::Ice::Int) const;
+ virtual bool datagram() const;
+ virtual bool secure() const;
+ virtual bool unknown() const;
+ virtual TransceiverPtr clientTransceiver() const;
+ virtual TransceiverPtr serverTransceiver(EndpointPtr&) const;
+ virtual ConnectorPtr connector() const;
+ virtual AcceptorPtr acceptor(EndpointPtr&) const;
+ virtual bool equivalent(const TransceiverPtr&) const;
+ virtual bool equivalent(const AcceptorPtr&) const;
+
+ virtual bool operator==(const Endpoint&) const;
+ virtual bool operator!=(const Endpoint&) const;
+ virtual bool operator<(const Endpoint&) const;
+
+private:
+
+ //
+ // All members are const, because endpoints are immutable.
+ //
+ const InstancePtr _instance;
+ ::Ice::Short _type;
+ const std::vector< ::Ice::Byte> _rawBytes;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/UserExceptionFactoryManager.cpp b/cpp/src/Ice/UserExceptionFactoryManager.cpp
index b47500ebacf..272ec1dcde0 100644
--- a/cpp/src/Ice/UserExceptionFactoryManager.cpp
+++ b/cpp/src/Ice/UserExceptionFactoryManager.cpp
@@ -33,24 +33,24 @@ IceInternal::UserExceptionFactoryManager::remove(const string& id)
map<string, ::Ice::UserExceptionFactoryPtr>::iterator p = _factoryMap.end();
- if (_factoryMapHint != _factoryMap.end())
+ if(_factoryMapHint != _factoryMap.end())
{
- if (_factoryMapHint->first == id)
+ if(_factoryMapHint->first == id)
{
p = _factoryMapHint;
}
}
- if (p == _factoryMap.end())
+ if(p == _factoryMap.end())
{
p = _factoryMap.find(id);
}
- if (p != _factoryMap.end())
+ if(p != _factoryMap.end())
{
p->second->destroy();
- if (p == _factoryMapHint)
+ if(p == _factoryMapHint)
{
_factoryMap.erase(p++);
_factoryMapHint = p;
@@ -69,20 +69,20 @@ IceInternal::UserExceptionFactoryManager::find(const string& id)
map<string, ::Ice::UserExceptionFactoryPtr>::iterator p = _factoryMap.end();
- if (_factoryMapHint != _factoryMap.end())
+ if(_factoryMapHint != _factoryMap.end())
{
- if (_factoryMapHint->first == id)
+ if(_factoryMapHint->first == id)
{
p = _factoryMapHint;
}
}
- if (p == _factoryMap.end())
+ if(p == _factoryMap.end())
{
p = _factoryMap.find(id);
}
- if (p != _factoryMap.end())
+ if(p != _factoryMap.end())
{
_factoryMapHint = p;
return p->second;
diff --git a/cpp/src/Ice/UserExceptionFactoryManager.h b/cpp/src/Ice/UserExceptionFactoryManager.h
index 8c59c847549..a213272df31 100644
--- a/cpp/src/Ice/UserExceptionFactoryManager.h
+++ b/cpp/src/Ice/UserExceptionFactoryManager.h
@@ -1,42 +1,42 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_USER_EXCEPTION_FACTORY_MANAGER_H
-#define ICE_USER_EXCEPTION_FACTORY_MANAGER_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Mutex.h>
-#include <Ice/UserExceptionFactoryManagerF.h>
-#include <Ice/UserExceptionFactoryF.h>
-
-namespace IceInternal
-{
-
-class UserExceptionFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
-{
-public:
-
- void add(const ::Ice::UserExceptionFactoryPtr&, const std::string&);
- void remove(const std::string&);
- ::Ice::UserExceptionFactoryPtr find(const std::string&);
-
-private:
-
- UserExceptionFactoryManager();
- void destroy();
- friend class Instance;
-
- std::map<std::string, ::Ice::UserExceptionFactoryPtr> _factoryMap;
- std::map<std::string, ::Ice::UserExceptionFactoryPtr>::iterator _factoryMapHint;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_USER_EXCEPTION_FACTORY_MANAGER_H
+#define ICE_USER_EXCEPTION_FACTORY_MANAGER_H
+
+#include <IceUtil/Shared.h>
+#include <IceUtil/Mutex.h>
+#include <Ice/UserExceptionFactoryManagerF.h>
+#include <Ice/UserExceptionFactoryF.h>
+
+namespace IceInternal
+{
+
+class UserExceptionFactoryManager : public ::IceUtil::Shared, public ::IceUtil::Mutex
+{
+public:
+
+ void add(const ::Ice::UserExceptionFactoryPtr&, const std::string&);
+ void remove(const std::string&);
+ ::Ice::UserExceptionFactoryPtr find(const std::string&);
+
+private:
+
+ UserExceptionFactoryManager();
+ void destroy();
+ friend class Instance;
+
+ std::map<std::string, ::Ice::UserExceptionFactoryPtr> _factoryMap;
+ std::map<std::string, ::Ice::UserExceptionFactoryPtr>::iterator _factoryMapHint;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/UserExceptionFactoryManagerF.h b/cpp/src/Ice/UserExceptionFactoryManagerF.h
index 9f4bb2deac8..5640d639ec9 100644
--- a/cpp/src/Ice/UserExceptionFactoryManagerF.h
+++ b/cpp/src/Ice/UserExceptionFactoryManagerF.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_USER_EXCEPTION_FACTORY_MANAGER_F_H
-#define ICE_USER_EXCEPTION_FACTORY_MANAGER_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class UserExceptionFactoryManager;
-void incRef(UserExceptionFactoryManager*);
-void decRef(UserExceptionFactoryManager*);
-typedef IceInternal::Handle<UserExceptionFactoryManager> UserExceptionFactoryManagerPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_USER_EXCEPTION_FACTORY_MANAGER_F_H
+#define ICE_USER_EXCEPTION_FACTORY_MANAGER_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceInternal
+{
+
+class UserExceptionFactoryManager;
+void incRef(UserExceptionFactoryManager*);
+void decRef(UserExceptionFactoryManager*);
+typedef IceInternal::Handle<UserExceptionFactoryManager> UserExceptionFactoryManagerPtr;
+
+}
+
+#endif
diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp
index 6269444b63b..0f526f2b594 100644
--- a/cpp/src/IceBox/Admin.cpp
+++ b/cpp/src/IceBox/Admin.cpp
@@ -57,19 +57,19 @@ Client::run(int argc, char* argv[])
vector<string> commands;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << appName() << ": unknown option `" << argv[idx] << "'" << endl;
usage();
@@ -82,7 +82,7 @@ Client::run(int argc, char* argv[])
}
}
- if (commands.empty())
+ if(commands.empty())
{
usage();
return EXIT_SUCCESS;
@@ -90,7 +90,7 @@ Client::run(int argc, char* argv[])
const char* managerEndpointsProperty = "IceBox.ServiceManager.Endpoints";
string managerEndpoints = properties->getProperty(managerEndpointsProperty);
- if (managerEndpoints.empty())
+ if(managerEndpoints.empty())
{
cerr << appName() << ": property `" << managerEndpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -98,16 +98,16 @@ Client::run(int argc, char* argv[])
ObjectPrx base = communicator()->stringToProxy("ServiceManager:" + managerEndpoints);
IceBox::ServiceManagerPrx manager = IceBox::ServiceManagerPrx::checkedCast(base);
- if (!manager)
+ if(!manager)
{
cerr << appName() << ": `" << managerEndpoints << "' is not running" << endl;
return EXIT_FAILURE;
}
vector<string>::const_iterator r;
- for (r = commands.begin(); r != commands.end(); ++r)
+ for(r = commands.begin(); r != commands.end(); ++r)
{
- if ((*r) == "shutdown")
+ if((*r) == "shutdown")
{
manager->shutdown();
}
diff --git a/cpp/src/IceBox/Server.cpp b/cpp/src/IceBox/Server.cpp
index 6e3129d1969..032964a3627 100644
--- a/cpp/src/IceBox/Server.cpp
+++ b/cpp/src/IceBox/Server.cpp
@@ -42,19 +42,19 @@ main(int argc, char* argv[])
args = properties->parseCommandLineOptions("IceBox", args);
stringSeqToArgs(args, argc, argv);
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strncmp(argv[i], "--", 2) != 0)
+ else if(strncmp(argv[i], "--", 2) != 0)
{
cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
usage(argv[0]);
@@ -72,7 +72,7 @@ main(int argc, char* argv[])
status = EXIT_FAILURE;
}
- if (communicator)
+ if(communicator)
{
try
{
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 428b65beb80..6139bbb81d0 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -23,12 +23,12 @@ IceBox::ServiceManagerI::ServiceManagerI(CommunicatorPtr communicator, int& argc
{
_logger = _communicator->getLogger();
- if (argc > 0)
+ if(argc > 0)
{
_progName = argv[0];
}
- for (int i = 1; i < argc; i++)
+ for(int i = 1; i < argc; i++)
{
_argv.push_back(argv[i]);
}
@@ -74,7 +74,7 @@ IceBox::ServiceManagerI::run()
PropertiesPtr properties = _communicator->getProperties();
PropertyDict services = properties->getPropertiesForPrefix(prefix);
PropertyDict::const_iterator p;
- for (p = services.begin(); p != services.end(); ++p)
+ for(p = services.begin(); p != services.end(); ++p)
{
string name = p->first.substr(prefix.size());
const string& value = p->second;
@@ -85,7 +85,7 @@ IceBox::ServiceManagerI::run()
string entryPoint;
StringSeq args;
string::size_type pos = value.find_first_of(" \t\n");
- if (pos == string::npos)
+ if(pos == string::npos)
{
entryPoint = value;
}
@@ -93,10 +93,10 @@ IceBox::ServiceManagerI::run()
{
entryPoint = value.substr(0, pos);
string::size_type beg = value.find_first_not_of(" \t\n", pos);
- while (beg != string::npos)
+ while(beg != string::npos)
{
string::size_type end = value.find_first_of(" \t\n", beg);
- if (end == string::npos)
+ if(end == string::npos)
{
args.push_back(value.substr(beg));
beg = end;
@@ -116,7 +116,7 @@ IceBox::ServiceManagerI::run()
// Invoke start() on the services.
//
map<string,ServiceInfo>::const_iterator r;
- for (r = _services.begin(); r != _services.end(); ++r)
+ for(r = _services.begin(); r != _services.end(); ++r)
{
try
{
@@ -147,7 +147,7 @@ IceBox::ServiceManagerI::run()
// services.
//
string bundleName = properties->getProperty("IceBox.PrintServicesReady");
- if (!bundleName.empty())
+ if(!bundleName.empty())
{
cout << bundleName << " ready" << endl;
}
@@ -199,20 +199,20 @@ IceBox::ServiceManagerI::init(const string& service, const string& entryPoint, c
//
StringSeq serviceArgs;
StringSeq::size_type j;
- for (j = 0; j < _options.size(); j++)
+ for(j = 0; j < _options.size(); j++)
{
- if (_options[j].find("--" + service + ".") == 0)
+ if(_options[j].find("--" + service + ".") == 0)
{
serviceArgs.push_back(_options[j]);
}
}
- for (j = 0; j < args.size(); j++)
+ for(j = 0; j < args.size(); j++)
{
serviceArgs.push_back(args[j]);
}
- for (j = 0; j < _argv.size(); j++)
+ for(j = 0; j < _argv.size(); j++)
{
- if (_argv[j].find("--" + service + ".") == 0)
+ if(_argv[j].find("--" + service + ".") == 0)
{
serviceArgs.push_back(_argv[j]);
}
@@ -230,12 +230,12 @@ IceBox::ServiceManagerI::init(const string& service, const string& entryPoint, c
//
DynamicLibraryPtr library = new DynamicLibrary();
DynamicLibrary::symbol_type sym = library->loadEntryPoint(entryPoint);
- if (sym == 0)
+ if(sym == 0)
{
string msg = library->getErrorMessage();
FailureException ex;
ex.reason = "ServiceManager: unable to load entry point `" + entryPoint + "'";
- if (!msg.empty())
+ if(!msg.empty())
{
ex.reason += ": " + msg;
}
@@ -323,7 +323,7 @@ void
IceBox::ServiceManagerI::stopAll()
{
map<string,ServiceInfo>::const_iterator r = _services.begin();
- while (r != _services.end())
+ while(r != _services.end())
{
try
{
diff --git a/cpp/src/IceBox/ServiceManagerI.h b/cpp/src/IceBox/ServiceManagerI.h
index cbfa5edd8b7..00a6de8a7b8 100644
--- a/cpp/src/IceBox/ServiceManagerI.h
+++ b/cpp/src/IceBox/ServiceManagerI.h
@@ -1,56 +1,56 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef SERVICE_MANAGER_I_H
-#define SERVICE_MANAGER_I_H
-
-#include <IceBox/IceBox.h>
-#include <Ice/LoggerF.h>
-#include <Ice/CommunicatorF.h>
-#include <Ice/DynamicLibraryF.h>
-#include <map>
-
-namespace IceBox
-{
-
-class ServiceManagerI : public ServiceManager
-{
-public:
-
- ServiceManagerI(::Ice::CommunicatorPtr, int&, char*[]);
- virtual ~ServiceManagerI();
-
- virtual void shutdown(const ::Ice::Current&);
-
- int run();
-
- struct ServiceInfo
- {
- ServicePtr service;
- ::IceInternal::DynamicLibraryPtr library;
- };
-
-private:
-
- ServicePtr init(const std::string&, const std::string&, const ::Ice::StringSeq&);
- void stop(const std::string&);
- void stopAll();
-
- ::Ice::CommunicatorPtr _communicator;
- ::Ice::LoggerPtr _logger;
- std::string _progName; // argv[0]
- ::Ice::StringSeq _argv; // Filtered server argument vector, not including program name
- ::Ice::StringSeq _options; // Server property set converted to command-line options
- std::map<std::string, ServiceInfo> _services;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef SERVICE_MANAGER_I_H
+#define SERVICE_MANAGER_I_H
+
+#include <IceBox/IceBox.h>
+#include <Ice/LoggerF.h>
+#include <Ice/CommunicatorF.h>
+#include <Ice/DynamicLibraryF.h>
+#include <map>
+
+namespace IceBox
+{
+
+class ServiceManagerI : public ServiceManager
+{
+public:
+
+ ServiceManagerI(::Ice::CommunicatorPtr, int&, char*[]);
+ virtual ~ServiceManagerI();
+
+ virtual void shutdown(const ::Ice::Current&);
+
+ int run();
+
+ struct ServiceInfo
+ {
+ ServicePtr service;
+ ::IceInternal::DynamicLibraryPtr library;
+ };
+
+private:
+
+ ServicePtr init(const std::string&, const std::string&, const ::Ice::StringSeq&);
+ void stop(const std::string&);
+ void stopAll();
+
+ ::Ice::CommunicatorPtr _communicator;
+ ::Ice::LoggerPtr _logger;
+ std::string _progName; // argv[0]
+ ::Ice::StringSeq _argv; // Filtered server argument vector, not including program name
+ ::Ice::StringSeq _options; // Server property set converted to command-line options
+ std::map<std::string, ServiceInfo> _services;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/Activator.cpp b/cpp/src/IcePack/Activator.cpp
index 821755e3821..0e80a0eeeaf 100644
--- a/cpp/src/IcePack/Activator.cpp
+++ b/cpp/src/IcePack/Activator.cpp
@@ -26,7 +26,7 @@ IcePack::Activator::Activator(const CommunicatorPtr& communicator) :
_destroy(false)
{
int fds[2];
- if (pipe(fds) != 0)
+ if(pipe(fds) != 0)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -44,7 +44,7 @@ IcePack::Activator::~Activator()
assert(_destroy);
close(_fdIntrRead);
close(_fdIntrWrite);
- for (map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
+ for(map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
{
close(p->second.fd);
}
@@ -74,7 +74,7 @@ IcePack::Activator::destroy()
{
IceUtil::Mutex::Lock sync(*this);
- if (_destroy) // Don't destroy twice.
+ if(_destroy) // Don't destroy twice.
{
return;
}
@@ -88,13 +88,13 @@ IcePack::Activator::activate(const ServerDescription& desc)
{
IceUtil::Mutex::Lock sync(*this);
- if (_destroy)
+ if(_destroy)
{
return false;
}
string path = desc.path;
- if (path.empty())
+ if(path.empty())
{
return false;
}
@@ -103,11 +103,11 @@ IcePack::Activator::activate(const ServerDescription& desc)
// Normalize the pathname a bit.
//
string::size_type pos;
- while ((pos = path.find("//")) != string::npos)
+ while((pos = path.find("//")) != string::npos)
{
path.erase(pos, 1);
}
- while ((pos = path.find("/./")) != string::npos)
+ while((pos = path.find("/./")) != string::npos)
{
path.erase(pos, 2);
}
@@ -115,7 +115,7 @@ IcePack::Activator::activate(const ServerDescription& desc)
//
// Do nothing if the process exists.
//
- if (_processes.count(path))
+ if(_processes.count(path))
{
return false;
}
@@ -124,20 +124,20 @@ IcePack::Activator::activate(const ServerDescription& desc)
// Process does not exist, activate and create.
//
int fds[2];
- if (pipe(fds) != 0)
+ if(pipe(fds) != 0)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
pid_t pid = fork();
- if (pid == -1)
+ if(pid == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
- if (pid == 0) // Child process.
+ if(pid == 0) // Child process.
{
//
// Close all filedescriptors, except for standard input,
@@ -145,9 +145,9 @@ IcePack::Activator::activate(const ServerDescription& desc)
// of the newly created pipe.
//
int maxFd = static_cast<int>(sysconf(_SC_OPEN_MAX));
- for (int fd = 3; fd < maxFd; ++fd)
+ for(int fd = 3; fd < maxFd; ++fd)
{
- if (fd != fds[1])
+ if(fd != fds[1])
{
close(fd);
}
@@ -156,13 +156,13 @@ IcePack::Activator::activate(const ServerDescription& desc)
int argc = desc.args.size() + 2;
char** argv = static_cast<char**>(malloc(argc * sizeof(char*)));
argv[0] = strdup(path.c_str());
- for (unsigned int i = 0; i < desc.args.size(); ++i)
+ for(unsigned int i = 0; i < desc.args.size(); ++i)
{
argv[i + 1] = strdup(desc.args[i].c_str());
}
argv[argc - 1] = 0;
- if (execvp(argv[0], argv) == -1)
+ if(execvp(argv[0], argv) == -1)
{
//
// Send any errors to the parent process, using the write
@@ -199,7 +199,7 @@ IcePack::Activator::activate(const ServerDescription& desc)
void
IcePack::Activator::terminationListener()
{
- while (true)
+ while(true)
{
fd_set fdSet;
int maxFd = _fdIntrRead;
@@ -209,16 +209,16 @@ IcePack::Activator::terminationListener()
{
IceUtil::Mutex::Lock sync(*this);
- if (_destroy)
+ if(_destroy)
{
return;
}
- for (map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
+ for(map<string, Process>::iterator p = _processes.begin(); p != _processes.end(); ++p)
{
int fd = p->second.fd;
FD_SET(fd, &fdSet);
- if (maxFd < fd)
+ if(maxFd < fd)
{
maxFd = fd;
}
@@ -229,9 +229,9 @@ IcePack::Activator::terminationListener()
int ret = ::select(maxFd + 1, &fdSet, 0, 0, 0);
assert(ret != 0);
- if (ret == -1)
+ if(ret == -1)
{
- if (errno == EINTR || errno == EPROTO)
+ if(errno == EINTR || errno == EPROTO)
{
goto repeatSelect;
}
@@ -244,25 +244,25 @@ IcePack::Activator::terminationListener()
{
IceUtil::Mutex::Lock sync(*this);
- if (FD_ISSET(_fdIntrRead, &fdSet))
+ if(FD_ISSET(_fdIntrRead, &fdSet))
{
clearInterrupt();
}
- if (_destroy)
+ if(_destroy)
{
return;
}
map<string, Process>::iterator p = _processes.begin();
- while (p != _processes.end())
+ while(p != _processes.end())
{
int fd = p->second.fd;
- if (FD_ISSET(fd, &fdSet))
+ if(FD_ISSET(fd, &fdSet))
{
char s[16];
int ret = read(fd, &s, 16);
- if (ret == -1)
+ if(ret == -1)
{
SystemException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
@@ -292,7 +292,7 @@ IcePack::Activator::terminationListener()
err.append(s, ret);
ret = read(fd, &s, 16);
}
- while (ret != 0);
+ while(ret != 0);
Error out(_communicator->getLogger());
out << err;
@@ -311,7 +311,7 @@ void
IcePack::Activator::clearInterrupt()
{
char s[32]; // Clear up to 32 interrupts at once.
- while (read(_fdIntrRead, s, 32) == 32)
+ while(read(_fdIntrRead, s, 32) == 32)
{
}
}
diff --git a/cpp/src/IcePack/Activator.h b/cpp/src/IcePack/Activator.h
index c5bb6943c1b..764d3f85839 100644
--- a/cpp/src/IcePack/Activator.h
+++ b/cpp/src/IcePack/Activator.h
@@ -1,55 +1,55 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PACK_ACTIVATOR_H
-#define ICE_PACK_ACTIVATOR_H
-
-#include <IceUtil/Thread.h>
-
-namespace IcePack
-{
-
-struct ServerDescription;
-
-class Activator : public IceUtil::Thread, public IceUtil::Mutex
-{
-public:
-
- Activator(const Ice::CommunicatorPtr&);
- virtual ~Activator();
-
- virtual void run();
- void destroy();
- bool activate(const IcePack::ServerDescription&);
-
-private:
-
- void terminationListener();
- void clearInterrupt();
- void setInterrupt();
-
- struct Process
- {
- pid_t pid;
- int fd;
- };
-
- Ice::CommunicatorPtr _communicator;
- std::map<std::string, Process> _processes;
- bool _destroy;
- int _fdIntrRead;
- int _fdIntrWrite;
-};
-
-typedef IceUtil::Handle<Activator> ActivatorPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_ACTIVATOR_H
+#define ICE_PACK_ACTIVATOR_H
+
+#include <IceUtil/Thread.h>
+
+namespace IcePack
+{
+
+struct ServerDescription;
+
+class Activator : public IceUtil::Thread, public IceUtil::Mutex
+{
+public:
+
+ Activator(const Ice::CommunicatorPtr&);
+ virtual ~Activator();
+
+ virtual void run();
+ void destroy();
+ bool activate(const IcePack::ServerDescription&);
+
+private:
+
+ void terminationListener();
+ void clearInterrupt();
+ void setInterrupt();
+
+ struct Process
+ {
+ pid_t pid;
+ int fd;
+ };
+
+ Ice::CommunicatorPtr _communicator;
+ std::map<std::string, Process> _processes;
+ bool _destroy;
+ int _fdIntrRead;
+ int _fdIntrWrite;
+};
+
+typedef IceUtil::Handle<Activator> ActivatorPtr;
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp
index 5d35a30e3ba..c5b4e21713f 100644
--- a/cpp/src/IcePack/AdminI.cpp
+++ b/cpp/src/IcePack/AdminI.cpp
@@ -25,7 +25,7 @@ IcePack::AdminI::add(const ServerDescription& desc, const Ice::Current&)
{
IceUtil::Mutex::Lock sync(*this);
- if (desc.object)
+ if(desc.object)
{
_serverDescriptions[desc.object->ice_getIdentity()] = desc;
}
@@ -44,7 +44,7 @@ IcePack::AdminI::find(const Identity& ident, const Ice::Current&)
IceUtil::Mutex::Lock sync(*this);
ServerDescriptions::iterator p = _serverDescriptions.find(ident);
- if (p != _serverDescriptions.end())
+ if(p != _serverDescriptions.end())
{
return p->second;
}
diff --git a/cpp/src/IcePack/AdminI.h b/cpp/src/IcePack/AdminI.h
index 6c000d2cbcc..92d9c3e0fd8 100644
--- a/cpp/src/IcePack/AdminI.h
+++ b/cpp/src/IcePack/AdminI.h
@@ -1,38 +1,38 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PACK_ADMIN_I_H
-#define ICE_PACK_ADMIN_I_H
-
-#include <IcePack/Admin.h>
-
-namespace IcePack
-{
-
-class AdminI : public Admin, public IceUtil::Mutex
-{
-public:
-
- AdminI(const Ice::CommunicatorPtr&);
-
- virtual void add(const ServerDescription&, const Ice::Current&);
- virtual void remove(const Ice::Identity&, const Ice::Current&);
- virtual ServerDescription find(const Ice::Identity&, const Ice::Current&);
- virtual ServerDescriptions getAll(const Ice::Current&);
- virtual void shutdown(const Ice::Current&);
-
-private:
-
- Ice::CommunicatorPtr _communicator;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_ADMIN_I_H
+#define ICE_PACK_ADMIN_I_H
+
+#include <IcePack/Admin.h>
+
+namespace IcePack
+{
+
+class AdminI : public Admin, public IceUtil::Mutex
+{
+public:
+
+ AdminI(const Ice::CommunicatorPtr&);
+
+ virtual void add(const ServerDescription&, const Ice::Current&);
+ virtual void remove(const Ice::Identity&, const Ice::Current&);
+ virtual ServerDescription find(const Ice::Identity&, const Ice::Current&);
+ virtual ServerDescriptions getAll(const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+
+private:
+
+ Ice::CommunicatorPtr _communicator;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/Client.cpp b/cpp/src/IcePack/Client.cpp
index 0d468109d10..fe379cae26e 100644
--- a/cpp/src/IcePack/Client.cpp
+++ b/cpp/src/IcePack/Client.cpp
@@ -62,43 +62,43 @@ Client::run(int argc, char* argv[])
stringSeqToArgs(args, argc, argv);
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-e") == 0)
+ else if(strcmp(argv[idx], "-e") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << appName() << ": argument expected for`" << argv[idx] << "'" << endl;
usage();
@@ -108,22 +108,22 @@ Client::run(int argc, char* argv[])
commands += argv[idx + 1];
commands += ';';
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << appName() << ": unknown option `" << argv[idx] << "'" << endl;
usage();
@@ -135,7 +135,7 @@ Client::run(int argc, char* argv[])
}
}
- if (argc >= 2 && !commands.empty())
+ if(argc >= 2 && !commands.empty())
{
cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
usage();
@@ -144,7 +144,7 @@ Client::run(int argc, char* argv[])
const char* adminEndpointsProperty = "IcePack.Admin.Endpoints";
string adminEndpoints = properties->getProperty(adminEndpointsProperty);
- if (adminEndpoints.empty())
+ if(adminEndpoints.empty())
{
cerr << appName() << ": property `" << adminEndpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -152,7 +152,7 @@ Client::run(int argc, char* argv[])
Ice::ObjectPrx base = communicator()->stringToProxy("admin:" + adminEndpoints);
AdminPrx admin = AdminPrx::checkedCast(base);
- if (!admin)
+ if(!admin)
{
cerr << appName() << ": `" << adminEndpoints << "' are no valid administrative endpoints" << endl;
return EXIT_FAILURE;
@@ -161,12 +161,12 @@ Client::run(int argc, char* argv[])
ParserPtr parser = Parser::createParser(communicator(), admin);
int status = EXIT_SUCCESS;
- if (argc < 2) // No files given
+ if(argc < 2) // No files given
{
- if (!commands.empty()) // Commands were given
+ if(!commands.empty()) // Commands were given
{
int parseStatus = parser->parse(commands, debug);
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -174,7 +174,7 @@ Client::run(int argc, char* argv[])
else // No commands, let's use standard input
{
int parseStatus = parser->parse(stdin, debug);
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -182,10 +182,10 @@ Client::run(int argc, char* argv[])
}
else // Process files given on the command line
{
- for (idx = 1 ; idx < argc ; ++idx)
+ for(idx = 1 ; idx < argc ; ++idx)
{
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << appName() << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -198,7 +198,7 @@ Client::run(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == NULL)
+ if(cppHandle == NULL)
{
cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -212,7 +212,7 @@ Client::run(int argc, char* argv[])
pclose(cppHandle);
#endif
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
diff --git a/cpp/src/IcePack/Forward.cpp b/cpp/src/IcePack/Forward.cpp
index 008b1b605db..e55f4b64f45 100644
--- a/cpp/src/IcePack/Forward.cpp
+++ b/cpp/src/IcePack/Forward.cpp
@@ -25,7 +25,7 @@ IcePack::Forward::Forward(const CommunicatorPtr& communicator, const AdminPtr& a
_activator->start();
_waitTime = _communicator->getProperties()->getPropertyAsIntWithDefault("IcePack.Activator.WaitTime", 10);
- if (_waitTime < 0)
+ if(_waitTime < 0)
{
_waitTime = 0;
}
@@ -48,7 +48,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current
// If we didn't find a server description, we return null, meaning
// that the client will get an "object not exist" exception.
//
- if (!desc.object)
+ if(!desc.object)
{
return 0;
}
@@ -60,13 +60,13 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current
//
// We only try to activate if we have a path for the server
//
- if (!desc.path.empty())
+ if(!desc.path.empty())
{
try
{
bool doSleep = false;
int count = 0;
- while (true)
+ while(true)
{
try
{
@@ -74,7 +74,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current
// Activate the server. If the server is already
// running, this operation does nothing.
//
- if (_activator->activate(desc))
+ if(_activator->activate(desc))
{
//
// If we just activated the server, we sleep
@@ -84,7 +84,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current
doSleep = true;
}
- if (doSleep)
+ if(doSleep)
{
sleep(1);
}
@@ -120,7 +120,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const Current& current
// to give the server more time before we try
// again.
//
- if (++count >= _waitTime)
+ if(++count >= _waitTime)
{
throw;
}
diff --git a/cpp/src/IcePack/Forward.h b/cpp/src/IcePack/Forward.h
index ac2f2646238..3c73b5f10d3 100644
--- a/cpp/src/IcePack/Forward.h
+++ b/cpp/src/IcePack/Forward.h
@@ -1,46 +1,46 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PACK_FORWARD_H
-#define ICE_PACK_FORWARD_H
-
-#include <IcePack/AdminF.h>
-#ifndef _WIN32
-# include <IcePack/Activator.h>
-#endif
-
-namespace IcePack
-{
-
-class Forward : public Ice::ServantLocator
-{
-public:
-
- Forward(const Ice::CommunicatorPtr& communicator, const AdminPtr&);
- virtual ~Forward();
-
- virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&);
- virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&,
- const Ice::ObjectPtr&, const Ice::LocalObjectPtr&);
- virtual void deactivate();
-
-private:
-
- Ice::CommunicatorPtr _communicator;
- AdminPtr _admin;
-#ifndef _WIN32
- ActivatorPtr _activator;
- int _waitTime;
-#endif
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_FORWARD_H
+#define ICE_PACK_FORWARD_H
+
+#include <IcePack/AdminF.h>
+#ifndef _WIN32
+# include <IcePack/Activator.h>
+#endif
+
+namespace IcePack
+{
+
+class Forward : public Ice::ServantLocator
+{
+public:
+
+ Forward(const Ice::CommunicatorPtr& communicator, const AdminPtr&);
+ virtual ~Forward();
+
+ virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&);
+ virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&,
+ const Ice::ObjectPtr&, const Ice::LocalObjectPtr&);
+ virtual void deactivate();
+
+private:
+
+ Ice::CommunicatorPtr _communicator;
+ AdminPtr _admin;
+#ifndef _WIN32
+ ActivatorPtr _activator;
+ int _waitTime;
+#endif
+};
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp
index 89292bf17e7..9e807e60991 100644
--- a/cpp/src/IcePack/Parser.cpp
+++ b/cpp/src/IcePack/Parser.cpp
@@ -51,7 +51,7 @@ IcePack::Parser::usage()
void
IcePack::Parser::add(const list<string>& args)
{
- if (args.empty())
+ if(args.empty())
{
error("`add' requires at least one argument (type `help' for more info)");
return;
@@ -62,10 +62,10 @@ IcePack::Parser::add(const list<string>& args)
ServerDescription desc;
list<string>::const_iterator p = args.begin();
desc.object = _communicator->stringToProxy(*p);
- if (++p != args.end())
+ if(++p != args.end())
{
desc.path = *p;
- while (++p != args.end())
+ while(++p != args.end())
{
desc.args.push_back(*p);
}
@@ -84,7 +84,7 @@ IcePack::Parser::add(const list<string>& args)
void
IcePack::Parser::remove(const list<string>& args)
{
- if (args.size() != 1)
+ if(args.size() != 1)
{
error("`remove' requires exactly one argument (type `help' for more info)");
return;
@@ -116,12 +116,12 @@ IcePack::Parser::listAll()
cout << "host = " << p->second.host << endl;
cout << "path = " << p->second.path << endl;
cout << "args =";
- for (Args::iterator q = p->second.args.begin(); q != p->second.args.end(); ++q)
+ for(Args::iterator q = p->second.args.begin(); q != p->second.args.end(); ++q)
{
cout << ' ' << *q;
}
cout << endl;
- if (++p != descriptions.end())
+ if(++p != descriptions.end())
{
cout << endl;
}
@@ -153,9 +153,9 @@ IcePack::Parser::shutdown()
void
IcePack::Parser::getInput(char* buf, int& result, int maxSize)
{
- if (!_commands.empty())
+ if(!_commands.empty())
{
- if (_commands == ";")
+ if(_commands == ";")
{
result = 0;
}
@@ -169,30 +169,30 @@ IcePack::Parser::getInput(char* buf, int& result, int maxSize)
#endif
strncpy(buf, _commands.c_str(), result);
_commands.erase(0, result);
- if (_commands.empty())
+ if(_commands.empty())
{
_commands = ";";
}
}
}
- else if (isatty(fileno(yyin)))
+ else if(isatty(fileno(yyin)))
{
#ifdef HAVE_READLINE
char* line = readline(parser->getPrompt());
- if (!line)
+ if(!line)
{
result = 0;
}
else
{
- if (*line)
+ if(*line)
{
add_history(line);
}
result = strlen(line) + 1;
- if (result > maxSize)
+ if(result > maxSize)
{
free(line);
error("input line too long");
@@ -211,12 +211,12 @@ IcePack::Parser::getInput(char* buf, int& result, int maxSize)
cout << parser->getPrompt() << flush;
string line;
- while (true)
+ while(true)
{
char c = static_cast<char>(getc(yyin));
- if (c == EOF)
+ if(c == EOF)
{
- if (line.size())
+ if(line.size())
{
line += '\n';
}
@@ -225,14 +225,14 @@ IcePack::Parser::getInput(char* buf, int& result, int maxSize)
line += c;
- if (c == '\n')
+ if(c == '\n')
{
break;
}
}
result = line.length();
- if (result > maxSize)
+ if(result > maxSize)
{
error("input line too long");
buf[0] = EOF;
@@ -247,7 +247,7 @@ IcePack::Parser::getInput(char* buf, int& result, int maxSize)
}
else
{
- if (((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ if(((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
{
error("input in flex scanner failed");
buf[0] = EOF;
@@ -273,7 +273,7 @@ IcePack::Parser::getPrompt()
{
assert(_commands.empty() && isatty(fileno(yyin)));
- if (_continue)
+ if(_continue)
{
_continue = false;
return "(cont) ";
@@ -291,13 +291,13 @@ IcePack::Parser::scanPosition(const char* s)
string::size_type idx;
idx = line.find("line");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx + 4);
}
idx = line.find_first_not_of(" \t\r#");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
@@ -305,18 +305,18 @@ IcePack::Parser::scanPosition(const char* s)
_currentLine = atoi(line.c_str()) - 1;
idx = line.find_first_of(" \t\r");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
idx = line.find_first_not_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
idx = line.find_first_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
_currentFile = line.substr(0, idx);
line.erase(0, idx + 1);
@@ -331,7 +331,7 @@ IcePack::Parser::scanPosition(const char* s)
void
IcePack::Parser::error(const char* s)
{
- if (_commands.empty() && !isatty(fileno(yyin)))
+ if(_commands.empty() && !isatty(fileno(yyin)))
{
cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
}
@@ -351,7 +351,7 @@ IcePack::Parser::error(const string& s)
void
IcePack::Parser::warning(const char* s)
{
- if (_commands.empty() && !isatty(fileno(yyin)))
+ if(_commands.empty() && !isatty(fileno(yyin)))
{
cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
@@ -387,7 +387,7 @@ IcePack::Parser::parse(FILE* file, bool debug)
nextLine();
int status = yyparse();
- if (_errors)
+ if(_errors)
{
status = EXIT_FAILURE;
}
@@ -416,7 +416,7 @@ IcePack::Parser::parse(const std::string& commands, bool debug)
nextLine();
int status = yyparse();
- if (_errors)
+ if(_errors)
{
status = EXIT_FAILURE;
}
diff --git a/cpp/src/IcePack/Parser.h b/cpp/src/IcePack/Parser.h
index cbb3fb058d0..3d284a203c4 100644
--- a/cpp/src/IcePack/Parser.h
+++ b/cpp/src/IcePack/Parser.h
@@ -1,107 +1,107 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PACK_PARSER_H
-#define ICE_PACK_PARSER_H
-
-#include <IceUtil/Handle.h>
-#include <IcePack/Admin.h>
-#include <list>
-
-#ifdef _WIN32
-# include <io.h>
-# define isatty _isatty
-# define fileno _fileno
-// '_isatty' : inconsistent dll linkage. dllexport assumed.
-# pragma warning( disable : 4273 )
-#endif
-
-//
-// Stuff for flex and bison
-//
-
-#define YYSTYPE std::list<std::string>
-#define YY_DECL int yylex(YYSTYPE* yylvalp)
-YY_DECL;
-int yyparse();
-
-//
-// I must set the initial stack depth to the maximum stack depth to
-// disable bison stack resizing. The bison stack resizing routines use
-// simple malloc/alloc/memcpy calls, which do not work for the
-// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor,
-// assignment operator, etc.
-//
-#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum.
-#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above.
-
-//
-// Newer bison versions allow to disable stack resizing by defining
-// yyoverflow.
-//
-#define yyoverflow(a, b, c, d, e, f) yyerror(a)
-
-namespace IcePack
-{
-
-class Parser;
-typedef ::IceUtil::Handle<Parser> ParserPtr;
-
-}
-
-namespace IcePack
-{
-
-class Parser : public ::IceUtil::SimpleShared
-{
-public:
-
- static ParserPtr createParser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&);
-
- void usage();
-
- void add(const std::list<std::string>&);
- void remove(const std::list<std::string>&);
- void listAll();
- void shutdown();
-
- void getInput(char*, int&, int);
- void nextLine();
- void continueLine();
- char* getPrompt();
- void scanPosition(const char*);
-
- void error(const char*);
- void error(const std::string&);
-
- void warning(const char*);
- void warning(const std::string&);
-
- int parse(FILE*, bool);
- int parse(const std::string&, bool);
-
-private:
-
- Parser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&);
-
- std::string _commands;
- Ice::CommunicatorPtr _communicator;
- IcePack::AdminPrx _admin;
- bool _continue;
- int _errors;
- int _currentLine;
- std::string _currentFile;
-};
-
-extern Parser* parser; // The current parser for bison/flex
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_PARSER_H
+#define ICE_PACK_PARSER_H
+
+#include <IceUtil/Handle.h>
+#include <IcePack/Admin.h>
+#include <list>
+
+#ifdef _WIN32
+# include <io.h>
+# define isatty _isatty
+# define fileno _fileno
+// '_isatty' : inconsistent dll linkage. dllexport assumed.
+# pragma warning( disable : 4273 )
+#endif
+
+//
+// Stuff for flex and bison
+//
+
+#define YYSTYPE std::list<std::string>
+#define YY_DECL int yylex(YYSTYPE* yylvalp)
+YY_DECL;
+int yyparse();
+
+//
+// I must set the initial stack depth to the maximum stack depth to
+// disable bison stack resizing. The bison stack resizing routines use
+// simple malloc/alloc/memcpy calls, which do not work for the
+// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor,
+// assignment operator, etc.
+//
+#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum.
+#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above.
+
+//
+// Newer bison versions allow to disable stack resizing by defining
+// yyoverflow.
+//
+#define yyoverflow(a, b, c, d, e, f) yyerror(a)
+
+namespace IcePack
+{
+
+class Parser;
+typedef ::IceUtil::Handle<Parser> ParserPtr;
+
+}
+
+namespace IcePack
+{
+
+class Parser : public ::IceUtil::SimpleShared
+{
+public:
+
+ static ParserPtr createParser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&);
+
+ void usage();
+
+ void add(const std::list<std::string>&);
+ void remove(const std::list<std::string>&);
+ void listAll();
+ void shutdown();
+
+ void getInput(char*, int&, int);
+ void nextLine();
+ void continueLine();
+ char* getPrompt();
+ void scanPosition(const char*);
+
+ void error(const char*);
+ void error(const std::string&);
+
+ void warning(const char*);
+ void warning(const std::string&);
+
+ int parse(FILE*, bool);
+ int parse(const std::string&, bool);
+
+private:
+
+ Parser(const Ice::CommunicatorPtr&, const IcePack::AdminPrx&);
+
+ std::string _commands;
+ Ice::CommunicatorPtr _communicator;
+ IcePack::AdminPrx _admin;
+ bool _continue;
+ int _errors;
+ int _currentLine;
+ std::string _currentFile;
+};
+
+extern Parser* parser; // The current parser for bison/flex
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/Server.cpp b/cpp/src/IcePack/Server.cpp
index 3697d74b263..5e3332f2ff0 100644
--- a/cpp/src/IcePack/Server.cpp
+++ b/cpp/src/IcePack/Server.cpp
@@ -78,19 +78,19 @@ Server::run(int argc, char* argv[])
stringSeqToArgs(args, argc, argv);
bool nowarn = false;
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "--nowarn") == 0)
+ else if(strcmp(argv[i], "--nowarn") == 0)
{
nowarn = true;
}
@@ -104,7 +104,7 @@ Server::run(int argc, char* argv[])
const char* adminEndpointsProperty = "IcePack.Admin.Endpoints";
string adminEndpoints = properties->getProperty(adminEndpointsProperty);
- if (!adminEndpoints.empty() && !nowarn)
+ if(!adminEndpoints.empty() && !nowarn)
{
cerr << appName() << ": warning: administrative endpoints property `" << adminEndpointsProperty << "' enabled"
<< endl;
@@ -112,7 +112,7 @@ Server::run(int argc, char* argv[])
const char* forwardEndpointsProperty = "IcePack.Forward.Endpoints";
string forwardEndpoints = properties->getProperty(forwardEndpointsProperty);
- if (forwardEndpoints.empty())
+ if(forwardEndpoints.empty())
{
cerr << appName() << ": property `" << forwardEndpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -121,7 +121,7 @@ Server::run(int argc, char* argv[])
AdminPtr admin = new AdminI(communicator());
ServantLocatorPtr forward = new Forward(communicator(), admin);
- if (adminEndpoints.length() != 0)
+ if(adminEndpoints.length() != 0)
{
ObjectAdapterPtr adminAdapter = communicator()->createObjectAdapterFromProperty("Admin",
adminEndpointsProperty);
diff --git a/cpp/src/IcePack/dummyinclude/unistd.h b/cpp/src/IcePack/dummyinclude/unistd.h
index 92d53d10b9b..a5868056a35 100644
--- a/cpp/src/IcePack/dummyinclude/unistd.h
+++ b/cpp/src/IcePack/dummyinclude/unistd.h
@@ -1,4 +1,4 @@
-//
-// Files generated by flex need unistd.h, which is not available on
-// Windows. Thus this dummy file.
-//
+//
+// Files generated by flex need unistd.h, which is not available on
+// Windows. Thus this dummy file.
+//
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp
index 2d7447b7497..eef4467867f 100644
--- a/cpp/src/IcePatch/Client.cpp
+++ b/cpp/src/IcePatch/Client.cpp
@@ -58,19 +58,19 @@ IcePatch::Client::run(int argc, char* argv[])
try
{
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << appName() << ": unknown option `" << argv[idx] << "'" << endl;
usage();
@@ -83,9 +83,9 @@ IcePatch::Client::run(int argc, char* argv[])
}
vector<string> subdirs;
- if (argc > 1)
+ if(argc > 1)
{
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
subdirs.push_back(argv[i]);
}
@@ -102,11 +102,11 @@ IcePatch::Client::run(int argc, char* argv[])
//
const char* glacierStarterEndpointsProperty = "Glacier.Starter.Endpoints";
string glacierStarterEndpoints = properties->getProperty(glacierStarterEndpointsProperty);
- if (!glacierStarterEndpoints.empty())
+ if(!glacierStarterEndpoints.empty())
{
ObjectPrx starterBase = communicator()->stringToProxy("Glacier/starter:" + glacierStarterEndpoints);
Glacier::StarterPrx starter = Glacier::StarterPrx::checkedCast(starterBase);
- if (!starter)
+ if(!starter)
{
cerr << appName() << ": endpoints `" << glacierStarterEndpoints
<< "' do not refer to a glacier router starter" << endl;
@@ -117,7 +117,7 @@ IcePatch::Client::run(int argc, char* argv[])
ByteSeq publicKey;
ByteSeq routerCert;
- while (!router)
+ while(!router)
{
string id;
string pw;
@@ -143,7 +143,7 @@ IcePatch::Client::run(int argc, char* argv[])
}
string clientConfig = properties->getProperty("IceSSL.Client.Config");
- if (!clientConfig.empty())
+ if(!clientConfig.empty())
{
string privateKeyBase64 = IceUtil::Base64::encode(privateKey);
string publicKeyBase64 = IceUtil::Base64::encode(publicKey);
@@ -167,7 +167,7 @@ IcePatch::Client::run(int argc, char* argv[])
//
const char* endpointsProperty = "IcePatch.Endpoints";
string endpoints = properties->getProperty(endpointsProperty);
- if (endpoints.empty())
+ if(endpoints.empty())
{
cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -178,12 +178,12 @@ IcePatch::Client::run(int argc, char* argv[])
//
const char* directoryProperty = "IcePatch.Directory";
string directory = properties->getProperty(directoryProperty);
- if (!directory.empty())
+ if(!directory.empty())
{
#ifdef _WIN32
- if (_chdir(directory.c_str()) == -1)
+ if(_chdir(directory.c_str()) == -1)
#else
- if (chdir(directory.c_str()) == -1)
+ if(chdir(directory.c_str()) == -1)
#endif
{
cerr << appName() << ": cannot change to directory `" << directory << "': " << strerror(errno) << endl;
@@ -201,7 +201,7 @@ IcePatch::Client::run(int argc, char* argv[])
//
// Patch all subdirectories.
//
- for (vector<string>::const_iterator p = subdirs.begin(); p != subdirs.end(); ++p)
+ for(vector<string>::const_iterator p = subdirs.begin(); p != subdirs.end(); ++p)
{
Identity identity = pathToIdentity(*p);
ObjectPrx topObj = communicator()->stringToProxy(identityToString(identity) + ':' + endpoints);
@@ -211,16 +211,16 @@ IcePatch::Client::run(int argc, char* argv[])
assert(topDesc);
string path = identityToPath(topDesc->directory->ice_getIdentity());
string::size_type pos = 0;
- while (pos < path.size())
+ while(pos < path.size())
{
string::size_type pos2 = path.find('/', pos);
- if (pos2 == string::npos)
+ if(pos2 == string::npos)
{
pos2 = path.size();
}
string subPath = path.substr(0, pos2);
FileInfo subPathInfo = getFileInfo(subPath, false);
- if (subPathInfo.type == FileTypeNotExist)
+ if(subPathInfo.type == FileTypeNotExist)
{
createDirectory(subPath);
cout << subPath << ": created" << endl;
@@ -236,7 +236,7 @@ IcePatch::Client::run(int argc, char* argv[])
{
cout << endl; // There might still be a non-terminated line on cout.
cerr << appName() << ": " << ex << ":\n" << ex.reason << endl;
- if (router)
+ if(router)
{
router->shutdown();
}
@@ -246,14 +246,14 @@ IcePatch::Client::run(int argc, char* argv[])
{
cout << endl; // There might still be a non-terminated line on cout.
cerr << appName() << ": patching service busy, try again later" << endl;
- if (router)
+ if(router)
{
router->shutdown();
}
return EXIT_FAILURE;
}
- if (router)
+ if(router)
{
router->shutdown();
}
@@ -265,7 +265,7 @@ string
IcePatch::Client::pathToName(const string& path)
{
string::size_type pos = path.rfind('/');
- if (pos == string::npos)
+ if(pos == string::npos)
{
return path;
}
@@ -318,12 +318,12 @@ public:
void
IcePatch::Client::patch(const FileDescSeq& fileDescSeq, const string& indent)
{
- for (unsigned int i = 0; i < fileDescSeq.size(); ++i)
+ for(unsigned int i = 0; i < fileDescSeq.size(); ++i)
{
string path;
DirectoryDescPtr directoryDesc = DirectoryDescPtr::dynamicCast(fileDescSeq[i]);
RegularDescPtr regularDesc;
- if (directoryDesc)
+ if(directoryDesc)
{
path = identityToPath(directoryDesc->directory->ice_getIdentity());
}
@@ -336,10 +336,10 @@ IcePatch::Client::patch(const FileDescSeq& fileDescSeq, const string& indent)
bool last = (i == fileDescSeq.size() - 1);
- if (directoryDesc)
+ if(directoryDesc)
{
string newIndent;
- if (last)
+ if(last)
{
newIndent = indent + " ";
}
@@ -350,7 +350,7 @@ IcePatch::Client::patch(const FileDescSeq& fileDescSeq, const string& indent)
cout << indent << "+-" << pathToName(path) << ":";
FileInfo info = getFileInfo(path, false);
- switch (info.type)
+ switch(info.type)
{
case FileTypeNotExist:
{
@@ -393,7 +393,7 @@ IcePatch::Client::patch(const FileDescSeq& fileDescSeq, const string& indent)
MyProgressCB progressCB;
FileInfo info = getFileInfo(path, false);
- switch (info.type)
+ switch(info.type)
{
case FileTypeNotExist:
{
@@ -414,12 +414,12 @@ IcePatch::Client::patch(const FileDescSeq& fileDescSeq, const string& indent)
string pathMD5 = path + ".md5";
FileInfo infoMD5 = getFileInfo(pathMD5, false);
- if (infoMD5.type == FileTypeRegular && infoMD5.time >= info.time)
+ if(infoMD5.type == FileTypeRegular && infoMD5.time >= info.time)
{
md5 = getMD5(path);
}
- if (md5 != regularDesc->md5)
+ if(md5 != regularDesc->md5)
{
removeRecursive(path);
getRegular(regularDesc->regular, progressCB);
@@ -440,7 +440,7 @@ IcePatch::Client::patch(const FileDescSeq& fileDescSeq, const string& indent)
}
}
- if (last)
+ if(last)
{
cout << indent << endl;
}
diff --git a/cpp/src/IcePatch/FileDescFactory.cpp b/cpp/src/IcePatch/FileDescFactory.cpp
index 76044fd700d..75627d27a74 100644
--- a/cpp/src/IcePatch/FileDescFactory.cpp
+++ b/cpp/src/IcePatch/FileDescFactory.cpp
@@ -17,12 +17,12 @@ using namespace IcePatch;
ObjectPtr
IcePatch::FileDescFactory::create(const std::string& type)
{
- if (type == "::IcePatch::DirectoryDesc")
+ if(type == "::IcePatch::DirectoryDesc")
{
return new DirectoryDesc;
}
- if (type == "::IcePatch::RegularDesc")
+ if(type == "::IcePatch::RegularDesc")
{
return new RegularDesc;
}
diff --git a/cpp/src/IcePatch/FileLocator.cpp b/cpp/src/IcePatch/FileLocator.cpp
index bcf0a46cab7..140bb522fff 100644
--- a/cpp/src/IcePatch/FileLocator.cpp
+++ b/cpp/src/IcePatch/FileLocator.cpp
@@ -30,27 +30,27 @@ IcePatch::FileLocator::locate(const ObjectAdapterPtr& adapter, const Current& cu
//
string path = identityToPath(current.identity);
- if (path.empty()) // Empty paths are not permissible.
+ if(path.empty()) // Empty paths are not permissible.
{
return 0;
}
- if (path[0] == '/') // Path must not start with '/'.
+ if(path[0] == '/') // Path must not start with '/'.
{
return 0;
}
- if (path.find("..") != string::npos) // Path must not contain '..'.
+ if(path.find("..") != string::npos) // Path must not contain '..'.
{
return 0;
}
- if (path.find(':') == 1) // Path cannot contain ':' as second character.
+ if(path.find(':') == 1) // Path cannot contain ':' as second character.
{
return 0;
}
- if (ignoreSuffix(path)) // Some suffixes are reserved.
+ if(ignoreSuffix(path)) // Some suffixes are reserved.
{
return 0;
}
@@ -67,7 +67,7 @@ IcePatch::FileLocator::locate(const ObjectAdapterPtr& adapter, const Current& cu
return 0;
}
- switch (info.type)
+ switch(info.type)
{
case FileTypeDirectory:
{
diff --git a/cpp/src/IcePatch/FileLocator.h b/cpp/src/IcePatch/FileLocator.h
index 83c77f15b0a..c8290ad761a 100644
--- a/cpp/src/IcePatch/FileLocator.h
+++ b/cpp/src/IcePatch/FileLocator.h
@@ -1,41 +1,41 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PATCH_FILE_LOCATOR_H
-#define ICE_PATCH_FILE_LOCATOR_H
-
-#include <Ice/Ice.h>
-#include <IcePatch/IcePatch.h>
-
-namespace IcePatch
-{
-
-class FileLocator: virtual public Ice::ServantLocator
-{
-public:
-
- FileLocator(const Ice::ObjectAdapterPtr&);
-
- virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&);
-
- virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&, const Ice::ObjectPtr&,
- const Ice::LocalObjectPtr&);
-
- virtual void deactivate();
-
-private:
-
- DirectoryPtr _directory; // The stateless default servant for all directories.
- RegularPtr _regular; // The stateless default servant for all regular files.
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PATCH_FILE_LOCATOR_H
+#define ICE_PATCH_FILE_LOCATOR_H
+
+#include <Ice/Ice.h>
+#include <IcePatch/IcePatch.h>
+
+namespace IcePatch
+{
+
+class FileLocator: virtual public Ice::ServantLocator
+{
+public:
+
+ FileLocator(const Ice::ObjectAdapterPtr&);
+
+ virtual Ice::ObjectPtr locate(const Ice::ObjectAdapterPtr&, const Ice::Current&, Ice::LocalObjectPtr&);
+
+ virtual void finished(const Ice::ObjectAdapterPtr&, const Ice::Current&, const Ice::ObjectPtr&,
+ const Ice::LocalObjectPtr&);
+
+ virtual void deactivate();
+
+private:
+
+ DirectoryPtr _directory; // The stateless default servant for all directories.
+ RegularPtr _regular; // The stateless default servant for all regular files.
+};
+
+}
+
+#endif
diff --git a/cpp/src/IcePatch/IcePatchI.cpp b/cpp/src/IcePatch/IcePatchI.cpp
index dd9de9b2c35..bdaa5a5b118 100644
--- a/cpp/src/IcePatch/IcePatchI.cpp
+++ b/cpp/src/IcePatch/IcePatchI.cpp
@@ -53,15 +53,15 @@ IcePatch::DirectoryI::getContents(const Ice::Current& current)
string path = identityToPath(current.identity);
StringSeq paths = readDirectory(path);
filteredPaths.reserve(paths.size() / 3);
- for (StringSeq::const_iterator p = paths.begin(); p != paths.end(); ++p)
+ for(StringSeq::const_iterator p = paths.begin(); p != paths.end(); ++p)
{
- if (ignoreSuffix(*p))
+ if(ignoreSuffix(*p))
{
pair<StringSeq::const_iterator, StringSeq::const_iterator> r =
equal_range(paths.begin(), paths.end(), removeSuffix(*p));
- if (r.first == r.second)
+ if(r.first == r.second)
{
- if (!syncUpgraded)
+ if(!syncUpgraded)
{
sync.timedUpgrade(_busyTimeout);
syncUpgraded = true;
@@ -69,11 +69,11 @@ IcePatch::DirectoryI::getContents(const Ice::Current& current)
StringSeq paths2 = readDirectory(path);
pair<StringSeq::const_iterator, StringSeq::const_iterator> r2 =
equal_range(paths2.begin(), paths2.end(), removeSuffix(*p));
- if (r2.first == r2.second)
+ if(r2.first == r2.second)
{
removeRecursive(*p);
- if (_traceLevel > 0)
+ if(_traceLevel > 0)
{
Trace out(_logger, "IcePatch");
out << "removed orphaned file `" << *p << "'";
@@ -98,7 +98,7 @@ IcePatch::DirectoryI::getContents(const Ice::Current& current)
//
FileDescSeq result;
result.reserve(filteredPaths.size());
- for (StringSeq::const_iterator p = filteredPaths.begin(); p != filteredPaths.end(); ++p)
+ for(StringSeq::const_iterator p = filteredPaths.begin(); p != filteredPaths.end(); ++p)
{
FilePrx file = FilePrx::uncheckedCast(_adapter->createProxy(pathToIdentity(*p)));
try
@@ -131,15 +131,15 @@ IcePatch::RegularI::describe(const Ice::Current& current)
FileInfo info = getFileInfo(path, true);
FileInfo infoMD5 = getFileInfo(path + ".md5", false);
- if (infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
+ if(infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
{
sync.timedUpgrade(_busyTimeout);
infoMD5 = getFileInfo(path + ".md5", false);
- if (infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
+ if(infoMD5.type != FileTypeRegular || infoMD5.time <= info.time)
{
createMD5(path);
- if (_traceLevel > 0)
+ if(_traceLevel > 0)
{
Trace out(_logger, "IcePatch");
out << "created .md5 file for `" << path << "'";
@@ -168,15 +168,15 @@ IcePatch::RegularI::getBZ2Size(const Ice::Current& current)
FileInfo info = getFileInfo(path, true);
FileInfo infoBZ2 = getFileInfo(path + ".bz2", false);
- if (infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
{
sync.timedUpgrade(_busyTimeout);
infoBZ2 = getFileInfo(path + ".bz2", false);
- if (infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
{
createBZ2(path);
- if (_traceLevel > 0)
+ if(_traceLevel > 0)
{
Trace out(_logger, "IcePatch");
out << "created .bz2 file for `" << path << "'";
@@ -207,15 +207,15 @@ IcePatch::RegularI::getBZ2(Ice::Int pos, Ice::Int num, const Ice::Current& curre
FileInfo info = getFileInfo(path, true);
FileInfo infoBZ2 = getFileInfo(path + ".bz2", false);
- if (infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
{
sync.timedUpgrade(_busyTimeout);
infoBZ2 = getFileInfo(path + ".bz2", false);
- if (infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
{
createBZ2(path);
- if (_traceLevel > 0)
+ if(_traceLevel > 0)
{
Trace out(_logger, "IcePatch");
out << "created .bz2 file for `" << path << "'";
@@ -241,15 +241,15 @@ IcePatch::RegularI::getBZ2MD5(Ice::Int size, const Ice::Current& current)
FileInfo info = getFileInfo(path, true);
FileInfo infoBZ2 = getFileInfo(path + ".bz2", false);
- if (infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
{
sync.timedUpgrade(_busyTimeout);
infoBZ2 = getFileInfo(path + ".bz2", false);
- if (infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
+ if(infoBZ2.type != FileTypeRegular || infoBZ2.time <= info.time)
{
createBZ2(path);
- if (_traceLevel > 0)
+ if(_traceLevel > 0)
{
Trace out(_logger, "IcePatch");
out << "created .bz2 file for `" << path << "'";
diff --git a/cpp/src/IcePatch/IcePatchI.h b/cpp/src/IcePatch/IcePatchI.h
index 040b7d9e9c8..fb9f636eca9 100644
--- a/cpp/src/IcePatch/IcePatchI.h
+++ b/cpp/src/IcePatch/IcePatchI.h
@@ -1,62 +1,62 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PATCH_ICE_PATCH_I_H
-#define ICE_PATCH_ICE_PATCH_I_H
-
-#include <Ice/Ice.h>
-#include <IceUtil/RWRecMutex.h>
-#include <IcePatch/IcePatch.h>
-
-namespace IcePatch
-{
-
-class FileI : virtual public File
-{
-public:
-
- FileI(const Ice::ObjectAdapterPtr&);
-
-protected:
-
- Ice::ObjectAdapterPtr _adapter;
- Ice::LoggerPtr _logger;
- Ice::Int _traceLevel;
- IceUtil::Time _busyTimeout;
- static IceUtil::RWRecMutex _globalMutex;
-};
-
-class DirectoryI : virtual public Directory,
- virtual public FileI
-{
-public:
-
- DirectoryI(const Ice::ObjectAdapterPtr&);
-
- virtual FileDescPtr describe(const Ice::Current&);
- virtual FileDescSeq getContents(const Ice::Current&);
-};
-
-class RegularI : virtual public Regular,
- virtual public FileI
-{
-public:
-
- RegularI(const Ice::ObjectAdapterPtr&);
-
- virtual FileDescPtr describe(const Ice::Current&);
- virtual Ice::Int getBZ2Size(const Ice::Current&);
- virtual Ice::ByteSeq getBZ2(Ice::Int, Ice::Int, const Ice::Current&);
- virtual Ice::ByteSeq getBZ2MD5(Ice::Int, const Ice::Current&);
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PATCH_ICE_PATCH_I_H
+#define ICE_PATCH_ICE_PATCH_I_H
+
+#include <Ice/Ice.h>
+#include <IceUtil/RWRecMutex.h>
+#include <IcePatch/IcePatch.h>
+
+namespace IcePatch
+{
+
+class FileI : virtual public File
+{
+public:
+
+ FileI(const Ice::ObjectAdapterPtr&);
+
+protected:
+
+ Ice::ObjectAdapterPtr _adapter;
+ Ice::LoggerPtr _logger;
+ Ice::Int _traceLevel;
+ IceUtil::Time _busyTimeout;
+ static IceUtil::RWRecMutex _globalMutex;
+};
+
+class DirectoryI : virtual public Directory,
+ virtual public FileI
+{
+public:
+
+ DirectoryI(const Ice::ObjectAdapterPtr&);
+
+ virtual FileDescPtr describe(const Ice::Current&);
+ virtual FileDescSeq getContents(const Ice::Current&);
+};
+
+class RegularI : virtual public Regular,
+ virtual public FileI
+{
+public:
+
+ RegularI(const Ice::ObjectAdapterPtr&);
+
+ virtual FileDescPtr describe(const Ice::Current&);
+ virtual Ice::Int getBZ2Size(const Ice::Current&);
+ virtual Ice::ByteSeq getBZ2(Ice::Int, Ice::Int, const Ice::Current&);
+ virtual Ice::ByteSeq getBZ2MD5(Ice::Int, const Ice::Current&);
+};
+
+}
+
+#endif
diff --git a/cpp/src/IcePatch/Server.cpp b/cpp/src/IcePatch/Server.cpp
index 5ced21f7d3b..e8b14415ad8 100644
--- a/cpp/src/IcePatch/Server.cpp
+++ b/cpp/src/IcePatch/Server.cpp
@@ -66,14 +66,14 @@ IcePatch::Server::usage()
int
IcePatch::Server::run(int argc, char* argv[])
{
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
@@ -93,7 +93,7 @@ IcePatch::Server::run(int argc, char* argv[])
//
const char* endpointsProperty = "IcePatch.Endpoints";
string endpoints = properties->getProperty(endpointsProperty);
- if (endpoints.empty())
+ if(endpoints.empty())
{
cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -104,12 +104,12 @@ IcePatch::Server::run(int argc, char* argv[])
//
const char* directoryProperty = "IcePatch.Directory";
string directory = properties->getProperty(directoryProperty);
- if (!directory.empty())
+ if(!directory.empty())
{
#ifdef _WIN32
- if (_chdir(directory.c_str()) == -1)
+ if(_chdir(directory.c_str()) == -1)
#else
- if (chdir(directory.c_str()) == -1)
+ if(chdir(directory.c_str()) == -1)
#endif
{
cerr << appName() << ": cannot change to directory `" << directory << "': " << strerror(errno) << endl;
@@ -161,12 +161,12 @@ IcePatch::Updater::run()
PropertiesPtr properties = _adapter->getCommunicator()->getProperties();
IceUtil::Time updatePeriod = IceUtil::Time::seconds(
properties->getPropertyAsIntWithDefault("IcePatch.UpdatePeriod", 60));
- if (updatePeriod < IceUtil::Time::seconds(10))
+ if(updatePeriod < IceUtil::Time::seconds(10))
{
updatePeriod = IceUtil::Time::seconds(10);
}
- while (!_destroy)
+ while(!_destroy)
{
try
{
@@ -204,7 +204,7 @@ IcePatch::Updater::run()
out << "exception during update:\n" << ex;
}
- if (_destroy)
+ if(_destroy)
{
break;
}
@@ -224,15 +224,15 @@ IcePatch::Updater::destroy()
void
IcePatch::Updater::cleanup(const FileDescSeq& fileDescSeq)
{
- if (_destroy)
+ if(_destroy)
{
return;
}
- for (FileDescSeq::const_iterator p = fileDescSeq.begin(); p != fileDescSeq.end(); ++p)
+ for(FileDescSeq::const_iterator p = fileDescSeq.begin(); p != fileDescSeq.end(); ++p)
{
DirectoryDescPtr directoryDesc = DirectoryDescPtr::dynamicCast(*p);
- if (directoryDesc)
+ if(directoryDesc)
{
//
// Force .md5 files to be created and orphaned files to be
diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp
index 8bc4e4c8f72..6e5369d543b 100644
--- a/cpp/src/IcePatch/Util.cpp
+++ b/cpp/src/IcePatch/Util.cpp
@@ -45,27 +45,27 @@ normalizePath(const string& path)
string::size_type pos;
- for (pos = 0; pos < result.size(); ++pos)
+ for(pos = 0; pos < result.size(); ++pos)
{
- if (result[pos] == '\\')
+ if(result[pos] == '\\')
{
result[pos] = '/';
}
}
pos = 0;
- while ((pos = result.find("//", pos)) != string::npos)
+ while((pos = result.find("//", pos)) != string::npos)
{
result.erase(pos, 1);
}
pos = 0;
- while ((pos = result.find("/./", pos)) != string::npos)
+ while((pos = result.find("/./", pos)) != string::npos)
{
result.erase(pos, 2);
}
- if (result.substr(0, 2) == "./")
+ if(result.substr(0, 2) == "./")
{
result.erase(0, 2);
}
@@ -93,7 +93,7 @@ string
IcePatch::getSuffix(const string& path)
{
string::size_type pos = path.rfind('.');
- if (pos == string::npos)
+ if(pos == string::npos)
{
return string();
}
@@ -114,7 +114,7 @@ string
IcePatch::removeSuffix(const string& path)
{
string::size_type pos = path.rfind('.');
- if (pos == string::npos)
+ if(pos == string::npos)
{
return path;
}
@@ -128,9 +128,9 @@ FileInfo
IcePatch::getFileInfo(const string& path, bool exceptionIfNotExist)
{
struct stat buf;
- if (::stat(path.c_str(), &buf) == -1)
+ if(::stat(path.c_str(), &buf) == -1)
{
- if (!exceptionIfNotExist && errno == ENOENT)
+ if(!exceptionIfNotExist && errno == ENOENT)
{
FileInfo result;
result.size = 0;
@@ -150,11 +150,11 @@ IcePatch::getFileInfo(const string& path, bool exceptionIfNotExist)
result.size = buf.st_size;
result.time = buf.st_mtime;
- if (S_ISDIR(buf.st_mode))
+ if(S_ISDIR(buf.st_mode))
{
result.type = FileTypeDirectory;
}
- else if (S_ISREG(buf.st_mode))
+ else if(S_ISREG(buf.st_mode))
{
result.type = FileTypeRegular;
}
@@ -169,16 +169,16 @@ IcePatch::getFileInfo(const string& path, bool exceptionIfNotExist)
void
IcePatch::removeRecursive(const string& path)
{
- if (getFileInfo(path, true).type == FileTypeDirectory)
+ if(getFileInfo(path, true).type == FileTypeDirectory)
{
StringSeq paths = readDirectory(path);
- for (StringSeq::const_iterator p = paths.begin(); p != paths.end(); ++p)
+ for(StringSeq::const_iterator p = paths.begin(); p != paths.end(); ++p)
{
removeRecursive(*p);
}
}
- if (::remove(path.c_str()) == -1)
+ if(::remove(path.c_str()) == -1)
{
FileAccessException ex;
ex.reason = "cannot remove file `" + path + "': " + strerror(errno);
@@ -193,7 +193,7 @@ IcePatch::readDirectory(const string& path)
struct _finddata_t data;
long h = _findfirst((path + "/*").c_str(), &data);
- if (h == -1)
+ if(h == -1)
{
FileAccessException ex;
ex.reason = "cannot read directory `" + path + "': " + strerror(errno);
@@ -202,18 +202,18 @@ IcePatch::readDirectory(const string& path)
StringSeq result;
- while (true)
+ while(true)
{
string name = data.name;
- if (name != ".." && name != ".")
+ if(name != ".." && name != ".")
{
result.push_back(normalizePath(path + '/' + name));
}
- if (_findnext(h, &data) == -1)
+ if(_findnext(h, &data) == -1)
{
- if (errno == ENOENT)
+ if(errno == ENOENT)
{
break;
}
@@ -235,7 +235,7 @@ IcePatch::readDirectory(const string& path)
struct dirent **namelist;
int n = ::scandir(path.c_str(), &namelist, 0, alphasort);
- if (n < 0)
+ if(n < 0)
{
FileAccessException ex;
ex.reason = "cannot read directory `" + path + "': " + strerror(errno);
@@ -245,13 +245,13 @@ IcePatch::readDirectory(const string& path)
StringSeq result;
result.reserve(n - 2);
- for (int i = 0; i < n; ++i)
+ for(int i = 0; i < n; ++i)
{
string name = namelist[i]->d_name;
free(namelist[i]);
- if (name != ".." && name != ".")
+ if(name != ".." && name != ".")
{
result.push_back(normalizePath(path + '/' + name));
}
@@ -267,9 +267,9 @@ void
IcePatch::createDirectory(const string& path)
{
#ifdef _WIN32
- if (::_mkdir(path.c_str()) == -1)
+ if(::_mkdir(path.c_str()) == -1)
#else
- if (::mkdir(path.c_str(), 00777) == -1)
+ if(::mkdir(path.c_str(), 00777) == -1)
#endif
{
FileAccessException ex;
@@ -283,7 +283,7 @@ IcePatch::getMD5(const string& path)
{
string pathMD5 = path + ".md5";
ifstream fileMD5(pathMD5.c_str(), ios::binary);
- if (!fileMD5)
+ if(!fileMD5)
{
FileAccessException ex;
ex.reason = "cannot open `" + pathMD5 + "' for reading: " + strerror(errno);
@@ -292,13 +292,13 @@ IcePatch::getMD5(const string& path)
ByteSeq bytesMD5;
bytesMD5.resize(16);
fileMD5.read(&bytesMD5[0], 16);
- if (!fileMD5)
+ if(!fileMD5)
{
FileAccessException ex;
ex.reason = "cannot read `" + pathMD5 + "': " + strerror(errno);
throw ex;
}
- if (fileMD5.gcount() < 16)
+ if(fileMD5.gcount() < 16)
{
FileAccessException ex;
ex.reason = "could not read 16 bytes from `" + pathMD5 + "'";
@@ -311,7 +311,7 @@ IcePatch::getMD5(const string& path)
ByteSeq
IcePatch::getPartialMD5(const string& path, Int size)
{
- if (size < 0)
+ if(size < 0)
{
FileAccessException ex;
ex.reason = "negative file size is illegal";
@@ -324,7 +324,7 @@ IcePatch::getPartialMD5(const string& path, Int size)
FileInfo info = getFileInfo(path, true);
size = std::min(size, static_cast<Int>(info.size));
ifstream file(path.c_str(), ios::binary);
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
@@ -333,13 +333,13 @@ IcePatch::getPartialMD5(const string& path, Int size)
ByteSeq bytes;
bytes.resize(size);
file.read(&bytes[0], bytes.size());
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot read `" + path + "': " + strerror(errno);
throw ex;
}
- if (file.gcount() < static_cast<int>(bytes.size()))
+ if(file.gcount() < static_cast<int>(bytes.size()))
{
FileAccessException ex;
ex.reason = "could not read all bytes from `" + path + "'";
@@ -365,7 +365,7 @@ IcePatch::createMD5(const string& path)
//
FileInfo info = getFileInfo(path, true);
ifstream file(path.c_str(), ios::binary);
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
@@ -374,13 +374,13 @@ IcePatch::createMD5(const string& path)
ByteSeq bytes;
bytes.resize(info.size);
file.read(&bytes[0], bytes.size());
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot read `" + path + "': " + strerror(errno);
throw ex;
}
- if (file.gcount() < static_cast<int>(bytes.size()))
+ if(file.gcount() < static_cast<int>(bytes.size()))
{
FileAccessException ex;
ex.reason = "could not read all bytes from `" + path + "'";
@@ -401,14 +401,14 @@ IcePatch::createMD5(const string& path)
string pathMD5 = path + ".md5";
string pathMD5Temp = path + ".md5temp";
ofstream fileMD5(pathMD5Temp.c_str(), ios::binary);
- if (!fileMD5)
+ if(!fileMD5)
{
FileAccessException ex;
ex.reason = "cannot open `" + pathMD5Temp + "' for writing: " + strerror(errno);
throw ex;
}
fileMD5.write(&bytesMD5[0], 16);
- if (!fileMD5)
+ if(!fileMD5)
{
FileAccessException ex;
ex.reason = "cannot write `" + pathMD5Temp + "': " + strerror(errno);
@@ -422,7 +422,7 @@ IcePatch::createMD5(const string& path)
// abortive application termination.
//
::remove(pathMD5.c_str());
- if (::rename(pathMD5Temp.c_str(), pathMD5.c_str()) == -1)
+ if(::rename(pathMD5Temp.c_str(), pathMD5.c_str()) == -1)
{
FileAccessException ex;
ex.reason = "cannot rename `" + pathMD5Temp + "' to `" + pathMD5 + "': " + strerror(errno);
@@ -433,21 +433,21 @@ IcePatch::createMD5(const string& path)
ByteSeq
IcePatch::getBZ2(const string& path, Int pos, Int num)
{
- if (pos < 0)
+ if(pos < 0)
{
FileAccessException ex;
ex.reason = "negative read offset is illegal";
throw ex;
}
- if (num < 0)
+ if(num < 0)
{
FileAccessException ex;
ex.reason = "negative data segment size is illegal";
throw ex;
}
- if (num > 1024 * 1024)
+ if(num > 1024 * 1024)
{
FileAccessException ex;
ex.reason = "maxium data segment size exceeded";
@@ -456,14 +456,14 @@ IcePatch::getBZ2(const string& path, Int pos, Int num)
string pathBZ2 = path + ".bz2";
ifstream fileBZ2(pathBZ2.c_str(), ios::binary);
- if (!fileBZ2)
+ if(!fileBZ2)
{
FileAccessException ex;
ex.reason = "cannot open `" + pathBZ2 + "' for reading: " + strerror(errno);
throw ex;
}
fileBZ2.seekg(pos);
- if (!fileBZ2)
+ if(!fileBZ2)
{
FileAccessException ex;
ostringstream out;
@@ -474,7 +474,7 @@ IcePatch::getBZ2(const string& path, Int pos, Int num)
ByteSeq bytesBZ2;
bytesBZ2.resize(num);
fileBZ2.read(&bytesBZ2[0], bytesBZ2.size());
- if (!fileBZ2 && !fileBZ2.eof())
+ if(!fileBZ2 && !fileBZ2.eof())
{
FileAccessException ex;
ex.reason = "cannot read `" + pathBZ2 + "': " + strerror(errno);
@@ -493,7 +493,7 @@ IcePatch::createBZ2(const string& path)
// file.
//
ifstream file(path.c_str(), ios::binary);
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
@@ -503,7 +503,7 @@ IcePatch::createBZ2(const string& path)
string pathBZ2 = path + ".bz2";
string pathBZ2Temp = path + ".bz2temp";
FILE* stdioFileBZ2 = fopen(pathBZ2Temp.c_str(), "wb");
- if (!stdioFileBZ2)
+ if(!stdioFileBZ2)
{
FileAccessException ex;
ex.reason = "cannot open `" + pathBZ2Temp + "' for writing: " + strerror(errno);
@@ -512,11 +512,11 @@ IcePatch::createBZ2(const string& path)
int bzError;
BZFILE* bzFile = BZ2_bzWriteOpen(&bzError, stdioFileBZ2, 5, 0, 0);
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
FileAccessException ex;
ex.reason = "BZ2_bzWriteOpen failed";
- if (bzError == BZ_IO_ERROR)
+ if(bzError == BZ_IO_ERROR)
{
ex.reason += string(": ") + strerror(errno);
}
@@ -527,10 +527,10 @@ IcePatch::createBZ2(const string& path)
static const Int num = 64 * 1024;
Byte bytes[num];
- while (!file.eof())
+ while(!file.eof())
{
file.read(bytes, num);
- if (!file && !file.eof())
+ if(!file && !file.eof())
{
FileAccessException ex;
ex.reason = "cannot read `" + path + "': " + strerror(errno);
@@ -539,14 +539,14 @@ IcePatch::createBZ2(const string& path)
throw ex;
}
- if (file.gcount() > 0)
+ if(file.gcount() > 0)
{
BZ2_bzWrite(&bzError, bzFile, bytes, file.gcount());
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
FileAccessException ex;
ex.reason = "BZ2_bzWrite failed";
- if (bzError == BZ_IO_ERROR)
+ if(bzError == BZ_IO_ERROR)
{
ex.reason += string(": ") + strerror(errno);
}
@@ -558,11 +558,11 @@ IcePatch::createBZ2(const string& path)
}
BZ2_bzWriteClose(&bzError, bzFile, 0, 0, 0);
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
FileAccessException ex;
ex.reason = "BZ2_bzWriteClose failed";
- if (bzError == BZ_IO_ERROR)
+ if(bzError == BZ_IO_ERROR)
{
ex.reason += string(": ") + strerror(errno);
}
@@ -579,7 +579,7 @@ IcePatch::createBZ2(const string& path)
// abortive application termination.
//
::remove(pathBZ2.c_str());
- if (::rename(pathBZ2Temp.c_str(), pathBZ2.c_str()) == -1)
+ if(::rename(pathBZ2Temp.c_str(), pathBZ2.c_str()) == -1)
{
FileAccessException ex;
ex.reason = "cannot rename `" + pathBZ2Temp + "' to `" + pathBZ2 + "': " + strerror(errno);
@@ -599,12 +599,12 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
// Check for partial BZ2 file.
//
FileInfo infoBZ2 = getFileInfo(pathBZ2, false);
- if (infoBZ2.type == FileTypeRegular)
+ if(infoBZ2.type == FileTypeRegular)
{
ByteSeq remoteBZ2MD5 = regular->getBZ2MD5(infoBZ2.size);
ByteSeq localBZ2MD5 = getPartialMD5(pathBZ2, infoBZ2.size);
- if (remoteBZ2MD5 == localBZ2MD5)
+ if(remoteBZ2MD5 == localBZ2MD5)
{
posBZ2 = infoBZ2.size;
}
@@ -616,7 +616,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
progressCB.startDownload(totalBZ2, posBZ2);
ofstream fileBZ2(pathBZ2.c_str(), ios::binary | (posBZ2 ? ios::app : 0));
- if (!fileBZ2)
+ if(!fileBZ2)
{
FileAccessException ex;
ex.reason = "cannot open `" + pathBZ2 + "' for writing: " + strerror(errno);
@@ -628,7 +628,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
static const Int numBZ2 = 64 * 1024;
ByteSeq bytesBZ2 = regular->getBZ2(posBZ2, numBZ2);
- if (bytesBZ2.empty())
+ if(bytesBZ2.empty())
{
break;
}
@@ -636,14 +636,14 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
posBZ2 += bytesBZ2.size();
fileBZ2.write(&bytesBZ2[0], bytesBZ2.size());
- if (!fileBZ2)
+ if(!fileBZ2)
{
FileAccessException ex;
ex.reason = "cannot write `" + pathBZ2 + "': " + strerror(errno);
throw ex;
}
- if (static_cast<Int>(bytesBZ2.size()) < numBZ2)
+ if(static_cast<Int>(bytesBZ2.size()) < numBZ2)
{
break;
}
@@ -659,7 +659,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
// Read the BZ2 file in blocks and write the original file.
//
ofstream file(path.c_str(), ios::binary);
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot open `" + path + "' for writing: " + strerror(errno);
@@ -667,7 +667,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
}
FILE* stdioFileBZ2 = fopen(pathBZ2.c_str(), "rb");
- if (!stdioFileBZ2)
+ if(!stdioFileBZ2)
{
FileAccessException ex;
ex.reason = "cannot open `" + pathBZ2 + "' for reading: " + strerror(errno);
@@ -676,11 +676,11 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
int bzError;
BZFILE* bzFile = BZ2_bzReadOpen(&bzError, stdioFileBZ2, 0, 0, 0, 0);
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
FileAccessException ex;
ex.reason = "BZ2_bzReadOpen failed";
- if (bzError == BZ_IO_ERROR)
+ if(bzError == BZ_IO_ERROR)
{
ex.reason += string(": ") + strerror(errno);
}
@@ -693,14 +693,14 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
progressCB.startUncompress(totalBZ2, 0);
- while (bzError != BZ_STREAM_END)
+ while(bzError != BZ_STREAM_END)
{
int sz = BZ2_bzRead(&bzError, bzFile, bytesBZ2, numBZ2);
- if (bzError != BZ_OK && bzError != BZ_STREAM_END)
+ if(bzError != BZ_OK && bzError != BZ_STREAM_END)
{
FileAccessException ex;
ex.reason = "BZ2_bzRead failed";
- if (bzError == BZ_IO_ERROR)
+ if(bzError == BZ_IO_ERROR)
{
ex.reason += string(": ") + strerror(errno);
}
@@ -709,10 +709,10 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
throw ex;
}
- if (sz > 0)
+ if(sz > 0)
{
long pos = ftell(stdioFileBZ2);
- if (pos == -1)
+ if(pos == -1)
{
FileAccessException ex;
ex.reason = "cannot get read position for `" + pathBZ2 + "': " + strerror(errno);
@@ -724,7 +724,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
progressCB.updateUncompress(totalBZ2, pos);
file.write(bytesBZ2, sz);
- if (!file)
+ if(!file)
{
FileAccessException ex;
ex.reason = "cannot write `" + path + "': " + strerror(errno);
@@ -738,11 +738,11 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
progressCB.finishedUncompress(totalBZ2);
BZ2_bzReadClose(&bzError, bzFile);
- if (bzError != BZ_OK)
+ if(bzError != BZ_OK)
{
FileAccessException ex;
ex.reason = "BZ2_bzReadClose failed";
- if (bzError == BZ_IO_ERROR)
+ if(bzError == BZ_IO_ERROR)
{
ex.reason += string(": ") + strerror(errno);
}
@@ -756,7 +756,7 @@ IcePatch::getRegular(const RegularPrx& regular, ProgressCB& progressCB)
//
// Remove the BZ2 file, it is not needed anymore.
//
- if (::remove(pathBZ2.c_str()) == -1)
+ if(::remove(pathBZ2.c_str()) == -1)
{
FileAccessException ex;
ex.reason = "cannot remove file `" + pathBZ2 + "': " + strerror(errno);
diff --git a/cpp/src/IceSSL/BaseCerts.h b/cpp/src/IceSSL/BaseCerts.h
index f431ba8a3c2..86b30e01790 100644
--- a/cpp/src/IceSSL/BaseCerts.h
+++ b/cpp/src/IceSSL/BaseCerts.h
@@ -1,68 +1,68 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_BASE_CERTS_H
-#define ICE_SSL_BASE_CERTS_H
-
-#include <IceSSL/CertificateDesc.h>
-
-namespace IceSSL
-{
-
-class BaseCertificates
-{
-public:
-
- BaseCertificates();
- BaseCertificates(CertificateDesc&, CertificateDesc&, DiffieHellmanParamsFile&);
- BaseCertificates(BaseCertificates&);
-
- const CertificateDesc& getRSACert() const;
- const CertificateDesc& getDSACert() const;
-
- const DiffieHellmanParamsFile& getDHParams() const;
-
-protected:
-
- CertificateDesc _rsaCert;
- CertificateDesc _dsaCert;
- DiffieHellmanParamsFile _dhParams;
-};
-
-template<class Stream>
-inline Stream& operator << (Stream& target, const BaseCertificates& baseCerts)
-{
- if (baseCerts.getRSACert().getKeySize() != 0)
- {
- target << "RSA\n{" << std::endl;
- target << baseCerts.getRSACert();
- target << "}\n" << std::endl;
- }
-
- if (baseCerts.getDSACert().getKeySize() != 0)
- {
- target << "DSA\n{" << std::endl;
- target << baseCerts.getDSACert();
- target << "}\n" << std::endl;
- }
-
- if (baseCerts.getDHParams().getKeySize() != 0)
- {
- target << "DH\n{" << std::endl;
- target << baseCerts.getDHParams();
- target << "}\n" << std::endl;
- }
-
- return target;
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_BASE_CERTS_H
+#define ICE_SSL_BASE_CERTS_H
+
+#include <IceSSL/CertificateDesc.h>
+
+namespace IceSSL
+{
+
+class BaseCertificates
+{
+public:
+
+ BaseCertificates();
+ BaseCertificates(CertificateDesc&, CertificateDesc&, DiffieHellmanParamsFile&);
+ BaseCertificates(BaseCertificates&);
+
+ const CertificateDesc& getRSACert() const;
+ const CertificateDesc& getDSACert() const;
+
+ const DiffieHellmanParamsFile& getDHParams() const;
+
+protected:
+
+ CertificateDesc _rsaCert;
+ CertificateDesc _dsaCert;
+ DiffieHellmanParamsFile _dhParams;
+};
+
+template<class Stream>
+inline Stream& operator << (Stream& target, const BaseCertificates& baseCerts)
+{
+ if(baseCerts.getRSACert().getKeySize() != 0)
+ {
+ target << "RSA\n{" << std::endl;
+ target << baseCerts.getRSACert();
+ target << "}\n" << std::endl;
+ }
+
+ if(baseCerts.getDSACert().getKeySize() != 0)
+ {
+ target << "DSA\n{" << std::endl;
+ target << baseCerts.getDSACert();
+ target << "}\n" << std::endl;
+ }
+
+ if(baseCerts.getDHParams().getKeySize() != 0)
+ {
+ target << "DH\n{" << std::endl;
+ target << baseCerts.getDHParams();
+ target << "}\n" << std::endl;
+ }
+
+ return target;
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/CertificateAuthority.h b/cpp/src/IceSSL/CertificateAuthority.h
index 5447aa2140e..058c9a6b02d 100644
--- a/cpp/src/IceSSL/CertificateAuthority.h
+++ b/cpp/src/IceSSL/CertificateAuthority.h
@@ -1,41 +1,41 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CERTIFICATE_AUTHORITY_H
-#define ICE_SSL_CERTIFICATE_AUTHORITY_H
-
-#include <IceUtil/Config.h>
-
-namespace IceSSL
-{
-
-class CertificateAuthority
-{
-public:
-
- CertificateAuthority();
- CertificateAuthority(std::string&, std::string&);
- CertificateAuthority(CertificateAuthority&);
-
- void setCAFileName(std::string&);
- void setCAPath(std::string&);
-
- const std::string& getCAFileName() const;
- const std::string& getCAPath() const;
-
-private:
-
- std::string _fileName;
- std::string _path;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CERTIFICATE_AUTHORITY_H
+#define ICE_SSL_CERTIFICATE_AUTHORITY_H
+
+#include <IceUtil/Config.h>
+
+namespace IceSSL
+{
+
+class CertificateAuthority
+{
+public:
+
+ CertificateAuthority();
+ CertificateAuthority(std::string&, std::string&);
+ CertificateAuthority(CertificateAuthority&);
+
+ void setCAFileName(std::string&);
+ void setCAPath(std::string&);
+
+ const std::string& getCAFileName() const;
+ const std::string& getCAPath() const;
+
+private:
+
+ std::string _fileName;
+ std::string _path;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/CertificateDesc.h b/cpp/src/IceSSL/CertificateDesc.h
index bd4bb931c28..d7e758bfd66 100644
--- a/cpp/src/IceSSL/CertificateDesc.h
+++ b/cpp/src/IceSSL/CertificateDesc.h
@@ -1,119 +1,119 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CERTIFICATE_DESC_H
-#define ICE_SSL_CERTIFICATE_DESC_H
-
-#include <IceUtil/Config.h>
-#include <openssl/ssl.h>
-#include <vector>
-
-namespace IceSSL
-{
-
-class CertificateFile
-{
-public:
-
- CertificateFile();
- CertificateFile(const std::string&, const int);
- CertificateFile(const CertificateFile&);
-
- std::string getFileName() const;
- int getEncoding() const;
-
-protected:
-
- std::string _fileName;
- int _encoding;
-};
-
-class DiffieHellmanParamsFile : public CertificateFile
-{
-public:
-
- DiffieHellmanParamsFile();
- DiffieHellmanParamsFile(const int, const std::string&, const int);
- DiffieHellmanParamsFile(const DiffieHellmanParamsFile&);
-
- int getKeySize() const;
-
-protected:
-
- int _keySize;
-};
-
-class CertificateDesc
-{
-public:
-
- CertificateDesc();
- CertificateDesc(const int, const CertificateFile&, const CertificateFile&);
- CertificateDesc(const CertificateDesc&);
-
- int getKeySize() const;
-
- const CertificateFile& getPublic() const;
- const CertificateFile& getPrivate() const;
-
-protected:
-
- int _keySize;
- CertificateFile _public;
- CertificateFile _private;
-};
-
-typedef std::vector<CertificateDesc> RSAVector;
-typedef std::vector<CertificateDesc> DSAVector;
-typedef std::vector<DiffieHellmanParamsFile> DHVector;
-
-template<class Stream>
-inline Stream& operator << (Stream& target, const CertificateFile& certFile)
-{
- if (certFile.getEncoding() == SSL_FILETYPE_PEM)
- {
- target << "[PEM]: " << certFile.getFileName();
- }
- else if (certFile.getEncoding() == SSL_FILETYPE_ASN1)
- {
- target << "[ASN1]: " << certFile.getFileName();
- }
-
- return target;
-}
-
-template<class Stream>
-inline Stream& operator << (Stream& target, const DiffieHellmanParamsFile& dhParams)
-{
- if (dhParams.getKeySize() != 0)
- {
- target << "Keysize: " << dhParams.getKeySize() << std::endl;
- target << "File: " << ((CertificateFile&)dhParams) << std::endl;
- }
-
- return target;
-}
-
-template<class Stream>
-inline Stream& operator << (Stream& target, const CertificateDesc& certDesc)
-{
- if (certDesc.getKeySize() != 0)
- {
- target << "Keysize: " << certDesc.getKeySize() << std::endl;
- target << "Public: " << certDesc.getPublic() << std::endl;
- target << "Private: " << certDesc.getPrivate() << std::endl;
- }
-
- return target;
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CERTIFICATE_DESC_H
+#define ICE_SSL_CERTIFICATE_DESC_H
+
+#include <IceUtil/Config.h>
+#include <openssl/ssl.h>
+#include <vector>
+
+namespace IceSSL
+{
+
+class CertificateFile
+{
+public:
+
+ CertificateFile();
+ CertificateFile(const std::string&, const int);
+ CertificateFile(const CertificateFile&);
+
+ std::string getFileName() const;
+ int getEncoding() const;
+
+protected:
+
+ std::string _fileName;
+ int _encoding;
+};
+
+class DiffieHellmanParamsFile : public CertificateFile
+{
+public:
+
+ DiffieHellmanParamsFile();
+ DiffieHellmanParamsFile(const int, const std::string&, const int);
+ DiffieHellmanParamsFile(const DiffieHellmanParamsFile&);
+
+ int getKeySize() const;
+
+protected:
+
+ int _keySize;
+};
+
+class CertificateDesc
+{
+public:
+
+ CertificateDesc();
+ CertificateDesc(const int, const CertificateFile&, const CertificateFile&);
+ CertificateDesc(const CertificateDesc&);
+
+ int getKeySize() const;
+
+ const CertificateFile& getPublic() const;
+ const CertificateFile& getPrivate() const;
+
+protected:
+
+ int _keySize;
+ CertificateFile _public;
+ CertificateFile _private;
+};
+
+typedef std::vector<CertificateDesc> RSAVector;
+typedef std::vector<CertificateDesc> DSAVector;
+typedef std::vector<DiffieHellmanParamsFile> DHVector;
+
+template<class Stream>
+inline Stream& operator << (Stream& target, const CertificateFile& certFile)
+{
+ if(certFile.getEncoding() == SSL_FILETYPE_PEM)
+ {
+ target << "[PEM]: " << certFile.getFileName();
+ }
+ else if(certFile.getEncoding() == SSL_FILETYPE_ASN1)
+ {
+ target << "[ASN1]: " << certFile.getFileName();
+ }
+
+ return target;
+}
+
+template<class Stream>
+inline Stream& operator << (Stream& target, const DiffieHellmanParamsFile& dhParams)
+{
+ if(dhParams.getKeySize() != 0)
+ {
+ target << "Keysize: " << dhParams.getKeySize() << std::endl;
+ target << "File: " << ((CertificateFile&)dhParams) << std::endl;
+ }
+
+ return target;
+}
+
+template<class Stream>
+inline Stream& operator << (Stream& target, const CertificateDesc& certDesc)
+{
+ if(certDesc.getKeySize() != 0)
+ {
+ target << "Keysize: " << certDesc.getKeySize() << std::endl;
+ target << "Public: " << certDesc.getPublic() << std::endl;
+ target << "Private: " << certDesc.getPrivate() << std::endl;
+ }
+
+ return target;
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/ConfigParser.cpp b/cpp/src/IceSSL/ConfigParser.cpp
index 2d6a66717da..9ce7ccbaf1f 100644
--- a/cpp/src/IceSSL/ConfigParser.cpp
+++ b/cpp/src/IceSSL/ConfigParser.cpp
@@ -47,7 +47,7 @@ IceSSL::ConfigParser::ConfigParser(const string& configFile, const string& confi
}
IceSSL::ConfigParser::~ConfigParser()
-{
+{
XMLPlatformUtils::Terminate();
}
@@ -89,9 +89,9 @@ IceSSL::ConfigParser::process()
try
{
- if (*(_configFile.begin()) != '/')
+ if(*(_configFile.begin()) != '/')
{
- if (*(_configPath.rbegin()) != '/')
+ if(*(_configPath.rbegin()) != '/')
{
_configPath += "/";
}
@@ -115,7 +115,7 @@ IceSSL::ConfigParser::process()
errorCount = parser.getErrorCount();
- if (errorCount == 0)
+ if(errorCount == 0)
{
// Get the root of the parse tree.
_root = parser.getDocument();
@@ -155,7 +155,7 @@ IceSSL::ConfigParser::process()
throw configEx;
}
- if (errorCount)
+ if(errorCount)
{
ConfigParseException configEx(__FILE__, __LINE__);
@@ -167,7 +167,7 @@ IceSSL::ConfigParser::process()
string reporterErrors = errReporter->getErrors();
- if (!reporterErrors.empty())
+ if(!reporterErrors.empty())
{
configEx._message += "\n";
configEx._message += reporterErrors;
@@ -188,7 +188,7 @@ IceSSL::ConfigParser::loadClientConfig(GeneralConfig& general,
try
{
// If we actually have a client section.
- if (clientSection != 0)
+ if(clientSection != 0)
{
getGeneral(clientSection, general);
getCertAuth(clientSection, certAuth);
@@ -225,7 +225,7 @@ IceSSL::ConfigParser::loadServerConfig(GeneralConfig& general,
try
{
// If we actually have a client section.
- if (serverSection != 0)
+ if(serverSection != 0)
{
getGeneral(serverSection, general);
getCertAuth(serverSection, certAuth);
@@ -285,7 +285,7 @@ IceSSL::ConfigParser::popRoot(string& path, string& root, string& tail)
{
string::size_type pos = path.find_first_of(':');
- if (pos != string::npos)
+ if(pos != string::npos)
{
root = path.substr(0,pos);
tail = path.substr(pos+1);
@@ -309,7 +309,7 @@ IceSSL::ConfigParser::find(DOM_Node rootNode, string& nodePath)
// The target node that we're looking for.
DOM_Node tNode;
- if (rootNode == 0)
+ if(rootNode == 0)
{
return tNode;
}
@@ -322,17 +322,17 @@ IceSSL::ConfigParser::find(DOM_Node rootNode, string& nodePath)
DOM_Node child = rootNode.getFirstChild();
- while (child != 0)
+ while(child != 0)
{
// Ignore any other node types - we're only interested in ELEMENT_NODEs.
- if (child.getNodeType() == DOM_Node::ELEMENT_NODE)
+ if(child.getNodeType() == DOM_Node::ELEMENT_NODE)
{
string nodeName = toString(child.getNodeName());
- if (nodeName.compare(rootNodeName) == 0)
+ if(nodeName.compare(rootNodeName) == 0)
{
// No further to recurse, this must be it.
- if (tailNodes.empty())
+ if(tailNodes.empty())
{
tNode = child;
}
@@ -353,7 +353,7 @@ IceSSL::ConfigParser::find(DOM_Node rootNode, string& nodePath)
void
IceSSL::ConfigParser::getGeneral(DOM_Node rootNode, GeneralConfig& generalConfig)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -365,7 +365,7 @@ IceSSL::ConfigParser::getGeneral(DOM_Node rootNode, GeneralConfig& generalConfig
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string nodeName = toString(attribute.getNodeName());
@@ -379,7 +379,7 @@ IceSSL::ConfigParser::getGeneral(DOM_Node rootNode, GeneralConfig& generalConfig
void
IceSSL::ConfigParser::getCertAuth(DOM_Node rootNode, CertificateAuthority& certAuth)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -387,7 +387,7 @@ IceSSL::ConfigParser::getCertAuth(DOM_Node rootNode, CertificateAuthority& certA
string nodeName = "certauthority";
DOM_Node certAuthNode = find(rootNode, nodeName);
- if (certAuthNode == 0)
+ if(certAuthNode == 0)
{
return;
}
@@ -396,25 +396,25 @@ IceSSL::ConfigParser::getCertAuth(DOM_Node rootNode, CertificateAuthority& certA
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string nodeName = toString(attribute.getNodeName());
string nodeValue = toString(attribute.getNodeValue());
- if (nodeName.compare("file") == 0)
+ if(nodeName.compare("file") == 0)
{
string filename = nodeValue;
// Just a filename, no path component, append path.
- if ((filename.find("/") == string::npos) && (filename.find("\\") == string::npos))
+ if((filename.find("/") == string::npos) && (filename.find("\\") == string::npos))
{
filename = _configPath + filename;
}
certAuth.setCAFileName(filename);
}
- else if (nodeName.compare("path") == 0)
+ else if(nodeName.compare("path") == 0)
{
certAuth.setCAPath(nodeValue);
}
@@ -424,7 +424,7 @@ IceSSL::ConfigParser::getCertAuth(DOM_Node rootNode, CertificateAuthority& certA
void
IceSSL::ConfigParser::getBaseCerts(DOM_Node rootNode, BaseCertificates& baseCerts)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -432,7 +432,7 @@ IceSSL::ConfigParser::getBaseCerts(DOM_Node rootNode, BaseCertificates& baseCert
string nodeName = "basecerts";
DOM_Node baseCertsRoot = find(rootNode, nodeName);
- if (baseCertsRoot == 0)
+ if(baseCertsRoot == 0)
{
return;
}
@@ -456,7 +456,7 @@ IceSSL::ConfigParser::getBaseCerts(DOM_Node rootNode, BaseCertificates& baseCert
void
IceSSL::ConfigParser::getTempCerts(DOM_Node rootNode, TempCertificates& tempCerts)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -464,23 +464,23 @@ IceSSL::ConfigParser::getTempCerts(DOM_Node rootNode, TempCertificates& tempCert
string nodeName = "tempcerts";
DOM_Node tempCertsRoot = find(rootNode, nodeName);
- if (tempCertsRoot == 0)
+ if(tempCertsRoot == 0)
{
return;
}
DOM_Node child = tempCertsRoot.getFirstChild();
- while (child != 0)
+ while(child != 0)
{
DOMString nodeName = child.getNodeName();
string name = toString(nodeName);
- if (name.compare("dhparams") == 0)
+ if(name.compare("dhparams") == 0)
{
loadDHParams(child, tempCerts);
}
- else if (name.compare("rsacert") == 0)
+ else if(name.compare("rsacert") == 0)
{
loadRSACert(child, tempCerts);
}
@@ -512,7 +512,7 @@ IceSSL::ConfigParser::loadRSACert(DOM_Node rootNode, TempCertificates& tempCerts
void
IceSSL::ConfigParser::getCert(DOM_Node rootNode, CertificateDesc& certDesc)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -524,13 +524,13 @@ IceSSL::ConfigParser::getCert(DOM_Node rootNode, CertificateDesc& certDesc)
DOM_NamedNodeMap attributes = rootNode.getAttributes();
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string nodeName = toString(attribute.getNodeName());
string nodeValue = toString(attribute.getNodeValue());
- if (nodeName.compare("keysize") == 0)
+ if(nodeName.compare("keysize") == 0)
{
keySize = atoi(nodeValue.c_str());
}
@@ -549,7 +549,7 @@ IceSSL::ConfigParser::getCert(DOM_Node rootNode, CertificateDesc& certDesc)
void
IceSSL::ConfigParser::getDHParams(DOM_Node rootNode, DiffieHellmanParamsFile& dhParams)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -561,13 +561,13 @@ IceSSL::ConfigParser::getDHParams(DOM_Node rootNode, DiffieHellmanParamsFile& dh
int keySize = 0;
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string nodeName = toString(attribute.getNodeName());
string nodeValue = toString(attribute.getNodeValue());
- if (nodeName.compare("keysize") == 0)
+ if(nodeName.compare("keysize") == 0)
{
keySize = atoi(nodeValue.c_str());
}
@@ -579,7 +579,7 @@ IceSSL::ConfigParser::getDHParams(DOM_Node rootNode, DiffieHellmanParamsFile& dh
void
IceSSL::ConfigParser::loadCertificateFile(DOM_Node rootNode, CertificateFile& certFile)
{
- if (rootNode == 0)
+ if(rootNode == 0)
{
return;
}
@@ -590,22 +590,22 @@ IceSSL::ConfigParser::loadCertificateFile(DOM_Node rootNode, CertificateFile& ce
DOM_NamedNodeMap attributes = rootNode.getAttributes();
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string nodeName = toString(attribute.getNodeName());
string nodeValue = toString(attribute.getNodeValue());
- if (nodeName.compare("encoding") == 0)
+ if(nodeName.compare("encoding") == 0)
{
encoding = parseEncoding(nodeValue);
}
- else if (nodeName.compare("filename") == 0)
+ else if(nodeName.compare("filename") == 0)
{
filename = nodeValue;
// Just a filename, no path component, append path.
- if ((filename.find("/") == string::npos) && (filename.find("\\") == string::npos))
+ if((filename.find("/") == string::npos) && (filename.find("\\") == string::npos))
{
filename = _configPath + filename;
}
@@ -620,11 +620,11 @@ IceSSL::ConfigParser::parseEncoding(string& encodingString)
{
int encoding = 0;
- if (encodingString.compare("PEM") == 0)
+ if(encodingString.compare("PEM") == 0)
{
encoding = SSL_FILETYPE_PEM;
}
- else if (encodingString.compare("ASN1") == 0)
+ else if(encodingString.compare("ASN1") == 0)
{
encoding = SSL_FILETYPE_ASN1;
}
diff --git a/cpp/src/IceSSL/ConfigParser.h b/cpp/src/IceSSL/ConfigParser.h
index c88201b0019..bbe6158ac65 100644
--- a/cpp/src/IceSSL/ConfigParser.h
+++ b/cpp/src/IceSSL/ConfigParser.h
@@ -1,89 +1,89 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONFIG_H
-#define ICE_SSL_CONFIG_H
-
-#include <Ice/LoggerF.h>
-#include <IceSSL/CertificateDesc.h>
-#include <IceSSL/GeneralConfig.h>
-#include <IceSSL/CertificateAuthority.h>
-#include <IceSSL/BaseCerts.h>
-#include <IceSSL/TempCerts.h>
-#include <IceSSL/TraceLevelsF.h>
-#include <dom/DOM.hpp>
-
-namespace IceSSL
-{
-
-class ConfigParser
-{
-public:
-
- // Construction based on the indicated config file, or config file and
- // certificate path.
- ConfigParser(const std::string&);
- ConfigParser(const std::string&, const std::string&);
- ~ConfigParser();
-
- // Performs a complete parsing of the file.
- void process();
-
- // Loads the Client/Server portions of the config file.
- bool loadClientConfig(GeneralConfig&, CertificateAuthority&, BaseCertificates&);
- bool loadServerConfig(GeneralConfig&, CertificateAuthority&, BaseCertificates&, TempCertificates&);
-
- void setTrace(const TraceLevelsPtr&);
- bool isTraceSet() const;
-
- void setLogger(const Ice::LoggerPtr&);
- bool isLoggerSet() const;
-
-private:
-
- DOM_Node _root;
- std::string _configFile;
- std::string _configPath;
-
- TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
-
- // Parse tree walking utility methods.
- void popRoot(std::string&, std::string&, std::string&);
- DOM_Node find(std::string&);
- DOM_Node find(DOM_Node, std::string&);
-
- // Loading of the base elements of the file.
- void getGeneral(DOM_Node, GeneralConfig&);
- void getCertAuth(DOM_Node, CertificateAuthority&);
- void getBaseCerts(DOM_Node, BaseCertificates&);
- void getTempCerts(DOM_Node, TempCertificates&);
-
- // Loading of temporary certificates/params (Ephemeral Keys).
- void loadDHParams(DOM_Node, TempCertificates&);
- void loadRSACert(DOM_Node, TempCertificates&);
-
- // Populate with information from the indicated node in the parse tree.
- void getCert(DOM_Node, CertificateDesc&);
- void getDHParams(DOM_Node, DiffieHellmanParamsFile&);
-
- // Populate a certificate file object, basis of all certificates.
- void loadCertificateFile(DOM_Node, CertificateFile&);
-
- // Parses the certificate encoding format from a string representation
- // to the proper integer value used by the underlying SSL framework.
- int parseEncoding(std::string&);
-
- std::string toString(const DOMString&);
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONFIG_H
+#define ICE_SSL_CONFIG_H
+
+#include <Ice/LoggerF.h>
+#include <IceSSL/CertificateDesc.h>
+#include <IceSSL/GeneralConfig.h>
+#include <IceSSL/CertificateAuthority.h>
+#include <IceSSL/BaseCerts.h>
+#include <IceSSL/TempCerts.h>
+#include <IceSSL/TraceLevelsF.h>
+#include <dom/DOM.hpp>
+
+namespace IceSSL
+{
+
+class ConfigParser
+{
+public:
+
+ // Construction based on the indicated config file, or config file and
+ // certificate path.
+ ConfigParser(const std::string&);
+ ConfigParser(const std::string&, const std::string&);
+ ~ConfigParser();
+
+ // Performs a complete parsing of the file.
+ void process();
+
+ // Loads the Client/Server portions of the config file.
+ bool loadClientConfig(GeneralConfig&, CertificateAuthority&, BaseCertificates&);
+ bool loadServerConfig(GeneralConfig&, CertificateAuthority&, BaseCertificates&, TempCertificates&);
+
+ void setTrace(const TraceLevelsPtr&);
+ bool isTraceSet() const;
+
+ void setLogger(const Ice::LoggerPtr&);
+ bool isLoggerSet() const;
+
+private:
+
+ DOM_Node _root;
+ std::string _configFile;
+ std::string _configPath;
+
+ TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+
+ // Parse tree walking utility methods.
+ void popRoot(std::string&, std::string&, std::string&);
+ DOM_Node find(std::string&);
+ DOM_Node find(DOM_Node, std::string&);
+
+ // Loading of the base elements of the file.
+ void getGeneral(DOM_Node, GeneralConfig&);
+ void getCertAuth(DOM_Node, CertificateAuthority&);
+ void getBaseCerts(DOM_Node, BaseCertificates&);
+ void getTempCerts(DOM_Node, TempCertificates&);
+
+ // Loading of temporary certificates/params (Ephemeral Keys).
+ void loadDHParams(DOM_Node, TempCertificates&);
+ void loadRSACert(DOM_Node, TempCertificates&);
+
+ // Populate with information from the indicated node in the parse tree.
+ void getCert(DOM_Node, CertificateDesc&);
+ void getDHParams(DOM_Node, DiffieHellmanParamsFile&);
+
+ // Populate a certificate file object, basis of all certificates.
+ void loadCertificateFile(DOM_Node, CertificateFile&);
+
+ // Parses the certificate encoding format from a string representation
+ // to the proper integer value used by the underlying SSL framework.
+ int parseEncoding(std::string&);
+
+ std::string toString(const DOMString&);
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/ConfigParserErrorReporter.cpp b/cpp/src/IceSSL/ConfigParserErrorReporter.cpp
index 9a0fb2e4576..0f30587055d 100644
--- a/cpp/src/IceSSL/ConfigParserErrorReporter.cpp
+++ b/cpp/src/IceSSL/ConfigParserErrorReporter.cpp
@@ -37,7 +37,7 @@ IceSSL::ConfigParserErrorReporter::~ConfigParserErrorReporter()
void
IceSSL::ConfigParserErrorReporter::warning(const SAXParseException& toCatch)
{
- if (_traceLevels->security >= IceSSL::SECURITY_PARSE_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_PARSE_WARNINGS)
{
ostringstream s;
diff --git a/cpp/src/IceSSL/ConfigParserErrorReporter.h b/cpp/src/IceSSL/ConfigParserErrorReporter.h
index 2b94b4c1d74..192917fd2d8 100644
--- a/cpp/src/IceSSL/ConfigParserErrorReporter.h
+++ b/cpp/src/IceSSL/ConfigParserErrorReporter.h
@@ -1,63 +1,63 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONFIG_ERROR_REPORTER_H
-#define ICE_SSL_CONFIG_ERROR_REPORTER_H
-
-#include <Ice/LoggerF.h>
-#include <IceSSL/TraceLevelsF.h>
-#include <util/XercesDefs.hpp>
-#include <dom/DOMString.hpp>
-#include <sax/ErrorHandler.hpp>
-
-namespace IceSSL
-{
-
-class ConfigParserErrorReporter : public ErrorHandler, public IceUtil::Shared
-{
-public:
-
- ConfigParserErrorReporter(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&);
- ~ConfigParserErrorReporter();
-
- // Implementation of the error handler interface.
- void warning(const SAXParseException& toCatch);
- void error(const SAXParseException& toCatch);
- void fatalError(const SAXParseException& toCatch);
- void resetErrors();
-
- bool getSawErrors() const;
- std::string getErrors() const;
-
-private:
-
- IceSSL::TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
-
- // Any errors that are encountered will be output to this stream.
- std::ostringstream _errors;
- int _errorCount;
-};
-
-typedef IceInternal::Handle<ConfigParserErrorReporter> ConfigParserErrorReporterPtr;
-
-std::ostream& operator << (std::ostream& target, const DOMString& s);
-
-}
-
-namespace IceInternal
-{
-
-void incRef(::IceSSL::ConfigParserErrorReporter*);
-void decRef(::IceSSL::ConfigParserErrorReporter*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONFIG_ERROR_REPORTER_H
+#define ICE_SSL_CONFIG_ERROR_REPORTER_H
+
+#include <Ice/LoggerF.h>
+#include <IceSSL/TraceLevelsF.h>
+#include <util/XercesDefs.hpp>
+#include <dom/DOMString.hpp>
+#include <sax/ErrorHandler.hpp>
+
+namespace IceSSL
+{
+
+class ConfigParserErrorReporter : public ErrorHandler, public IceUtil::Shared
+{
+public:
+
+ ConfigParserErrorReporter(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&);
+ ~ConfigParserErrorReporter();
+
+ // Implementation of the error handler interface.
+ void warning(const SAXParseException& toCatch);
+ void error(const SAXParseException& toCatch);
+ void fatalError(const SAXParseException& toCatch);
+ void resetErrors();
+
+ bool getSawErrors() const;
+ std::string getErrors() const;
+
+private:
+
+ IceSSL::TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+
+ // Any errors that are encountered will be output to this stream.
+ std::ostringstream _errors;
+ int _errorCount;
+};
+
+typedef IceInternal::Handle<ConfigParserErrorReporter> ConfigParserErrorReporterPtr;
+
+std::ostream& operator << (std::ostream& target, const DOMString& s);
+
+}
+
+namespace IceInternal
+{
+
+void incRef(::IceSSL::ConfigParserErrorReporter*);
+void decRef(::IceSSL::ConfigParserErrorReporter*);
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/ContextOpenSSL.cpp b/cpp/src/IceSSL/ContextOpenSSL.cpp
index af94d715f7f..20ba1eca7b9 100644
--- a/cpp/src/IceSSL/ContextOpenSSL.cpp
+++ b/cpp/src/IceSSL/ContextOpenSSL.cpp
@@ -34,7 +34,7 @@ void ::IceInternal::decRef(::IceSSL::OpenSSL::Context* p) { p->__decRef(); }
IceSSL::OpenSSL::Context::~Context()
{
- if (_sslContext != 0)
+ if(_sslContext != 0)
{
SSL_CTX_free(_sslContext);
@@ -74,7 +74,7 @@ void
IceSSL::OpenSSL::Context::setRSAKeysBase64(const string& privateKey,
const string& publicKey)
{
- if (privateKey.empty())
+ if(privateKey.empty())
{
IceSSL::PrivateKeyException privateKeyEx(__FILE__, __LINE__);
@@ -89,7 +89,7 @@ IceSSL::OpenSSL::Context::setRSAKeysBase64(const string& privateKey,
void
IceSSL::OpenSSL::Context::setRSAKeys(const Ice::ByteSeq& privateKey, const Ice::ByteSeq& publicKey)
{
- if (privateKey.empty())
+ if(privateKey.empty())
{
IceSSL::PrivateKeyException privateKeyEx(__FILE__, __LINE__);
@@ -132,7 +132,7 @@ IceSSL::OpenSSL::Context::configure(const GeneralConfig& generalConfig,
setKeyCert(baseCertificates.getDSACert(), _dsaPrivateKeyProperty, _dsaPublicKeyProperty);
// Set the DH key agreement parameters.
- if (baseCertificates.getDHParams().getKeySize() != 0)
+ if(baseCertificates.getDHParams().getKeySize() != 0)
{
setDHParams(baseCertificates);
}
@@ -159,7 +159,7 @@ IceSSL::OpenSSL::Context::getSslMethod(SslProtocol sslVersion)
{
SSL_METHOD* sslMethod = 0;
- switch (sslVersion)
+ switch(sslVersion)
{
case SSL_V2 :
{
@@ -187,7 +187,7 @@ IceSSL::OpenSSL::Context::getSslMethod(SslProtocol sslVersion)
default :
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
string errorString;
@@ -207,7 +207,7 @@ IceSSL::OpenSSL::Context::getSslMethod(SslProtocol sslVersion)
void
IceSSL::OpenSSL::Context::createContext(SslProtocol sslProtocol)
{
- if (_sslContext != 0)
+ if(_sslContext != 0)
{
SSL_CTX_free(_sslContext);
_sslContext = 0;
@@ -215,7 +215,7 @@ IceSSL::OpenSSL::Context::createContext(SslProtocol sslProtocol)
_sslContext = SSL_CTX_new(getSslMethod(sslProtocol));
- if (_sslContext == 0)
+ if(_sslContext == 0)
{
ContextInitializationException contextInitEx(__FILE__, __LINE__);
@@ -242,12 +242,12 @@ IceSSL::OpenSSL::Context::loadCertificateAuthority(const CertificateAuthority& c
// The following checks are required to send the expected values to the OpenSSL library.
// It does not like receiving "", but prefers NULLs.
- if (!fileName.empty())
+ if(!fileName.empty())
{
caFile = fileName.c_str();
}
- if (!certPath.length())
+ if(!certPath.length())
{
caPath = certPath.c_str();
}
@@ -257,9 +257,9 @@ IceSSL::OpenSSL::Context::loadCertificateAuthority(const CertificateAuthority& c
// Check the Certificate Authority file(s).
int loadVerifyRet = SSL_CTX_load_verify_locations(_sslContext, caFile, caPath);
- if (!loadVerifyRet)
+ if(!loadVerifyRet)
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
_logger->trace(_traceLevels->securityCat, "WRN unable to load certificate authorities.");
}
@@ -269,7 +269,7 @@ IceSSL::OpenSSL::Context::loadCertificateAuthority(const CertificateAuthority& c
int setDefaultVerifyPathsRet = SSL_CTX_set_default_verify_paths(_sslContext);
- if (!setDefaultVerifyPathsRet && (_traceLevels->security >= IceSSL::SECURITY_WARNINGS))
+ if(!setDefaultVerifyPathsRet && (_traceLevels->security >= IceSSL::SECURITY_WARNINGS))
{
_logger->trace(_traceLevels->securityCat, "WRN unable to verify certificate authorities.");
}
@@ -277,7 +277,7 @@ IceSSL::OpenSSL::Context::loadCertificateAuthority(const CertificateAuthority& c
// Now we add whatever override/addition that we wish to put into the trusted certificates list
string caCertBase64 = _properties->getProperty(_caCertificateProperty);
- if (!caCertBase64.empty())
+ if(!caCertBase64.empty())
{
addTrustedCertificateBase64(caCertBase64);
}
@@ -291,21 +291,21 @@ IceSSL::OpenSSL::Context::setKeyCert(const CertificateDesc& certDesc,
string privateKey;
string publicKey;
- if (!privateProperty.empty())
+ if(!privateProperty.empty())
{
privateKey = _properties->getProperty(privateProperty);
}
- if (!publicProperty.empty())
+ if(!publicProperty.empty())
{
publicKey = _properties->getProperty(publicProperty);
}
- if (!privateKey.empty() && !publicKey.empty())
+ if(!privateKey.empty() && !publicKey.empty())
{
addKeyCert(privateKey, publicKey);
}
- else if (certDesc.getKeySize() != 0)
+ else if(certDesc.getKeySize() != 0)
{
const CertificateFile& privateKey = certDesc.getPrivate();
const CertificateFile& publicKey = certDesc.getPublic();
@@ -321,14 +321,14 @@ IceSSL::OpenSSL::Context::checkKeyCert()
// Check to see if the Private and Public keys that have been
// set against the SSL context match up.
- if (!SSL_CTX_check_private_key(_sslContext))
+ if(!SSL_CTX_check_private_key(_sslContext))
{
CertificateKeyMatchException certKeyMatchEx(__FILE__, __LINE__);
certKeyMatchEx._message = "private key does not match the certificate public key";
string sslError = sslGetErrors();
- if (!sslError.empty())
+ if(!sslError.empty())
{
certKeyMatchEx._message += "\n";
certKeyMatchEx._message += sslError;
@@ -341,7 +341,7 @@ IceSSL::OpenSSL::Context::checkKeyCert()
void
IceSSL::OpenSSL::Context::addTrustedCertificate(const RSAPublicKey& trustedCertificate)
{
- if (_sslContext == 0)
+ if(_sslContext == 0)
{
ContextNotConfiguredException contextConfigEx(__FILE__, __LINE__);
@@ -354,7 +354,7 @@ IceSSL::OpenSSL::Context::addTrustedCertificate(const RSAPublicKey& trustedCerti
assert(certStore != 0);
- if (X509_STORE_add_cert(certStore, trustedCertificate.getX509PublicKey()) == 0)
+ if(X509_STORE_add_cert(certStore, trustedCertificate.getX509PublicKey()) == 0)
{
TrustedCertificateAddException trustEx(__FILE__, __LINE__);
@@ -369,7 +369,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
{
assert(_sslContext != 0);
- if (!publicCert.getFileName().empty())
+ if(!publicCert.getFileName().empty())
{
string publicCertFile = publicCert.getFileName();
const char* publicFile = publicCertFile.c_str();
@@ -380,7 +380,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
int privKeyFileType = privateKey.getEncoding();
// Set which Public Key file to use.
- if (SSL_CTX_use_certificate_file(_sslContext, publicFile, publicEncoding) <= 0)
+ if(SSL_CTX_use_certificate_file(_sslContext, publicFile, publicEncoding) <= 0)
{
CertificateLoadException certLoadEx(__FILE__, __LINE__);
@@ -392,9 +392,9 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
throw certLoadEx;
}
- if (privateKey.getFileName().empty())
+ if(privateKey.getFileName().empty())
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
_logger->trace(_traceLevels->securityCat, "WRN no private key specified -- using the certificate");
}
@@ -407,7 +407,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
int pkLoadResult;
int errCode = 0;
- while (retryCount != _maxPassphraseTries)
+ while(retryCount != _maxPassphraseTries)
{
// We ignore the errors and remove them from the stack.
string errorString = sslGetErrors();
@@ -415,7 +415,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
// Set which Private Key file to use.
pkLoadResult = SSL_CTX_use_PrivateKey_file(_sslContext, privKeyFile, privKeyFileType);
- if (pkLoadResult <= 0)
+ if(pkLoadResult <= 0)
{
errCode = ERR_GET_REASON(ERR_peek_error());
}
@@ -426,7 +426,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
}
// PEM errors, most likely related to a bad passphrase.
- if (errCode != PEM_R_BAD_PASSWORD_READ &&
+ if(errCode != PEM_R_BAD_PASSWORD_READ &&
errCode != PEM_R_BAD_DECRYPT &&
errCode != PEM_R_BAD_BASE64_DECODE)
{
@@ -439,20 +439,20 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
retryCount++;
}
- if (pkLoadResult <= 0)
+ if(pkLoadResult <= 0)
{
int errCode = ERR_GET_REASON(ERR_peek_error());
// Note: Because OpenSSL currently (V0.9.6b) performs a check to see if the
// key matches the private key when calling SSL_CTX_use_PrivateKey_file().
- if (errCode == X509_R_KEY_VALUES_MISMATCH || errCode == X509_R_KEY_TYPE_MISMATCH)
+ if(errCode == X509_R_KEY_VALUES_MISMATCH || errCode == X509_R_KEY_TYPE_MISMATCH)
{
CertificateKeyMatchException certKeyMatchEx(__FILE__, __LINE__);
certKeyMatchEx._message = "private key does not match the certificate public key";
string sslError = sslGetErrors();
- if (!sslError.empty())
+ if(!sslError.empty())
{
certKeyMatchEx._message += "\n";
certKeyMatchEx._message += sslError;
@@ -480,7 +480,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const CertificateFile& privateKey, const Ce
void
IceSSL::OpenSSL::Context::addKeyCert(const RSAKeyPair& keyPair)
{
- if (_sslContext == 0)
+ if(_sslContext == 0)
{
ContextNotConfiguredException contextConfigEx(__FILE__, __LINE__);
@@ -495,14 +495,14 @@ IceSSL::OpenSSL::Context::addKeyCert(const RSAKeyPair& keyPair)
// certificate/key memory regardless if the call succeeded.
// Set which Public Key file to use.
- if (SSL_CTX_use_certificate(_sslContext, keyPair.getX509PublicKey()) <= 0)
+ if(SSL_CTX_use_certificate(_sslContext, keyPair.getX509PublicKey()) <= 0)
{
CertificateLoadException certLoadEx(__FILE__, __LINE__);
certLoadEx._message = "unable to set certificate from memory";
string sslError = sslGetErrors();
- if (!sslError.empty())
+ if(!sslError.empty())
{
certLoadEx._message += "\n";
certLoadEx._message += sslError;
@@ -512,20 +512,20 @@ IceSSL::OpenSSL::Context::addKeyCert(const RSAKeyPair& keyPair)
}
// Set which Private Key file to use.
- if (SSL_CTX_use_RSAPrivateKey(_sslContext, keyPair.getRSAPrivateKey()) <= 0)
+ if(SSL_CTX_use_RSAPrivateKey(_sslContext, keyPair.getRSAPrivateKey()) <= 0)
{
int errCode = ERR_GET_REASON(ERR_peek_error());
// Note: Because OpenSSL currently (V0.9.6b) performs a check to see if the
// key matches the private key when calling SSL_CTX_use_PrivateKey_file().
- if (errCode == X509_R_KEY_VALUES_MISMATCH || errCode == X509_R_KEY_TYPE_MISMATCH)
+ if(errCode == X509_R_KEY_VALUES_MISMATCH || errCode == X509_R_KEY_TYPE_MISMATCH)
{
CertificateKeyMatchException certKeyMatchEx(__FILE__, __LINE__);
certKeyMatchEx._message = "private key does not match the certificate public key";
string sslError = sslGetErrors();
- if (!sslError.empty())
+ if(!sslError.empty())
{
certKeyMatchEx._message += "\n";
certKeyMatchEx._message += sslError;
@@ -540,7 +540,7 @@ IceSSL::OpenSSL::Context::addKeyCert(const RSAKeyPair& keyPair)
pklEx._message = "unable to set private key from memory";
string sslError = sslGetErrors();
- if (!sslError.empty())
+ if(!sslError.empty())
{
pklEx._message += "\n";
pklEx._message += sslError;
@@ -558,9 +558,9 @@ IceSSL::OpenSSL::Context::addKeyCert(const Ice::ByteSeq& privateKey, const Ice::
{
Ice::ByteSeq privKey = privateKey;
- if (privKey.empty())
+ if(privKey.empty())
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
_logger->trace(_traceLevels->securityCat, "WRN no private key specified -- using the certificate");
}
@@ -577,9 +577,9 @@ IceSSL::OpenSSL::Context::addKeyCert(const string& privateKey, const string& pub
{
string privKey = privateKey;
- if (privKey.empty())
+ if(privKey.empty())
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
_logger->trace(_traceLevels->securityCat, "WRN no private key specified -- using the certificate");
}
@@ -620,7 +620,7 @@ IceSSL::OpenSSL::Context::setCipherList(const string& cipherList)
{
assert(_sslContext != 0);
- if (!cipherList.empty() && (!SSL_CTX_set_cipher_list(_sslContext, cipherList.c_str())) &&
+ if(!cipherList.empty() && (!SSL_CTX_set_cipher_list(_sslContext, cipherList.c_str())) &&
(_traceLevels->security >= IceSSL::SECURITY_WARNINGS))
{
string errorString = "WRN error setting cipher list " + cipherList + " -- using default list\n";
@@ -638,14 +638,14 @@ IceSSL::OpenSSL::Context::setDHParams(const BaseCertificates& baseCerts)
int encoding = baseCerts.getDHParams().getEncoding();
// File type must be PEM - that's the only way we can load DH Params, apparently.
- if ((!dhFile.empty()) && (encoding == SSL_FILETYPE_PEM))
+ if((!dhFile.empty()) && (encoding == SSL_FILETYPE_PEM))
{
dh = loadDHParam(dhFile.c_str());
}
- if (dh == 0)
+ if(dh == 0)
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
_logger->trace(_traceLevels->securityCat,
"WRN Could not load Diffie-Hellman params, generating a temporary 512bit key.");
@@ -654,7 +654,7 @@ IceSSL::OpenSSL::Context::setDHParams(const BaseCertificates& baseCerts)
dh = getTempDH512();
}
- if (dh != 0)
+ if(dh != 0)
{
SSL_CTX_set_tmp_dh(_sslContext, dh);
diff --git a/cpp/src/IceSSL/ContextOpenSSL.h b/cpp/src/IceSSL/ContextOpenSSL.h
index b8933cbb69e..0d885c0ffdb 100644
--- a/cpp/src/IceSSL/ContextOpenSSL.h
+++ b/cpp/src/IceSSL/ContextOpenSSL.h
@@ -1,120 +1,120 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONTEXT_OPENSSL_H
-#define ICE_SSL_CONTEXT_OPENSSL_H
-
-#include <Ice/LoggerF.h>
-#include <Ice/PropertiesF.h>
-#include <Ice/BuiltinSequences.h>
-#include <IceSSL/OpenSSL.h>
-#include <IceSSL/TraceLevelsF.h>
-#include <IceSSL/CertificateVerifierOpenSSL.h>
-#include <IceSSL/GeneralConfig.h>
-#include <IceSSL/CertificateAuthority.h>
-#include <IceSSL/BaseCerts.h>
-#include <IceSSL/TempCerts.h>
-#include <IceSSL/SslConnectionF.h>
-#include <IceSSL/SslConnectionOpenSSLF.h>
-#include <IceSSL/ContextOpenSSLF.h>
-#include <IceSSL/RSAPublicKey.h>
-#include <IceSSL/RSAKeyPairF.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class PluginI;
-
-class Context : public IceUtil::Shared
-{
-public:
-
- virtual ~Context();
-
- bool isConfigured();
-
- virtual void setCertificateVerifier(const CertificateVerifierPtr&);
-
- virtual void addTrustedCertificateBase64(const std::string&);
-
- virtual void addTrustedCertificate(const Ice::ByteSeq&);
-
- virtual void setRSAKeysBase64(const std::string&, const std::string&);
-
- virtual void setRSAKeys(const Ice::ByteSeq&, const Ice::ByteSeq&);
-
- virtual void configure(const IceSSL::GeneralConfig&,
- const IceSSL::CertificateAuthority&,
- const IceSSL::BaseCertificates&);
-
- // Takes a socket fd as the first parameter.
- virtual ::IceSSL::ConnectionPtr createConnection(int, const IceSSL::PluginBaseIPtr&) = 0;
-
-protected:
-
- Context(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&, const Ice::PropertiesPtr&);
-
- SSL_METHOD* getSslMethod(SslProtocol);
- void createContext(SslProtocol);
-
- virtual void loadCertificateAuthority(const CertificateAuthority&);
-
- void setKeyCert(const IceSSL::CertificateDesc&, const std::string&, const std::string&);
-
- void checkKeyCert();
-
- void addTrustedCertificate(const IceSSL::OpenSSL::RSAPublicKey&);
-
- void addKeyCert(const IceSSL::CertificateFile&, const IceSSL::CertificateFile&);
-
- void addKeyCert(const RSAKeyPair&);
-
- void addKeyCert(const Ice::ByteSeq&, const Ice::ByteSeq&);
-
- void addKeyCert(const std::string&, const std::string&);
-
- SSL* createSSLConnection(int);
-
- void connectionSetup(const IceSSL::OpenSSL::ConnectionPtr& connection);
-
- void setCipherList(const std::string&);
-
- void setDHParams(const IceSSL::BaseCertificates&);
-
- IceSSL::TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
- Ice::PropertiesPtr _properties;
-
- std::string _rsaPrivateKeyProperty;
- std::string _rsaPublicKeyProperty;
- std::string _dsaPrivateKeyProperty;
- std::string _dsaPublicKeyProperty;
- std::string _caCertificateProperty;
- std::string _handshakeTimeoutProperty;
- std::string _passphraseRetriesProperty;
- std::string _maxPassphraseRetriesDefault;
-
- IceSSL::CertificateVerifierPtr _certificateVerifier;
-
- SSL_CTX* _sslContext;
-
- int _maxPassphraseTries;
-
- friend class IceSSL::OpenSSL::PluginI;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONTEXT_OPENSSL_H
+#define ICE_SSL_CONTEXT_OPENSSL_H
+
+#include <Ice/LoggerF.h>
+#include <Ice/PropertiesF.h>
+#include <Ice/BuiltinSequences.h>
+#include <IceSSL/OpenSSL.h>
+#include <IceSSL/TraceLevelsF.h>
+#include <IceSSL/CertificateVerifierOpenSSL.h>
+#include <IceSSL/GeneralConfig.h>
+#include <IceSSL/CertificateAuthority.h>
+#include <IceSSL/BaseCerts.h>
+#include <IceSSL/TempCerts.h>
+#include <IceSSL/SslConnectionF.h>
+#include <IceSSL/SslConnectionOpenSSLF.h>
+#include <IceSSL/ContextOpenSSLF.h>
+#include <IceSSL/RSAPublicKey.h>
+#include <IceSSL/RSAKeyPairF.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class PluginI;
+
+class Context : public IceUtil::Shared
+{
+public:
+
+ virtual ~Context();
+
+ bool isConfigured();
+
+ virtual void setCertificateVerifier(const CertificateVerifierPtr&);
+
+ virtual void addTrustedCertificateBase64(const std::string&);
+
+ virtual void addTrustedCertificate(const Ice::ByteSeq&);
+
+ virtual void setRSAKeysBase64(const std::string&, const std::string&);
+
+ virtual void setRSAKeys(const Ice::ByteSeq&, const Ice::ByteSeq&);
+
+ virtual void configure(const IceSSL::GeneralConfig&,
+ const IceSSL::CertificateAuthority&,
+ const IceSSL::BaseCertificates&);
+
+ // Takes a socket fd as the first parameter.
+ virtual ::IceSSL::ConnectionPtr createConnection(int, const IceSSL::PluginBaseIPtr&) = 0;
+
+protected:
+
+ Context(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&, const Ice::PropertiesPtr&);
+
+ SSL_METHOD* getSslMethod(SslProtocol);
+ void createContext(SslProtocol);
+
+ virtual void loadCertificateAuthority(const CertificateAuthority&);
+
+ void setKeyCert(const IceSSL::CertificateDesc&, const std::string&, const std::string&);
+
+ void checkKeyCert();
+
+ void addTrustedCertificate(const IceSSL::OpenSSL::RSAPublicKey&);
+
+ void addKeyCert(const IceSSL::CertificateFile&, const IceSSL::CertificateFile&);
+
+ void addKeyCert(const RSAKeyPair&);
+
+ void addKeyCert(const Ice::ByteSeq&, const Ice::ByteSeq&);
+
+ void addKeyCert(const std::string&, const std::string&);
+
+ SSL* createSSLConnection(int);
+
+ void connectionSetup(const IceSSL::OpenSSL::ConnectionPtr& connection);
+
+ void setCipherList(const std::string&);
+
+ void setDHParams(const IceSSL::BaseCertificates&);
+
+ IceSSL::TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+ Ice::PropertiesPtr _properties;
+
+ std::string _rsaPrivateKeyProperty;
+ std::string _rsaPublicKeyProperty;
+ std::string _dsaPrivateKeyProperty;
+ std::string _dsaPublicKeyProperty;
+ std::string _caCertificateProperty;
+ std::string _handshakeTimeoutProperty;
+ std::string _passphraseRetriesProperty;
+ std::string _maxPassphraseRetriesDefault;
+
+ IceSSL::CertificateVerifierPtr _certificateVerifier;
+
+ SSL_CTX* _sslContext;
+
+ int _maxPassphraseTries;
+
+ friend class IceSSL::OpenSSL::PluginI;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/ContextOpenSSLClient.cpp b/cpp/src/IceSSL/ContextOpenSSLClient.cpp
index a16406bcfb7..185da70b4b5 100644
--- a/cpp/src/IceSSL/ContextOpenSSLClient.cpp
+++ b/cpp/src/IceSSL/ContextOpenSSLClient.cpp
@@ -30,7 +30,7 @@ IceSSL::OpenSSL::ClientContext::configure(const GeneralConfig& generalConfig,
loadCertificateAuthority(certificateAuthority);
- if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
+ if(_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
{
ostringstream s;
@@ -55,7 +55,7 @@ IceSSL::OpenSSL::ClientContext::configure(const GeneralConfig& generalConfig,
IceSSL::ConnectionPtr
IceSSL::OpenSSL::ClientContext::createConnection(int socket, const PluginBaseIPtr& plugin)
{
- if (_sslContext == 0)
+ if(_sslContext == 0)
{
IceSSL::OpenSSL::ContextNotConfiguredException contextEx(__FILE__, __LINE__);
diff --git a/cpp/src/IceSSL/ContextOpenSSLClient.h b/cpp/src/IceSSL/ContextOpenSSLClient.h
index 263078a53e9..8c4036db20e 100644
--- a/cpp/src/IceSSL/ContextOpenSSLClient.h
+++ b/cpp/src/IceSSL/ContextOpenSSLClient.h
@@ -1,44 +1,44 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONTEXT_OPENSSL_CLIENT_H
-#define ICE_SSL_CONTEXT_OPENSSL_CLIENT_H
-
-#include <IceSSL/ContextOpenSSL.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class ClientContext : public Context
-{
-public:
-
- virtual void configure(const IceSSL::GeneralConfig&,
- const IceSSL::CertificateAuthority&,
- const IceSSL::BaseCertificates&);
-
- // Takes a socket fd as the first parameter.
- virtual IceSSL::ConnectionPtr createConnection(int, const IceSSL::PluginBaseIPtr&);
-
-protected:
-
- ClientContext(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&, const Ice::PropertiesPtr&);
-
- friend class IceSSL::OpenSSL::PluginI;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONTEXT_OPENSSL_CLIENT_H
+#define ICE_SSL_CONTEXT_OPENSSL_CLIENT_H
+
+#include <IceSSL/ContextOpenSSL.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class ClientContext : public Context
+{
+public:
+
+ virtual void configure(const IceSSL::GeneralConfig&,
+ const IceSSL::CertificateAuthority&,
+ const IceSSL::BaseCertificates&);
+
+ // Takes a socket fd as the first parameter.
+ virtual IceSSL::ConnectionPtr createConnection(int, const IceSSL::PluginBaseIPtr&);
+
+protected:
+
+ ClientContext(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&, const Ice::PropertiesPtr&);
+
+ friend class IceSSL::OpenSSL::PluginI;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/ContextOpenSSLF.h b/cpp/src/IceSSL/ContextOpenSSLF.h
index fd338e10a58..322c3d0b5aa 100644
--- a/cpp/src/IceSSL/ContextOpenSSLF.h
+++ b/cpp/src/IceSSL/ContextOpenSSLF.h
@@ -1,37 +1,37 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONTEXT_OPENSSL_F_H
-#define ICE_SSL_CONTEXT_OPENSSL_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class Context;
-typedef IceInternal::Handle<Context> ContextPtr;
-
-}
-
-}
-
-namespace IceInternal
-{
-
-void incRef(::IceSSL::OpenSSL::Context*);
-void decRef(::IceSSL::OpenSSL::Context*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONTEXT_OPENSSL_F_H
+#define ICE_SSL_CONTEXT_OPENSSL_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class Context;
+typedef IceInternal::Handle<Context> ContextPtr;
+
+}
+
+}
+
+namespace IceInternal
+{
+
+void incRef(::IceSSL::OpenSSL::Context*);
+void decRef(::IceSSL::OpenSSL::Context*);
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/ContextOpenSSLServer.cpp b/cpp/src/IceSSL/ContextOpenSSLServer.cpp
index 462b50bd520..90f571b2c92 100644
--- a/cpp/src/IceSSL/ContextOpenSSLServer.cpp
+++ b/cpp/src/IceSSL/ContextOpenSSLServer.cpp
@@ -51,7 +51,7 @@ IceSSL::OpenSSL::ServerContext::configure(const GeneralConfig& generalConfig,
reinterpret_cast<const unsigned char *>(connectionContext.c_str()),
connectionContext.size());
- if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
+ if(_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
{
ostringstream s;
@@ -74,7 +74,7 @@ IceSSL::OpenSSL::ServerContext::configure(const GeneralConfig& generalConfig,
IceSSL::ConnectionPtr
IceSSL::OpenSSL::ServerContext::createConnection(int socket, const PluginBaseIPtr& plugin)
{
- if (_sslContext == 0)
+ if(_sslContext == 0)
{
ContextNotConfiguredException contextEx(__FILE__, __LINE__);
@@ -114,16 +114,16 @@ IceSSL::OpenSSL::ServerContext::loadCertificateAuthority(const CertificateAuthor
string caFile = certAuth.getCAFileName();
- if (caFile.empty())
+ if(caFile.empty())
{
return;
}
STACK_OF(X509_NAME)* certNames = SSL_load_client_CA_file(caFile.c_str());
- if (certNames == 0)
+ if(certNames == 0)
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
string errorString = "unable to load certificate authorities certificate names from " + caFile + "\n";
errorString += sslGetErrors();
diff --git a/cpp/src/IceSSL/ContextOpenSSLServer.h b/cpp/src/IceSSL/ContextOpenSSLServer.h
index 4818d0bfc82..66fa31d13c3 100644
--- a/cpp/src/IceSSL/ContextOpenSSLServer.h
+++ b/cpp/src/IceSSL/ContextOpenSSLServer.h
@@ -1,46 +1,46 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONTEXT_OPENSSL_SERVER_H
-#define ICE_SSL_CONTEXT_OPENSSL_SERVER_H
-
-#include <IceSSL/ContextOpenSSL.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class ServerContext : public Context
-{
-public:
-
- virtual void configure(const IceSSL::GeneralConfig&,
- const IceSSL::CertificateAuthority&,
- const IceSSL::BaseCertificates&);
-
- // Takes a socket fd as the first parameter.
- virtual IceSSL::ConnectionPtr createConnection(int, const IceSSL::PluginBaseIPtr&);
-
-protected:
-
- ServerContext(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&, const Ice::PropertiesPtr&);
-
- virtual void loadCertificateAuthority(const IceSSL::CertificateAuthority& certAuth);
-
- friend class IceSSL::OpenSSL::PluginI;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONTEXT_OPENSSL_SERVER_H
+#define ICE_SSL_CONTEXT_OPENSSL_SERVER_H
+
+#include <IceSSL/ContextOpenSSL.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class ServerContext : public Context
+{
+public:
+
+ virtual void configure(const IceSSL::GeneralConfig&,
+ const IceSSL::CertificateAuthority&,
+ const IceSSL::BaseCertificates&);
+
+ // Takes a socket fd as the first parameter.
+ virtual IceSSL::ConnectionPtr createConnection(int, const IceSSL::PluginBaseIPtr&);
+
+protected:
+
+ ServerContext(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&, const Ice::PropertiesPtr&);
+
+ virtual void loadCertificateAuthority(const IceSSL::CertificateAuthority& certAuth);
+
+ friend class IceSSL::OpenSSL::PluginI;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/Convert.h b/cpp/src/IceSSL/Convert.h
index a4bce9fdbd9..ea5e2452d6f 100644
--- a/cpp/src/IceSSL/Convert.h
+++ b/cpp/src/IceSSL/Convert.h
@@ -1,26 +1,26 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONVERT_H
-#define ICE_SSL_CONVERT_H
-
-#include <Ice/BuiltinSequences.h>
-
-namespace IceSSL
-{
-
-void ucharToByteSeq(unsigned char*, int, Ice::ByteSeq&);
-
-unsigned char* byteSeqToUChar(const Ice::ByteSeq&);
-
-}
-
-#endif
-
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONVERT_H
+#define ICE_SSL_CONVERT_H
+
+#include <Ice/BuiltinSequences.h>
+
+namespace IceSSL
+{
+
+void ucharToByteSeq(unsigned char*, int, Ice::ByteSeq&);
+
+unsigned char* byteSeqToUChar(const Ice::ByteSeq&);
+
+}
+
+#endif
+
diff --git a/cpp/src/IceSSL/DHParams.cpp b/cpp/src/IceSSL/DHParams.cpp
index bde584bf7ff..6980487d179 100644
--- a/cpp/src/IceSSL/DHParams.cpp
+++ b/cpp/src/IceSSL/DHParams.cpp
@@ -21,7 +21,7 @@ IceSSL::OpenSSL::DHParams::DHParams(DH* dhParams) :
IceSSL::OpenSSL::DHParams::~DHParams()
{
- if (_dhParams != 0)
+ if(_dhParams != 0)
{
DH_free(_dhParams);
}
diff --git a/cpp/src/IceSSL/DHParams.h b/cpp/src/IceSSL/DHParams.h
index 446917a1c09..1981d2dae8d 100644
--- a/cpp/src/IceSSL/DHParams.h
+++ b/cpp/src/IceSSL/DHParams.h
@@ -1,45 +1,45 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_DH_PARAMS_H
-#define ICE_DH_PARAMS_H
-
-#include <IceUtil/Shared.h>
-#include <IceSSL/DHParamsF.h>
-#include <openssl/ssl.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class DHParams : public IceUtil::Shared
-{
-public:
-
- // Construction from DH Params structure (simple initialization).
- DHParams(DH*);
-
- ~DHParams();
-
- // Get the internal key structure as per the OpenSSL implementation.
- DH* get() const;
-
-private:
-
- DH* _dhParams;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_DH_PARAMS_H
+#define ICE_DH_PARAMS_H
+
+#include <IceUtil/Shared.h>
+#include <IceSSL/DHParamsF.h>
+#include <openssl/ssl.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class DHParams : public IceUtil::Shared
+{
+public:
+
+ // Construction from DH Params structure (simple initialization).
+ DHParams(DH*);
+
+ ~DHParams();
+
+ // Get the internal key structure as per the OpenSSL implementation.
+ DH* get() const;
+
+private:
+
+ DH* _dhParams;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/DHParamsF.h b/cpp/src/IceSSL/DHParamsF.h
index abe97b9f4e6..b8b8274ec88 100644
--- a/cpp/src/IceSSL/DHParamsF.h
+++ b/cpp/src/IceSSL/DHParamsF.h
@@ -1,37 +1,37 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_DH_PARAMS_F_H
-#define ICE_DH_PARAMS_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class DHParams;
-typedef IceInternal::Handle<DHParams> DHParamsPtr;
-
-}
-
-}
-
-namespace IceInternal
-{
-
-void incRef(::IceSSL::OpenSSL::DHParams*);
-void decRef(::IceSSL::OpenSSL::DHParams*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_DH_PARAMS_F_H
+#define ICE_DH_PARAMS_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class DHParams;
+typedef IceInternal::Handle<DHParams> DHParamsPtr;
+
+}
+
+}
+
+namespace IceInternal
+{
+
+void incRef(::IceSSL::OpenSSL::DHParams*);
+void decRef(::IceSSL::OpenSSL::DHParams*);
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/DefaultCertificateVerifier.cpp b/cpp/src/IceSSL/DefaultCertificateVerifier.cpp
index 3df5f085e98..4fd1789cd62 100644
--- a/cpp/src/IceSSL/DefaultCertificateVerifier.cpp
+++ b/cpp/src/IceSSL/DefaultCertificateVerifier.cpp
@@ -38,11 +38,11 @@ IceSSL::OpenSSL::DefaultCertificateVerifier::verify(int preVerifyOkay, X509_STOR
int verifyDepth = SSL_get_verify_depth(sslConnection);
// A verify error has been encountered.
- if (verifyError != X509_V_OK)
+ if(verifyError != X509_V_OK)
{
// We have a limited verify depth, and we have had to delve too deeply
// into the certificate chain to find an acceptable root certificate.
- if ((verifyDepth != -1) && (verifyDepth < errorDepth))
+ if((verifyDepth != -1) && (verifyDepth < errorDepth))
{
verifyError = X509_V_ERR_CERT_CHAIN_TOO_LONG;
X509_STORE_CTX_set_error(x509StoreContext, verifyError);
@@ -53,7 +53,7 @@ IceSSL::OpenSSL::DefaultCertificateVerifier::verify(int preVerifyOkay, X509_STOR
}
// Only if ICE_PROTOCOL level logging is on do we worry about this.
- if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
+ if(_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
{
char buf[256];
@@ -65,14 +65,14 @@ IceSSL::OpenSSL::DefaultCertificateVerifier::verify(int preVerifyOkay, X509_STOR
outStringStream << "depth = " << dec << errorDepth << ":" << buf << std::endl;
- if (!preVerifyOkay)
+ if(!preVerifyOkay)
{
outStringStream << "verify error: num = " << verifyError << " : "
<< X509_verify_cert_error_string(verifyError) << endl;
}
- switch (verifyError)
+ switch(verifyError)
{
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
{
diff --git a/cpp/src/IceSSL/DefaultCertificateVerifier.h b/cpp/src/IceSSL/DefaultCertificateVerifier.h
index 05e99716105..c465cd52be4 100644
--- a/cpp/src/IceSSL/DefaultCertificateVerifier.h
+++ b/cpp/src/IceSSL/DefaultCertificateVerifier.h
@@ -1,42 +1,42 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_DEFAULT_CERTIFICATE_VERIFIER_H
-#define ICE_SSL_DEFAULT_CERTIFICATE_VERIFIER_H
-
-#include <Ice/LoggerF.h>
-#include <IceSSL/TraceLevelsF.h>
-#include <IceSSL/CertificateVerifierOpenSSL.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class DefaultCertificateVerifier : public IceSSL::OpenSSL::CertificateVerifier
-{
-public:
-
- DefaultCertificateVerifier(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&);
-
- virtual int verify(int, X509_STORE_CTX*, SSL*);
-
-private:
-
- IceSSL::TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_DEFAULT_CERTIFICATE_VERIFIER_H
+#define ICE_SSL_DEFAULT_CERTIFICATE_VERIFIER_H
+
+#include <Ice/LoggerF.h>
+#include <IceSSL/TraceLevelsF.h>
+#include <IceSSL/CertificateVerifierOpenSSL.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class DefaultCertificateVerifier : public IceSSL::OpenSSL::CertificateVerifier
+{
+public:
+
+ DefaultCertificateVerifier(const IceSSL::TraceLevelsPtr&, const Ice::LoggerPtr&);
+
+ virtual int verify(int, X509_STORE_CTX*, SSL*);
+
+private:
+
+ IceSSL::TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/GeneralConfig.cpp b/cpp/src/IceSSL/GeneralConfig.cpp
index 541614d8ad4..f33230c0455 100644
--- a/cpp/src/IceSSL/GeneralConfig.cpp
+++ b/cpp/src/IceSSL/GeneralConfig.cpp
@@ -68,27 +68,27 @@ IceSSL::GeneralConfig::getRandomBytesFiles() const
void
IceSSL::GeneralConfig::set(string& name, string& value)
{
- if (name.compare("version") == 0)
+ if(name.compare("version") == 0)
{
parseVersion(value);
}
- else if (name.compare("cipherlist") == 0)
+ else if(name.compare("cipherlist") == 0)
{
_cipherList = value;
}
- else if (name.compare("context") == 0)
+ else if(name.compare("context") == 0)
{
_context = value;
}
- else if (name.compare("verifymode") == 0)
+ else if(name.compare("verifymode") == 0)
{
parseVerifyMode(value);
}
- else if (name.compare("verifydepth") == 0)
+ else if(name.compare("verifydepth") == 0)
{
_verifyDepth = atoi(value.c_str());
}
- else if (name.compare("randombytes") == 0)
+ else if(name.compare("randombytes") == 0)
{
_randomBytesFiles = value;
}
@@ -102,19 +102,19 @@ IceSSL::GeneralConfig::set(string& name, string& value)
void
IceSSL::GeneralConfig::parseVersion(string& value)
{
- if (value.compare("SSLv2") == 0)
+ if(value.compare("SSLv2") == 0)
{
_sslVersion = SSL_V2;
}
- else if (value.compare("SSLv23") == 0)
+ else if(value.compare("SSLv23") == 0)
{
_sslVersion = SSL_V23;
}
- else if (value.compare("SSLv3") == 0)
+ else if(value.compare("SSLv3") == 0)
{
_sslVersion = SSL_V3;
}
- else if (value.compare("TLSv1") == 0)
+ else if(value.compare("TLSv1") == 0)
{
_sslVersion = TLS_V1;
}
@@ -133,37 +133,37 @@ IceSSL::GeneralConfig::parseVerifyMode(string& value)
string::size_type beg;
string::size_type end = 0;
- while (true)
+ while(true)
{
beg = s.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
end = s.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = s.length();
}
string option = s.substr(beg, end - beg);
- if (option.compare("none") == 0)
+ if(option.compare("none") == 0)
{
_verifyMode |= SSL_VERIFY_NONE;
}
- else if (option.compare("peer") == 0)
+ else if(option.compare("peer") == 0)
{
_verifyMode |= SSL_VERIFY_PEER;
}
- else if (option.compare("fail_no_cert") == 0)
+ else if(option.compare("fail_no_cert") == 0)
{
_verifyMode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
}
- else if (option.compare("client_once") == 0)
+ else if(option.compare("client_once") == 0)
{
_verifyMode |= SSL_VERIFY_CLIENT_ONCE;
}
@@ -171,7 +171,7 @@ IceSSL::GeneralConfig::parseVerifyMode(string& value)
// Both SSL_VERIFY_FAIL_IF_NO_PEER_CERT and SSL_VERIFY_CLIENT_ONCE require
// that SSL_VERIFY_PEER be set, otherwise it's an error.
- if ((_verifyMode != SSL_VERIFY_NONE) && !(_verifyMode & SSL_VERIFY_PEER))
+ if((_verifyMode != SSL_VERIFY_NONE) && !(_verifyMode & SSL_VERIFY_PEER))
{
_verifyMode = SSL_VERIFY_NONE;
}
diff --git a/cpp/src/IceSSL/GeneralConfig.h b/cpp/src/IceSSL/GeneralConfig.h
index c9bca2c9090..967347adf29 100644
--- a/cpp/src/IceSSL/GeneralConfig.h
+++ b/cpp/src/IceSSL/GeneralConfig.h
@@ -1,66 +1,66 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_GENERAL_CONFIG_H
-#define ICE_SSL_GENERAL_CONFIG_H
-
-#include <IceSSL/OpenSSL.h>
-
-namespace IceSSL
-{
-
-class GeneralConfig
-{
-public:
-
- GeneralConfig();
-
- SslProtocol getProtocol() const;
- int getVerifyMode() const;
- int getVerifyDepth() const;
-
- std::string getContext() const;
- std::string getCipherList() const;
- std::string getRandomBytesFiles() const;
-
- // General method - it will figure out how to properly parse the data.
- void set(std::string&, std::string&);
-
-protected:
-
- SslProtocol _sslVersion;
-
- int _verifyMode;
- int _verifyDepth;
-
- std::string _context;
- std::string _cipherList;
- std::string _randomBytesFiles;
-
- void parseVersion(std::string&);
- void parseVerifyMode(std::string&);
-};
-
-template<class Stream> inline
-Stream& operator << (Stream& target, const GeneralConfig& generalConfig)
-{
- target << "Protocol: " << generalConfig.getProtocol() << std::endl;
- target << "Verify Mode: " << generalConfig.getVerifyMode() << std::endl;
- target << "Verify Depth: " << generalConfig.getVerifyDepth() << std::endl;
- target << "Context: " << generalConfig.getContext() << std::endl;
- target << "Cipher List: " << generalConfig.getCipherList() << std::endl;
- target << "Random Bytes: " << generalConfig.getRandomBytesFiles() << std::endl;
-
- return target;
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_GENERAL_CONFIG_H
+#define ICE_SSL_GENERAL_CONFIG_H
+
+#include <IceSSL/OpenSSL.h>
+
+namespace IceSSL
+{
+
+class GeneralConfig
+{
+public:
+
+ GeneralConfig();
+
+ SslProtocol getProtocol() const;
+ int getVerifyMode() const;
+ int getVerifyDepth() const;
+
+ std::string getContext() const;
+ std::string getCipherList() const;
+ std::string getRandomBytesFiles() const;
+
+ // General method - it will figure out how to properly parse the data.
+ void set(std::string&, std::string&);
+
+protected:
+
+ SslProtocol _sslVersion;
+
+ int _verifyMode;
+ int _verifyDepth;
+
+ std::string _context;
+ std::string _cipherList;
+ std::string _randomBytesFiles;
+
+ void parseVersion(std::string&);
+ void parseVerifyMode(std::string&);
+};
+
+template<class Stream> inline
+Stream& operator << (Stream& target, const GeneralConfig& generalConfig)
+{
+ target << "Protocol: " << generalConfig.getProtocol() << std::endl;
+ target << "Verify Mode: " << generalConfig.getVerifyMode() << std::endl;
+ target << "Verify Depth: " << generalConfig.getVerifyDepth() << std::endl;
+ target << "Context: " << generalConfig.getContext() << std::endl;
+ target << "Cipher List: " << generalConfig.getCipherList() << std::endl;
+ target << "Random Bytes: " << generalConfig.getRandomBytesFiles() << std::endl;
+
+ return target;
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/OpenSSL.h b/cpp/src/IceSSL/OpenSSL.h
index 978f2c85ce8..463c036247d 100644
--- a/cpp/src/IceSSL/OpenSSL.h
+++ b/cpp/src/IceSSL/OpenSSL.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_OPENSSL_H
-#define ICE_OPENSSL_H
-
-#include <IceUtil/Config.h>
-#include <openssl/ssl.h>
-
-namespace IceSSL
-{
-
-typedef enum
-{
- NO_SECURITY_TRACE = 0,
- SECURITY_WARNINGS,
- SECURITY_PARSE_WARNINGS,
- SECURITY_PROTOCOL,
- SECURITY_PROTOCOL_DEBUG
-} SecurityTraceLevel;
-
-enum SslProtocol
-{
- SSL_V2 = 1, // Only speak SSLv2
- SSL_V23, // Speak SSLv2 and SSLv3
- SSL_V3, // Only speak SSLv3
- TLS_V1 // Only speak TLSv1
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_OPENSSL_H
+#define ICE_OPENSSL_H
+
+#include <IceUtil/Config.h>
+#include <openssl/ssl.h>
+
+namespace IceSSL
+{
+
+typedef enum
+{
+ NO_SECURITY_TRACE = 0,
+ SECURITY_WARNINGS,
+ SECURITY_PARSE_WARNINGS,
+ SECURITY_PROTOCOL,
+ SECURITY_PROTOCOL_DEBUG
+} SecurityTraceLevel;
+
+enum SslProtocol
+{
+ SSL_V2 = 1, // Only speak SSLv2
+ SSL_V23, // Speak SSLv2 and SSLv3
+ SSL_V3, // Only speak SSLv3
+ TLS_V1 // Only speak TLSv1
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/OpenSSLJanitors.cpp b/cpp/src/IceSSL/OpenSSLJanitors.cpp
index 7779f3a0959..dda448e67ed 100644
--- a/cpp/src/IceSSL/OpenSSLJanitors.cpp
+++ b/cpp/src/IceSSL/OpenSSLJanitors.cpp
@@ -18,7 +18,7 @@ IceSSL::OpenSSL::RSAJanitor::RSAJanitor(RSA* rsa) :
IceSSL::OpenSSL::RSAJanitor::~RSAJanitor()
{
- if (_rsa)
+ if(_rsa)
{
RSA_free(_rsa);
}
@@ -44,7 +44,7 @@ IceSSL::OpenSSL::EVP_PKEYJanitor::EVP_PKEYJanitor(EVP_PKEY* evp_pkey) :
IceSSL::OpenSSL::EVP_PKEYJanitor::~EVP_PKEYJanitor()
{
- if (_evp_pkey)
+ if(_evp_pkey)
{
EVP_PKEY_free(_evp_pkey);
}
@@ -70,7 +70,7 @@ IceSSL::OpenSSL::X509_REQJanitor::X509_REQJanitor(X509_REQ* x509_req) :
IceSSL::OpenSSL::X509_REQJanitor::~X509_REQJanitor()
{
- if (_x509_req)
+ if(_x509_req)
{
X509_REQ_free(_x509_req);
}
@@ -96,7 +96,7 @@ IceSSL::OpenSSL::X509Janitor::X509Janitor(X509* x509) :
IceSSL::OpenSSL::X509Janitor::~X509Janitor()
{
- if (_x509)
+ if(_x509)
{
X509_free(_x509);
}
@@ -122,7 +122,7 @@ IceSSL::OpenSSL::BIOJanitor::BIOJanitor(BIO* bio) :
IceSSL::OpenSSL::BIOJanitor::~BIOJanitor()
{
- if (_bio)
+ if(_bio)
{
BIO_free(_bio);
}
diff --git a/cpp/src/IceSSL/OpenSSLJanitors.h b/cpp/src/IceSSL/OpenSSLJanitors.h
index 63802ae50ba..1140d2bc6c7 100644
--- a/cpp/src/IceSSL/OpenSSLJanitors.h
+++ b/cpp/src/IceSSL/OpenSSLJanitors.h
@@ -1,102 +1,102 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_JANITORS_H
-#define ICE_SSL_JANITORS_H
-
-#include <IceUtil/Config.h>
-#include <openssl/ssl.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class RSAJanitor
-{
-public:
-
- RSAJanitor(RSA*);
- ~RSAJanitor();
-
- void clear();
- RSA* get() const;
-
-private:
-
- RSA* _rsa;
-};
-
-class EVP_PKEYJanitor
-{
-public:
-
- EVP_PKEYJanitor(EVP_PKEY*);
- ~EVP_PKEYJanitor();
-
- void clear();
- EVP_PKEY* get() const;
-
-private:
-
- EVP_PKEY* _evp_pkey;
-};
-
-class X509_REQJanitor
-{
-public:
-
- X509_REQJanitor(X509_REQ*);
- ~X509_REQJanitor();
-
- void clear();
- X509_REQ* get() const;
-
-private:
-
- X509_REQ* _x509_req;
-};
-
-class X509Janitor
-{
-public:
-
- X509Janitor(X509*);
- ~X509Janitor();
-
- void clear();
- X509* get() const;
-
-private:
-
- X509* _x509;
-};
-
-class BIOJanitor
-{
-public:
-
- BIOJanitor(BIO*);
- ~BIOJanitor();
-
- void clear();
- BIO* get() const;
-
-private:
-
- BIO* _bio;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_JANITORS_H
+#define ICE_SSL_JANITORS_H
+
+#include <IceUtil/Config.h>
+#include <openssl/ssl.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class RSAJanitor
+{
+public:
+
+ RSAJanitor(RSA*);
+ ~RSAJanitor();
+
+ void clear();
+ RSA* get() const;
+
+private:
+
+ RSA* _rsa;
+};
+
+class EVP_PKEYJanitor
+{
+public:
+
+ EVP_PKEYJanitor(EVP_PKEY*);
+ ~EVP_PKEYJanitor();
+
+ void clear();
+ EVP_PKEY* get() const;
+
+private:
+
+ EVP_PKEY* _evp_pkey;
+};
+
+class X509_REQJanitor
+{
+public:
+
+ X509_REQJanitor(X509_REQ*);
+ ~X509_REQJanitor();
+
+ void clear();
+ X509_REQ* get() const;
+
+private:
+
+ X509_REQ* _x509_req;
+};
+
+class X509Janitor
+{
+public:
+
+ X509Janitor(X509*);
+ ~X509Janitor();
+
+ void clear();
+ X509* get() const;
+
+private:
+
+ X509* _x509;
+};
+
+class BIOJanitor
+{
+public:
+
+ BIOJanitor(BIO*);
+ ~BIOJanitor();
+
+ void clear();
+ BIO* get() const;
+
+private:
+
+ BIO* _bio;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp
index 3c913d40016..a869dd09c05 100644
--- a/cpp/src/IceSSL/OpenSSLPluginI.cpp
+++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp
@@ -110,7 +110,7 @@ SslLockKeeper lockKeeper;
void IceSSL::lockingCallback(int mode, int type, const char *file, int line)
{
- if (mode & CRYPTO_LOCK)
+ if(mode & CRYPTO_LOCK)
{
lockKeeper.sslLocks[type].lock();
}
@@ -138,7 +138,7 @@ IceSSL::OpenSSL::PluginI::createConnection(ContextType connectionType, int socke
{
IceUtil::RecMutex::Lock sync(_configMutex);
- if (connectionType == ClientServer)
+ if(connectionType == ClientServer)
{
UnsupportedContextException unsupportedException(__FILE__, __LINE__);
@@ -148,18 +148,18 @@ IceSSL::OpenSSL::PluginI::createConnection(ContextType connectionType, int socke
}
// Configure the context if need be.
- if (!isConfigured(connectionType))
+ if(!isConfigured(connectionType))
{
configure(connectionType);
}
IceSSL::ConnectionPtr connection;
- if (connectionType == Client)
+ if(connectionType == Client)
{
connection = _clientContext.createConnection(socket, this);
}
- else if (connectionType == Server)
+ else if(connectionType == Server)
{
connection = _serverContext.createConnection(socket, this);
}
@@ -174,7 +174,7 @@ IceSSL::OpenSSL::PluginI::isConfigured(ContextType contextType)
bool retCode = false;
- switch (contextType)
+ switch(contextType)
{
case Client :
{
@@ -207,15 +207,15 @@ IceSSL::OpenSSL::PluginI::configure()
bool clientConfig = (clientConfigFile.empty() ? false : true);
bool serverConfig = (serverConfigFile.empty() ? false : true);
- if (clientConfig && serverConfig)
+ if(clientConfig && serverConfig)
{
configure(ClientServer);
}
- else if (clientConfig)
+ else if(clientConfig)
{
configure(Client);
}
- else if (serverConfig)
+ else if(serverConfig)
{
configure(Server);
}
@@ -226,7 +226,7 @@ IceSSL::OpenSSL::PluginI::configure(ContextType contextType)
{
IceUtil::RecMutex::Lock sync(_configMutex);
- switch (contextType)
+ switch(contextType)
{
case Client :
{
@@ -252,7 +252,7 @@ IceSSL::OpenSSL::PluginI::configure(ContextType contextType)
string serverCertPath = _properties->getProperty("IceSSL.Server.CertPath");
// Short cut, so that we only have to load the file once.
- if ((clientConfigFile == serverConfigFile) && (clientCertPath == serverCertPath))
+ if((clientConfigFile == serverConfigFile) && (clientCertPath == serverCertPath))
{
loadConfig(ClientServer, clientConfigFile, clientCertPath);
}
@@ -271,13 +271,13 @@ IceSSL::OpenSSL::PluginI::loadConfig(ContextType contextType,
const std::string& configFile,
const std::string& certPath)
{
- if (configFile.empty())
+ if(configFile.empty())
{
ConfigurationLoadingException configEx(__FILE__, __LINE__);
string contextString;
- switch (contextType)
+ switch(contextType)
{
case Client :
{
@@ -312,14 +312,14 @@ IceSSL::OpenSSL::PluginI::loadConfig(ContextType contextType,
// Actually parse the file now.
sslConfig.process();
- if ((contextType == Client || contextType == ClientServer))
+ if((contextType == Client || contextType == ClientServer))
{
GeneralConfig clientGeneral;
CertificateAuthority clientCertAuth;
BaseCertificates clientBaseCerts;
// Walk the parse tree, get the Client configuration.
- if (sslConfig.loadClientConfig(clientGeneral, clientCertAuth, clientBaseCerts))
+ if(sslConfig.loadClientConfig(clientGeneral, clientCertAuth, clientBaseCerts))
{
initRandSystem(clientGeneral.getRandomBytesFiles());
@@ -327,7 +327,7 @@ IceSSL::OpenSSL::PluginI::loadConfig(ContextType contextType,
}
}
- if ((contextType == Server || contextType == ClientServer))
+ if((contextType == Server || contextType == ClientServer))
{
GeneralConfig serverGeneral;
CertificateAuthority serverCertAuth;
@@ -335,7 +335,7 @@ IceSSL::OpenSSL::PluginI::loadConfig(ContextType contextType,
TempCertificates serverTempCerts;
// Walk the parse tree, get the Server configuration.
- if (sslConfig.loadServerConfig(serverGeneral, serverCertAuth, serverBaseCerts, serverTempCerts))
+ if(sslConfig.loadServerConfig(serverGeneral, serverCertAuth, serverBaseCerts, serverTempCerts))
{
initRandSystem(serverGeneral.getRandomBytesFiles());
@@ -343,7 +343,7 @@ IceSSL::OpenSSL::PluginI::loadConfig(ContextType contextType,
_serverContext.configure(serverGeneral, serverCertAuth, serverBaseCerts);
- if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
+ if(_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
{
ostringstream s;
@@ -367,7 +367,7 @@ IceSSL::OpenSSL::PluginI::getRSAKey(int isExport, int keyLength)
RSAMap::iterator retVal = _tempRSAKeys.find(keyLength);
// Does the key already exist?
- if (retVal != _tempRSAKeys.end())
+ if(retVal != _tempRSAKeys.end())
{
// Yes! Use it.
rsa_tmp = (*retVal).second->get();
@@ -379,7 +379,7 @@ IceSSL::OpenSSL::PluginI::getRSAKey(int isExport, int keyLength)
const RSACertMap::iterator& it = _tempRSAFileMap.find(keyLength);
// First we try to load a private and public key from specified files
- if (it != _tempRSAFileMap.end())
+ if(it != _tempRSAFileMap.end())
{
CertificateDesc& rsaKeyCert = (*it).second;
@@ -390,16 +390,16 @@ IceSSL::OpenSSL::PluginI::getRSAKey(int isExport, int keyLength)
RSA* rsaKey = 0;
BIO* bio = 0;
- if ((bio = BIO_new_file(pubCertFile.c_str(), "r")) != 0)
+ if((bio = BIO_new_file(pubCertFile.c_str(), "r")) != 0)
{
BIOJanitor bioJanitor(bio);
rsaCert = PEM_read_bio_RSAPublicKey(bio, 0, 0, 0);
}
- if (rsaCert != 0)
+ if(rsaCert != 0)
{
- if ((bio = BIO_new_file(privKeyFile.c_str(), "r")) != 0)
+ if((bio = BIO_new_file(privKeyFile.c_str(), "r")) != 0)
{
BIOJanitor bioJanitor(bio);
@@ -411,13 +411,13 @@ IceSSL::OpenSSL::PluginI::getRSAKey(int isExport, int keyLength)
// rsaCert. We check to ensure that both are not 0, because if either are,
// one of the reads failed.
- if ((rsaCert != 0) && (rsaKey != 0))
+ if((rsaCert != 0) && (rsaKey != 0))
{
rsa_tmp = rsaCert;
}
else
{
- if (rsaCert != 0)
+ if(rsaCert != 0)
{
RSA_free(rsaCert);
rsaCert = 0;
@@ -426,17 +426,17 @@ IceSSL::OpenSSL::PluginI::getRSAKey(int isExport, int keyLength)
}
// Couldn't load file, last ditch effort - generate a key on the fly.
- if (rsa_tmp == 0)
+ if(rsa_tmp == 0)
{
rsa_tmp = RSA_generate_key(keyLength, RSA_F4, 0, 0);
}
// Save in our temporary key cache.
- if (rsa_tmp != 0)
+ if(rsa_tmp != 0)
{
_tempRSAKeys[keyLength] = new RSAPrivateKey(rsa_tmp);
}
- else if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ else if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
ostringstream errorMsg;
@@ -460,7 +460,7 @@ IceSSL::OpenSSL::PluginI::getDHParams(int isExport, int keyLength)
const DHMap::iterator& retVal = _tempDHKeys.find(keyLength);
// Does the key already exist?
- if (retVal != _tempDHKeys.end())
+ if(retVal != _tempDHKeys.end())
{
// Yes! Use it.
dh_tmp = (*retVal).second->get();
@@ -470,7 +470,7 @@ IceSSL::OpenSSL::PluginI::getDHParams(int isExport, int keyLength)
const DHParamsMap::iterator& it = _tempDHParamsFileMap.find(keyLength);
// First we try to load params from specified files
- if (it != _tempDHParamsFileMap.end())
+ if(it != _tempDHParamsFileMap.end())
{
DiffieHellmanParamsFile& dhParamsFile = (*it).second;
@@ -480,9 +480,9 @@ IceSSL::OpenSSL::PluginI::getDHParams(int isExport, int keyLength)
}
// If that doesn't work, use a compiled-in group.
- if (dh_tmp == 0)
+ if(dh_tmp == 0)
{
- switch (keyLength)
+ switch(keyLength)
{
case 512 :
{
@@ -510,13 +510,13 @@ IceSSL::OpenSSL::PluginI::getDHParams(int isExport, int keyLength)
}
}
- if (dh_tmp != 0)
+ if(dh_tmp != 0)
{
// Cache the dh params for quick lookup - no
// extra processing required then.
_tempDHKeys[keyLength] = new DHParams(dh_tmp);
}
- else if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ else if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
ostringstream errorMsg;
@@ -539,18 +539,18 @@ IceSSL::OpenSSL::PluginI::setCertificateVerifier(ContextType contextType,
IceSSL::OpenSSL::CertificateVerifierPtr castVerifier;
castVerifier = IceSSL::OpenSSL::CertificateVerifierPtr::dynamicCast(verifier);
- if (!castVerifier.get())
+ if(!castVerifier.get())
{
IceSSL::CertificateVerifierTypeException cvtEx(__FILE__, __LINE__);
throw cvtEx;
}
- if (contextType == Client || contextType == ClientServer)
+ if(contextType == Client || contextType == ClientServer)
{
_clientContext.setCertificateVerifier(castVerifier);
}
- if (contextType == Server || contextType == ClientServer)
+ if(contextType == Server || contextType == ClientServer)
{
_serverContext.setCertificateVerifier(castVerifier);
}
@@ -561,12 +561,12 @@ IceSSL::OpenSSL::PluginI::addTrustedCertificateBase64(ContextType contextType, c
{
IceUtil::RecMutex::Lock sync(_configMutex);
- if (contextType == Client || contextType == ClientServer)
+ if(contextType == Client || contextType == ClientServer)
{
_clientContext.addTrustedCertificateBase64(certString);
}
- if (contextType == Server || contextType == ClientServer)
+ if(contextType == Server || contextType == ClientServer)
{
_serverContext.addTrustedCertificateBase64(certString);
}
@@ -577,12 +577,12 @@ IceSSL::OpenSSL::PluginI::addTrustedCertificate(ContextType contextType, const I
{
IceUtil::RecMutex::Lock sync(_configMutex);
- if (contextType == Client || contextType == ClientServer)
+ if(contextType == Client || contextType == ClientServer)
{
_clientContext.addTrustedCertificate(certSeq);
}
- if (contextType == Server || contextType == ClientServer)
+ if(contextType == Server || contextType == ClientServer)
{
_serverContext.addTrustedCertificate(certSeq);
}
@@ -595,12 +595,12 @@ IceSSL::OpenSSL::PluginI::setRSAKeysBase64(ContextType contextType,
{
IceUtil::RecMutex::Lock sync(_configMutex);
- if (contextType == Client || contextType == ClientServer)
+ if(contextType == Client || contextType == ClientServer)
{
_clientContext.setRSAKeysBase64(privateKey, publicKey);
}
- if (contextType == Server || contextType == ClientServer)
+ if(contextType == Server || contextType == ClientServer)
{
_serverContext.setRSAKeysBase64(privateKey, publicKey);
}
@@ -613,12 +613,12 @@ IceSSL::OpenSSL::PluginI::setRSAKeys(ContextType contextType,
{
IceUtil::RecMutex::Lock sync(_configMutex);
- if (contextType == Client || contextType == ClientServer)
+ if(contextType == Client || contextType == ClientServer)
{
_clientContext.setRSAKeys(privateKey, publicKey);
}
- if (contextType == Server || contextType == ClientServer)
+ if(contextType == Server || contextType == ClientServer)
{
_serverContext.setRSAKeys(privateKey, publicKey);
}
@@ -675,7 +675,7 @@ IceSSL::OpenSSL::PluginI::seedRand()
char buffer[1024];
const char* file = RAND_file_name(buffer, sizeof(buffer));
- if (file == 0)
+ if(file == 0)
{
return 0;
}
@@ -686,7 +686,7 @@ IceSSL::OpenSSL::PluginI::seedRand()
long
IceSSL::OpenSSL::PluginI::loadRandFiles(const string& names)
{
- if (!names.empty())
+ if(!names.empty())
{
return 0;
}
@@ -706,11 +706,11 @@ IceSSL::OpenSSL::PluginI::loadRandFiles(const string& names)
char* token = strtok(namesString, seps);
- while (token != 0)
+ while(token != 0)
{
egd = RAND_egd(token);
- if (egd > 0)
+ if(egd > 0)
{
tot += egd;
}
@@ -722,7 +722,7 @@ IceSSL::OpenSSL::PluginI::loadRandFiles(const string& names)
token = strtok(0, seps);
}
- if (tot > 512)
+ if(tot > 512)
{
_randSeeded = 1;
}
@@ -735,19 +735,19 @@ IceSSL::OpenSSL::PluginI::loadRandFiles(const string& names)
void
IceSSL::OpenSSL::PluginI::initRandSystem(const string& randBytesFiles)
{
- if (_randSeeded)
+ if(_randSeeded)
{
return;
}
long randBytesLoaded = seedRand();
- if (!randBytesFiles.empty())
+ if(!randBytesFiles.empty())
{
randBytesLoaded += loadRandFiles(randBytesFiles);
}
- if (!randBytesLoaded && !RAND_status() && (_traceLevels->security >= IceSSL::SECURITY_WARNINGS))
+ if(!randBytesLoaded && !RAND_status() && (_traceLevels->security >= IceSSL::SECURITY_WARNINGS))
{
// In this case, there are two options open to us - specify a random data file using the
// RANDFILE environment variable, or specify additional random data files in the
@@ -765,7 +765,7 @@ IceSSL::OpenSSL::PluginI::loadTempCerts(TempCertificates& tempCerts)
RSAVector::iterator iRSA = tempCerts.getRSACerts().begin();
RSAVector::iterator eRSA = tempCerts.getRSACerts().end();
- while (iRSA != eRSA)
+ while(iRSA != eRSA)
{
_tempRSAFileMap[(*iRSA).getKeySize()] = *iRSA;
iRSA++;
@@ -774,7 +774,7 @@ IceSSL::OpenSSL::PluginI::loadTempCerts(TempCertificates& tempCerts)
DHVector::iterator iDHP = tempCerts.getDHParams().begin();
DHVector::iterator eDHP = tempCerts.getDHParams().end();
- while (iDHP != eDHP)
+ while(iDHP != eDHP)
{
_tempDHParamsFileMap[(*iDHP).getKeySize()] = *iDHP;
iDHP++;
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.h b/cpp/src/IceSSL/OpenSSLPluginI.h
index 2aac3e8c179..d18dfbe3e83 100644
--- a/cpp/src/IceSSL/OpenSSLPluginI.h
+++ b/cpp/src/IceSSL/OpenSSLPluginI.h
@@ -1,118 +1,118 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_OPENSSL_PLUGIN_I_H
-#define ICE_SSL_OPENSSL_PLUGIN_I_H
-
-#include <IceUtil/RecMutex.h>
-#include <IceSSL/PluginBaseI.h>
-#include <IceSSL/CertificateDesc.h>
-#include <IceSSL/CertificateAuthority.h>
-#include <IceSSL/BaseCerts.h>
-#include <IceSSL/TempCerts.h>
-#include <IceSSL/ContextOpenSSLServer.h>
-#include <IceSSL/ContextOpenSSLClient.h>
-#include <IceSSL/RSAPrivateKeyF.h>
-#include <IceSSL/DHParamsF.h>
-#include <openssl/ssl.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-typedef std::map<int,RSAPrivateKeyPtr> RSAMap;
-typedef std::map<int,DHParamsPtr> DHMap;
-
-typedef std::map<int,CertificateDesc> RSACertMap;
-typedef std::map<int,DiffieHellmanParamsFile> DHParamsMap;
-
-class PluginI : public PluginBaseI
-{
-public:
-
- PluginI(const IceInternal::ProtocolPluginFacadePtr&);
- ~PluginI();
-
- virtual IceSSL::ConnectionPtr createConnection(ContextType, int);
-
- virtual bool isConfigured(ContextType);
- virtual void configure();
- virtual void configure(ContextType);
- virtual void loadConfig(ContextType, const std::string&, const std::string&);
-
- // Returns the desired RSA Key, or creates it if not already created.
- // This is public because the tmpRSACallback must be able to access it.
- RSA* getRSAKey(int, int);
-
- // Returns the desired DH Params. If the Params do not already exist, and the key
- // requested is a 512bit or 1024bit key, we use the compiled-in temporary params.
- // If the key is some other length, we read the desired key, based on length,
- // from a DH Param file.
- // This is public because the tmpDHCallback must be able to access it.
- DH* getDHParams(int, int);
-
- virtual void setCertificateVerifier(ContextType, const IceSSL::CertificateVerifierPtr&);
-
- virtual void addTrustedCertificateBase64(ContextType, const std::string&);
-
- virtual void addTrustedCertificate(ContextType, const Ice::ByteSeq&);
-
- virtual void setRSAKeysBase64(ContextType, const std::string&, const std::string&);
-
- virtual void setRSAKeys(ContextType, const Ice::ByteSeq&, const Ice::ByteSeq&);
-
- virtual IceSSL::CertificateVerifierPtr getDefaultCertVerifier();
-
- virtual IceSSL::CertificateVerifierPtr getSingleCertVerifier(const Ice::ByteSeq&);
-
- virtual void destroy();
-
-private:
-
- ServerContext _serverContext;
- ClientContext _clientContext;
-
- // Mutex to ensure synchronization of calls to configure
- // the contexts and calls to create connections.
- IceUtil::RecMutex _configMutex;
-
- // Keep a cache of all temporary RSA keys.
- RSAMap _tempRSAKeys;
- IceUtil::Mutex _tempRSAKeysMutex;
-
- // Keep a cache of all temporary Diffie-Hellman keys.
- DHMap _tempDHKeys;
- IceUtil::Mutex _tempDHKeysMutex;
-
- // Maps of all temporary keying information.
- // The files themselves will not be loaded until
- // needed.
- RSACertMap _tempRSAFileMap;
- DHParamsMap _tempDHParamsFileMap;
-
- // Flag as to whether the Random Number system has been seeded.
- int _randSeeded;
-
- // Cryptographic Random Number System related routines.
- int seedRand();
- long loadRandFiles(const std::string&);
- void initRandSystem(const std::string&);
-
- // Load the temporary (ephemeral) certificates for Server operations.
- void loadTempCerts(TempCertificates&);
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_OPENSSL_PLUGIN_I_H
+#define ICE_SSL_OPENSSL_PLUGIN_I_H
+
+#include <IceUtil/RecMutex.h>
+#include <IceSSL/PluginBaseI.h>
+#include <IceSSL/CertificateDesc.h>
+#include <IceSSL/CertificateAuthority.h>
+#include <IceSSL/BaseCerts.h>
+#include <IceSSL/TempCerts.h>
+#include <IceSSL/ContextOpenSSLServer.h>
+#include <IceSSL/ContextOpenSSLClient.h>
+#include <IceSSL/RSAPrivateKeyF.h>
+#include <IceSSL/DHParamsF.h>
+#include <openssl/ssl.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+typedef std::map<int,RSAPrivateKeyPtr> RSAMap;
+typedef std::map<int,DHParamsPtr> DHMap;
+
+typedef std::map<int,CertificateDesc> RSACertMap;
+typedef std::map<int,DiffieHellmanParamsFile> DHParamsMap;
+
+class PluginI : public PluginBaseI
+{
+public:
+
+ PluginI(const IceInternal::ProtocolPluginFacadePtr&);
+ ~PluginI();
+
+ virtual IceSSL::ConnectionPtr createConnection(ContextType, int);
+
+ virtual bool isConfigured(ContextType);
+ virtual void configure();
+ virtual void configure(ContextType);
+ virtual void loadConfig(ContextType, const std::string&, const std::string&);
+
+ // Returns the desired RSA Key, or creates it if not already created.
+ // This is public because the tmpRSACallback must be able to access it.
+ RSA* getRSAKey(int, int);
+
+ // Returns the desired DH Params. If the Params do not already exist, and the key
+ // requested is a 512bit or 1024bit key, we use the compiled-in temporary params.
+ // If the key is some other length, we read the desired key, based on length,
+ // from a DH Param file.
+ // This is public because the tmpDHCallback must be able to access it.
+ DH* getDHParams(int, int);
+
+ virtual void setCertificateVerifier(ContextType, const IceSSL::CertificateVerifierPtr&);
+
+ virtual void addTrustedCertificateBase64(ContextType, const std::string&);
+
+ virtual void addTrustedCertificate(ContextType, const Ice::ByteSeq&);
+
+ virtual void setRSAKeysBase64(ContextType, const std::string&, const std::string&);
+
+ virtual void setRSAKeys(ContextType, const Ice::ByteSeq&, const Ice::ByteSeq&);
+
+ virtual IceSSL::CertificateVerifierPtr getDefaultCertVerifier();
+
+ virtual IceSSL::CertificateVerifierPtr getSingleCertVerifier(const Ice::ByteSeq&);
+
+ virtual void destroy();
+
+private:
+
+ ServerContext _serverContext;
+ ClientContext _clientContext;
+
+ // Mutex to ensure synchronization of calls to configure
+ // the contexts and calls to create connections.
+ IceUtil::RecMutex _configMutex;
+
+ // Keep a cache of all temporary RSA keys.
+ RSAMap _tempRSAKeys;
+ IceUtil::Mutex _tempRSAKeysMutex;
+
+ // Keep a cache of all temporary Diffie-Hellman keys.
+ DHMap _tempDHKeys;
+ IceUtil::Mutex _tempDHKeysMutex;
+
+ // Maps of all temporary keying information.
+ // The files themselves will not be loaded until
+ // needed.
+ RSACertMap _tempRSAFileMap;
+ DHParamsMap _tempDHParamsFileMap;
+
+ // Flag as to whether the Random Number system has been seeded.
+ int _randSeeded;
+
+ // Cryptographic Random Number System related routines.
+ int seedRand();
+ long loadRandFiles(const std::string&);
+ void initRandSystem(const std::string&);
+
+ // Load the temporary (ephemeral) certificates for Server operations.
+ void loadTempCerts(TempCertificates&);
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/OpenSSLUtils.cpp b/cpp/src/IceSSL/OpenSSLUtils.cpp
index 2767ce97aba..682a632ad52 100644
--- a/cpp/src/IceSSL/OpenSSLUtils.cpp
+++ b/cpp/src/IceSSL/OpenSSLUtils.cpp
@@ -156,19 +156,19 @@ IceSSL::OpenSSL::getGeneralizedTime(ASN1_GENERALIZEDTIME *tm)
char* v = (char *) tm->data;
- if (i < 12)
+ if(i < 12)
{
goto err;
}
- if (v[i-1] == 'Z')
+ if(v[i-1] == 'Z')
{
gmt=1;
}
- for (i=0; i<12; i++)
+ for(i=0; i<12; i++)
{
- if ((v[i] > '9') || (v[i] < '0'))
+ if((v[i] > '9') || (v[i] < '0'))
{
goto err;
}
@@ -177,7 +177,7 @@ IceSSL::OpenSSL::getGeneralizedTime(ASN1_GENERALIZEDTIME *tm)
y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0');
M = (v[4] - '0') * 10 + (v[5] - '0');
- if ((M > 12) || (M < 1))
+ if((M > 12) || (M < 1))
{
goto err;
}
@@ -186,7 +186,7 @@ IceSSL::OpenSSL::getGeneralizedTime(ASN1_GENERALIZEDTIME *tm)
h = (v[8] - '0') * 10 + (v[9] - '0');
m = (v[10] - '0') * 10 + (v[11] - '0');
- if ((v[12] >= '0') && (v[12] <= '9') &&
+ if((v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9'))
{
s = (v[12] - '0') * 10 + (v[13] - '0');
@@ -210,19 +210,19 @@ IceSSL::OpenSSL::getUTCTime(ASN1_UTCTIME *tm)
int i = tm->length;
char* v = (char *) tm->data;
- if (i < 10)
+ if(i < 10)
{
goto err;
}
- if (v[i-1] == 'Z')
+ if(v[i-1] == 'Z')
{
gmt=1;
}
- for (i = 0; i < 10; i++)
+ for(i = 0; i < 10; i++)
{
- if ((v[i] > '9') || (v[i] < '0'))
+ if((v[i] > '9') || (v[i] < '0'))
{
goto err;
}
@@ -230,14 +230,14 @@ IceSSL::OpenSSL::getUTCTime(ASN1_UTCTIME *tm)
y = (v[0] - '0') * 10 + (v[1] - '0');
- if (y < 50)
+ if(y < 50)
{
y+=100;
}
M = (v[2] - '0') * 10 + (v[3] - '0');
- if ((M > 12) || (M < 1))
+ if((M > 12) || (M < 1))
{
goto err;
}
@@ -246,7 +246,7 @@ IceSSL::OpenSSL::getUTCTime(ASN1_UTCTIME *tm)
h = (v[6] - '0') * 10 + (v[7] - '0');
m = (v[8] - '0') * 10 + (v[9] - '0');
- if ((v[10] >= '0') && (v[10] <= '9') && (v[11] >= '0') && (v[11] <= '9'))
+ if((v[10] >= '0') && (v[10] <= '9') && (v[11] >= '0') && (v[11] <= '9'))
{
s = (v[10] - '0') * 10 + (v[11] - '0');
}
@@ -265,7 +265,7 @@ IceSSL::OpenSSL::getASN1time(ASN1_TIME *tm)
string theTime;
- switch (tm->type)
+ switch(tm->type)
{
case V_ASN1_UTCTIME :
{
@@ -297,7 +297,7 @@ IceSSL::OpenSSL::loadDHParam(const char* dhfile)
DH* ret = 0;
BIO* bio = BIO_new_file(dhfile,"r");
- if (bio != 0)
+ if(bio != 0)
{
ret = PEM_read_bio_DHparams(bio, 0, 0, 0);
BIO_free(bio);
@@ -314,13 +314,13 @@ IceSSL::OpenSSL::getTempDH(unsigned char* p, int plen, unsigned char* g, int gle
DH* dh = DH_new();
- if (dh != 0)
+ if(dh != 0)
{
dh->p = BN_bin2bn(p, plen, 0);
dh->g = BN_bin2bn(g, glen, 0);
- if ((dh->p == 0) || (dh->g == 0))
+ if((dh->p == 0) || (dh->g == 0))
{
DH_free(dh);
dh = 0;
@@ -379,7 +379,7 @@ IceSSL::OpenSSL::sslGetErrors()
unsigned long es = CRYPTO_thread_id();
- while ((errorCode = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0)
+ while((errorCode = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0)
{
sprintf(bigBuffer,"%6d - Thread ID: %lu\n", errorNum, es);
errorMessage += bigBuffer;
@@ -395,7 +395,7 @@ IceSSL::OpenSSL::sslGetErrors()
sprintf(bigBuffer,"%6d - Location: %s, %d\n", errorNum, file, line);
errorMessage += bigBuffer;
- if (flags & ERR_TXT_STRING)
+ if(flags & ERR_TXT_STRING)
{
sprintf(bigBuffer,"%6d - Data: %s\n", errorNum, data);
errorMessage += bigBuffer;
diff --git a/cpp/src/IceSSL/OpenSSLUtils.h b/cpp/src/IceSSL/OpenSSLUtils.h
index 9e75f8fac02..7dc57afee56 100644
--- a/cpp/src/IceSSL/OpenSSLUtils.h
+++ b/cpp/src/IceSSL/OpenSSLUtils.h
@@ -1,52 +1,52 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#include <IceUtil/Config.h>
-#include <openssl/ssl.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-std::string getGeneralizedTime(ASN1_GENERALIZEDTIME*);
-
-std::string getUTCTime(ASN1_UTCTIME*);
-
-std::string getASN1time(ASN1_TIME*);
-
-DH* loadDHParam(const char*);
-
-DH* getTempDH(unsigned char*, int, unsigned char*, int);
-
-DH* getTempDH512();
-DH* getTempDH1024();
-DH* getTempDH2048();
-DH* getTempDH4096();
-
-std::string sslGetErrors();
-
-}
-
-}
-
-extern "C"
-{
-
-RSA* tmpRSACallback(SSL*, int, int);
-
-DH* tmpDHCallback(SSL*, int, int);
-
-int verifyCallback(int, X509_STORE_CTX*);
-
-int passwordCallback(char*, int, int, void*);
-
-}
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <IceUtil/Config.h>
+#include <openssl/ssl.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+std::string getGeneralizedTime(ASN1_GENERALIZEDTIME*);
+
+std::string getUTCTime(ASN1_UTCTIME*);
+
+std::string getASN1time(ASN1_TIME*);
+
+DH* loadDHParam(const char*);
+
+DH* getTempDH(unsigned char*, int, unsigned char*, int);
+
+DH* getTempDH512();
+DH* getTempDH1024();
+DH* getTempDH2048();
+DH* getTempDH4096();
+
+std::string sslGetErrors();
+
+}
+
+}
+
+extern "C"
+{
+
+RSA* tmpRSACallback(SSL*, int, int);
+
+DH* tmpDHCallback(SSL*, int, int);
+
+int verifyCallback(int, X509_STORE_CTX*);
+
+int passwordCallback(char*, int, int, void*);
+
+}
diff --git a/cpp/src/IceSSL/PluginBaseI.h b/cpp/src/IceSSL/PluginBaseI.h
index 42b6a6d1aa2..9f9a180003d 100644
--- a/cpp/src/IceSSL/PluginBaseI.h
+++ b/cpp/src/IceSSL/PluginBaseI.h
@@ -1,71 +1,71 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_PLUGIN_I_H
-#define ICE_SSL_PLUGIN_I_H
-
-#include <Ice/LoggerF.h>
-#include <Ice/PropertiesF.h>
-#include <Ice/ProtocolPluginFacadeF.h>
-#include <IceSSL/Plugin.h>
-#include <IceSSL/PluginBaseIF.h>
-#include <IceSSL/SslConnectionF.h>
-#include <IceSSL/CertificateVerifierF.h>
-#include <IceSSL/TraceLevelsF.h>
-
-namespace IceSSL
-{
-
-class PluginBaseI : public IceSSL::Plugin
-{
-public:
-
- virtual ConnectionPtr createConnection(ContextType, int) = 0;
-
- virtual bool isConfigured(ContextType) = 0;
-
- virtual void configure() = 0;
-
- virtual void configure(ContextType) = 0;
-
- virtual void loadConfig(ContextType, const ::std::string&, const ::std::string&) = 0;
-
- virtual void setCertificateVerifier(ContextType, const CertificateVerifierPtr&) = 0;
-
- virtual void addTrustedCertificateBase64(ContextType, const std::string&) = 0;
-
- virtual void addTrustedCertificate(ContextType, const Ice::ByteSeq&) = 0;
-
- virtual void setRSAKeysBase64(ContextType, const std::string&, const std::string&) = 0;
-
- virtual void setRSAKeys(ContextType, const ::Ice::ByteSeq&, const ::Ice::ByteSeq&) = 0;
-
- TraceLevelsPtr getTraceLevels() const;
-
- Ice::LoggerPtr getLogger() const;
-
- Ice::PropertiesPtr getProperties() const;
-
- IceInternal::ProtocolPluginFacadePtr getProtocolPluginFacade() const;
-
-protected:
-
- PluginBaseI(const IceInternal::ProtocolPluginFacadePtr&);
- virtual ~PluginBaseI();
-
- IceInternal::ProtocolPluginFacadePtr _protocolPluginFacade;
- TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
- Ice::PropertiesPtr _properties;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_PLUGIN_I_H
+#define ICE_SSL_PLUGIN_I_H
+
+#include <Ice/LoggerF.h>
+#include <Ice/PropertiesF.h>
+#include <Ice/ProtocolPluginFacadeF.h>
+#include <IceSSL/Plugin.h>
+#include <IceSSL/PluginBaseIF.h>
+#include <IceSSL/SslConnectionF.h>
+#include <IceSSL/CertificateVerifierF.h>
+#include <IceSSL/TraceLevelsF.h>
+
+namespace IceSSL
+{
+
+class PluginBaseI : public IceSSL::Plugin
+{
+public:
+
+ virtual ConnectionPtr createConnection(ContextType, int) = 0;
+
+ virtual bool isConfigured(ContextType) = 0;
+
+ virtual void configure() = 0;
+
+ virtual void configure(ContextType) = 0;
+
+ virtual void loadConfig(ContextType, const ::std::string&, const ::std::string&) = 0;
+
+ virtual void setCertificateVerifier(ContextType, const CertificateVerifierPtr&) = 0;
+
+ virtual void addTrustedCertificateBase64(ContextType, const std::string&) = 0;
+
+ virtual void addTrustedCertificate(ContextType, const Ice::ByteSeq&) = 0;
+
+ virtual void setRSAKeysBase64(ContextType, const std::string&, const std::string&) = 0;
+
+ virtual void setRSAKeys(ContextType, const ::Ice::ByteSeq&, const ::Ice::ByteSeq&) = 0;
+
+ TraceLevelsPtr getTraceLevels() const;
+
+ Ice::LoggerPtr getLogger() const;
+
+ Ice::PropertiesPtr getProperties() const;
+
+ IceInternal::ProtocolPluginFacadePtr getProtocolPluginFacade() const;
+
+protected:
+
+ PluginBaseI(const IceInternal::ProtocolPluginFacadePtr&);
+ virtual ~PluginBaseI();
+
+ IceInternal::ProtocolPluginFacadePtr _protocolPluginFacade;
+ TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+ Ice::PropertiesPtr _properties;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/PluginBaseIF.h b/cpp/src/IceSSL/PluginBaseIF.h
index 1f7cf16bd6e..e145fe32230 100644
--- a/cpp/src/IceSSL/PluginBaseIF.h
+++ b/cpp/src/IceSSL/PluginBaseIF.h
@@ -1,32 +1,32 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_PLUGIN_BASE_I_F_H
-#define ICE_SSL_PLUGIN_BASE_I_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceSSL
-{
-
-class PluginBaseI;
-typedef IceInternal::Handle<PluginBaseI> PluginBaseIPtr;
-
-}
-
-namespace IceInternal
-{
-
-void incRef(IceSSL::PluginBaseI*);
-void decRef(IceSSL::PluginBaseI*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_PLUGIN_BASE_I_F_H
+#define ICE_SSL_PLUGIN_BASE_I_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceSSL
+{
+
+class PluginBaseI;
+typedef IceInternal::Handle<PluginBaseI> PluginBaseIPtr;
+
+}
+
+namespace IceInternal
+{
+
+void incRef(IceSSL::PluginBaseI*);
+void decRef(IceSSL::PluginBaseI*);
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/RSACertificateGen.cpp b/cpp/src/IceSSL/RSACertificateGen.cpp
index 173e18a1017..8b1ef2b722a 100644
--- a/cpp/src/IceSSL/RSACertificateGen.cpp
+++ b/cpp/src/IceSSL/RSACertificateGen.cpp
@@ -252,13 +252,13 @@ IceSSL::OpenSSL::RSACertificateGen::generate(const RSACertificateGenContext& con
X509_set_pubkey(x509SelfSigned, pkey);
// Sign the public key using an MD5 digest.
- if (!X509_sign(x509SelfSigned, pkey, EVP_md5()))
+ if(!X509_sign(x509SelfSigned, pkey, EVP_md5()))
{
throw IceSSL::CertificateSigningException(__FILE__, __LINE__);
}
// Verify the Signature (paranoia).
- if (!X509_REQ_verify(signingRequest, pkey))
+ if(!X509_REQ_verify(signingRequest, pkey))
{
throw IceSSL::CertificateSignatureException(__FILE__, __LINE__);
}
@@ -284,7 +284,7 @@ IceSSL::OpenSSL::RSACertificateGen::loadKeyPair(const std::string& keyFile, cons
// Read in the X509 Certificate Structure
//
BIOJanitor certBIO(BIO_new_file(certFile.c_str(), "r"));
- if (certBIO.get() == 0)
+ if(certBIO.get() == 0)
{
IceSSL::OpenSSL::CertificateLoadException certLoadEx(__FILE__, __LINE__);
@@ -298,7 +298,7 @@ IceSSL::OpenSSL::RSACertificateGen::loadKeyPair(const std::string& keyFile, cons
X509Janitor x509Janitor(PEM_read_bio_X509(certBIO.get(), 0, 0, 0));
- if (x509Janitor.get() == 0)
+ if(x509Janitor.get() == 0)
{
IceSSL::OpenSSL::CertificateLoadException certLoadEx(__FILE__, __LINE__);
@@ -314,7 +314,7 @@ IceSSL::OpenSSL::RSACertificateGen::loadKeyPair(const std::string& keyFile, cons
// Read in the RSA Private Key Structure
//
BIOJanitor keyBIO(BIO_new_file(keyFile.c_str(), "r"));
- if (keyBIO.get() == 0)
+ if(keyBIO.get() == 0)
{
IceSSL::OpenSSL::PrivateKeyLoadException pklEx(__FILE__, __LINE__);
@@ -328,7 +328,7 @@ IceSSL::OpenSSL::RSACertificateGen::loadKeyPair(const std::string& keyFile, cons
RSAJanitor rsaJanitor(PEM_read_bio_RSAPrivateKey(keyBIO.get(), 0, 0, 0));
- if (rsaJanitor.get() == 0)
+ if(rsaJanitor.get() == 0)
{
IceSSL::OpenSSL::PrivateKeyLoadException pklEx(__FILE__, __LINE__);
diff --git a/cpp/src/IceSSL/RSAPrivateKey.cpp b/cpp/src/IceSSL/RSAPrivateKey.cpp
index 7499c69ecdc..90e07cc87b4 100644
--- a/cpp/src/IceSSL/RSAPrivateKey.cpp
+++ b/cpp/src/IceSSL/RSAPrivateKey.cpp
@@ -52,7 +52,7 @@ IceSSL::OpenSSL::RSAPrivateKey::RSAPrivateKey(RSA* rsa) :
IceSSL::OpenSSL::RSAPrivateKey::~RSAPrivateKey()
{
- if (_privateKey != 0)
+ if(_privateKey != 0)
{
RSA_free(_privateKey);
}
@@ -106,9 +106,9 @@ IceSSL::OpenSSL::RSAPrivateKey::byteSeqToKey(const ByteSeq& keySeq)
_privateKey = d2i_RSAPrivateKey(rsapp, privKeyBuffpp, (long)keySeq.size());
- delete [] privateKeyBuffer;
-
- if (_privateKey == 0)
+ delete [] privateKeyBuffer;
+
+ if(_privateKey == 0)
{
IceSSL::PrivateKeyParseException pkParseException(__FILE__, __LINE__);
diff --git a/cpp/src/IceSSL/RSAPublicKey.cpp b/cpp/src/IceSSL/RSAPublicKey.cpp
index 70ddadeb1bd..1e3ead9ef64 100644
--- a/cpp/src/IceSSL/RSAPublicKey.cpp
+++ b/cpp/src/IceSSL/RSAPublicKey.cpp
@@ -46,7 +46,7 @@ IceSSL::OpenSSL::RSAPublicKey::RSAPublicKey(const ByteSeq& certSeq)
IceSSL::OpenSSL::RSAPublicKey::~RSAPublicKey()
{
- if (_publicKey != 0)
+ if(_publicKey != 0)
{
X509_free(_publicKey);
}
@@ -107,7 +107,7 @@ IceSSL::OpenSSL::RSAPublicKey::byteSeqToCert(const ByteSeq& certSeq)
_publicKey = d2i_X509(x509pp, pubKeyBuffpp, (long)certSeq.size());
- if (_publicKey == 0)
+ if(_publicKey == 0)
{
IceSSL::CertificateParseException certParseException(__FILE__, __LINE__);
diff --git a/cpp/src/IceSSL/SingleCertificateVerifier.cpp b/cpp/src/IceSSL/SingleCertificateVerifier.cpp
index 80198f5341f..9ef833690f3 100644
--- a/cpp/src/IceSSL/SingleCertificateVerifier.cpp
+++ b/cpp/src/IceSSL/SingleCertificateVerifier.cpp
@@ -35,7 +35,7 @@ IceSSL::OpenSSL::SingleCertificateVerifier::verify(int preVerifyOkay,
X509* peerCertificate = x509StoreContext->cert;
// We only bother to do the rest of this if we have something to verify.
- if (peerCertificate)
+ if(peerCertificate)
{
// Get the subject name (Not a memory leak, this is how this is used).
X509_NAME* peerCertName = X509_get_subject_name(peerCertificate);
@@ -46,7 +46,7 @@ IceSSL::OpenSSL::SingleCertificateVerifier::verify(int preVerifyOkay,
peerCertName,
&trustedObject);
- switch (retCode)
+ switch(retCode)
{
case X509_LU_X509:
{
@@ -74,7 +74,7 @@ IceSSL::OpenSSL::SingleCertificateVerifier::verify(int preVerifyOkay,
}
// Compare, only if we have both.
- if (trustedCert)
+ if(trustedCert)
{
ByteSeq peerByteSeq = toByteSeq(peerCertificate);
ByteSeq trustedByteSeq = toByteSeq(trustedCert);
diff --git a/cpp/src/IceSSL/SingleCertificateVerifier.h b/cpp/src/IceSSL/SingleCertificateVerifier.h
index 89753b620e9..c524311c119 100644
--- a/cpp/src/IceSSL/SingleCertificateVerifier.h
+++ b/cpp/src/IceSSL/SingleCertificateVerifier.h
@@ -1,43 +1,43 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_SINGLE_CERTIFICATE_VERIFIER_H
-#define ICE_SSL_SINGLE_CERTIFICATE_VERIFIER_H
-
-#include <Ice/BuiltinSequences.h>
-#include <IceSSL/CertificateVerifierOpenSSL.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class SingleCertificateVerifier : public IceSSL::OpenSSL::CertificateVerifier
-{
-public:
-
- SingleCertificateVerifier(const Ice::ByteSeq&);
-
- virtual int verify(int, X509_STORE_CTX*, SSL*);
-
- Ice::ByteSeq toByteSeq(X509*);
-
-protected:
-
- Ice::ByteSeq _publicKey;
-};
-
-}
-
-}
-
-#endif
-
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_SINGLE_CERTIFICATE_VERIFIER_H
+#define ICE_SSL_SINGLE_CERTIFICATE_VERIFIER_H
+
+#include <Ice/BuiltinSequences.h>
+#include <IceSSL/CertificateVerifierOpenSSL.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class SingleCertificateVerifier : public IceSSL::OpenSSL::CertificateVerifier
+{
+public:
+
+ SingleCertificateVerifier(const Ice::ByteSeq&);
+
+ virtual int verify(int, X509_STORE_CTX*, SSL*);
+
+ Ice::ByteSeq toByteSeq(X509*);
+
+protected:
+
+ Ice::ByteSeq _publicKey;
+};
+
+}
+
+}
+
+#endif
+
diff --git a/cpp/src/IceSSL/SslAcceptor.cpp b/cpp/src/IceSSL/SslAcceptor.cpp
index 8218a47ccb0..f1fbbadc967 100644
--- a/cpp/src/IceSSL/SslAcceptor.cpp
+++ b/cpp/src/IceSSL/SslAcceptor.cpp
@@ -29,7 +29,7 @@ IceSSL::SslAcceptor::fd()
void
IceSSL::SslAcceptor::close()
{
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
ostringstream s;
s << "stopping to accept ssl connections at " << toString();
@@ -54,7 +54,7 @@ IceSSL::SslAcceptor::listen()
throw;
}
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
ostringstream s;
s << "accepting ssl connections at " << toString();
@@ -68,7 +68,7 @@ IceSSL::SslAcceptor::accept(int timeout)
SOCKET fd = doAccept(_fd, timeout);
setBlock(fd, false);
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
ostringstream s;
s << "accepted ssl connection\n" << fdToString(fd);
@@ -107,7 +107,7 @@ IceSSL::SslAcceptor::SslAcceptor(const PluginBaseIPtr& plugin, const string& hos
_logger(plugin->getLogger()),
_backlog(0)
{
- if (_backlog <= 0)
+ if(_backlog <= 0)
{
_backlog = 5;
}
diff --git a/cpp/src/IceSSL/SslAcceptor.h b/cpp/src/IceSSL/SslAcceptor.h
index 5718d5ab3c9..dbe7656e840 100644
--- a/cpp/src/IceSSL/SslAcceptor.h
+++ b/cpp/src/IceSSL/SslAcceptor.h
@@ -1,58 +1,58 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_ACCEPTOR_H
-#define ICE_SSL_ACCEPTOR_H
-
-#include <Ice/TransceiverF.h>
-#include <Ice/LoggerF.h>
-#include <Ice/Acceptor.h>
-#include <IceSSL/PluginBaseIF.h>
-#include <IceSSL/TraceLevelsF.h>
-
-#ifndef _WIN32
-# include <netinet/in.h> // For struct sockaddr_in
-#endif
-
-namespace IceSSL
-{
-
-class SslEndpoint;
-
-class SslAcceptor : public IceInternal::Acceptor
-{
-public:
-
- virtual SOCKET fd();
- virtual void close();
- virtual void listen();
- virtual IceInternal::TransceiverPtr accept(int);
- virtual std::string toString() const;
-
- bool equivalent(const std::string&, int) const;
- int effectivePort();
-
-private:
-
- SslAcceptor(const PluginBaseIPtr&, const std::string&, int);
- virtual ~SslAcceptor();
- friend class SslEndpoint;
-
- PluginBaseIPtr _plugin;
- TraceLevelsPtr _traceLevels;
- ::Ice::LoggerPtr _logger;
- SOCKET _fd;
- int _backlog;
- struct sockaddr_in _addr;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_ACCEPTOR_H
+#define ICE_SSL_ACCEPTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/Acceptor.h>
+#include <IceSSL/PluginBaseIF.h>
+#include <IceSSL/TraceLevelsF.h>
+
+#ifndef _WIN32
+# include <netinet/in.h> // For struct sockaddr_in
+#endif
+
+namespace IceSSL
+{
+
+class SslEndpoint;
+
+class SslAcceptor : public IceInternal::Acceptor
+{
+public:
+
+ virtual SOCKET fd();
+ virtual void close();
+ virtual void listen();
+ virtual IceInternal::TransceiverPtr accept(int);
+ virtual std::string toString() const;
+
+ bool equivalent(const std::string&, int) const;
+ int effectivePort();
+
+private:
+
+ SslAcceptor(const PluginBaseIPtr&, const std::string&, int);
+ virtual ~SslAcceptor();
+ friend class SslEndpoint;
+
+ PluginBaseIPtr _plugin;
+ TraceLevelsPtr _traceLevels;
+ ::Ice::LoggerPtr _logger;
+ SOCKET _fd;
+ int _backlog;
+ struct sockaddr_in _addr;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnection.h b/cpp/src/IceSSL/SslConnection.h
index eb7aedb9e7f..8347f7893bf 100644
--- a/cpp/src/IceSSL/SslConnection.h
+++ b/cpp/src/IceSSL/SslConnection.h
@@ -1,46 +1,46 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTION_H
-#define ICE_SSL_CONNECTION_H
-
-#include <Ice/Buffer.h>
-#include <Ice/LoggerF.h>
-#include <IceSSL/SslConnectionF.h>
-#include <IceSSL/TraceLevelsF.h>
-#include <IceSSL/CertificateVerifierF.h>
-
-namespace IceSSL
-{
-
-class Connection : public IceUtil::Shared
-{
-public:
-
- Connection(const TraceLevelsPtr&,
- const Ice::LoggerPtr&,
- const CertificateVerifierPtr&);
- virtual ~Connection();
-
- virtual int shutdown(int timeout = 0) = 0;
-
- virtual int read(IceInternal::Buffer&, int) = 0;
- virtual int write(IceInternal::Buffer&, int) = 0;
-
-protected:
-
- TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
- CertificateVerifierPtr _certificateVerifier;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTION_H
+#define ICE_SSL_CONNECTION_H
+
+#include <Ice/Buffer.h>
+#include <Ice/LoggerF.h>
+#include <IceSSL/SslConnectionF.h>
+#include <IceSSL/TraceLevelsF.h>
+#include <IceSSL/CertificateVerifierF.h>
+
+namespace IceSSL
+{
+
+class Connection : public IceUtil::Shared
+{
+public:
+
+ Connection(const TraceLevelsPtr&,
+ const Ice::LoggerPtr&,
+ const CertificateVerifierPtr&);
+ virtual ~Connection();
+
+ virtual int shutdown(int timeout = 0) = 0;
+
+ virtual int read(IceInternal::Buffer&, int) = 0;
+ virtual int write(IceInternal::Buffer&, int) = 0;
+
+protected:
+
+ TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+ CertificateVerifierPtr _certificateVerifier;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnectionF.h b/cpp/src/IceSSL/SslConnectionF.h
index 5d394788405..48c4383448f 100644
--- a/cpp/src/IceSSL/SslConnectionF.h
+++ b/cpp/src/IceSSL/SslConnectionF.h
@@ -1,32 +1,32 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTION_F_H
-#define ICE_SSL_CONNECTION_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceSSL
-{
-
-class Connection;
-typedef IceInternal::Handle<Connection> ConnectionPtr;
-
-}
-
-namespace IceInternal
-{
-
-void incRef(::IceSSL::Connection*);
-void decRef(::IceSSL::Connection*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTION_F_H
+#define ICE_SSL_CONNECTION_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceSSL
+{
+
+class Connection;
+typedef IceInternal::Handle<Connection> ConnectionPtr;
+
+}
+
+namespace IceInternal
+{
+
+void incRef(::IceSSL::Connection*);
+void decRef(::IceSSL::Connection*);
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSL.cpp b/cpp/src/IceSSL/SslConnectionOpenSSL.cpp
index dba97fde2d2..844568e4adb 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSL.cpp
+++ b/cpp/src/IceSSL/SslConnectionOpenSSL.cpp
@@ -79,7 +79,7 @@ IceSSL::OpenSSL::Connection::Connection(const IceSSL::CertificateVerifierPtr& ce
IceSSL::OpenSSL::Connection::~Connection()
{
- if (_sslConnection != 0)
+ if(_sslConnection != 0)
{
removeConnection(_sslConnection);
SSL_set_ex_data(_sslConnection, 0, 0);
@@ -91,29 +91,29 @@ IceSSL::OpenSSL::Connection::~Connection()
int
IceSSL::OpenSSL::Connection::shutdown(int timeout)
{
- if (_sslConnection == 0)
+ if(_sslConnection == 0)
{
return 1;
}
int retCode = 0;
- if (_initWantWrite)
+ if(_initWantWrite)
{
int i = writeSelect(timeout);
- if (i == 0)
+ if(i == 0)
{
return 0;
}
_initWantWrite = 0;
}
- else if (_initWantRead)
+ else if(_initWantRead)
{
int i = readSelect(timeout);
- if (i == 0)
+ if(i == 0)
{
return 0;
}
@@ -125,18 +125,18 @@ IceSSL::OpenSSL::Connection::shutdown(int timeout)
retCode = SSL_shutdown(_sslConnection);
- if (retCode == 1)
+ if(retCode == 1)
{
// Shutdown successful - shut down the socket for writing.
::shutdown(SSL_get_fd(_sslConnection), SHUT_WR);
}
- else if (retCode == -1)
+ else if(retCode == -1)
{
setLastError(retCode);
// Shutdown failed due to an error.
- switch (getLastError())
+ switch(getLastError())
{
case SSL_ERROR_WANT_WRITE:
{
@@ -166,20 +166,20 @@ IceSSL::OpenSSL::Connection::shutdown(int timeout)
// Some error with the underlying transport.
//
- if (interrupted())
+ if(interrupted())
{
retCode = 0;
break;
}
- if (wouldBlock())
+ if(wouldBlock())
{
readSelect(timeout);
retCode = 0;
break;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -262,7 +262,7 @@ IceSSL::OpenSSL::Connection::verifyCertificate(int preVerifyOkay, X509_STORE_CTX
verifier = dynamic_cast<IceSSL::OpenSSL::CertificateVerifier*>(_certificateVerifier.get());
// Check to make sure we have a proper verifier for the operation.
- if (verifier)
+ if(verifier)
{
// Use the verifier to verify the certificate
try
@@ -271,7 +271,7 @@ IceSSL::OpenSSL::Connection::verifyCertificate(int preVerifyOkay, X509_STORE_CTX
}
catch (const Ice::LocalException& localEx)
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
ostringstream s;
@@ -289,11 +289,11 @@ IceSSL::OpenSSL::Connection::verifyCertificate(int preVerifyOkay, X509_STORE_CTX
// Note: This code should NEVER be able to be reached, as we check each
// CertificateVerifier as it is added to the System.
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
string errorString;
- if (_certificateVerifier.get())
+ if(_certificateVerifier.get())
{
errorString = "WRN improper CertificateVerifier type";
}
@@ -353,7 +353,7 @@ IceSSL::OpenSSL::Connection::initialize(int timeout)
{
int retCode = 0;
- while (true)
+ while(true)
{
// One lucky thread will get the honor of carrying out the hanshake,
// if there is one to perform. The HandshakeSentinel effectively
@@ -365,9 +365,9 @@ IceSSL::OpenSSL::Connection::initialize(int timeout)
HandshakeSentinel handshakeSentinel(_handshakeFlag);
- if (!handshakeSentinel.ownHandshake())
+ if(!handshakeSentinel.ownHandshake())
{
- if (timeout >= 0)
+ if(timeout >= 0)
{
// We should return immediately here - do not block,
// leave it to the caller to figure this out.
@@ -389,9 +389,9 @@ IceSSL::OpenSSL::Connection::initialize(int timeout)
// get away with it. As long as we don't encounter some error
// status (or completion), this thread continues to service the
// initialize() call.
- while (retCode == 0)
+ while(retCode == 0)
{
- switch (_phase)
+ switch(_phase)
{
case Handshake :
{
@@ -409,7 +409,7 @@ IceSSL::OpenSSL::Connection::initialize(int timeout)
{
retCode = SSL_is_init_finished(_sslConnection);
- if (!retCode)
+ if(!retCode)
{
// In this case, we are essentially renegotiating
// the connection at the behest of the peer.
@@ -481,7 +481,7 @@ IceSSL::OpenSSL::Connection::select(int timeout, bool write)
fd_set rwFdSet;
struct timeval tv;
- if (timeout >= 0)
+ if(timeout >= 0)
{
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
@@ -492,9 +492,9 @@ IceSSL::OpenSSL::Connection::select(int timeout, bool write)
FD_ZERO(&rwFdSet);
FD_SET(fd, &rwFdSet);
- if (timeout >= 0)
+ if(timeout >= 0)
{
- if (write)
+ if(write)
{
ret = ::select(fd + 1, 0, &rwFdSet, 0, &tv);
}
@@ -505,7 +505,7 @@ IceSSL::OpenSSL::Connection::select(int timeout, bool write)
}
else
{
- if (write)
+ if(write)
{
ret = ::select(fd + 1, 0, &rwFdSet, 0, 0);
}
@@ -515,16 +515,16 @@ IceSSL::OpenSSL::Connection::select(int timeout, bool write)
}
}
}
- while (ret == SOCKET_ERROR && interrupted());
+ while(ret == SOCKET_ERROR && interrupted());
- if (ret == SOCKET_ERROR)
+ if(ret == SOCKET_ERROR)
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
- if (ret == 0)
+ if(ret == 0)
{
throw TimeoutException(__FILE__, __LINE__);
}
@@ -554,18 +554,18 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout)
int initReturn = 0;
// We keep reading until we're done.
- while (buf.i != buf.b.end())
+ while(buf.i != buf.b.end())
{
// Ensure we're initialized.
initReturn = initialize(timeout);
- if (initReturn == -1)
+ if(initReturn == -1)
{
// Handshake underway, timeout immediately, easy way to deal with this.
throw TimeoutException(__FILE__, __LINE__);
}
- if (initReturn == 0)
+ if(initReturn == 0)
{
// Retry the initialize call
continue;
@@ -573,10 +573,10 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout)
// initReturn must be > 0, so we're okay to try a read
- if (!pending() && !readSelect(_readTimeout))
+ if(!pending() && !readSelect(_readTimeout))
{
// Nothing is left to read (according to SSL).
- if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
+ if(_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
{
_logger->trace(_traceLevels->securityCat, "no pending application-level bytes");
}
@@ -589,13 +589,13 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout)
bytesRead = sslRead(static_cast<char*>(&*buf.i), packetSize);
- switch (getLastError())
+ switch(getLastError())
{
case SSL_ERROR_NONE:
{
- if (bytesRead > 0)
+ if(bytesRead > 0)
{
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
ostringstream s;
s << "received " << bytesRead << " of " << packetSize;
@@ -607,7 +607,7 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout)
buf.i += bytesRead;
- if (packetSize > buf.b.end() - buf.i)
+ if(packetSize > buf.b.end() - buf.i)
{
packetSize = buf.b.end() - buf.i;
}
@@ -617,7 +617,7 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout)
case SSL_ERROR_WANT_READ:
{
- if (!readSelect(timeout))
+ if(!readSelect(timeout))
{
// Timeout and wait for them to arrive.
throw TimeoutException(__FILE__, __LINE__);
@@ -638,17 +638,17 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout)
{
// IO Error in underlying BIO
- if (interrupted())
+ if(interrupted())
{
break;
}
- if (wouldBlock())
+ if(wouldBlock())
{
break;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -721,11 +721,11 @@ IceSSL::OpenSSL::Connection::showCertificateChain(BIO* bio)
// Big nasty buffer
char buffer[4096];
- if ((sk = SSL_get_peer_cert_chain(_sslConnection)) != 0)
+ if((sk = SSL_get_peer_cert_chain(_sslConnection)) != 0)
{
BIO_printf(bio,"---\nCertificate chain\n");
- for (int i = 0; i < sk_X509_num(sk); i++)
+ 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));
BIO_printf(bio, "%2d s:%s\n", i, buffer);
@@ -751,7 +751,7 @@ IceSSL::OpenSSL::Connection::showPeerCertificate(BIO* bio, const char* connType)
X509* peerCert = 0;
char buffer[4096];
- if ((peerCert = SSL_get_peer_certificate(_sslConnection)) != 0)
+ if((peerCert = SSL_get_peer_certificate(_sslConnection)) != 0)
{
BIO_printf(bio, "%s Certificate\n", connType);
PEM_write_bio_X509(bio, peerCert);
@@ -784,7 +784,7 @@ IceSSL::OpenSSL::Connection::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, 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)
@@ -795,9 +795,9 @@ IceSSL::OpenSSL::Connection::showSharedCiphers(BIO* bio)
int j = 0;
int i = 0;
- while (*strPointer)
+ while(*strPointer)
{
- if (*strPointer == ':')
+ if(*strPointer == ':')
{
BIO_write(bio, " ", (15-j%25));
i++;
@@ -823,7 +823,7 @@ IceSSL::OpenSSL::Connection::showSessionInfo(BIO* bio)
assert(_sslConnection != 0);
assert(bio != 0);
- if (_sslConnection->hit)
+ if(_sslConnection->hit)
{
BIO_printf(bio, "Reused session-id\n");
}
@@ -871,11 +871,11 @@ IceSSL::OpenSSL::Connection::showClientCAList(BIO* bio, const char* connType)
char buffer[4096];
STACK_OF(X509_NAME)* sk = SSL_get_client_CA_list(_sslConnection);
- if ((sk != 0) && (sk_X509_NAME_num(sk) > 0))
+ if((sk != 0) && (sk_X509_NAME_num(sk) > 0))
{
BIO_printf(bio,"---\nAcceptable %s certificate CA names\n", connType);
- for (int i = 0; i < sk_X509_NAME_num(sk); i++)
+ 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));
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSL.h b/cpp/src/IceSSL/SslConnectionOpenSSL.h
index 0d08f83ccbc..6cf2a501b4b 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSL.h
+++ b/cpp/src/IceSSL/SslConnectionOpenSSL.h
@@ -1,206 +1,206 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTION_OPENSSL_H
-#define ICE_SSL_CONNECTION_OPENSSL_H
-
-#include <IceUtil/Mutex.h>
-#include <IceSSL/SslConnection.h>
-#include <IceSSL/PluginBaseIF.h>
-#include <IceSSL/SslConnectionOpenSSLF.h>
-#include <IceSSL/CertificateVerifierOpenSSL.h>
-#include <IceSSL/TraceLevelsF.h>
-
-#include <openssl/ssl.h>
-
-#include <map>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class SafeFlag
-{
-public:
-
- SafeFlag(bool flagVal = false)
- {
- _flag = flagVal;
- }
-
- ~SafeFlag()
- {
- }
-
- bool checkAndSet()
- {
- IceUtil::Mutex::Lock sync(_mutex);
-
- if (_flag)
- {
- return false;
- }
- else
- {
- _flag = true;
- return true;
- }
- }
-
- bool check()
- {
- IceUtil::Mutex::Lock sync(_mutex);
- return _flag;
- }
-
- void set()
- {
- IceUtil::Mutex::Lock sync(_mutex);
- _flag = true;
- }
-
- void unset()
- {
- IceUtil::Mutex::Lock sync(_mutex);
- _flag = false;
- }
-
-private:
-
- IceUtil::Mutex _mutex;
- bool _flag;
-};
-
-class HandshakeSentinel
-{
-public:
-
- HandshakeSentinel(SafeFlag& handshakeFlag) :
- _flag(handshakeFlag)
- {
- _ownHandshake = _flag.checkAndSet();
- }
-
- ~HandshakeSentinel()
- {
- if (_ownHandshake)
- {
- _flag.unset();
- }
- }
-
- bool ownHandshake()
- {
- return _ownHandshake;
- }
-
-private:
-
- bool _ownHandshake;
- SafeFlag& _flag;
-};
-
-// NOTE: This is a mapping from SSL* to Connection*, for use with the verifyCallback.
-// I have purposely not used ConnectionPtr here, as connections register themselves
-// with this map on construction and unregister themselves in the destructor. If
-// this map used ConnectionPtr, Connection instances would never destruct as there
-// would always be a reference to them from the map.
-typedef std::map<SSL*, Connection*> SslConnectionMap;
-
-typedef enum
-{
- Handshake, // The connection is negotiating a connection with the peer.
- Shutdown, // The connection is in the process of shutting down.
- Connected // The connection is connected - communication may continue.
-} ConnectPhase;
-
-class Connection : public IceSSL::Connection
-{
-public:
-
- Connection(const IceSSL::CertificateVerifierPtr&,
- SSL*,
- const IceSSL::PluginBaseIPtr&);
- virtual ~Connection();
-
- virtual int shutdown(int timeout = 0);
-
- virtual int read(IceInternal::Buffer&, int);
- virtual int write(IceInternal::Buffer&, int) = 0;
-
- virtual int handshake(int timeout = 0) = 0;
-
- void setHandshakeReadTimeout(int timeout);
-
- static ConnectionPtr getConnection(SSL*);
-
- // Callback from OpenSSL for purposes of certificate verification
- int verifyCertificate(int, X509_STORE_CTX*);
-
-protected:
-
- int connect();
- int accept();
- int renegotiate();
- int initialize(int timeout);
-
- int pending();
- int getLastError() const;
-
- int sslRead(char*, int);
- int sslWrite(char*, int);
-
- int select(int, bool);
- int readSelect(int);
- int writeSelect(int);
-
- int readSSL(IceInternal::Buffer&, int);
-
- static void addConnection(SSL*, Connection*);
- static void removeConnection(SSL*);
-
- virtual void showConnectionInfo() = 0;
-
- void showCertificateChain(BIO*);
- void showPeerCertificate(BIO*, const char*);
- void showSharedCiphers(BIO*);
- void showSessionInfo(BIO*);
- void showSelectedCipherInfo(BIO*);
- void showHandshakeStats(BIO*);
- void showClientCAList(BIO*, const char*);
-
- void setLastError(int errorCode) { _lastError = errorCode; };
-
- static SslConnectionMap _connectionMap;
- static IceUtil::Mutex _connectionRepositoryMutex;
-
- // Pointer to the OpenSSL Connection structure.
- SSL* _sslConnection;
-
- int _lastError;
-
- IceUtil::Mutex _handshakeWaitMutex;
-
- SafeFlag _handshakeFlag;
- int _initWantRead;
- int _initWantWrite;
- int _handshakeReadTimeout;
- int _readTimeout;
-
- ConnectPhase _phase;
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTION_OPENSSL_H
+#define ICE_SSL_CONNECTION_OPENSSL_H
+
+#include <IceUtil/Mutex.h>
+#include <IceSSL/SslConnection.h>
+#include <IceSSL/PluginBaseIF.h>
+#include <IceSSL/SslConnectionOpenSSLF.h>
+#include <IceSSL/CertificateVerifierOpenSSL.h>
+#include <IceSSL/TraceLevelsF.h>
+
+#include <openssl/ssl.h>
+
+#include <map>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class SafeFlag
+{
+public:
+
+ SafeFlag(bool flagVal = false)
+ {
+ _flag = flagVal;
+ }
+
+ ~SafeFlag()
+ {
+ }
+
+ bool checkAndSet()
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+
+ if(_flag)
+ {
+ return false;
+ }
+ else
+ {
+ _flag = true;
+ return true;
+ }
+ }
+
+ bool check()
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ return _flag;
+ }
+
+ void set()
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _flag = true;
+ }
+
+ void unset()
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _flag = false;
+ }
+
+private:
+
+ IceUtil::Mutex _mutex;
+ bool _flag;
+};
+
+class HandshakeSentinel
+{
+public:
+
+ HandshakeSentinel(SafeFlag& handshakeFlag) :
+ _flag(handshakeFlag)
+ {
+ _ownHandshake = _flag.checkAndSet();
+ }
+
+ ~HandshakeSentinel()
+ {
+ if(_ownHandshake)
+ {
+ _flag.unset();
+ }
+ }
+
+ bool ownHandshake()
+ {
+ return _ownHandshake;
+ }
+
+private:
+
+ bool _ownHandshake;
+ SafeFlag& _flag;
+};
+
+// NOTE: This is a mapping from SSL* to Connection*, for use with the verifyCallback.
+// I have purposely not used ConnectionPtr here, as connections register themselves
+// with this map on construction and unregister themselves in the destructor. If
+// this map used ConnectionPtr, Connection instances would never destruct as there
+// would always be a reference to them from the map.
+typedef std::map<SSL*, Connection*> SslConnectionMap;
+
+typedef enum
+{
+ Handshake, // The connection is negotiating a connection with the peer.
+ Shutdown, // The connection is in the process of shutting down.
+ Connected // The connection is connected - communication may continue.
+} ConnectPhase;
+
+class Connection : public IceSSL::Connection
+{
+public:
+
+ Connection(const IceSSL::CertificateVerifierPtr&,
+ SSL*,
+ const IceSSL::PluginBaseIPtr&);
+ virtual ~Connection();
+
+ virtual int shutdown(int timeout = 0);
+
+ virtual int read(IceInternal::Buffer&, int);
+ virtual int write(IceInternal::Buffer&, int) = 0;
+
+ virtual int handshake(int timeout = 0) = 0;
+
+ void setHandshakeReadTimeout(int timeout);
+
+ static ConnectionPtr getConnection(SSL*);
+
+ // Callback from OpenSSL for purposes of certificate verification
+ int verifyCertificate(int, X509_STORE_CTX*);
+
+protected:
+
+ int connect();
+ int accept();
+ int renegotiate();
+ int initialize(int timeout);
+
+ int pending();
+ int getLastError() const;
+
+ int sslRead(char*, int);
+ int sslWrite(char*, int);
+
+ int select(int, bool);
+ int readSelect(int);
+ int writeSelect(int);
+
+ int readSSL(IceInternal::Buffer&, int);
+
+ static void addConnection(SSL*, Connection*);
+ static void removeConnection(SSL*);
+
+ virtual void showConnectionInfo() = 0;
+
+ void showCertificateChain(BIO*);
+ void showPeerCertificate(BIO*, const char*);
+ void showSharedCiphers(BIO*);
+ void showSessionInfo(BIO*);
+ void showSelectedCipherInfo(BIO*);
+ void showHandshakeStats(BIO*);
+ void showClientCAList(BIO*, const char*);
+
+ void setLastError(int errorCode) { _lastError = errorCode; };
+
+ static SslConnectionMap _connectionMap;
+ static IceUtil::Mutex _connectionRepositoryMutex;
+
+ // Pointer to the OpenSSL Connection structure.
+ SSL* _sslConnection;
+
+ int _lastError;
+
+ IceUtil::Mutex _handshakeWaitMutex;
+
+ SafeFlag _handshakeFlag;
+ int _initWantRead;
+ int _initWantWrite;
+ int _handshakeReadTimeout;
+ int _readTimeout;
+
+ ConnectPhase _phase;
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSLClient.cpp b/cpp/src/IceSSL/SslConnectionOpenSSLClient.cpp
index acfbdd6bc71..15042ebd0b6 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSLClient.cpp
+++ b/cpp/src/IceSSL/SslConnectionOpenSSLClient.cpp
@@ -57,26 +57,26 @@ IceSSL::OpenSSL::ClientConnection::handshake(int timeout)
int retCode = SSL_is_init_finished(_sslConnection);
- while (!retCode)
+ while(!retCode)
{
_readTimeout = timeout > _handshakeReadTimeout ? timeout : _handshakeReadTimeout;
- if (_initWantRead)
+ if(_initWantRead)
{
int i = readSelect(_readTimeout);
- if (i == 0)
+ if(i == 0)
{
return 0;
}
_initWantRead = 0;
}
- else if (_initWantWrite)
+ else if(_initWantWrite)
{
int i = writeSelect(timeout);
- if (i == 0)
+ if(i == 0)
{
return 0;
}
@@ -86,7 +86,7 @@ IceSSL::OpenSSL::ClientConnection::handshake(int timeout)
int result = connect();
- switch (getLastError())
+ switch(getLastError())
{
case SSL_ERROR_WANT_READ:
{
@@ -119,18 +119,18 @@ IceSSL::OpenSSL::ClientConnection::handshake(int timeout)
{
// IO Error in underlying BIO
- if (interrupted())
+ if(interrupted())
{
break;
}
- if (wouldBlock())
+ if(wouldBlock())
{
readSelect(_readTimeout);
break;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -165,7 +165,7 @@ IceSSL::OpenSSL::ClientConnection::handshake(int timeout)
{
int verifyError = SSL_get_verify_result(_sslConnection);
- if (verifyError != X509_V_OK && verifyError != 1)
+ if(verifyError != X509_V_OK && verifyError != 1)
{
CertificateVerificationException certVerEx(__FILE__, __LINE__);
@@ -173,7 +173,7 @@ IceSSL::OpenSSL::ClientConnection::handshake(int timeout)
string errors = sslGetErrors();
- if (!errors.empty())
+ if(!errors.empty())
{
certVerEx._message += "\n";
certVerEx._message += errors;
@@ -206,7 +206,7 @@ IceSSL::OpenSSL::ClientConnection::handshake(int timeout)
retCode = SSL_is_init_finished(_sslConnection);
- if (retCode > 0)
+ if(retCode > 0)
{
_phase = Connected;
@@ -231,17 +231,17 @@ IceSSL::OpenSSL::ClientConnection::write(Buffer& buf, int timeout)
// Limit packet size to avoid performance problems on WIN32.
// (blatantly ripped off from Marc Laukien)
//
- if (packetSize > 64 * 1024)
+ if(packetSize > 64 * 1024)
{
packetSize = 64 * 1024;
}
#endif
// We keep reading until we're done
- while (buf.i != buf.b.end())
+ while(buf.i != buf.b.end())
{
// Ensure we're initialized.
- if (initialize(timeout) <= 0)
+ if(initialize(timeout) <= 0)
{
// Retry the initialize call
continue;
@@ -250,7 +250,7 @@ IceSSL::OpenSSL::ClientConnection::write(Buffer& buf, int timeout)
// initialize() must have returned > 0, so we're okay to try a write.
// Perform a select on the socket.
- if (!writeSelect(timeout))
+ if(!writeSelect(timeout))
{
// We're done here.
break;
@@ -258,13 +258,13 @@ IceSSL::OpenSSL::ClientConnection::write(Buffer& buf, int timeout)
bytesWritten = sslWrite(static_cast<char*>(&*buf.i), packetSize);
- switch (getLastError())
+ switch(getLastError())
{
case SSL_ERROR_NONE:
{
- if (bytesWritten > 0)
+ if(bytesWritten > 0)
{
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
ostringstream s;
s << "sent " << bytesWritten << " of " << packetSize;
@@ -276,7 +276,7 @@ IceSSL::OpenSSL::ClientConnection::write(Buffer& buf, int timeout)
buf.i += bytesWritten;
- if (packetSize > buf.b.end() - buf.i)
+ if(packetSize > buf.b.end() - buf.i)
{
packetSize = buf.b.end() - buf.i;
}
@@ -299,21 +299,21 @@ IceSSL::OpenSSL::ClientConnection::write(Buffer& buf, int timeout)
// requiring shutdown.
// If nothing was written, the demo client stops writing - we continue.
// This is potentially something wierd to watch out for.
- if (bytesWritten == -1)
+ if(bytesWritten == -1)
{
// IO Error in underlying BIO
- if (interrupted())
+ if(interrupted())
{
break;
}
- if (wouldBlock())
+ if(wouldBlock())
{
break;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -324,7 +324,7 @@ IceSSL::OpenSSL::ClientConnection::write(Buffer& buf, int timeout)
ex.error = getSocketErrno();
throw ex;
}
- else if (bytesWritten > 0)
+ else if(bytesWritten > 0)
{
ProtocolException protocolEx(__FILE__, __LINE__);
@@ -371,7 +371,7 @@ void
IceSSL::OpenSSL::ClientConnection::showConnectionInfo()
{
// Only in extreme cases do we enable this, partially because it doesn't use the Logger.
- if ((_traceLevels->security >= IceSSL::SECURITY_PROTOCOL_DEBUG) && 0)
+ if((_traceLevels->security >= IceSSL::SECURITY_PROTOCOL_DEBUG) && 0)
{
BIOJanitor bioJanitor(BIO_new_fp(stdout, BIO_NOCLOSE));
BIO* bio = bioJanitor.get();
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSLClient.h b/cpp/src/IceSSL/SslConnectionOpenSSLClient.h
index 89903e5c8a8..988bd20411e 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSLClient.h
+++ b/cpp/src/IceSSL/SslConnectionOpenSSLClient.h
@@ -1,44 +1,44 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTION_OPENSSL_CLIENT_H
-#define ICE_SSL_CONNECTION_OPENSSL_CLIENT_H
-
-#include <IceSSL/SslConnectionOpenSSL.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class ClientConnection : public Connection
-{
-public:
-
- ClientConnection(const IceSSL::CertificateVerifierPtr&,
- SSL*,
- const IceSSL::PluginBaseIPtr&);
- virtual ~ClientConnection();
-
- virtual int handshake(int timeout = 0);
-
- virtual int write(IceInternal::Buffer&, int);
-
-protected:
-
- virtual void showConnectionInfo();
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTION_OPENSSL_CLIENT_H
+#define ICE_SSL_CONNECTION_OPENSSL_CLIENT_H
+
+#include <IceSSL/SslConnectionOpenSSL.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class ClientConnection : public Connection
+{
+public:
+
+ ClientConnection(const IceSSL::CertificateVerifierPtr&,
+ SSL*,
+ const IceSSL::PluginBaseIPtr&);
+ virtual ~ClientConnection();
+
+ virtual int handshake(int timeout = 0);
+
+ virtual int write(IceInternal::Buffer&, int);
+
+protected:
+
+ virtual void showConnectionInfo();
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSLF.h b/cpp/src/IceSSL/SslConnectionOpenSSLF.h
index 4c35b8166a3..b5fb778de64 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSLF.h
+++ b/cpp/src/IceSSL/SslConnectionOpenSSLF.h
@@ -1,37 +1,37 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTION_OPENSSL_F_H
-#define ICE_SSL_CONNECTION_OPENSSL_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class Connection;
-typedef IceInternal::Handle<Connection> ConnectionPtr;
-
-}
-
-}
-
-namespace IceInternal
-{
-
-void incRef(::IceSSL::OpenSSL::Connection*);
-void decRef(::IceSSL::OpenSSL::Connection*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTION_OPENSSL_F_H
+#define ICE_SSL_CONNECTION_OPENSSL_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class Connection;
+typedef IceInternal::Handle<Connection> ConnectionPtr;
+
+}
+
+}
+
+namespace IceInternal
+{
+
+void incRef(::IceSSL::OpenSSL::Connection*);
+void decRef(::IceSSL::OpenSSL::Connection*);
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp b/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp
index 1933a5056a1..e925e6d61b2 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp
+++ b/cpp/src/IceSSL/SslConnectionOpenSSLServer.cpp
@@ -59,15 +59,15 @@ IceSSL::OpenSSL::ServerConnection::handshake(int timeout)
int retCode = SSL_is_init_finished(_sslConnection);
- while (!retCode)
+ while(!retCode)
{
_readTimeout = timeout > _handshakeReadTimeout ? timeout : _handshakeReadTimeout;
- if (_initWantWrite)
+ if(_initWantWrite)
{
int i = writeSelect(timeout);
- if (i == 0)
+ if(i == 0)
{
cerr << "-" << flush;
return 0;
@@ -79,7 +79,7 @@ IceSSL::OpenSSL::ServerConnection::handshake(int timeout)
{
int i = readSelect(_readTimeout);
- if (i == 0)
+ if(i == 0)
{
cerr << "-" << flush;
return 0;
@@ -89,12 +89,12 @@ IceSSL::OpenSSL::ServerConnection::handshake(int timeout)
int result = accept();
// We're doing an Accept and we don't get a retry on the socket.
- if ((result <= 0) && (BIO_sock_should_retry(result) == 0))
+ if((result <= 0) && (BIO_sock_should_retry(result) == 0))
{
// Socket can't retry - bad scene, find out why.
long verifyError = SSL_get_verify_result(_sslConnection);
- if (verifyError != X509_V_OK)
+ if(verifyError != X509_V_OK)
{
// Flag the connection for shutdown, let the
// usual initialization take care of it.
@@ -115,7 +115,7 @@ IceSSL::OpenSSL::ServerConnection::handshake(int timeout)
}
// Find out what the error was (if any).
- switch (getLastError())
+ switch(getLastError())
{
case SSL_ERROR_WANT_WRITE:
{
@@ -139,18 +139,18 @@ IceSSL::OpenSSL::ServerConnection::handshake(int timeout)
// if you look at their code).
if(result == -1)
{
- if (interrupted())
+ if(interrupted())
{
break;
}
- if (wouldBlock())
+ if(wouldBlock())
{
readSelect(_readTimeout);
break;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -197,7 +197,7 @@ IceSSL::OpenSSL::ServerConnection::handshake(int timeout)
retCode = SSL_is_init_finished(_sslConnection);
- if (retCode > 0)
+ if(retCode > 0)
{
_phase = Connected;
@@ -221,17 +221,17 @@ IceSSL::OpenSSL::ServerConnection::write(Buffer& buf, int timeout)
//
// Limit packet size to avoid performance problems on WIN32.
//
- if (packetSize > 64 * 1024)
+ if(packetSize > 64 * 1024)
{
packetSize = 64 * 1024;
}
#endif
// We keep writing until we're done.
- while (buf.i != buf.b.end())
+ while(buf.i != buf.b.end())
{
// Ensure we're initialized.
- if (initialize(timeout) <= 0)
+ if(initialize(timeout) <= 0)
{
// Retry the initialize call
continue;
@@ -240,7 +240,7 @@ IceSSL::OpenSSL::ServerConnection::write(Buffer& buf, int timeout)
// initialize() must have returned > 0, so we're okay to try a write.
// Perform a select on the socket.
- if (!writeSelect(timeout))
+ if(!writeSelect(timeout))
{
// We're done here.
break;
@@ -248,11 +248,11 @@ IceSSL::OpenSSL::ServerConnection::write(Buffer& buf, int timeout)
bytesWritten = sslWrite(static_cast<char*>(&*buf.i), packetSize);
- switch (getLastError())
+ switch(getLastError())
{
case SSL_ERROR_NONE:
{
- if (_traceLevels->network >= 3)
+ if(_traceLevels->network >= 3)
{
ostringstream s;
s << "sent " << bytesWritten << " of " << packetSize;
@@ -264,7 +264,7 @@ IceSSL::OpenSSL::ServerConnection::write(Buffer& buf, int timeout)
buf.i += bytesWritten;
- if (packetSize > buf.b.end() - buf.i)
+ if(packetSize > buf.b.end() - buf.i)
{
packetSize = buf.b.end() - buf.i;
}
@@ -280,21 +280,21 @@ IceSSL::OpenSSL::ServerConnection::write(Buffer& buf, int timeout)
case SSL_ERROR_SYSCALL:
{
- if (bytesWritten == -1)
+ if(bytesWritten == -1)
{
// IO Error in underlying BIO
- if (interrupted())
+ if(interrupted())
{
break;
}
- if (wouldBlock())
+ if(wouldBlock())
{
break;
}
- if (connectionLost())
+ if(connectionLost())
{
ConnectionLostException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -347,7 +347,7 @@ void
IceSSL::OpenSSL::ServerConnection::showConnectionInfo()
{
// Only in extreme cases do we enable this, partially because it doesn't use the Logger.
- if ((_traceLevels->security >= IceSSL::SECURITY_PROTOCOL_DEBUG) && 0)
+ if((_traceLevels->security >= IceSSL::SECURITY_PROTOCOL_DEBUG) && 0)
{
BIOJanitor bioJanitor(BIO_new_fp(stdout, BIO_NOCLOSE));
BIO* bio = bioJanitor.get();
diff --git a/cpp/src/IceSSL/SslConnectionOpenSSLServer.h b/cpp/src/IceSSL/SslConnectionOpenSSLServer.h
index fb990670f68..6e1b91a524b 100644
--- a/cpp/src/IceSSL/SslConnectionOpenSSLServer.h
+++ b/cpp/src/IceSSL/SslConnectionOpenSSLServer.h
@@ -1,44 +1,44 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTION_OPENSSL_SERVER_H
-#define ICE_SSL_CONNECTION_OPENSSL_SERVER_H
-
-#include <IceSSL/SslConnectionOpenSSL.h>
-
-namespace IceSSL
-{
-
-namespace OpenSSL
-{
-
-class ServerConnection : public Connection
-{
-public:
-
- ServerConnection(const IceSSL::CertificateVerifierPtr&,
- SSL*,
- const IceSSL::PluginBaseIPtr&);
- virtual ~ServerConnection();
-
- virtual int handshake(int timeout = 0);
-
- virtual int write(IceInternal::Buffer&, int);
-
-protected:
-
- virtual void showConnectionInfo();
-};
-
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTION_OPENSSL_SERVER_H
+#define ICE_SSL_CONNECTION_OPENSSL_SERVER_H
+
+#include <IceSSL/SslConnectionOpenSSL.h>
+
+namespace IceSSL
+{
+
+namespace OpenSSL
+{
+
+class ServerConnection : public Connection
+{
+public:
+
+ ServerConnection(const IceSSL::CertificateVerifierPtr&,
+ SSL*,
+ const IceSSL::PluginBaseIPtr&);
+ virtual ~ServerConnection();
+
+ virtual int handshake(int timeout = 0);
+
+ virtual int write(IceInternal::Buffer&, int);
+
+protected:
+
+ virtual void showConnectionInfo();
+};
+
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslConnector.cpp b/cpp/src/IceSSL/SslConnector.cpp
index be354757e81..d82288e8b52 100644
--- a/cpp/src/IceSSL/SslConnector.cpp
+++ b/cpp/src/IceSSL/SslConnector.cpp
@@ -26,7 +26,7 @@ IceSSL::SslConnector::connect(int timeout)
TraceLevelsPtr traceLevels = _plugin->getTraceLevels();
LoggerPtr logger = _plugin->getLogger();
- if (traceLevels->network >= 2)
+ if(traceLevels->network >= 2)
{
ostringstream s;
s << "trying to establish ssl connection to " << toString();
@@ -37,7 +37,7 @@ IceSSL::SslConnector::connect(int timeout)
setBlock(fd, false);
doConnect(fd, _addr, timeout);
- if (traceLevels->network >= 1)
+ if(traceLevels->network >= 1)
{
ostringstream s;
s << "ssl connection established\n" << fdToString(fd);
diff --git a/cpp/src/IceSSL/SslConnector.h b/cpp/src/IceSSL/SslConnector.h
index de556f0e3ba..7514abcc82b 100644
--- a/cpp/src/IceSSL/SslConnector.h
+++ b/cpp/src/IceSSL/SslConnector.h
@@ -1,46 +1,46 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_CONNECTOR_H
-#define ICE_SSL_CONNECTOR_H
-
-#include <Ice/TransceiverF.h>
-#include <Ice/Connector.h>
-#include <IceSSL/PluginBaseIF.h>
-
-#ifndef _WIN32
-# include <netinet/in.h> // For struct sockaddr_in
-#endif
-
-namespace IceSSL
-{
-
-class SslEndpoint;
-
-class SslConnector : public IceInternal::Connector
-{
-public:
-
- virtual IceInternal::TransceiverPtr connect(int);
- virtual std::string toString() const;
-
-private:
-
- SslConnector(const PluginBaseIPtr&, const std::string&, int);
- virtual ~SslConnector();
- friend class SslEndpoint;
-
- PluginBaseIPtr _plugin;
- struct sockaddr_in _addr;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_CONNECTOR_H
+#define ICE_SSL_CONNECTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/Connector.h>
+#include <IceSSL/PluginBaseIF.h>
+
+#ifndef _WIN32
+# include <netinet/in.h> // For struct sockaddr_in
+#endif
+
+namespace IceSSL
+{
+
+class SslEndpoint;
+
+class SslConnector : public IceInternal::Connector
+{
+public:
+
+ virtual IceInternal::TransceiverPtr connect(int);
+ virtual std::string toString() const;
+
+private:
+
+ SslConnector(const PluginBaseIPtr&, const std::string&, int);
+ virtual ~SslConnector();
+ friend class SslEndpoint;
+
+ PluginBaseIPtr _plugin;
+ struct sockaddr_in _addr;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslEndpoint.cpp b/cpp/src/IceSSL/SslEndpoint.cpp
index 8c5e000ec15..c3b593a8d77 100644
--- a/cpp/src/IceSSL/SslEndpoint.cpp
+++ b/cpp/src/IceSSL/SslEndpoint.cpp
@@ -39,44 +39,44 @@ IceSSL::SslEndpoint::SslEndpoint(const PluginBaseIPtr& plugin, const string& str
string::size_type beg;
string::size_type end = 0;
- while (true)
+ while(true)
{
beg = str.find_first_not_of(delim, end);
- if (beg == string::npos)
+ if(beg == string::npos)
{
break;
}
end = str.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
string option = str.substr(beg, end - beg);
- if (option.length() != 2 || option[0] != '-')
+ if(option.length() != 2 || option[0] != '-')
{
throw EndpointParseException(__FILE__, __LINE__);
}
string argument;
string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if (argumentBeg != string::npos && str[argumentBeg] != '-')
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
{
beg = argumentBeg;
end = str.find_first_of(delim, beg);
- if (end == string::npos)
+ if(end == string::npos)
{
end = str.length();
}
argument = str.substr(beg, end - beg);
}
- switch (option[1])
+ switch(option[1])
{
case 'h':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -86,7 +86,7 @@ IceSSL::SslEndpoint::SslEndpoint(const PluginBaseIPtr& plugin, const string& str
case 'p':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -96,7 +96,7 @@ IceSSL::SslEndpoint::SslEndpoint(const PluginBaseIPtr& plugin, const string& str
case 't':
{
- if (argument.empty())
+ if(argument.empty())
{
throw EndpointParseException(__FILE__, __LINE__);
}
@@ -111,7 +111,7 @@ IceSSL::SslEndpoint::SslEndpoint(const PluginBaseIPtr& plugin, const string& str
}
}
- if (_host.empty())
+ if(_host.empty())
{
const_cast<string&>(_host) = _plugin->getProtocolPluginFacade()->getDefaultHost();
}
@@ -145,7 +145,7 @@ IceSSL::SslEndpoint::toString() const
{
ostringstream s;
s << "ssl -h " << _host << " -p " << _port;
- if (_timeout != -1)
+ if(_timeout != -1)
{
s << " -t " << _timeout;
}
@@ -167,7 +167,7 @@ IceSSL::SslEndpoint::timeout() const
EndpointPtr
IceSSL::SslEndpoint::timeout(Int timeout) const
{
- if (timeout == _timeout)
+ if(timeout == _timeout)
{
return const_cast<SslEndpoint*>(this);
}
@@ -232,7 +232,7 @@ bool
IceSSL::SslEndpoint::equivalent(const AcceptorPtr& acceptor) const
{
const SslAcceptor* sslAcceptor = dynamic_cast<const SslAcceptor*>(acceptor.get());
- if (!sslAcceptor)
+ if(!sslAcceptor)
{
return false;
}
@@ -243,27 +243,27 @@ bool
IceSSL::SslEndpoint::operator==(const Endpoint& r) const
{
const SslEndpoint* p = dynamic_cast<const SslEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return false;
}
- if (this == p)
+ if(this == p)
{
return true;
}
- if (_port != p->_port)
+ if(_port != p->_port)
{
return false;
}
- if (_timeout != p->_timeout)
+ if(_timeout != p->_timeout)
{
return false;
}
- if (_host != p->_host)
+ if(_host != p->_host)
{
//
// We do the most time-consuming part of the comparison last.
@@ -288,35 +288,35 @@ bool
IceSSL::SslEndpoint::operator<(const Endpoint& r) const
{
const SslEndpoint* p = dynamic_cast<const SslEndpoint*>(&r);
- if (!p)
+ if(!p)
{
return type() < r.type();
}
- if (this == p)
+ if(this == p)
{
return false;
}
- if (_port < p->_port)
+ if(_port < p->_port)
{
return true;
}
- else if (p->_port < _port)
+ else if(p->_port < _port)
{
return false;
}
- if (_timeout < p->_timeout)
+ if(_timeout < p->_timeout)
{
return true;
}
- else if (p->_timeout < _timeout)
+ else if(p->_timeout < _timeout)
{
return false;
}
- if (_host != p->_host)
+ if(_host != p->_host)
{
//
// We do the most time-consuming part of the comparison last.
@@ -325,11 +325,11 @@ IceSSL::SslEndpoint::operator<(const Endpoint& r) const
struct sockaddr_in raddr;
getAddress(_host, _port, laddr);
getAddress(p->_host, p->_port, raddr);
- if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
{
return true;
}
- else if (raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
{
return false;
}
diff --git a/cpp/src/IceSSL/SslEndpoint.h b/cpp/src/IceSSL/SslEndpoint.h
index 308f4b072db..4f2c4303737 100644
--- a/cpp/src/IceSSL/SslEndpoint.h
+++ b/cpp/src/IceSSL/SslEndpoint.h
@@ -1,81 +1,81 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_ENDPOINT_H
-#define ICE_SSL_ENDPOINT_H
-
-#include <Ice/Endpoint.h>
-#include <Ice/EndpointFactory.h>
-#include <IceSSL/PluginBaseI.h>
-
-namespace IceSSL
-{
-
-const ::Ice::Short SslEndpointType = 2;
-
-class SslEndpoint : public IceInternal::Endpoint
-{
-public:
-
- SslEndpoint(const IceSSL::PluginBaseIPtr&, const std::string&, ::Ice::Int, ::Ice::Int);
- SslEndpoint(const IceSSL::PluginBaseIPtr&, const std::string&);
- SslEndpoint(const IceSSL::PluginBaseIPtr&, IceInternal::BasicStream*);
-
- virtual void streamWrite(IceInternal::BasicStream*) const;
- virtual std::string toString() const;
- virtual ::Ice::Short type() const;
- virtual ::Ice::Int timeout() const;
- virtual IceInternal::EndpointPtr timeout(::Ice::Int) const;
- virtual bool datagram() const;
- virtual bool secure() const;
- virtual bool unknown() const;
- virtual IceInternal::TransceiverPtr clientTransceiver() const;
- virtual IceInternal::TransceiverPtr serverTransceiver(IceInternal::EndpointPtr&) const;
- virtual IceInternal::ConnectorPtr connector() const;
- virtual IceInternal::AcceptorPtr acceptor(IceInternal::EndpointPtr&) const;
- virtual bool equivalent(const IceInternal::TransceiverPtr&) const;
- virtual bool equivalent(const IceInternal::AcceptorPtr&) const;
-
- virtual bool operator==(const IceInternal::Endpoint&) const;
- virtual bool operator!=(const IceInternal::Endpoint&) const;
- virtual bool operator<(const IceInternal::Endpoint&) const;
-
-private:
-
- //
- // All members are const, because endpoints are immutable.
- //
- const IceSSL::PluginBaseIPtr _plugin;
- const std::string _host;
- const ::Ice::Int _port;
- const ::Ice::Int _timeout;
-};
-
-class SslEndpointFactory : public IceInternal::EndpointFactory
-{
-public:
-
- SslEndpointFactory(const IceSSL::PluginBaseIPtr&);
- virtual ~SslEndpointFactory();
-
- virtual ::Ice::Short type() const;
- virtual const ::std::string& protocol() const;
- virtual IceInternal::EndpointPtr create(const std::string&) const;
- virtual IceInternal::EndpointPtr read(IceInternal::BasicStream*) const;
- virtual void destroy();
-
-private:
-
- IceSSL::PluginBaseIPtr _plugin;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_ENDPOINT_H
+#define ICE_SSL_ENDPOINT_H
+
+#include <Ice/Endpoint.h>
+#include <Ice/EndpointFactory.h>
+#include <IceSSL/PluginBaseI.h>
+
+namespace IceSSL
+{
+
+const ::Ice::Short SslEndpointType = 2;
+
+class SslEndpoint : public IceInternal::Endpoint
+{
+public:
+
+ SslEndpoint(const IceSSL::PluginBaseIPtr&, const std::string&, ::Ice::Int, ::Ice::Int);
+ SslEndpoint(const IceSSL::PluginBaseIPtr&, const std::string&);
+ SslEndpoint(const IceSSL::PluginBaseIPtr&, IceInternal::BasicStream*);
+
+ virtual void streamWrite(IceInternal::BasicStream*) const;
+ virtual std::string toString() const;
+ virtual ::Ice::Short type() const;
+ virtual ::Ice::Int timeout() const;
+ virtual IceInternal::EndpointPtr timeout(::Ice::Int) const;
+ virtual bool datagram() const;
+ virtual bool secure() const;
+ virtual bool unknown() const;
+ virtual IceInternal::TransceiverPtr clientTransceiver() const;
+ virtual IceInternal::TransceiverPtr serverTransceiver(IceInternal::EndpointPtr&) const;
+ virtual IceInternal::ConnectorPtr connector() const;
+ virtual IceInternal::AcceptorPtr acceptor(IceInternal::EndpointPtr&) const;
+ virtual bool equivalent(const IceInternal::TransceiverPtr&) const;
+ virtual bool equivalent(const IceInternal::AcceptorPtr&) const;
+
+ virtual bool operator==(const IceInternal::Endpoint&) const;
+ virtual bool operator!=(const IceInternal::Endpoint&) const;
+ virtual bool operator<(const IceInternal::Endpoint&) const;
+
+private:
+
+ //
+ // All members are const, because endpoints are immutable.
+ //
+ const IceSSL::PluginBaseIPtr _plugin;
+ const std::string _host;
+ const ::Ice::Int _port;
+ const ::Ice::Int _timeout;
+};
+
+class SslEndpointFactory : public IceInternal::EndpointFactory
+{
+public:
+
+ SslEndpointFactory(const IceSSL::PluginBaseIPtr&);
+ virtual ~SslEndpointFactory();
+
+ virtual ::Ice::Short type() const;
+ virtual const ::std::string& protocol() const;
+ virtual IceInternal::EndpointPtr create(const std::string&) const;
+ virtual IceInternal::EndpointPtr read(IceInternal::BasicStream*) const;
+ virtual void destroy();
+
+private:
+
+ IceSSL::PluginBaseIPtr _plugin;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/SslException.cpp b/cpp/src/IceSSL/SslException.cpp
index bc5d645450a..dbda359f50c 100644
--- a/cpp/src/IceSSL/SslException.cpp
+++ b/cpp/src/IceSSL/SslException.cpp
@@ -18,7 +18,7 @@ void
IceSSL::SslException::ice_print(ostream& out) const
{
Exception::ice_print(out);
- if (!_message.empty())
+ if(!_message.empty())
{
out << ":\n" << _message;
}
diff --git a/cpp/src/IceSSL/SslTransceiver.cpp b/cpp/src/IceSSL/SslTransceiver.cpp
index 64dc4b002d7..72a8362d950 100644
--- a/cpp/src/IceSSL/SslTransceiver.cpp
+++ b/cpp/src/IceSSL/SslTransceiver.cpp
@@ -31,7 +31,7 @@ IceSSL::SslTransceiver::fd()
void
IceSSL::SslTransceiver::close()
{
- if (_traceLevels->network >= 1)
+ if(_traceLevels->network >= 1)
{
ostringstream s;
s << "closing ssl connection\n" << toString();
@@ -49,7 +49,7 @@ IceSSL::SslTransceiver::close()
shutdown = _sslConnection->shutdown();
retries++;
}
- while ((shutdown == 0) && (retries < 0));
+ while((shutdown == 0) && (retries < 0));
::shutdown(fd, SHUT_RDWR); // helps to unblock threads in recv()
closeSocket(fd);
@@ -58,7 +58,7 @@ IceSSL::SslTransceiver::close()
void
IceSSL::SslTransceiver::shutdown()
{
- if (_traceLevels->network >= 2)
+ if(_traceLevels->network >= 2)
{
ostringstream s;
s << "shutting down ssl connection\n" << toString();
@@ -73,7 +73,7 @@ IceSSL::SslTransceiver::shutdown()
shutdown = _sslConnection->shutdown();
retries++;
}
- while ((shutdown == 0) && (retries < 0));
+ while((shutdown == 0) && (retries < 0));
::shutdown(_fd, SHUT_WR); // Shutdown socket for writing
}
@@ -87,9 +87,9 @@ IceSSL::SslTransceiver::write(Buffer& buf, int timeout)
void
IceSSL::SslTransceiver::read(Buffer& buf, int timeout)
{
- if (!_sslConnection->read(buf, timeout))
+ if(!_sslConnection->read(buf, timeout))
{
- if (_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
+ if(_traceLevels->security >= IceSSL::SECURITY_WARNINGS)
{
_logger->trace(_traceLevels->securityCat, "WRN reading from ssl connection returns no bytes");
}
diff --git a/cpp/src/IceSSL/SslTransceiver.h b/cpp/src/IceSSL/SslTransceiver.h
index fd07fcd78b6..3f37406398a 100644
--- a/cpp/src/IceSSL/SslTransceiver.h
+++ b/cpp/src/IceSSL/SslTransceiver.h
@@ -1,56 +1,56 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_TRANSCEIVER_H
-#define ICE_SSL_TRANSCEIVER_H
-
-#include <Ice/LoggerF.h>
-#include <Ice/Transceiver.h>
-#include <IceSSL/SslConnectionF.h>
-#include <IceSSL/PluginBaseIF.h>
-#include <IceSSL/TraceLevelsF.h>
-
-namespace IceSSL
-{
-
-class SslConnector;
-class SslAcceptor;
-
-class SslTransceiver : public IceInternal::Transceiver
-{
-public:
-
- virtual SOCKET fd();
- virtual void close();
- virtual void shutdown();
- virtual void write(IceInternal::Buffer&, int);
- virtual void read(IceInternal::Buffer&, int);
- virtual std::string toString() const;
-
-private:
-
- SslTransceiver(const PluginBaseIPtr&, SOCKET, const ::IceSSL::ConnectionPtr&);
-
- virtual ~SslTransceiver();
- friend class SslConnector;
- friend class SslAcceptor;
-
- TraceLevelsPtr _traceLevels;
- Ice::LoggerPtr _logger;
- SOCKET _fd;
- fd_set _rFdSet;
- fd_set _wFdSet;
-
- ::IceSSL::ConnectionPtr _sslConnection;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_TRANSCEIVER_H
+#define ICE_SSL_TRANSCEIVER_H
+
+#include <Ice/LoggerF.h>
+#include <Ice/Transceiver.h>
+#include <IceSSL/SslConnectionF.h>
+#include <IceSSL/PluginBaseIF.h>
+#include <IceSSL/TraceLevelsF.h>
+
+namespace IceSSL
+{
+
+class SslConnector;
+class SslAcceptor;
+
+class SslTransceiver : public IceInternal::Transceiver
+{
+public:
+
+ virtual SOCKET fd();
+ virtual void close();
+ virtual void shutdown();
+ virtual void write(IceInternal::Buffer&, int);
+ virtual void read(IceInternal::Buffer&, int);
+ virtual std::string toString() const;
+
+private:
+
+ SslTransceiver(const PluginBaseIPtr&, SOCKET, const ::IceSSL::ConnectionPtr&);
+
+ virtual ~SslTransceiver();
+ friend class SslConnector;
+ friend class SslAcceptor;
+
+ TraceLevelsPtr _traceLevels;
+ Ice::LoggerPtr _logger;
+ SOCKET _fd;
+ fd_set _rFdSet;
+ fd_set _wFdSet;
+
+ ::IceSSL::ConnectionPtr _sslConnection;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/TempCerts.h b/cpp/src/IceSSL/TempCerts.h
index f46e7f09720..1614668cff2 100644
--- a/cpp/src/IceSSL/TempCerts.h
+++ b/cpp/src/IceSSL/TempCerts.h
@@ -1,68 +1,68 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_TEMP_CERTS_H
-#define ICE_SSL_TEMP_CERTS_H
-
-#include <IceSSL/CertificateDesc.h>
-
-namespace IceSSL
-{
-
-class TempCertificates
-{
-public:
-
- TempCertificates();
- ~TempCertificates();
-
- void addRSACert(CertificateDesc&);
- void addDHParams(DiffieHellmanParamsFile&);
-
- RSAVector& getRSACerts();
- DHVector& getDHParams();
-
-protected:
-
- RSAVector _rsaCerts;
- DHVector _dhParams;
-};
-
-template<class Stream>
-inline Stream& operator << (Stream& target, TempCertificates& tmpCerts)
-{
- RSAVector::iterator iRSA = tmpCerts.getRSACerts().begin();
- RSAVector::iterator eRSA = tmpCerts.getRSACerts().end();
-
- while (iRSA != eRSA)
- {
- target << "RSA" << std::endl << "{" << std::endl;
- target << *iRSA;
- target << "}" << std::endl << std::endl;
- iRSA++;
- }
-
- DHVector::iterator iDHP = tmpCerts.getDHParams().begin();
- DHVector::iterator eDHP = tmpCerts.getDHParams().end();
-
- while (iDHP != eDHP)
- {
- target << "DH" << std::endl << "{" << std::endl;
- target << *iDHP;
- target << "}" << std::endl << std::endl;
- iDHP++;
- }
-
- return target;
-}
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_TEMP_CERTS_H
+#define ICE_SSL_TEMP_CERTS_H
+
+#include <IceSSL/CertificateDesc.h>
+
+namespace IceSSL
+{
+
+class TempCertificates
+{
+public:
+
+ TempCertificates();
+ ~TempCertificates();
+
+ void addRSACert(CertificateDesc&);
+ void addDHParams(DiffieHellmanParamsFile&);
+
+ RSAVector& getRSACerts();
+ DHVector& getDHParams();
+
+protected:
+
+ RSAVector _rsaCerts;
+ DHVector _dhParams;
+};
+
+template<class Stream>
+inline Stream& operator << (Stream& target, TempCertificates& tmpCerts)
+{
+ RSAVector::iterator iRSA = tmpCerts.getRSACerts().begin();
+ RSAVector::iterator eRSA = tmpCerts.getRSACerts().end();
+
+ while(iRSA != eRSA)
+ {
+ target << "RSA" << std::endl << "{" << std::endl;
+ target << *iRSA;
+ target << "}" << std::endl << std::endl;
+ iRSA++;
+ }
+
+ DHVector::iterator iDHP = tmpCerts.getDHParams().begin();
+ DHVector::iterator eDHP = tmpCerts.getDHParams().end();
+
+ while(iDHP != eDHP)
+ {
+ target << "DH" << std::endl << "{" << std::endl;
+ target << *iDHP;
+ target << "}" << std::endl << std::endl;
+ iDHP++;
+ }
+
+ return target;
+}
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/TraceLevels.h b/cpp/src/IceSSL/TraceLevels.h
index d2ef318e0fc..519b8f0375b 100644
--- a/cpp/src/IceSSL/TraceLevels.h
+++ b/cpp/src/IceSSL/TraceLevels.h
@@ -1,37 +1,37 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_TRACE_LEVELS_H
-#define ICE_SSL_TRACE_LEVELS_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/ProtocolPluginFacadeF.h>
-#include <IceSSL/TraceLevelsF.h>
-
-namespace IceSSL
-{
-
-class TraceLevels : public ::IceUtil::Shared
-{
-public:
-
- TraceLevels(const IceInternal::ProtocolPluginFacadePtr&);
- virtual ~TraceLevels();
-
- const int network;
- const char* networkCat;
-
- const int security;
- const char* securityCat;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_TRACE_LEVELS_H
+#define ICE_SSL_TRACE_LEVELS_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/ProtocolPluginFacadeF.h>
+#include <IceSSL/TraceLevelsF.h>
+
+namespace IceSSL
+{
+
+class TraceLevels : public ::IceUtil::Shared
+{
+public:
+
+ TraceLevels(const IceInternal::ProtocolPluginFacadePtr&);
+ virtual ~TraceLevels();
+
+ const int network;
+ const char* networkCat;
+
+ const int security;
+ const char* securityCat;
+};
+
+}
+
+#endif
diff --git a/cpp/src/IceSSL/TraceLevelsF.h b/cpp/src/IceSSL/TraceLevelsF.h
index 417c3bb7630..ee35dd5c692 100644
--- a/cpp/src/IceSSL/TraceLevelsF.h
+++ b/cpp/src/IceSSL/TraceLevelsF.h
@@ -1,32 +1,32 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_SSL_TRACE_LEVELS_F_H
-#define ICE_SSL_TRACE_LEVELS_F_H
-
-#include <Ice/Handle.h>
-
-namespace IceSSL
-{
-
-class TraceLevels;
-typedef IceInternal::Handle<TraceLevels> TraceLevelsPtr;
-
-}
-
-namespace IceInternal
-{
-
-void incRef(IceSSL::TraceLevels*);
-void decRef(IceSSL::TraceLevels*);
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_SSL_TRACE_LEVELS_F_H
+#define ICE_SSL_TRACE_LEVELS_F_H
+
+#include <Ice/Handle.h>
+
+namespace IceSSL
+{
+
+class TraceLevels;
+typedef IceInternal::Handle<TraceLevels> TraceLevelsPtr;
+
+}
+
+namespace IceInternal
+{
+
+void incRef(IceSSL::TraceLevels*);
+void decRef(IceSSL::TraceLevels*);
+
+}
+
+#endif
diff --git a/cpp/src/IceStorm/Admin.cpp b/cpp/src/IceStorm/Admin.cpp
index 4fa1e530218..1fdf607bc93 100644
--- a/cpp/src/IceStorm/Admin.cpp
+++ b/cpp/src/IceStorm/Admin.cpp
@@ -77,43 +77,43 @@ Client::run(int argc, char* argv[])
bool debug = false;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-e") == 0)
+ else if(strcmp(argv[idx], "-e") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << appName() << ": argument expected for`" << argv[idx] << "'" << endl;
usage();
@@ -123,22 +123,22 @@ Client::run(int argc, char* argv[])
commands += argv[idx + 1];
commands += ';';
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << appName() << ": unknown option `" << argv[idx] << "'" << endl;
usage();
@@ -150,7 +150,7 @@ Client::run(int argc, char* argv[])
}
}
- if (argc >= 2 && !commands.empty())
+ if(argc >= 2 && !commands.empty())
{
cerr << appName() << ": `-e' option cannot be used if input files are given" << endl;
usage();
@@ -159,7 +159,7 @@ Client::run(int argc, char* argv[])
const char* managerEndpointsProperty = "IceStorm.TopicManager.Endpoints";
string managerEndpoints = properties->getProperty(managerEndpointsProperty);
- if (managerEndpoints.empty())
+ if(managerEndpoints.empty())
{
cerr << appName() << ": property `" << managerEndpointsProperty << "' is not set" << endl;
return EXIT_FAILURE;
@@ -167,7 +167,7 @@ Client::run(int argc, char* argv[])
ObjectPrx base = communicator()->stringToProxy("TopicManager:" + managerEndpoints);
IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base);
- if (!manager)
+ if(!manager)
{
cerr << appName() << ": `" << managerEndpoints << "' is not running" << endl;
return EXIT_FAILURE;
@@ -176,12 +176,12 @@ Client::run(int argc, char* argv[])
ParserPtr parser = Parser::createParser(communicator(), manager);
int status = EXIT_SUCCESS;
- if (argc < 2) // No files given
+ if(argc < 2) // No files given
{
- if (!commands.empty()) // Commands were given
+ if(!commands.empty()) // Commands were given
{
int parseStatus = parser->parse(commands, debug);
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -189,7 +189,7 @@ Client::run(int argc, char* argv[])
else // No commands, let's use standard input
{
int parseStatus = parser->parse(stdin, debug);
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -197,10 +197,10 @@ Client::run(int argc, char* argv[])
}
else // Process files given on the command line
{
- for (idx = 1 ; idx < argc ; ++idx)
+ for(idx = 1 ; idx < argc ; ++idx)
{
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << appName() << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -213,7 +213,7 @@ Client::run(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == NULL)
+ if(cppHandle == NULL)
{
cerr << appName() << ": can't run C++ preprocessor: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -227,7 +227,7 @@ Client::run(int argc, char* argv[])
pclose(cppHandle);
#endif
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
diff --git a/cpp/src/IceStorm/Flushable.h b/cpp/src/IceStorm/Flushable.h
index ee6566e337d..f071a72beb6 100644
--- a/cpp/src/IceStorm/Flushable.h
+++ b/cpp/src/IceStorm/Flushable.h
@@ -1,50 +1,50 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef FLUSHABLE_H
-#define FLUSHABLE_H
-
-#include <IceUtil/Handle.h>
-#include <IceUtil/Shared.h>
-
-namespace IceStorm
-{
-
-//
-// Flushable interface.
-//
-class Flushable : public virtual IceUtil::Shared
-{
-public:
-
- Flushable() { }
- ~Flushable() { }
-
- //
- // Flush any pending writes.
- //
- virtual void flush() = 0;
-
- //
- // Is this flushable object invalid?
- //
- virtual bool inactive() const = 0;
-
- //
- // Equality for flushable objects.
- //
- virtual bool operator==(const Flushable&) const = 0;
-};
-
-typedef IceUtil::Handle<Flushable> FlushablePtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef FLUSHABLE_H
+#define FLUSHABLE_H
+
+#include <IceUtil/Handle.h>
+#include <IceUtil/Shared.h>
+
+namespace IceStorm
+{
+
+//
+// Flushable interface.
+//
+class Flushable : public virtual IceUtil::Shared
+{
+public:
+
+ Flushable() { }
+ ~Flushable() { }
+
+ //
+ // Flush any pending writes.
+ //
+ virtual void flush() = 0;
+
+ //
+ // Is this flushable object invalid?
+ //
+ virtual bool inactive() const = 0;
+
+ //
+ // Equality for flushable objects.
+ //
+ virtual bool operator==(const Flushable&) const = 0;
+};
+
+typedef IceUtil::Handle<Flushable> FlushablePtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/Flusher.cpp b/cpp/src/IceStorm/Flusher.cpp
index 55629f92407..cbfa897f004 100644
--- a/cpp/src/IceStorm/Flusher.cpp
+++ b/cpp/src/IceStorm/Flusher.cpp
@@ -35,7 +35,7 @@ public:
_destroy(false)
{
_flushTime = communicator->getProperties()->getPropertyAsIntWithDefault("IceStorm.Flush.Timeout", 1000);
- if (_flushTime < 100)
+ if(_flushTime < 100)
{
_flushTime = 100; // Minimum of 100 ms
}
@@ -49,10 +49,10 @@ public:
run()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while (!_destroy)
+ while(!_destroy)
{
long tout = calcTimeout();
- if (tout == 0)
+ if(tout == 0)
{
wait();
}
@@ -60,7 +60,7 @@ public:
{
timedWait(IceUtil::Time::milliSeconds(tout));
}
- if (_destroy)
+ if(_destroy)
{
continue;
}
@@ -93,7 +93,7 @@ public:
// If the set of subscribers was previously empty then wake up
// the flushing thread since it will be waiting indefinitely
//
- if (isEmpty)
+ if(isEmpty)
{
notify();
}
@@ -129,7 +129,7 @@ private:
// Trace after the flush so that the correct number of objects
// are displayed
//
- if (_traceLevels->flush > 0)
+ if(_traceLevels->flush > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->flushCat);
out << _subscribers.size() << " object(s)";
diff --git a/cpp/src/IceStorm/Flusher.h b/cpp/src/IceStorm/Flusher.h
index ab0828ee146..dd1849ee7be 100644
--- a/cpp/src/IceStorm/Flusher.h
+++ b/cpp/src/IceStorm/Flusher.h
@@ -1,56 +1,56 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef FLUSHER_H
-#define FLUSHER_H
-
-#include <IceUtil/Handle.h>
-#include <IceUtil/Shared.h>
-#include <Ice/CommunicatorF.h>
-
-namespace IceStorm
-{
-
-//
-// Forward declarations.
-//
-class FlusherThread;
-typedef IceUtil::Handle<FlusherThread> FlusherThreadPtr;
-
-class TraceLevels;
-typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
-
-class Flushable;
-typedef IceUtil::Handle<Flushable> FlushablePtr;
-
-//
-// Responsible for flushing Flushable objects at regular intervals.
-//
-class Flusher : public IceUtil::Shared
-{
-public:
-
- Flusher(const Ice::CommunicatorPtr&, const TraceLevelsPtr&);
- ~Flusher();
-
- void add(const FlushablePtr&);
- void remove(const FlushablePtr&);
- void stopFlushing();
-
-private:
-
- FlusherThreadPtr _thread;
-};
-
-typedef IceUtil::Handle<Flusher> FlusherPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef FLUSHER_H
+#define FLUSHER_H
+
+#include <IceUtil/Handle.h>
+#include <IceUtil/Shared.h>
+#include <Ice/CommunicatorF.h>
+
+namespace IceStorm
+{
+
+//
+// Forward declarations.
+//
+class FlusherThread;
+typedef IceUtil::Handle<FlusherThread> FlusherThreadPtr;
+
+class TraceLevels;
+typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
+
+class Flushable;
+typedef IceUtil::Handle<Flushable> FlushablePtr;
+
+//
+// Responsible for flushing Flushable objects at regular intervals.
+//
+class Flusher : public IceUtil::Shared
+{
+public:
+
+ Flusher(const Ice::CommunicatorPtr&, const TraceLevelsPtr&);
+ ~Flusher();
+
+ void add(const FlushablePtr&);
+ void remove(const FlushablePtr&);
+ void stopFlushing();
+
+private:
+
+ FlusherThreadPtr _thread;
+};
+
+typedef IceUtil::Handle<Flusher> FlusherPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/LinkSubscriber.cpp b/cpp/src/IceStorm/LinkSubscriber.cpp
index 3b13c133685..b9b563848b8 100644
--- a/cpp/src/IceStorm/LinkSubscriber.cpp
+++ b/cpp/src/IceStorm/LinkSubscriber.cpp
@@ -44,7 +44,7 @@ LinkSubscriber::unsubscribe()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateUnsubscribed;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << "Unsubscribe " << _obj->ice_getIdentity();
@@ -57,7 +57,7 @@ LinkSubscriber::replace()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateReplaced;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << "Replace " << _obj->ice_getIdentity();
@@ -70,7 +70,7 @@ LinkSubscriber::publish(const Event& event)
//
// Don't forward forwarded, or more costly events.
//
- if (event.forwarded || event.cost > _cost)
+ if(event.forwarded || event.cost > _cost)
{
return;
}
@@ -87,7 +87,7 @@ LinkSubscriber::publish(const Event& event)
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateError;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << _obj->ice_getIdentity() << ": link topic publish failed: " << e;
@@ -95,7 +95,7 @@ LinkSubscriber::publish(const Event& event)
}
catch(const Ice::LocalException& e)
{
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << _obj->ice_getIdentity() << ": link topic publish failed: " << e;
@@ -118,7 +118,7 @@ LinkSubscriber::flush()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateError;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << _obj->ice_getIdentity() << ": link topic flush failed: " << e;
@@ -126,7 +126,7 @@ LinkSubscriber::flush()
}
catch(const Ice::LocalException& e)
{
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << _obj->ice_getIdentity() << ": link topic flush failed: " << e;
@@ -138,7 +138,7 @@ bool
LinkSubscriber::operator==(const Flushable& therhs) const
{
const LinkSubscriber* rhs = dynamic_cast<const LinkSubscriber*>(&therhs);
- if (rhs != 0)
+ if(rhs != 0)
{
return id() == rhs->id();
}
diff --git a/cpp/src/IceStorm/LinkSubscriber.h b/cpp/src/IceStorm/LinkSubscriber.h
index 5b437892f49..45f447d1e8f 100644
--- a/cpp/src/IceStorm/LinkSubscriber.h
+++ b/cpp/src/IceStorm/LinkSubscriber.h
@@ -1,47 +1,47 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef LINK_SUBSCRIBER_H
-#define LINK_SUBSCRIBER_H
-
-#include <IceStorm/Flushable.h>
-#include <IceStorm/Subscriber.h>
-#include <IceStorm/IceStormInternal.h> // For TopicLink
-
-namespace IceStorm
-{
-
-class LinkSubscriber : public Subscriber, public Flushable
-{
-public:
-
- LinkSubscriber(const TraceLevelsPtr&, const TopicLinkPrx&, Ice::Int);
- ~LinkSubscriber();
-
- virtual bool persistent() const;
- virtual bool inactive() const;
- virtual void unsubscribe();
- virtual void replace();
- virtual void publish(const Event&);
-
- virtual void flush();
- virtual bool operator==(const Flushable&) const;
-
-private:
-
- // Immutable
- TopicLinkPrx _obj;
- Ice::Int _cost;
-};
-
-} // End namespace IceStorm
-
-#endif
-
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef LINK_SUBSCRIBER_H
+#define LINK_SUBSCRIBER_H
+
+#include <IceStorm/Flushable.h>
+#include <IceStorm/Subscriber.h>
+#include <IceStorm/IceStormInternal.h> // For TopicLink
+
+namespace IceStorm
+{
+
+class LinkSubscriber : public Subscriber, public Flushable
+{
+public:
+
+ LinkSubscriber(const TraceLevelsPtr&, const TopicLinkPrx&, Ice::Int);
+ ~LinkSubscriber();
+
+ virtual bool persistent() const;
+ virtual bool inactive() const;
+ virtual void unsubscribe();
+ virtual void replace();
+ virtual void publish(const Event&);
+
+ virtual void flush();
+ virtual bool operator==(const Flushable&) const;
+
+private:
+
+ // Immutable
+ TopicLinkPrx _obj;
+ Ice::Int _cost;
+};
+
+} // End namespace IceStorm
+
+#endif
+
diff --git a/cpp/src/IceStorm/OnewayBatchSubscriber.cpp b/cpp/src/IceStorm/OnewayBatchSubscriber.cpp
index 137e0c02626..21e866e9f5d 100644
--- a/cpp/src/IceStorm/OnewayBatchSubscriber.cpp
+++ b/cpp/src/IceStorm/OnewayBatchSubscriber.cpp
@@ -34,7 +34,7 @@ OnewayBatchSubscriber::unsubscribe()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateUnsubscribed;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << "Unsubscribe " << _obj->ice_getIdentity();
@@ -53,7 +53,7 @@ OnewayBatchSubscriber::replace()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateReplaced;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << "Replace " << _obj->ice_getIdentity();
@@ -87,9 +87,9 @@ OnewayBatchSubscriber::flush()
// marked invalid by another thread. Don't display a
// diagnostic in this case.
//
- if (_state == StateActive)
+ if(_state == StateActive)
{
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << _obj->ice_getIdentity() << ": flush failed: " << e;
@@ -103,7 +103,7 @@ bool
OnewayBatchSubscriber::operator==(const Flushable& therhs) const
{
const OnewayBatchSubscriber* rhs = dynamic_cast<const OnewayBatchSubscriber*>(&therhs);
- if (rhs != 0)
+ if(rhs != 0)
{
return id() == rhs->id();
}
diff --git a/cpp/src/IceStorm/OnewayBatchSubscriber.h b/cpp/src/IceStorm/OnewayBatchSubscriber.h
index 4b90d33d1a6..3dda3b00889 100644
--- a/cpp/src/IceStorm/OnewayBatchSubscriber.h
+++ b/cpp/src/IceStorm/OnewayBatchSubscriber.h
@@ -1,50 +1,50 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ONEWAY_BATCH_SUBSCRIBER_H
-#define ONEWAY_BATCH_SUBSCRIBER_H
-
-#include <IceStorm/OnewaySubscriber.h>
-#include <IceStorm/Flushable.h>
-
-namespace IceStorm
-{
-
-//
-// Forward declarations.
-//
-class Flusher;
-typedef IceUtil::Handle<Flusher> FlusherPtr;
-
-class OnewayBatchSubscriber : public OnewaySubscriber, public Flushable
-{
-public:
-
- OnewayBatchSubscriber(const TraceLevelsPtr&, const FlusherPtr&, const Ice::ObjectPrx&);
- ~OnewayBatchSubscriber();
-
- virtual void unsubscribe();
- virtual void replace();
- virtual bool inactive() const;
-
- virtual void flush();
-
- virtual bool operator==(const Flushable&) const;
-
-private:
-
- FlusherPtr _flusher;
-};
-
-typedef IceUtil::Handle<OnewayBatchSubscriber> OnewayBatchSubscriberPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ONEWAY_BATCH_SUBSCRIBER_H
+#define ONEWAY_BATCH_SUBSCRIBER_H
+
+#include <IceStorm/OnewaySubscriber.h>
+#include <IceStorm/Flushable.h>
+
+namespace IceStorm
+{
+
+//
+// Forward declarations.
+//
+class Flusher;
+typedef IceUtil::Handle<Flusher> FlusherPtr;
+
+class OnewayBatchSubscriber : public OnewaySubscriber, public Flushable
+{
+public:
+
+ OnewayBatchSubscriber(const TraceLevelsPtr&, const FlusherPtr&, const Ice::ObjectPrx&);
+ ~OnewayBatchSubscriber();
+
+ virtual void unsubscribe();
+ virtual void replace();
+ virtual bool inactive() const;
+
+ virtual void flush();
+
+ virtual bool operator==(const Flushable&) const;
+
+private:
+
+ FlusherPtr _flusher;
+};
+
+typedef IceUtil::Handle<OnewayBatchSubscriber> OnewayBatchSubscriberPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/OnewaySubscriber.cpp b/cpp/src/IceStorm/OnewaySubscriber.cpp
index e3ce184f727..ab6628df709 100644
--- a/cpp/src/IceStorm/OnewaySubscriber.cpp
+++ b/cpp/src/IceStorm/OnewaySubscriber.cpp
@@ -37,7 +37,7 @@ OnewaySubscriber::unsubscribe()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateUnsubscribed;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << "Unsubscribe " << _obj->ice_getIdentity();
@@ -50,7 +50,7 @@ OnewaySubscriber::replace()
IceUtil::Mutex::Lock sync(_stateMutex);
_state = StateReplaced;
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << "Replace " << _obj->ice_getIdentity();
@@ -73,9 +73,9 @@ OnewaySubscriber::publish(const Event& event)
// marked invalid by another thread. Don't display a
// diagnostic in this case.
//
- if (_state == StateActive)
+ if(_state == StateActive)
{
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << _obj->ice_getIdentity() << ": publish failed: " << e;
diff --git a/cpp/src/IceStorm/OnewaySubscriber.h b/cpp/src/IceStorm/OnewaySubscriber.h
index 032821f271a..cef8f63993a 100644
--- a/cpp/src/IceStorm/OnewaySubscriber.h
+++ b/cpp/src/IceStorm/OnewaySubscriber.h
@@ -1,39 +1,39 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ONEWAY_SUBSCRIBER_H
-#define ONEWAY_SUBSCRIBER_H
-
-#include <IceStorm/Subscriber.h>
-
-namespace IceStorm
-{
-
-class OnewaySubscriber : public Subscriber
-{
-public:
-
- OnewaySubscriber(const TraceLevelsPtr&, const Ice::ObjectPrx&);
- ~OnewaySubscriber();
-
- virtual bool persistent() const;
- virtual void unsubscribe();
- virtual void replace();
- virtual void publish(const Event&);
-
-protected:
-
- // Immutable
- Ice::ObjectPrx _obj;
-};
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ONEWAY_SUBSCRIBER_H
+#define ONEWAY_SUBSCRIBER_H
+
+#include <IceStorm/Subscriber.h>
+
+namespace IceStorm
+{
+
+class OnewaySubscriber : public Subscriber
+{
+public:
+
+ OnewaySubscriber(const TraceLevelsPtr&, const Ice::ObjectPrx&);
+ ~OnewaySubscriber();
+
+ virtual bool persistent() const;
+ virtual void unsubscribe();
+ virtual void replace();
+ virtual void publish(const Event&);
+
+protected:
+
+ // Immutable
+ Ice::ObjectPrx _obj;
+};
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp
index 506a8549d96..7b94cf7d3ab 100644
--- a/cpp/src/IceStorm/Parser.cpp
+++ b/cpp/src/IceStorm/Parser.cpp
@@ -57,7 +57,7 @@ Parser::create(const list<string>& args)
{
try
{
- for (list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
+ for(list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
{
_admin->create(*i);
}
@@ -75,7 +75,7 @@ Parser::destroy(const list<string>& args)
{
try
{
- for (list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
+ for(list<string>::const_iterator i = args.begin(); i != args.end() ; ++i)
{
TopicPrx topic = _admin->retrieve(*i);
topic->destroy();
@@ -94,7 +94,7 @@ Parser::link(const list<string>& _args)
{
list<string> args = _args;
- if (args.size() != 3)
+ if(args.size() != 3)
{
error("`link' requires exactly three arguments (type `help' for more info)");
return;
@@ -148,7 +148,7 @@ Parser::unlink(const list<string>& _args)
{
list<string> args = _args;
- if (args.size() != 2)
+ if(args.size() != 2)
{
error("`unlink' requires exactly two arguments (type `help' for more info)");
return;
@@ -201,14 +201,14 @@ Parser::dolist(const list<string>& _args)
try
{
- if (args.size() == 0)
+ if(args.size() == 0)
{
TopicDict d = _admin->retrieveAll();
- if (!d.empty())
+ if(!d.empty())
{
- for (TopicDict::iterator i = d.begin(); i != d.end(); ++i)
+ for(TopicDict::iterator i = d.begin(); i != d.end(); ++i)
{
- if (i != d.begin())
+ if(i != d.begin())
{
cout << ", ";
}
@@ -219,7 +219,7 @@ Parser::dolist(const list<string>& _args)
}
else
{
- while (args.size() != 0)
+ while(args.size() != 0)
{
string name = args.front();
args.pop_front();
@@ -228,7 +228,7 @@ Parser::dolist(const list<string>& _args)
{
TopicPrx topic = _admin->retrieve(name);
LinkInfoSeq links = topic->getLinkInfoSeq();
- for (LinkInfoSeq::const_iterator p = links.begin(); p != links.end(); ++p)
+ for(LinkInfoSeq::const_iterator p = links.begin(); p != links.end(); ++p)
{
cout << "\t" << (*p).name << " with cost " << (*p).cost << endl;
}
@@ -253,7 +253,7 @@ Parser::graph(const list<string>& _args)
{
list<string> args = _args;
- if (args.size() != 2)
+ if(args.size() != 2)
{
error("`graph' requires exactly two arguments (type `help' for more info)");
return;
@@ -262,7 +262,7 @@ Parser::graph(const list<string>& _args)
string file = args.front();
args.pop_front();
int maxCost = atoi(args.front().c_str());
- if (maxCost == 0)
+ if(maxCost == 0)
{
error("`graph': cost must be a positive number");
return;
@@ -272,7 +272,7 @@ Parser::graph(const list<string>& _args)
try
{
WeightedGraph graph;
- if (!graph.parse(file))
+ if(!graph.parse(file))
{
cerr << file << ": parse failed" << endl;
return;
@@ -293,9 +293,9 @@ Parser::graph(const list<string>& _args)
TopicDict d = _admin->retrieveAll();
vector<string>::const_iterator p;
- for (p = vertices.begin(); p != vertices.end(); ++p)
+ for(p = vertices.begin(); p != vertices.end(); ++p)
{
- if (d.find(*p) == d.end())
+ if(d.find(*p) == d.end())
{
cout << *p << ": referenced topic not found" << endl;
return;
@@ -308,28 +308,28 @@ Parser::graph(const list<string>& _args)
//
// Get the edge set for reach vertex.
//
- for (p = vertices.begin(); p != vertices.end(); ++p)
+ for(p = vertices.begin(); p != vertices.end(); ++p)
{
TopicPrx topic = d[*p];
assert(topic);
LinkInfoSeq seq = topic->getLinkInfoSeq();
vector<pair<string, int> > edges = graph.getEdgesFor(*p);
- for (vector<pair<string, int> >::const_iterator q = edges.begin(); q != edges.end(); ++q)
+ for(vector<pair<string, int> >::const_iterator q = edges.begin(); q != edges.end(); ++q)
{
bool link = true;
- for (LinkInfoSeq::iterator r = seq.begin(); r != seq.end(); ++r)
+ for(LinkInfoSeq::iterator r = seq.begin(); r != seq.end(); ++r)
{
//
// Found the link element.
//
- if ((*r).name == (*q).first)
+ if((*r).name == (*q).first)
{
//
// If the cost is the same, then there is
// nothing to do.
//
- if ((*r).cost == (*q).second)
+ if((*r).cost == (*q).second)
{
link = false;
}
@@ -341,7 +341,7 @@ Parser::graph(const list<string>& _args)
//
// Else, need to rebind the link.
//
- if (link)
+ if(link)
{
TopicPrx target = d[(*q).first];
++links;
@@ -352,7 +352,7 @@ Parser::graph(const list<string>& _args)
//
// The remainder of the links are obsolete.
//
- for (LinkInfoSeq::const_iterator r = seq.begin(); r != seq.end(); ++r)
+ for(LinkInfoSeq::const_iterator r = seq.begin(); r != seq.end(); ++r)
{
++unlinks;
topic->unlink((*r).topic);
@@ -386,9 +386,9 @@ Parser::shutdown()
void
Parser::getInput(char* buf, int& result, int maxSize)
{
- if (!_commands.empty())
+ if(!_commands.empty())
{
- if (_commands == ";")
+ if(_commands == ";")
{
result = 0;
}
@@ -402,30 +402,30 @@ Parser::getInput(char* buf, int& result, int maxSize)
#endif
strncpy(buf, _commands.c_str(), result);
_commands.erase(0, result);
- if (_commands.empty())
+ if(_commands.empty())
{
_commands = ";";
}
}
}
- else if (isatty(fileno(yyin)))
+ else if(isatty(fileno(yyin)))
{
#ifdef HAVE_READLINE
char* line = readline(parser->getPrompt());
- if (!line)
+ if(!line)
{
result = 0;
}
else
{
- if (*line)
+ if(*line)
{
add_history(line);
}
result = strlen(line) + 1;
- if (result > maxSize)
+ if(result > maxSize)
{
free(line);
error("input line too long");
@@ -444,12 +444,12 @@ Parser::getInput(char* buf, int& result, int maxSize)
cout << parser->getPrompt() << flush;
string line;
- while (true)
+ while(true)
{
char c = static_cast<char>(getc(yyin));
- if (c == EOF)
+ if(c == EOF)
{
- if (line.size())
+ if(line.size())
{
line += '\n';
}
@@ -458,14 +458,14 @@ Parser::getInput(char* buf, int& result, int maxSize)
line += c;
- if (c == '\n')
+ if(c == '\n')
{
break;
}
}
result = line.length();
- if (result > maxSize)
+ if(result > maxSize)
{
error("input line too long");
buf[0] = EOF;
@@ -480,7 +480,7 @@ Parser::getInput(char* buf, int& result, int maxSize)
}
else
{
- if (((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ if(((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
{
error("input in flex scanner failed");
buf[0] = EOF;
@@ -506,7 +506,7 @@ Parser::getPrompt()
{
assert(_commands.empty() && isatty(fileno(yyin)));
- if (_continue)
+ if(_continue)
{
_continue = false;
return "(cont) ";
@@ -524,13 +524,13 @@ Parser::scanPosition(const char* s)
string::size_type idx;
idx = line.find("line");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx + 4);
}
idx = line.find_first_not_of(" \t\r#");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
@@ -538,18 +538,18 @@ Parser::scanPosition(const char* s)
_currentLine = atoi(line.c_str()) - 1;
idx = line.find_first_of(" \t\r");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
idx = line.find_first_not_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
idx = line.find_first_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
_currentFile = line.substr(0, idx);
line.erase(0, idx + 1);
@@ -564,7 +564,7 @@ Parser::scanPosition(const char* s)
void
Parser::error(const char* s)
{
- if (_commands.empty() && !isatty(fileno(yyin)))
+ if(_commands.empty() && !isatty(fileno(yyin)))
{
cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
}
@@ -584,7 +584,7 @@ Parser::error(const string& s)
void
Parser::warning(const char* s)
{
- if (_commands.empty() && !isatty(fileno(yyin)))
+ if(_commands.empty() && !isatty(fileno(yyin)))
{
cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
@@ -620,7 +620,7 @@ Parser::parse(FILE* file, bool debug)
nextLine();
int status = yyparse();
- if (_errors)
+ if(_errors)
{
status = EXIT_FAILURE;
}
@@ -649,7 +649,7 @@ Parser::parse(const std::string& commands, bool debug)
nextLine();
int status = yyparse();
- if (_errors)
+ if(_errors)
{
status = EXIT_FAILURE;
}
diff --git a/cpp/src/IceStorm/Parser.h b/cpp/src/IceStorm/Parser.h
index a60d2866f58..841f8e22d1f 100644
--- a/cpp/src/IceStorm/Parser.h
+++ b/cpp/src/IceStorm/Parser.h
@@ -1,108 +1,108 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_STORM_PARSER_H
-#define ICE_STORM_PARSER_H
-
-#include <IceUtil/Handle.h>
-#include <IceStorm/IceStorm.h>
-#include <list>
-
-#ifdef _WIN32
-# include <io.h>
-# define isatty _isatty
-# define fileno _fileno
-// '_isatty' : inconsistent dll linkage. dllexport assumed.
-# pragma warning( disable : 4273 )
-#endif
-
-//
-// Stuff for flex and bison
-//
-
-#define YYSTYPE std::list<std::string>
-#define YY_DECL int yylex(YYSTYPE* yylvalp)
-YY_DECL;
-int yyparse();
-
-//
-// I must set the initial stack depth to the maximum stack depth to
-// disable bison stack resizing. The bison stack resizing routines use
-// simple malloc/alloc/memcpy calls, which do not work for the
-// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor,
-// assignment operator, etc.
-//
-#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum.
-#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above.
-
-//
-// Newer bison versions allow to disable stack resizing by defining
-// yyoverflow.
-//
-#define yyoverflow(a, b, c, d, e, f) yyerror(a)
-
-namespace IceStorm
-{
-
-//
-// Forward declaration.
-//
-class Parser;
-typedef ::IceUtil::Handle<Parser> ParserPtr;
-
-class Parser : public ::IceUtil::SimpleShared
-{
-public:
-
- static ParserPtr createParser(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&);
-
- void usage();
-
- void create(const std::list<std::string>&);
- void destroy(const std::list<std::string>&);
- void dolist(const std::list<std::string>&); // Don't name list - conflicts with std::list
- void link(const std::list<std::string>&);
- void unlink(const std::list<std::string>&);
- void graph(const std::list<std::string>&);
- void shutdown();
-
- void getInput(char*, int&, int);
- void nextLine();
- void continueLine();
- char* getPrompt();
- void scanPosition(const char*);
-
- void error(const char*);
- void error(const std::string&);
-
- void warning(const char*);
- void warning(const std::string&);
-
- int parse(FILE*, bool);
- int parse(const std::string&, bool);
-
-private:
-
- Parser(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&);
-
- std::string _commands;
- Ice::CommunicatorPtr _communicator;
- IceStorm::TopicManagerPrx _admin;
- bool _continue;
- int _errors;
- int _currentLine;
- std::string _currentFile;
-};
-
-extern Parser* parser; // The current parser for bison/flex
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_STORM_PARSER_H
+#define ICE_STORM_PARSER_H
+
+#include <IceUtil/Handle.h>
+#include <IceStorm/IceStorm.h>
+#include <list>
+
+#ifdef _WIN32
+# include <io.h>
+# define isatty _isatty
+# define fileno _fileno
+// '_isatty' : inconsistent dll linkage. dllexport assumed.
+# pragma warning( disable : 4273 )
+#endif
+
+//
+// Stuff for flex and bison
+//
+
+#define YYSTYPE std::list<std::string>
+#define YY_DECL int yylex(YYSTYPE* yylvalp)
+YY_DECL;
+int yyparse();
+
+//
+// I must set the initial stack depth to the maximum stack depth to
+// disable bison stack resizing. The bison stack resizing routines use
+// simple malloc/alloc/memcpy calls, which do not work for the
+// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor,
+// assignment operator, etc.
+//
+#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum.
+#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above.
+
+//
+// Newer bison versions allow to disable stack resizing by defining
+// yyoverflow.
+//
+#define yyoverflow(a, b, c, d, e, f) yyerror(a)
+
+namespace IceStorm
+{
+
+//
+// Forward declaration.
+//
+class Parser;
+typedef ::IceUtil::Handle<Parser> ParserPtr;
+
+class Parser : public ::IceUtil::SimpleShared
+{
+public:
+
+ static ParserPtr createParser(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&);
+
+ void usage();
+
+ void create(const std::list<std::string>&);
+ void destroy(const std::list<std::string>&);
+ void dolist(const std::list<std::string>&); // Don't name list - conflicts with std::list
+ void link(const std::list<std::string>&);
+ void unlink(const std::list<std::string>&);
+ void graph(const std::list<std::string>&);
+ void shutdown();
+
+ void getInput(char*, int&, int);
+ void nextLine();
+ void continueLine();
+ char* getPrompt();
+ void scanPosition(const char*);
+
+ void error(const char*);
+ void error(const std::string&);
+
+ void warning(const char*);
+ void warning(const std::string&);
+
+ int parse(FILE*, bool);
+ int parse(const std::string&, bool);
+
+private:
+
+ Parser(const Ice::CommunicatorPtr&, const IceStorm::TopicManagerPrx&);
+
+ std::string _commands;
+ Ice::CommunicatorPtr _communicator;
+ IceStorm::TopicManagerPrx _admin;
+ bool _continue;
+ int _errors;
+ int _currentLine;
+ std::string _currentFile;
+};
+
+extern Parser* parser; // The current parser for bison/flex
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/Server.cpp b/cpp/src/IceStorm/Server.cpp
index cb9565bc813..e9615bebf0a 100644
--- a/cpp/src/IceStorm/Server.cpp
+++ b/cpp/src/IceStorm/Server.cpp
@@ -71,14 +71,14 @@ IceStorm::Server::usage()
int
IceStorm::Server::runFreeze(int argc, char* argv[], const Freeze::DBEnvironmentPtr& dbEnv)
{
- for (int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
- if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
{
usage();
return EXIT_SUCCESS;
}
- else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
diff --git a/cpp/src/IceStorm/Subscriber.h b/cpp/src/IceStorm/Subscriber.h
index 453c8b125b3..5f30a365b89 100644
--- a/cpp/src/IceStorm/Subscriber.h
+++ b/cpp/src/IceStorm/Subscriber.h
@@ -1,136 +1,136 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef SUBSCRIBER_H
-#define SUBSCRIBER_H
-
-#include <IceUtil/Mutex.h>
-#include <Ice/Current.h> // For Ice::Context
-#include <Ice/Identity.h>
-
-#include <vector>
-
-namespace IceStorm
-{
-
-//
-// Forward declarations.
-//
-class TraceLevels;
-typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
-
-//
-// Note that at present this requires to copy the event which isn't
-// nice. If this indeed becomes a bottleneck then either the event can
-// carry a reference to the blob, context & op (while event itself
-// isn't copied), or the op, blob & context can be passed along as
-// arguments (or do copy on write, or some such trick).
-//
-struct Event
-{
- bool forwarded;
- int cost;
- std::string op;
- bool nonmutating;
- std::vector< Ice::Byte> data;
- Ice::Context context;
-};
-
-//
-// Subscriber interface.
-//
-class Subscriber : public virtual IceUtil::Shared
-{
-public:
-
- Subscriber(const TraceLevelsPtr& traceLevels, const Ice::Identity&);
- ~Subscriber();
-
- virtual bool persistent() const = 0;
-
- //
- // Return true if the Subscriber is not active, false otherwise.
- //
- bool inactive() const;
-
- //
- // Retrieve true if the Subscriber is in the error state, false
- // otherwise.
- //
- bool error() const;
-
- //
- // Retrieve the identity of the Subscriber.
- //
- Ice::Identity id() const;
-
- //
- // Unsubscribe. Mark the state as Unsubscribed.
- //
- virtual void unsubscribe() = 0;
-
- //
- // Unsubscribe. Mark the state as Replaced.
- //
- virtual void replace() = 0;
-
- //
- // Publish the given event. Mark the state as Error in the event of
- // a problem.
- //
- virtual void publish(const Event&) = 0;
-
-protected:
-
- // Immutable
- TraceLevelsPtr _traceLevels;
-
- //
- // Subscriber state.
- //
- enum State
- {
- //
- // The Subscriber is active.
- //
- StateActive,
- //
- // The Subscriber encountered an error during event
- // transmission.
- //
- StateError,
- //
- // The Subscriber has been unsubscribed.
- //
- StateUnsubscribed,
- //
- // The Subscriber has been replaced.
- //
- StateReplaced
- };
-
- IceUtil::Mutex _stateMutex;
- State _state;
-
-private:
-
- //
- // This id is the full id of the subscriber for a particular topic.
- //
- // Immutable.
- //
- Ice::Identity _id;
-};
-
-typedef IceUtil::Handle<Subscriber> SubscriberPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef SUBSCRIBER_H
+#define SUBSCRIBER_H
+
+#include <IceUtil/Mutex.h>
+#include <Ice/Current.h> // For Ice::Context
+#include <Ice/Identity.h>
+
+#include <vector>
+
+namespace IceStorm
+{
+
+//
+// Forward declarations.
+//
+class TraceLevels;
+typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
+
+//
+// Note that at present this requires to copy the event which isn't
+// nice. If this indeed becomes a bottleneck then either the event can
+// carry a reference to the blob, context & op (while event itself
+// isn't copied), or the op, blob & context can be passed along as
+// arguments (or do copy on write, or some such trick).
+//
+struct Event
+{
+ bool forwarded;
+ int cost;
+ std::string op;
+ bool nonmutating;
+ std::vector< Ice::Byte> data;
+ Ice::Context context;
+};
+
+//
+// Subscriber interface.
+//
+class Subscriber : public virtual IceUtil::Shared
+{
+public:
+
+ Subscriber(const TraceLevelsPtr& traceLevels, const Ice::Identity&);
+ ~Subscriber();
+
+ virtual bool persistent() const = 0;
+
+ //
+ // Return true if the Subscriber is not active, false otherwise.
+ //
+ bool inactive() const;
+
+ //
+ // Retrieve true if the Subscriber is in the error state, false
+ // otherwise.
+ //
+ bool error() const;
+
+ //
+ // Retrieve the identity of the Subscriber.
+ //
+ Ice::Identity id() const;
+
+ //
+ // Unsubscribe. Mark the state as Unsubscribed.
+ //
+ virtual void unsubscribe() = 0;
+
+ //
+ // Unsubscribe. Mark the state as Replaced.
+ //
+ virtual void replace() = 0;
+
+ //
+ // Publish the given event. Mark the state as Error in the event of
+ // a problem.
+ //
+ virtual void publish(const Event&) = 0;
+
+protected:
+
+ // Immutable
+ TraceLevelsPtr _traceLevels;
+
+ //
+ // Subscriber state.
+ //
+ enum State
+ {
+ //
+ // The Subscriber is active.
+ //
+ StateActive,
+ //
+ // The Subscriber encountered an error during event
+ // transmission.
+ //
+ StateError,
+ //
+ // The Subscriber has been unsubscribed.
+ //
+ StateUnsubscribed,
+ //
+ // The Subscriber has been replaced.
+ //
+ StateReplaced
+ };
+
+ IceUtil::Mutex _stateMutex;
+ State _state;
+
+private:
+
+ //
+ // This id is the full id of the subscriber for a particular topic.
+ //
+ // Immutable.
+ //
+ Ice::Identity _id;
+};
+
+typedef IceUtil::Handle<Subscriber> SubscriberPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/SubscriberFactory.cpp b/cpp/src/IceStorm/SubscriberFactory.cpp
index 975936eb52c..b2ffb86a7e4 100644
--- a/cpp/src/IceStorm/SubscriberFactory.cpp
+++ b/cpp/src/IceStorm/SubscriberFactory.cpp
@@ -35,7 +35,7 @@ SubscriberFactory::createSubscriber(const QoS& qos, const Ice::ObjectPrx& obj)
QoS::const_iterator i = qos.find("reliability");
string reliability;
- if (i == qos.end())
+ if(i == qos.end())
{
reliability = "oneway";
}
@@ -44,15 +44,15 @@ SubscriberFactory::createSubscriber(const QoS& qos, const Ice::ObjectPrx& obj)
reliability = i->second;
}
- if (reliability == "batch")
+ if(reliability == "batch")
{
return new OnewayBatchSubscriber(_traceLevels, _flusher, obj->ice_batchOneway());
}
else // reliability == "oneway"
{
- if (reliability != "oneway")
+ if(reliability != "oneway")
{
- if (_traceLevels->subscriber > 0)
+ if(_traceLevels->subscriber > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->subscriberCat);
out << reliability <<" mode not understood.";
diff --git a/cpp/src/IceStorm/SubscriberFactory.h b/cpp/src/IceStorm/SubscriberFactory.h
index 9e6ee95e2af..904f8d35b5f 100644
--- a/cpp/src/IceStorm/SubscriberFactory.h
+++ b/cpp/src/IceStorm/SubscriberFactory.h
@@ -1,62 +1,62 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef SUBSCRIBER_FACTORY_H
-#define SUBSCRIBER_FACTORY_H
-
-#include <IceStorm/IceStormInternal.h> // For QoS, TopicLink
-
-namespace IceStorm
-{
-
-//
-// Forward declarations.
-//
-class TraceLevels;
-typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
-
-class Subscriber;
-typedef IceUtil::Handle<Subscriber> SubscriberPtr;
-
-class Flusher;
-typedef IceUtil::Handle<Flusher> FlusherPtr;
-
-//
-// Factory object that knows how to create various type of Subscriber
-// objects.
-//
-class SubscriberFactory : public IceUtil::Shared
-{
-public:
-
- SubscriberFactory(const TraceLevelsPtr&, const FlusherPtr&);
-
- //
- // Create a link subscriber (that is a subscriber that points to
- // another topic instance).
- //
- SubscriberPtr createLinkSubscriber(const TopicLinkPrx&, Ice::Int);
-
- //
- // Create a Subscriber with the given QoS.
- //
- SubscriberPtr createSubscriber(const QoS&, const Ice::ObjectPrx&);
-
-private:
-
- TraceLevelsPtr _traceLevels;
- FlusherPtr _flusher;
-};
-
-typedef IceUtil::Handle<SubscriberFactory> SubscriberFactoryPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef SUBSCRIBER_FACTORY_H
+#define SUBSCRIBER_FACTORY_H
+
+#include <IceStorm/IceStormInternal.h> // For QoS, TopicLink
+
+namespace IceStorm
+{
+
+//
+// Forward declarations.
+//
+class TraceLevels;
+typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
+
+class Subscriber;
+typedef IceUtil::Handle<Subscriber> SubscriberPtr;
+
+class Flusher;
+typedef IceUtil::Handle<Flusher> FlusherPtr;
+
+//
+// Factory object that knows how to create various type of Subscriber
+// objects.
+//
+class SubscriberFactory : public IceUtil::Shared
+{
+public:
+
+ SubscriberFactory(const TraceLevelsPtr&, const FlusherPtr&);
+
+ //
+ // Create a link subscriber (that is a subscriber that points to
+ // another topic instance).
+ //
+ SubscriberPtr createLinkSubscriber(const TopicLinkPrx&, Ice::Int);
+
+ //
+ // Create a Subscriber with the given QoS.
+ //
+ SubscriberPtr createSubscriber(const QoS&, const Ice::ObjectPrx&);
+
+private:
+
+ TraceLevelsPtr _traceLevels;
+ FlusherPtr _flusher;
+};
+
+typedef IceUtil::Handle<SubscriberFactory> SubscriberFactoryPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp
index 417ec20520e..e45e45199f3 100644
--- a/cpp/src/IceStorm/TopicI.cpp
+++ b/cpp/src/IceStorm/TopicI.cpp
@@ -115,9 +115,9 @@ public:
// the list of subscribers - it marks the Subscriber as
// replaced, and it's removed on the next event publish.
//
- for (SubscriberList::iterator i = _subscribers.begin() ; i != _subscribers.end(); ++i)
+ for(SubscriberList::iterator i = _subscribers.begin() ; i != _subscribers.end(); ++i)
{
- if ((*i)->id() == id)
+ if((*i)->id() == id)
{
//
// This marks the subscriber as invalid. It will be
@@ -148,9 +148,9 @@ public:
IceUtil::Mutex::Lock sync(_subscribersMutex);
- for (SubscriberList::iterator i = _subscribers.begin() ; i != _subscribers.end(); ++i)
+ for(SubscriberList::iterator i = _subscribers.begin() ; i != _subscribers.end(); ++i)
{
- if ((*i)->id() == id)
+ if((*i)->id() == id)
{
//
// This marks the subscriber as invalid. It will be
@@ -164,7 +164,7 @@ public:
//
// If the subscriber was not found then display a diagnostic
//
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << id << ": not subscribed.";
@@ -206,11 +206,11 @@ public:
// list. Copy the subscribers in error to the error list.
//
SubscriberList::iterator p = _subscribers.begin();
- while (p != _subscribers.end())
+ while(p != _subscribers.end())
{
- if ((*p)->inactive())
+ if((*p)->inactive())
{
- if ((*p)->error())
+ if((*p)->error())
{
e.push_back(*p);
}
@@ -226,14 +226,14 @@ public:
}
}
- if (!e.empty())
+ if(!e.empty())
{
IceUtil::Mutex::Lock errorSync(_errorMutex);
_error.splice(_error.begin(), e);
}
}
- for (SubscriberList::iterator p = copy.begin(); p != copy.end(); ++p)
+ for(SubscriberList::iterator p = copy.begin(); p != copy.end(); ++p)
{
(*p)->publish(event);
}
@@ -285,7 +285,7 @@ PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byt
Event event;
event.forwarded = false;
Ice::Context::const_iterator p = context.find("cost");
- if (p != context.end())
+ if(p != context.end())
{
event.cost = atoi(p->second.c_str());
}
@@ -358,9 +358,9 @@ TopicI::TopicI(const Ice::ObjectAdapterPtr& adapter, const TraceLevelsPtr& trace
//
// Run through link database re-establishing linked subscribers.
//
- for (IdentityLinkDict::const_iterator p = _links.begin(); p != _links.end(); ++p)
+ for(IdentityLinkDict::const_iterator p = _links.begin(); p != _links.end(); ++p)
{
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << _name << " relink " << p->first;
@@ -398,7 +398,7 @@ TopicI::destroy(const Ice::Current&)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
@@ -412,7 +412,7 @@ TopicI::destroy(const Ice::Current&)
id.category = _name;
id.name = "publish";
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << "destroying " << id;
@@ -429,7 +429,7 @@ TopicI::link(const TopicPrx& topic, Ice::Int cost, const Ice::Current&)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
@@ -437,7 +437,7 @@ TopicI::link(const TopicPrx& topic, Ice::Int cost, const Ice::Current&)
reap();
string name = topic->getName();
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << _name << " link " << name << " cost " << cost;
@@ -472,7 +472,7 @@ TopicI::unlink(const TopicPrx& topic, const Ice::Current&)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
@@ -482,9 +482,9 @@ TopicI::unlink(const TopicPrx& topic, const Ice::Current&)
TopicInternalPrx internal = TopicInternalPrx::checkedCast(topic);
Ice::ObjectPrx link = internal->getLinkProxy();
- if (_links.erase(link->ice_getIdentity()) > 0)
+ if(_links.erase(link->ice_getIdentity()) > 0)
{
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << _name << " unlink " << topic->getName();
@@ -493,7 +493,7 @@ TopicI::unlink(const TopicPrx& topic, const Ice::Current&)
}
else
{
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << _name << " unlink " << topic->getName() << " failed - not linked";
@@ -506,7 +506,7 @@ TopicI::getLinkInfoSeq(const Ice::Current&)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
@@ -515,7 +515,7 @@ TopicI::getLinkInfoSeq(const Ice::Current&)
LinkInfoSeq seq;
- for (IdentityLinkDict::const_iterator p = _links.begin(); p != _links.end(); ++p)
+ for(IdentityLinkDict::const_iterator p = _links.begin(); p != _links.end(); ++p)
{
LinkInfo info = p->second.info;
seq.push_back(info);
@@ -543,7 +543,7 @@ TopicI::subscribe(const Ice::ObjectPrx& obj, const QoS& qos)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
@@ -562,7 +562,7 @@ TopicI::unsubscribe(const Ice::ObjectPrx& obj)
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
throw Ice::ObjectNotExistException(__FILE__, __LINE__);
}
@@ -580,7 +580,7 @@ TopicI::reap()
{
IceUtil::RecMutex::Lock sync(*this);
- if (_destroyed)
+ if(_destroyed)
{
return;
}
@@ -590,15 +590,15 @@ TopicI::reap()
// database.
//
SubscriberList error = _subscribers->clearErrorList();
- for (SubscriberList::iterator p = error.begin(); p != error.end(); ++p)
+ for(SubscriberList::iterator p = error.begin(); p != error.end(); ++p)
{
SubscriberPtr subscriber = *p;
assert(subscriber->error());
- if (subscriber->persistent())
+ if(subscriber->persistent())
{
- if (_links.erase(subscriber->id()) > 0)
+ if(_links.erase(subscriber->id()) > 0)
{
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << "reaping " << subscriber->id();
@@ -606,7 +606,7 @@ TopicI::reap()
}
else
{
- if (_traceLevels->topic > 0)
+ if(_traceLevels->topic > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicCat);
out << "reaping " << subscriber->id() << " failed - not in database";
diff --git a/cpp/src/IceStorm/TopicI.h b/cpp/src/IceStorm/TopicI.h
index 67153cfda6c..f3f1a79ffcf 100644
--- a/cpp/src/IceStorm/TopicI.h
+++ b/cpp/src/IceStorm/TopicI.h
@@ -1,92 +1,92 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef TOPIC_I_H
-#define TOPIC_I_H
-
-#include <IceUtil/RecMutex.h>
-#include <IceStorm/IceStormInternal.h>
-#include <IceStorm/IdentityLinkDict.h>
-#include <IceStorm/SubscriberFactory.h>
-
-namespace IceStorm
-{
-
-//
-// Forward declarations.
-//
-class TopicSubscribers;
-typedef IceUtil::Handle<TopicSubscribers> TopicSubscribersPtr;
-
-class TraceLevels;
-typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
-
-class SubscriberFactory;
-typedef IceUtil::Handle<SubscriberFactory> SubscriberFactoryPtr;
-
-//
-// TopicInternal implementation.
-//
-class TopicI : public TopicInternal, public IceUtil::RecMutex
-{
-public:
-
- TopicI(const Ice::ObjectAdapterPtr&, const TraceLevelsPtr&, const std::string&, const SubscriberFactoryPtr&,
- const Freeze::DBPtr&);
- ~TopicI();
-
- virtual std::string getName(const Ice::Current&);
- virtual Ice::ObjectPrx getPublisher(const Ice::Current&);
- virtual void destroy(const Ice::Current&);
- virtual void link(const TopicPrx&, Ice::Int, const Ice::Current&);
- virtual void unlink(const TopicPrx&, const Ice::Current&);
- virtual LinkInfoSeq getLinkInfoSeq(const Ice::Current&);
-
- virtual TopicLinkPrx getLinkProxy(const Ice::Current&);
-
- // Internal methods
- bool destroyed() const;
- void subscribe(const Ice::ObjectPrx&, const QoS&);
- void unsubscribe(const Ice::ObjectPrx&);
-
- void reap();
-
-private:
-
- //
- // Immutable members.
- //
- Ice::ObjectAdapterPtr _adapter;
- TraceLevelsPtr _traceLevels;
- std::string _name; // The topic name
- SubscriberFactoryPtr _factory;
-
- Ice::ObjectPtr _publisher; // Publisher & associated proxy
- Ice::ObjectPrx _publisherPrx;
-
- Ice::ObjectPtr _link; // TopicLink & associated proxy
- TopicLinkPrx _linkPrx;
-
- //
- // Mutable members. Protected by *this
- //
- bool _destroyed; // Has this Topic been destroyed?
-
- TopicSubscribersPtr _subscribers; // Set of Subscribers
-
- IdentityLinkDict _links; // The database of Topic links
- Freeze::DBPtr _linksDb;
-};
-
-typedef IceUtil::Handle<TopicI> TopicIPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef TOPIC_I_H
+#define TOPIC_I_H
+
+#include <IceUtil/RecMutex.h>
+#include <IceStorm/IceStormInternal.h>
+#include <IceStorm/IdentityLinkDict.h>
+#include <IceStorm/SubscriberFactory.h>
+
+namespace IceStorm
+{
+
+//
+// Forward declarations.
+//
+class TopicSubscribers;
+typedef IceUtil::Handle<TopicSubscribers> TopicSubscribersPtr;
+
+class TraceLevels;
+typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
+
+class SubscriberFactory;
+typedef IceUtil::Handle<SubscriberFactory> SubscriberFactoryPtr;
+
+//
+// TopicInternal implementation.
+//
+class TopicI : public TopicInternal, public IceUtil::RecMutex
+{
+public:
+
+ TopicI(const Ice::ObjectAdapterPtr&, const TraceLevelsPtr&, const std::string&, const SubscriberFactoryPtr&,
+ const Freeze::DBPtr&);
+ ~TopicI();
+
+ virtual std::string getName(const Ice::Current&);
+ virtual Ice::ObjectPrx getPublisher(const Ice::Current&);
+ virtual void destroy(const Ice::Current&);
+ virtual void link(const TopicPrx&, Ice::Int, const Ice::Current&);
+ virtual void unlink(const TopicPrx&, const Ice::Current&);
+ virtual LinkInfoSeq getLinkInfoSeq(const Ice::Current&);
+
+ virtual TopicLinkPrx getLinkProxy(const Ice::Current&);
+
+ // Internal methods
+ bool destroyed() const;
+ void subscribe(const Ice::ObjectPrx&, const QoS&);
+ void unsubscribe(const Ice::ObjectPrx&);
+
+ void reap();
+
+private:
+
+ //
+ // Immutable members.
+ //
+ Ice::ObjectAdapterPtr _adapter;
+ TraceLevelsPtr _traceLevels;
+ std::string _name; // The topic name
+ SubscriberFactoryPtr _factory;
+
+ Ice::ObjectPtr _publisher; // Publisher & associated proxy
+ Ice::ObjectPrx _publisherPrx;
+
+ Ice::ObjectPtr _link; // TopicLink & associated proxy
+ TopicLinkPrx _linkPrx;
+
+ //
+ // Mutable members. Protected by *this
+ //
+ bool _destroyed; // Has this Topic been destroyed?
+
+ TopicSubscribersPtr _subscribers; // Set of Subscribers
+
+ IdentityLinkDict _links; // The database of Topic links
+ Freeze::DBPtr _linksDb;
+};
+
+typedef IceUtil::Handle<TopicI> TopicIPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp
index 179267e7483..518a1975909 100644
--- a/cpp/src/IceStorm/TopicManagerI.cpp
+++ b/cpp/src/IceStorm/TopicManagerI.cpp
@@ -38,7 +38,7 @@ TopicManagerI::TopicManagerI(const Ice::CommunicatorPtr& communicator, const Ice
// should only occur upon a crash.
//
StringBoolDict::iterator p = _topics.begin();
- while (p != _topics.end())
+ while(p != _topics.end())
{
assert(_topicIMap.find(p->first) == _topicIMap.end());
try
@@ -48,7 +48,7 @@ TopicManagerI::TopicManagerI(const Ice::CommunicatorPtr& communicator, const Ice
}
catch(const Freeze::DBNotFoundException& ex)
{
- if (_traceLevels->topicMgr > 0)
+ if(_traceLevels->topicMgr > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicMgrCat);
out << ex;
@@ -72,7 +72,7 @@ TopicManagerI::create(const string& name, const Ice::Current&)
reap();
- if (_topicIMap.find(name) != _topicIMap.end())
+ if(_topicIMap.find(name) != _topicIMap.end())
{
TopicExists ex;
ex.name = name;
@@ -97,7 +97,7 @@ TopicManagerI::retrieve(const string& name, const Ice::Current&)
reap();
- if (_topicIMap.find(name) != _topicIMap.end())
+ if(_topicIMap.find(name) != _topicIMap.end())
{
Ice::Identity id;
id.name = name;
@@ -140,16 +140,16 @@ TopicManagerI::subscribe(const QoS& qos, const Ice::ObjectPrx& subscriber, const
IceUtil::Mutex::Lock sync(*this);
Ice::Identity ident = subscriber->ice_getIdentity();
- if (_traceLevels->topicMgr > 0)
+ if(_traceLevels->topicMgr > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicMgrCat);
out << "Subscribe: " << Ice::identityToString(ident);
- if (_traceLevels->topicMgr > 1)
+ if(_traceLevels->topicMgr > 1)
{
out << " QoS: ";
- for (QoS::const_iterator qi = qos.begin(); qi != qos.end() ; ++qi)
+ for(QoS::const_iterator qi = qos.begin(); qi != qos.end() ; ++qi)
{
- if (qi != qos.begin())
+ if(qi != qos.begin())
{
out << ',';
}
@@ -163,7 +163,7 @@ TopicManagerI::subscribe(const QoS& qos, const Ice::ObjectPrx& subscriber, const
// channel.
//
TopicIMap::iterator elem = _topicIMap.find(ident.category);
- if (elem == _topicIMap.end())
+ if(elem == _topicIMap.end())
{
NoSuchTopic ex;
ex.name = ident.category;
@@ -183,7 +183,7 @@ TopicManagerI::unsubscribe(const Ice::ObjectPrx& subscriber, const Ice::Current&
Ice::Identity ident = subscriber->ice_getIdentity();
- if (_traceLevels->topicMgr > 0)
+ if(_traceLevels->topicMgr > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicMgrCat);
@@ -192,7 +192,7 @@ TopicManagerI::unsubscribe(const Ice::ObjectPrx& subscriber, const Ice::Current&
TopicIMap::iterator elem = _topicIMap.find(ident.category);
- if (elem != _topicIMap.end())
+ if(elem != _topicIMap.end())
{
elem->second->unsubscribe(subscriber);
}
@@ -214,11 +214,11 @@ TopicManagerI::reap()
// IceUtil::Mutex::Lock sync(*this);
//
TopicIMap::iterator i = _topicIMap.begin();
- while (i != _topicIMap.end())
+ while(i != _topicIMap.end())
{
- if (i->second->destroyed())
+ if(i->second->destroyed())
{
- if (_traceLevels->topicMgr > 0)
+ if(_traceLevels->topicMgr > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicMgrCat);
out << "Reaping " << i->first;
@@ -236,7 +236,7 @@ TopicManagerI::reap()
void
TopicManagerI::installTopic(const std::string& message, const std::string& name, bool create)
{
- if (_traceLevels->topicMgr > 0)
+ if(_traceLevels->topicMgr > 0)
{
Ice::Trace out(_traceLevels->logger, _traceLevels->topicMgrCat);
out << message << ' ' << name;
diff --git a/cpp/src/IceStorm/TopicManagerI.h b/cpp/src/IceStorm/TopicManagerI.h
index 0aa5b91f784..993cf1a5d0a 100644
--- a/cpp/src/IceStorm/TopicManagerI.h
+++ b/cpp/src/IceStorm/TopicManagerI.h
@@ -1,78 +1,78 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef TOPIC_MANAGER_I_H
-#define TOPIC_MANAGER_I_H
-
-#include <IceStorm/IceStorm.h>
-#include <IceStorm/StringBoolDict.h>
-
-namespace IceStorm
-{
-
-//
-// Forward declarations.
-//
-class TopicI;
-typedef IceUtil::Handle<TopicI> TopicIPtr;
-
-class TraceLevels;
-typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
-
-class Flusher;
-typedef IceUtil::Handle<Flusher> FlusherPtr;
-
-class SubscriberFactory;
-typedef IceUtil::Handle<SubscriberFactory> SubscriberFactoryPtr;
-
-//
-// Map of TopicImplementation objects.
-//
-typedef std::map<std::string, TopicIPtr> TopicIMap;
-
-//
-// TopicManager implementation.
-//
-class TopicManagerI : public TopicManager, public IceUtil::Mutex
-{
-public:
-
- TopicManagerI(const Ice::CommunicatorPtr&, const Ice::ObjectAdapterPtr&, const TraceLevelsPtr&,
- const Freeze::DBEnvironmentPtr&, const Freeze::DBPtr&);
- ~TopicManagerI();
-
- virtual TopicPrx create(const std::string&, const Ice::Current&);
- virtual TopicPrx retrieve(const std::string&, const Ice::Current&);
- virtual TopicDict retrieveAll(const Ice::Current&);
- virtual void subscribe(const QoS&, const Ice::ObjectPrx&, const Ice::Current&);
- virtual void unsubscribe(const Ice::ObjectPrx&, const Ice::Current&);
- virtual void shutdown(const Ice::Current&);
-
- void reap();
-
-private:
-
- void installTopic(const std::string&, const std::string&, bool);
-
- Ice::CommunicatorPtr _communicator;
- Ice::ObjectAdapterPtr _adapter;
- TraceLevelsPtr _traceLevels;
- TopicIMap _topicIMap;
- FlusherPtr _flusher;
- SubscriberFactoryPtr _factory;
- Freeze::DBEnvironmentPtr _dbEnv;
- StringBoolDict _topics;
-};
-
-typedef IceUtil::Handle<TopicManagerI> TopicManagerIPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef TOPIC_MANAGER_I_H
+#define TOPIC_MANAGER_I_H
+
+#include <IceStorm/IceStorm.h>
+#include <IceStorm/StringBoolDict.h>
+
+namespace IceStorm
+{
+
+//
+// Forward declarations.
+//
+class TopicI;
+typedef IceUtil::Handle<TopicI> TopicIPtr;
+
+class TraceLevels;
+typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
+
+class Flusher;
+typedef IceUtil::Handle<Flusher> FlusherPtr;
+
+class SubscriberFactory;
+typedef IceUtil::Handle<SubscriberFactory> SubscriberFactoryPtr;
+
+//
+// Map of TopicImplementation objects.
+//
+typedef std::map<std::string, TopicIPtr> TopicIMap;
+
+//
+// TopicManager implementation.
+//
+class TopicManagerI : public TopicManager, public IceUtil::Mutex
+{
+public:
+
+ TopicManagerI(const Ice::CommunicatorPtr&, const Ice::ObjectAdapterPtr&, const TraceLevelsPtr&,
+ const Freeze::DBEnvironmentPtr&, const Freeze::DBPtr&);
+ ~TopicManagerI();
+
+ virtual TopicPrx create(const std::string&, const Ice::Current&);
+ virtual TopicPrx retrieve(const std::string&, const Ice::Current&);
+ virtual TopicDict retrieveAll(const Ice::Current&);
+ virtual void subscribe(const QoS&, const Ice::ObjectPrx&, const Ice::Current&);
+ virtual void unsubscribe(const Ice::ObjectPrx&, const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+
+ void reap();
+
+private:
+
+ void installTopic(const std::string&, const std::string&, bool);
+
+ Ice::CommunicatorPtr _communicator;
+ Ice::ObjectAdapterPtr _adapter;
+ TraceLevelsPtr _traceLevels;
+ TopicIMap _topicIMap;
+ FlusherPtr _flusher;
+ SubscriberFactoryPtr _factory;
+ Freeze::DBEnvironmentPtr _dbEnv;
+ StringBoolDict _topics;
+};
+
+typedef IceUtil::Handle<TopicManagerI> TopicManagerIPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/TraceLevels.h b/cpp/src/IceStorm/TraceLevels.h
index fbc08dc4d6f..e971dd28169 100644
--- a/cpp/src/IceStorm/TraceLevels.h
+++ b/cpp/src/IceStorm/TraceLevels.h
@@ -1,47 +1,47 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_STORM_TRACE_LEVELS_H
-#define ICE_STORM_TRACE_LEVELS_H
-
-#include <IceUtil/Shared.h>
-#include <Ice/PropertiesF.h>
-#include <Ice/LoggerF.h>
-
-namespace IceStorm
-{
-
-class TraceLevels : public ::IceUtil::Shared
-{
-public:
-
- TraceLevels(const ::Ice::PropertiesPtr&, const Ice::LoggerPtr&);
- virtual ~TraceLevels();
-
- const int topicMgr;
- const char* topicMgrCat;
-
- const int topic;
- const char* topicCat;
-
- const int flush;
- const char* flushCat;
-
- const int subscriber;
- const char* subscriberCat;
-
- const Ice::LoggerPtr logger;
-};
-
-typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2002
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_STORM_TRACE_LEVELS_H
+#define ICE_STORM_TRACE_LEVELS_H
+
+#include <IceUtil/Shared.h>
+#include <Ice/PropertiesF.h>
+#include <Ice/LoggerF.h>
+
+namespace IceStorm
+{
+
+class TraceLevels : public ::IceUtil::Shared
+{
+public:
+
+ TraceLevels(const ::Ice::PropertiesPtr&, const Ice::LoggerPtr&);
+ virtual ~TraceLevels();
+
+ const int topicMgr;
+ const char* topicMgrCat;
+
+ const int topic;
+ const char* topicCat;
+
+ const int flush;
+ const char* flushCat;
+
+ const int subscriber;
+ const char* subscriberCat;
+
+ const Ice::LoggerPtr logger;
+};
+
+typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/WeightedGraph.cpp b/cpp/src/IceStorm/WeightedGraph.cpp
index 864e30f35be..f856f3aa465 100644
--- a/cpp/src/IceStorm/WeightedGraph.cpp
+++ b/cpp/src/IceStorm/WeightedGraph.cpp
@@ -110,12 +110,12 @@ SAXGraphHandler::startElement(const XMLCh *const name, AttributeList &attrs)
try
{
- if (str == "vertex")
+ if(str == "vertex")
{
XMLCh* n = XMLString::transcode("name");
const XMLCh* value = attrs.getValue(n);
delete[] n;
- if (value == 0)
+ if(value == 0)
{
WeightedGraphParseException ex;
ex.reason = "<vertex> name attribute missing";
@@ -126,12 +126,12 @@ SAXGraphHandler::startElement(const XMLCh *const name, AttributeList &attrs)
_graph.addVertex(vstr);
}
- else if (str == "edge")
+ else if(str == "edge")
{
XMLCh* n = XMLString::transcode("source");
const XMLCh* value = attrs.getValue(n);
delete[] n;
- if (value == 0)
+ if(value == 0)
{
WeightedGraphParseException ex;
ex.reason = "<edge> source attribute missing";
@@ -143,7 +143,7 @@ SAXGraphHandler::startElement(const XMLCh *const name, AttributeList &attrs)
n = XMLString::transcode("target");
value = attrs.getValue(n);
delete[] n;
- if (value == 0)
+ if(value == 0)
{
WeightedGraphParseException ex;
ex.reason = "<edge> target attribute missing";
@@ -156,7 +156,7 @@ SAXGraphHandler::startElement(const XMLCh *const name, AttributeList &attrs)
delete[] n;
int cost = 0;
- if (value != 0)
+ if(value != 0)
{
string cstr = toString(value);
cost = atoi(cstr.c_str());
@@ -224,9 +224,9 @@ WeightedGraph::parse(const string& xmlFile)
void
WeightedGraph::dump(ostream& os)
{
- for (unsigned int i = 0 ; i < _vertices.size(); ++i)
+ for(unsigned int i = 0 ; i < _vertices.size(); ++i)
{
- for (unsigned int j = 0; j < _vertices.size(); ++j)
+ for(unsigned int j = 0; j < _vertices.size(); ++j)
{
os << _edges[i*_vertices.size() + j] << " ";
}
@@ -253,12 +253,12 @@ WeightedGraph::getEdgesFor(const std::string& vertex) const
vector<pair<string, int> > edges;
map<std::string, int>::const_iterator p = _vlookup.find(vertex);
- if (p != _vlookup.end())
+ if(p != _vlookup.end())
{
int row = p->second * _vertices.size();
- for (unsigned int i = row; i < row + _vertices.size(); ++i)
+ for(unsigned int i = row; i < row + _vertices.size(); ++i)
{
- if (_edges[i] != -1)
+ if(_edges[i] != -1)
{
edges.push_back(make_pair(_vertices[i-row], _edges[i]));
}
@@ -281,7 +281,7 @@ WeightedGraph::compute(vector<int>& newEdges, int max)
// For each vertex calculate the cost for all reachable vertexes
// within the given max cost.
//
- for (unsigned int i = 0; i < _vertices.size(); ++i)
+ for(unsigned int i = 0; i < _vertices.size(); ++i)
{
//
// List of <vertex-index,cost> pairs.
@@ -294,15 +294,15 @@ WeightedGraph::compute(vector<int>& newEdges, int max)
// Add each vertex-index/cost pair to the new adjacency
// matrix.
//
- for (list<pair<unsigned int, int> >::iterator p = visited.begin(); p != visited.end(); ++p)
+ for(list<pair<unsigned int, int> >::iterator p = visited.begin(); p != visited.end(); ++p)
{
//
// Ignore loops.
//
- if ((*p).first != i)
+ if((*p).first != i)
{
newEdges[i*_vertices.size() + (*p).first] = (*p).second;
- if (_reflective)
+ if(_reflective)
{
newEdges[(*p).first*_vertices.size() + i] = (*p).second;
}
@@ -318,11 +318,11 @@ WeightedGraph::visit(unsigned int vertex, int cost, list<pair<unsigned int, int>
// Is the given vertex already in the visited list? If so, then
// check that is the cost is minimal cost and replace if not.
//
- for ( list<pair<unsigned int, int> >::iterator p = visited.begin(); p != visited.end(); ++p)
+ for( list<pair<unsigned int, int> >::iterator p = visited.begin(); p != visited.end(); ++p)
{
- if (p->first == vertex)
+ if(p->first == vertex)
{
- if (p->second > cost)
+ if(p->second > cost)
{
p->second = cost;
}
@@ -340,11 +340,11 @@ WeightedGraph::visit(unsigned int vertex, int cost, list<pair<unsigned int, int>
// adjacency matrix).
//
int row = vertex * _vertices.size();
- for (unsigned int i = row ; i < row + _vertices.size() ; ++i)
+ for(unsigned int i = row ; i < row + _vertices.size() ; ++i)
{
- if (_edges[i] != -1)
+ if(_edges[i] != -1)
{
- if (cost + _edges[i] <= max)
+ if(cost + _edges[i] <= max)
{
visit(i - row, cost + _edges[i], visited, max);
}
@@ -364,20 +364,20 @@ WeightedGraph::addEdge(const string& from, const string& to, int cost)
//
// Loops are not permitted.
//
- if (from == to)
+ if(from == to)
{
WeightedGraphParseException ex;
ex.reason = "loops are not permitted";
throw ex;
}
- if (_edges.size() == 0)
+ if(_edges.size() == 0)
{
//
// Prepare the edge map
//
_edges.resize(_vertices.size()*_vertices.size(), -1);
- for (unsigned int i = 0; i < _vertices.size(); ++i)
+ for(unsigned int i = 0; i < _vertices.size(); ++i)
{
_vlookup.insert(make_pair(_vertices[i], i));
}
@@ -387,7 +387,7 @@ WeightedGraph::addEdge(const string& from, const string& to, int cost)
// Location of from and to.
//
map<string, int>::iterator p = _vlookup.find(from);
- if (p == _vlookup.end())
+ if(p == _vlookup.end())
{
WeightedGraphParseException ex;
ex.reason = "<edge> vertex " + from + " not found";
@@ -396,7 +396,7 @@ WeightedGraph::addEdge(const string& from, const string& to, int cost)
int fidx = p->second;
p = _vlookup.find(to);
- if (p == _vlookup.end())
+ if(p == _vlookup.end())
{
WeightedGraphParseException ex;
ex.reason = "<edge> vertex " + to + " not found";
@@ -408,7 +408,7 @@ WeightedGraph::addEdge(const string& from, const string& to, int cost)
// Fill in from, to - to,from
//
_edges[fidx*_vertices.size() + tidx] = cost;
- if (_reflective)
+ if(_reflective)
{
_edges[tidx*_vertices.size() + fidx] = cost;
}
diff --git a/cpp/src/IceStorm/WeightedGraph.h b/cpp/src/IceStorm/WeightedGraph.h
index edbaa55a265..c0465ebd7f3 100644
--- a/cpp/src/IceStorm/WeightedGraph.h
+++ b/cpp/src/IceStorm/WeightedGraph.h
@@ -1,116 +1,116 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef WEIGHTED_GRAPH_H
-#define WEIGHTED_GRAPH_H
-
-#include <IceUtil/Config.h>
-#include <vector>
-#include <list>
-#include <map>
-
-namespace IceStorm
-{
-
-//
-// Forward declaration.
-//
-class SAXGraphHandler;
-
-//
-// A weighted graph. This class uses internally a vertex, adjacency
-// matrix representation. Each vertex has a name. The [i,j] of the
-// adjacency graph represents the the edge from _vertices[i] to
-// _vertices[j].
-//
-class WeightedGraph
-{
-public:
-
- WeightedGraph(bool = false);
- ~WeightedGraph();
-
- //
- // Parse the graph from the given XML file. Returns false in event
- // of a parse error.
- //
- bool parse(const std::string&);
-
- //
- // Compute a new adjacency matrix with the given cost.
- //
- void compute(std::vector<int>&, int);
-
- //
- // Render the edge table in ASCII format.
- //
- void dump(std::ostream&);
-
- //
- // Swap the adjacency matrix. This could be actual swap.
- //
- void swap(const std::vector<int>&);
-
- //
- // Get all the vertices.
- //
- std::vector<std::string> getVertices() const;
-
- //
- // Get the set of edges for a vertex. The return data is the name
- // of the second vertex, and the cost.
- //
- std::vector<std::pair<std::string, int> > getEdgesFor(const std::string&) const;
-
-private:
-
- //
- // Recursive function used in computation of new edge set.
- //
- void visit(unsigned int, int, std::list<std::pair<unsigned int, int> >&, int);
-
- //
- // Callbacks from parsing routines
- //
- void addVertex(const std::string&);
- void addEdge(const std::string&, const std::string&, int);
-
- void error();
-
- //
- // List of vertices.
- //
- std::vector<std::string> _vertices;
-
- //
- // Lookup table - maps from vertex name to vertex index.
- //
- std::map<std::string, int> _vlookup;
-
- //
- // The adjacency matrix. -1 indicates no edge, otherwise the value
- // is the cost.
- //
- std::vector<int> _edges;
-
- //
- // Is the graph reflective? That is if there is edge (v1, v2,
- // cost) then there is (v2, v1, cost).
- //
- bool _reflective;
-
- int _error;
-
- friend class SAXGraphHandler;
-};
-
-} // End namespace IceStorm
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef WEIGHTED_GRAPH_H
+#define WEIGHTED_GRAPH_H
+
+#include <IceUtil/Config.h>
+#include <vector>
+#include <list>
+#include <map>
+
+namespace IceStorm
+{
+
+//
+// Forward declaration.
+//
+class SAXGraphHandler;
+
+//
+// A weighted graph. This class uses internally a vertex, adjacency
+// matrix representation. Each vertex has a name. The [i,j] of the
+// adjacency graph represents the the edge from _vertices[i] to
+// _vertices[j].
+//
+class WeightedGraph
+{
+public:
+
+ WeightedGraph(bool = false);
+ ~WeightedGraph();
+
+ //
+ // Parse the graph from the given XML file. Returns false in event
+ // of a parse error.
+ //
+ bool parse(const std::string&);
+
+ //
+ // Compute a new adjacency matrix with the given cost.
+ //
+ void compute(std::vector<int>&, int);
+
+ //
+ // Render the edge table in ASCII format.
+ //
+ void dump(std::ostream&);
+
+ //
+ // Swap the adjacency matrix. This could be actual swap.
+ //
+ void swap(const std::vector<int>&);
+
+ //
+ // Get all the vertices.
+ //
+ std::vector<std::string> getVertices() const;
+
+ //
+ // Get the set of edges for a vertex. The return data is the name
+ // of the second vertex, and the cost.
+ //
+ std::vector<std::pair<std::string, int> > getEdgesFor(const std::string&) const;
+
+private:
+
+ //
+ // Recursive function used in computation of new edge set.
+ //
+ void visit(unsigned int, int, std::list<std::pair<unsigned int, int> >&, int);
+
+ //
+ // Callbacks from parsing routines
+ //
+ void addVertex(const std::string&);
+ void addEdge(const std::string&, const std::string&, int);
+
+ void error();
+
+ //
+ // List of vertices.
+ //
+ std::vector<std::string> _vertices;
+
+ //
+ // Lookup table - maps from vertex name to vertex index.
+ //
+ std::map<std::string, int> _vlookup;
+
+ //
+ // The adjacency matrix. -1 indicates no edge, otherwise the value
+ // is the cost.
+ //
+ std::vector<int> _edges;
+
+ //
+ // Is the graph reflective? That is if there is edge (v1, v2,
+ // cost) then there is (v2, v1, cost).
+ //
+ bool _reflective;
+
+ int _error;
+
+ friend class SAXGraphHandler;
+};
+
+} // End namespace IceStorm
+
+#endif
diff --git a/cpp/src/IceStorm/dummyinclude/unistd.h b/cpp/src/IceStorm/dummyinclude/unistd.h
index 92d53d10b9b..a5868056a35 100644
--- a/cpp/src/IceStorm/dummyinclude/unistd.h
+++ b/cpp/src/IceStorm/dummyinclude/unistd.h
@@ -1,4 +1,4 @@
-//
-// Files generated by flex need unistd.h, which is not available on
-// Windows. Thus this dummy file.
-//
+//
+// Files generated by flex need unistd.h, which is not available on
+// Windows. Thus this dummy file.
+//
diff --git a/cpp/src/IceUtil/Base64.cpp b/cpp/src/IceUtil/Base64.cpp
index 5cd6fe44af1..eae4ca9a94f 100644
--- a/cpp/src/IceUtil/Base64.cpp
+++ b/cpp/src/IceUtil/Base64.cpp
@@ -18,7 +18,7 @@ IceUtil::Base64::encode(const ByteSeq& plainSeq)
{
string retval;
- if (plainSeq.size() == 0)
+ if(plainSeq.size() == 0)
{
return retval;
}
@@ -38,18 +38,18 @@ IceUtil::Base64::encode(const ByteSeq& plainSeq)
unsigned char by6 = 0;
unsigned char by7 = 0;
- for (unsigned long i = 0; i < plainSeq.size(); i += 3)
+ for(unsigned long i = 0; i < plainSeq.size(); i += 3)
{
by1 = plainSeq[i];
by2 = 0;
by3 = 0;
- if ((i + 1) < plainSeq.size())
+ if((i + 1) < plainSeq.size())
{
by2 = plainSeq[i+1];
}
- if ((i + 2) < plainSeq.size())
+ if((i + 2) < plainSeq.size())
{
by3 = plainSeq[i+2];
}
@@ -62,7 +62,7 @@ IceUtil::Base64::encode(const ByteSeq& plainSeq)
retval += encode(by4);
retval += encode(by5);
- if ((i + 1) < plainSeq.size())
+ if((i + 1) < plainSeq.size())
{
retval += encode(by6);
}
@@ -71,7 +71,7 @@ IceUtil::Base64::encode(const ByteSeq& plainSeq)
retval += "=";
}
- if ((i + 2) < plainSeq.size())
+ if((i + 2) < plainSeq.size())
{
retval += encode(by7);
}
@@ -85,7 +85,7 @@ IceUtil::Base64::encode(const ByteSeq& plainSeq)
outString.reserve(totalBytes);
string::iterator iter = retval.begin();
- while ((retval.end() - iter) > 76)
+ while((retval.end() - iter) > 76)
{
copy(iter, iter+76, back_inserter(outString));
outString += "\r\n";
@@ -104,9 +104,9 @@ IceUtil::Base64::decode(const string& str)
newStr.reserve(str.length());
- for (unsigned long j = 0; j < str.length(); j++)
+ for(unsigned long j = 0; j < str.length(); j++)
{
- if (isBase64(str[j]))
+ if(isBase64(str[j]))
{
newStr += str[j];
}
@@ -114,7 +114,7 @@ IceUtil::Base64::decode(const string& str)
ByteSeq retval;
- if (newStr.length() == 0)
+ if(newStr.length() == 0)
{
return retval;
}
@@ -136,7 +136,7 @@ IceUtil::Base64::decode(const string& str)
char c1, c2, c3, c4;
- for (unsigned long i = 0; i < newStr.length(); i += 4)
+ for(unsigned long i = 0; i < newStr.length(); i += 4)
{
c1 = 'A';
c2 = 'A';
@@ -145,17 +145,17 @@ IceUtil::Base64::decode(const string& str)
c1 = newStr[i];
- if ((i + 1) < newStr.length())
+ if((i + 1) < newStr.length())
{
c2 = newStr[i + 1];
}
- if ((i + 2) < newStr.length())
+ if((i + 2) < newStr.length())
{
c3 = newStr[i + 2];
}
- if ((i + 3) < newStr.length())
+ if((i + 3) < newStr.length())
{
c4 = newStr[i + 3];
}
@@ -167,12 +167,12 @@ IceUtil::Base64::decode(const string& str)
retval.push_back((by1 << 2) | (by2 >> 4));
- if (c3 != '=')
+ if(c3 != '=')
{
retval.push_back(((by2 & 0xf) << 4) | (by3 >> 2));
}
- if (c4 != '=')
+ if(c4 != '=')
{
retval.push_back(((by3 & 0x3) << 6) | by4);
}
@@ -184,22 +184,22 @@ IceUtil::Base64::decode(const string& str)
char
IceUtil::Base64::encode(unsigned char uc)
{
- if (uc < 26)
+ if(uc < 26)
{
return 'A' + uc;
}
- if (uc < 52)
+ if(uc < 52)
{
return 'a' + (uc - 26);
}
- if (uc < 62)
+ if(uc < 62)
{
return '0' + (uc - 52);
}
- if (uc == 62)
+ if(uc == 62)
{
return '+';
}
@@ -210,22 +210,22 @@ IceUtil::Base64::encode(unsigned char uc)
unsigned char
IceUtil::Base64::decode(char c)
{
- if (c >= 'A' && c <= 'Z')
+ if(c >= 'A' && c <= 'Z')
{
return c - 'A';
}
- if (c >= 'a' && c <= 'z')
+ if(c >= 'a' && c <= 'z')
{
return c - 'a' + 26;
}
- if (c >= '0' && c <= '9')
+ if(c >= '0' && c <= '9')
{
return c - '0' + 52;
}
- if (c == '+')
+ if(c == '+')
{
return 62;
}
@@ -237,32 +237,32 @@ IceUtil::Base64::decode(char c)
bool
IceUtil::Base64::isBase64(char c)
{
- if (c >= 'A' && c <= 'Z')
+ if(c >= 'A' && c <= 'Z')
{
return true;
}
- if (c >= 'a' && c <= 'z')
+ if(c >= 'a' && c <= 'z')
{
return true;
}
- if (c >= '0' && c <= '9')
+ if(c >= '0' && c <= '9')
{
return true;
}
- if (c == '+')
+ if(c == '+')
{
return true;
}
- if (c == '/')
+ if(c == '/')
{
return true;
}
- if (c == '=')
+ if(c == '=')
{
return true;
}
diff --git a/cpp/src/IceUtil/Cond.cpp b/cpp/src/IceUtil/Cond.cpp
index 867d153224c..c26e0122661 100644
--- a/cpp/src/IceUtil/Cond.cpp
+++ b/cpp/src/IceUtil/Cond.cpp
@@ -19,7 +19,7 @@
IceUtil::Semaphore::Semaphore(long initial)
{
_sem = CreateSemaphore(0, initial, 0x7fffffff, 0);
- if (_sem == INVALID_HANDLE_VALUE)
+ if(_sem == INVALID_HANDLE_VALUE)
{
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
}
@@ -34,7 +34,7 @@ void
IceUtil::Semaphore::wait() const
{
int rc = WaitForSingleObject(_sem, INFINITE);
- if (rc != WAIT_OBJECT_0)
+ if(rc != WAIT_OBJECT_0)
{
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
}
@@ -47,7 +47,7 @@ IceUtil::Semaphore::timedWait(const Time& timeout) const
long msec = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
int rc = WaitForSingleObject(_sem, msec);
- if (rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0)
+ if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0)
{
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
}
@@ -58,7 +58,7 @@ void
IceUtil::Semaphore::post(int count) const
{
int rc = ReleaseSemaphore(_sem, count, 0);
- if (rc == 0)
+ if(rc == 0)
{
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
}
@@ -97,13 +97,13 @@ IceUtil::Cond::wake(bool broadcast)
_gate.wait();
_internal.lock();
- if (_unblocked != 0)
+ if(_unblocked != 0)
{
_blocked -= _unblocked;
_unblocked = 0;
}
- if (_blocked > 0)
+ if(_blocked > 0)
{
//
// Unblock some number of waiters.
@@ -136,17 +136,17 @@ IceUtil::Cond::postWait(bool timedOut) const
_internal.lock();
_unblocked++;
- if (_toUnblock != 0)
+ if(_toUnblock != 0)
{
bool last = --_toUnblock == 0;
_internal.unlock();
- if (timedOut)
+ if(timedOut)
{
_queue.wait();
}
- if (last)
+ if(last)
{
_gate.post();
}
@@ -197,7 +197,7 @@ IceUtil::Cond::timedDowait(const Time& timeout) const
IceUtil::Cond::Cond()
{
int rc = pthread_cond_init(&_cond, 0);
- if (rc != 0)
+ if(rc != 0)
{
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
@@ -214,7 +214,7 @@ void
IceUtil::Cond::signal()
{
int rc = pthread_cond_signal(&_cond);
- if (rc != 0)
+ if(rc != 0)
{
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
@@ -224,7 +224,7 @@ void
IceUtil::Cond::broadcast()
{
int rc = pthread_cond_broadcast(&_cond);
- if (rc != 0)
+ if(rc != 0)
{
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
diff --git a/cpp/src/IceUtil/Exception.cpp b/cpp/src/IceUtil/Exception.cpp
index 38afb2406ef..eab176ff011 100644
--- a/cpp/src/IceUtil/Exception.cpp
+++ b/cpp/src/IceUtil/Exception.cpp
@@ -38,7 +38,7 @@ IceUtil::Exception::ice_name() const
void
IceUtil::Exception::ice_print(ostream& out) const
{
- if (_file && _line > 0)
+ if(_file && _line > 0)
{
out << _file << ':' << _line << ": ";
}
diff --git a/cpp/src/IceUtil/OutputUtil.cpp b/cpp/src/IceUtil/OutputUtil.cpp
index 1c690ff5f88..1759f8bec88 100644
--- a/cpp/src/IceUtil/OutputUtil.cpp
+++ b/cpp/src/IceUtil/OutputUtil.cpp
@@ -73,9 +73,9 @@ IceUtil::OutputBase::open(const char* s)
void
IceUtil::OutputBase::print(const char* s)
{
- for (unsigned int i = 0; i < strlen(s); ++i)
+ for(unsigned int i = 0; i < strlen(s); ++i)
{
- if (s[i] == '\n')
+ if(s[i] == '\n')
{
_pos = 0;
}
@@ -144,9 +144,9 @@ IceUtil::OutputBase::nl()
int indent = _indent;
- if (_useTab)
+ if(_useTab)
{
- while (indent >= 8)
+ while(indent >= 8)
{
indent -= 8;
_out << '\t';
@@ -155,7 +155,7 @@ IceUtil::OutputBase::nl()
}
else
{
- while (indent >= _indentSize)
+ while(indent >= _indentSize)
{
indent -= _indentSize;
_out << " ";
@@ -163,7 +163,7 @@ IceUtil::OutputBase::nl()
}
}
- while (indent > 0)
+ while(indent > 0)
{
--indent;
_out << ' ';
@@ -176,7 +176,7 @@ IceUtil::OutputBase::nl()
void
IceUtil::OutputBase::sp()
{
- if (_separator)
+ if(_separator)
{
_out << '\n';
}
@@ -228,7 +228,7 @@ IceUtil::Output::setEndBlock(const char *eb)
void
IceUtil::Output::sb()
{
- if (_blockStart.length())
+ if(_blockStart.length())
{
nl();
_out << _blockStart;
@@ -242,7 +242,7 @@ void
IceUtil::Output::eb()
{
dec();
- if (_blockEnd.length())
+ if(_blockEnd.length())
{
nl();
_out << _blockEnd;
@@ -293,7 +293,7 @@ IceUtil::XMLOutput::setSGML(bool sgml)
void
IceUtil::XMLOutput::print(const char* s)
{
- if (!_printed)
+ if(!_printed)
{
_out << '>';
_printed = true;
@@ -304,7 +304,7 @@ IceUtil::XMLOutput::print(const char* s)
void
IceUtil::XMLOutput::nl()
{
- if (!_printed)
+ if(!_printed)
{
_printed = true;
_out << '>';
@@ -323,7 +323,7 @@ IceUtil::XMLOutput::se(const std::string& element)
// emitted) or until something //is displayed.
//
_out << '<' << element;
- if (_sgml)
+ if(_sgml)
{
_out << '>';
}
@@ -334,7 +334,7 @@ IceUtil::XMLOutput::se(const std::string& element)
string::size_type pos = element.find_first_of(" \t");
- if (pos == string::npos)
+ if(pos == string::npos)
{
_elementStack.push(element);
}
@@ -355,7 +355,7 @@ IceUtil::XMLOutput::ee()
_elementStack.pop();
dec();
- if (!_printed)
+ if(!_printed)
{
_out << "/>";
}
diff --git a/cpp/src/IceUtil/RWRecMutex.cpp b/cpp/src/IceUtil/RWRecMutex.cpp
index a9785dc7fef..e4c602c95ac 100644
--- a/cpp/src/IceUtil/RWRecMutex.cpp
+++ b/cpp/src/IceUtil/RWRecMutex.cpp
@@ -33,7 +33,7 @@ IceUtil::RWRecMutex::readlock() const
// Wait while a writer holds the lock or while writers are waiting
// to get the lock.
//
- while (_count < 0 || _waitingWriters != 0)
+ while(_count < 0 || _waitingWriters != 0)
{
_readers.wait(lock);
}
@@ -49,7 +49,7 @@ IceUtil::RWRecMutex::tryReadlock() const
// Would block if a writer holds the lock or if writers are
// waiting to get the lock.
//
- if (_count < 0 || _waitingWriters != 0)
+ if(_count < 0 || _waitingWriters != 0)
{
throw LockedException(__FILE__, __LINE__);
}
@@ -66,10 +66,10 @@ IceUtil::RWRecMutex::timedTryReadlock(const Time& timeout) const
// to get the lock.
//
Time end = Time::now() + timeout;
- while (_count < 0 || _waitingWriters != 0)
+ while(_count < 0 || _waitingWriters != 0)
{
Time remainder = end - Time::now();
- if (remainder > Time())
+ if(remainder > Time())
{
_readers.timedWait(lock, remainder);
}
@@ -91,7 +91,7 @@ IceUtil::RWRecMutex::writelock() const
// If the mutex is already write locked by this writer then
// decrement _count, and return.
//
- if (_count < 0 && _writerControl == ThreadControl())
+ if(_count < 0 && _writerControl == ThreadControl())
{
--_count;
return;
@@ -101,7 +101,7 @@ IceUtil::RWRecMutex::writelock() const
// Wait for the lock to become available and increment the number
// of waiting writers.
//
- while (_count != 0)
+ while(_count != 0)
{
_waitingWriters++;
try
@@ -131,7 +131,7 @@ IceUtil::RWRecMutex::tryWritelock() const
// If the mutex is already write locked by this writer then
// decrement _count, and return.
//
- if (_count < 0 && _writerControl == ThreadControl())
+ if(_count < 0 && _writerControl == ThreadControl())
{
--_count;
return;
@@ -140,7 +140,7 @@ IceUtil::RWRecMutex::tryWritelock() const
//
// If there are readers or other writers then the call would block.
//
- if (_count != 0)
+ if(_count != 0)
{
throw LockedException(__FILE__, __LINE__);
}
@@ -160,7 +160,7 @@ IceUtil::RWRecMutex::timedTryWritelock(const Time& timeout) const
// If the mutex is already write locked by this writer then
// decrement _count, and return.
//
- if (_count < 0 && _writerControl == ThreadControl())
+ if(_count < 0 && _writerControl == ThreadControl())
{
--_count;
return;
@@ -171,10 +171,10 @@ IceUtil::RWRecMutex::timedTryWritelock(const Time& timeout) const
// of waiting writers.
//
Time end = Time::now() + timeout;
- while (_count != 0)
+ while(_count != 0)
{
Time remainder = end - Time::now();
- if (remainder > Time())
+ if(remainder > Time())
{
_waitingWriters++;
try
@@ -215,7 +215,7 @@ IceUtil::RWRecMutex::unlock() const
// lock, so release the lock. Otherwise, _count is guaranteed to
// be > 0, so the calling thread is a reader releasing the lock.
//
- if (_count < 0)
+ if(_count < 0)
{
//
// Writer called unlock
@@ -225,7 +225,7 @@ IceUtil::RWRecMutex::unlock() const
//
// If the write lock wasn't totally released we're done.
//
- if (_count != 0)
+ if(_count != 0)
{
return;
}
@@ -252,14 +252,14 @@ IceUtil::RWRecMutex::unlock() const
// Wake up a waiting writer if there is one. If not, wake up all
// readers (just in case -- there may be none).
//
- if (ww)
+ if(ww)
{
//
// Wake writer
//
_writers.signal();
}
- else if (wr)
+ else if(wr)
{
//
// Wake readers
@@ -282,7 +282,7 @@ IceUtil::RWRecMutex::upgrade() const
//
// Wait to acquire the write lock.
//
- while (_count != 0)
+ while(_count != 0)
{
_waitingWriters++;
try
@@ -320,10 +320,10 @@ IceUtil::RWRecMutex::timedUpgrade(const Time& timeout) const
// Wait to acquire the write lock.
//
Time end = Time::now() + timeout;
- while (_count != 0)
+ while(_count != 0)
{
Time remainder = end - Time::now();
- if (remainder > Time())
+ if(remainder > Time())
{
_waitingWriters++;
try
diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp
index 9a876fb2ccd..182751ea67e 100644
--- a/cpp/src/IceUtil/RecMutex.cpp
+++ b/cpp/src/IceUtil/RecMutex.cpp
@@ -31,7 +31,7 @@ bool
IceUtil::RecMutex::lock() const
{
EnterCriticalSection(&_mutex);
- if (++_count > 1)
+ if(++_count > 1)
{
LeaveCriticalSection(&_mutex);
return false;
@@ -42,11 +42,11 @@ IceUtil::RecMutex::lock() const
bool
IceUtil::RecMutex::trylock() const
{
- if (!TryEnterCriticalSection(&_mutex))
+ if(!TryEnterCriticalSection(&_mutex))
{
throw LockedException(__FILE__, __LINE__);
}
- if (++_count > 1)
+ if(++_count > 1)
{
LeaveCriticalSection(&_mutex);
return false;
@@ -57,7 +57,7 @@ IceUtil::RecMutex::trylock() const
bool
IceUtil::RecMutex::unlock() const
{
- if (--_count == 0)
+ if(--_count == 0)
{
LeaveCriticalSection(&_mutex);
return true;
@@ -86,7 +86,7 @@ IceUtil::RecMutex::RecMutex() :
{
const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE_NP };
int rc = pthread_mutex_init(&_mutex, &attr);
- if (rc != 0)
+ if(rc != 0)
{
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
@@ -104,11 +104,11 @@ bool
IceUtil::RecMutex::lock() const
{
int rc = pthread_mutex_lock(&_mutex);
- if (rc != 0)
+ if(rc != 0)
{
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
- if (++_count > 1)
+ if(++_count > 1)
{
rc = pthread_mutex_unlock(&_mutex);
assert(rc == 0);
@@ -121,15 +121,15 @@ bool
IceUtil::RecMutex::trylock() const
{
int rc = pthread_mutex_trylock(&_mutex);
- if (rc != 0)
+ if(rc != 0)
{
- if (rc == EBUSY)
+ if(rc == EBUSY)
{
throw LockedException(__FILE__, __LINE__);
}
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
- if (++_count > 1)
+ if(++_count > 1)
{
rc = pthread_mutex_unlock(&_mutex);
assert(rc == 0);
@@ -141,7 +141,7 @@ IceUtil::RecMutex::trylock() const
bool
IceUtil::RecMutex::unlock() const
{
- if (--_count == 0)
+ if(--_count == 0)
{
int rc = 0; // Prevent warnings when NDEBUG is defined.
rc = pthread_mutex_unlock(&_mutex);
diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp
index cfb4f11c0f0..31ba4c36115 100644
--- a/cpp/src/IceUtil/Thread.cpp
+++ b/cpp/src/IceUtil/Thread.cpp
@@ -9,7 +9,7 @@
// **********************************************************************
#include <IceUtil/Thread.h>
-#include <IceUtil/Exception.h>
+#include <IceUtil/Exception.h>
#include <IceUtil/Time.h>
using namespace std;
@@ -23,7 +23,7 @@ IceUtil::ThreadControl::ThreadControl() :
HANDLE proc = GetCurrentProcess();
HANDLE current = GetCurrentThread();
int rc = DuplicateHandle(proc, current, proc, &_handle->handle, SYNCHRONIZE, TRUE, 0);
- if (rc == 0)
+ if(rc == 0)
{
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
}
@@ -57,7 +57,7 @@ void
IceUtil::ThreadControl::join()
{
int rc = WaitForSingleObject(_handle->handle, INFINITE);
- if (rc != WAIT_OBJECT_0)
+ if(rc != WAIT_OBJECT_0)
{
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
}
@@ -136,7 +136,7 @@ IceUtil::Thread::start()
__incRef();
_handle->handle = (HANDLE)_beginthreadex(0, 0, (unsigned (__stdcall*)(void*))startHook, (LPVOID)this, 0, &_id);
- if (_handle->handle == 0)
+ if(_handle->handle == 0)
{
__decRef();
throw SyscallException(SyscallException::errorToString(GetLastError()), __FILE__, __LINE__);
@@ -205,7 +205,7 @@ IceUtil::ThreadControl::join()
{
void* ignore = 0;
int rc = pthread_join(_id, &ignore);
- if (rc != 0)
+ if(rc != 0)
{
throw SyscallException(strerror(rc), __FILE__, __LINE__);
}
@@ -276,7 +276,7 @@ IceUtil::Thread::start()
//
__incRef();
int rc = pthread_create(&_id, 0, startHook, this);
- if (rc != 0)
+ if(rc != 0)
{
__decRef();
throw SyscallException(strerror(rc), __FILE__, __LINE__);
diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp
index 1cff84ab08a..6410cb2b9b5 100644
--- a/cpp/src/IceUtil/Unicode.cpp
+++ b/cpp/src/IceUtil/Unicode.cpp
@@ -19,27 +19,27 @@ IceUtil::wstringToString(const wstring& str)
string result;
result.reserve(str.length() * 2);
- for (unsigned int i = 0; i < str.length(); ++i)
+ for(unsigned int i = 0; i < str.length(); ++i)
{
wchar_t wc;
wc = str[i];
- if (wc < 0x80)
+ if(wc < 0x80)
{
result += static_cast<char>(wc);
}
- else if (wc < 0x800)
+ else if(wc < 0x800)
{
result += 0xc0 | (wc>>6);
result += 0x80 | (wc & 0x3f);
}
- else if (wc < 0x10000)
+ else if(wc < 0x10000)
{
result += 0xe0 | (wc>>12);
result += 0x80 | ((wc>>6) & 0x3f);
result += 0x80 | (wc & 0x3f);
}
- else if (wc < 0x10FFFF)
+ else if(wc < 0x10FFFF)
{
result += 0xf0 | (wc>>18);
result += 0x80 | ((wc>>12) & 0x3f);
@@ -62,19 +62,19 @@ IceUtil::stringToWstring(const string& str)
result.reserve(str.length());
unsigned int len;
- for (unsigned int i = 0; i < str.length(); i += len)
+ for(unsigned int i = 0; i < str.length(); i += len)
{
unsigned char c = str[i];
wchar_t wc;
int minval;
- if (c < 0x80)
+ if(c < 0x80)
{
wc = c;
len = 1;
minval = 0;
}
- else if (c < 0xc0) // Lead byte must not be 10xxxxxx
+ else if(c < 0xc0) // Lead byte must not be 10xxxxxx
{
return result; // Error, not encodable.
}
@@ -97,14 +97,14 @@ IceUtil::stringToWstring(const string& str)
len = 4;
minval = 0x10000;
}
- else if (c < 0xfc) // 111110xx
+ else if(c < 0xfc) // 111110xx
{
// Length 5 and 6 is declared invalid in Unicode 3.1 and ISO 10646:2001.
wc = c & 3;
len = 5;
minval = 0x110000;
}
- else if (c < 0xfe) // 1111110x
+ else if(c < 0xfe) // 1111110x
{
// Length 5 and 6 is declared invalid in Unicode 3.1 and ISO 10646:2001.
wc = c & 1;
@@ -117,11 +117,11 @@ IceUtil::stringToWstring(const string& str)
return result; // Error, not encodable.
}
- if (i + len - 1 < str.length())
+ if(i + len - 1 < str.length())
{
- for (unsigned int j = 1; j < len; ++j)
+ for(unsigned int j = 1; j < len; ++j)
{
- if ((str[i + j] & 0xc0) != 0x80) // All other bytes must be 10xxxxxx
+ if((str[i + j] & 0xc0) != 0x80) // All other bytes must be 10xxxxxx
{
return result; // Error, not encodable.
}
@@ -130,7 +130,7 @@ IceUtil::stringToWstring(const string& str)
wc |= str[i + j] & 0x3f;
}
- if (wc < minval)
+ if(wc < minval)
{
return result; // Error, non-shortest form.
}
diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp
index d8c6b252213..9848d14a7ab 100644
--- a/cpp/src/IceXML/StreamI.cpp
+++ b/cpp/src/IceXML/StreamI.cpp
@@ -218,7 +218,7 @@ IceXML::StreamI::StreamI(const ::Ice::CommunicatorPtr& communicator, std::istrea
//
// Read the contents of the stream into memory.
//
- while (!is.eof())
+ while(!is.eof())
{
char buf[1000];
is.read(buf, sizeof(buf));
@@ -236,7 +236,7 @@ IceXML::StreamI::StreamI(const ::Ice::CommunicatorPtr& communicator, std::istrea
//
_input->parser = new DOMParser;
_input->parser->setValidationScheme(DOMParser::Val_Auto);
- if (schema)
+ if(schema)
{
_input->parser->setDoNamespaces(true);
_input->parser->setDoSchema(true);
@@ -260,7 +260,7 @@ IceXML::StreamI::StreamI(const ::Ice::CommunicatorPtr& communicator, std::istrea
{
_input->parser->parse(*_input->source);
int errorCount = _input->parser->getErrorCount();
- if (errorCount > 0)
+ if(errorCount > 0)
{
errorsOccured = true;
}
@@ -280,7 +280,7 @@ IceXML::StreamI::StreamI(const ::Ice::CommunicatorPtr& communicator, std::istrea
errorsOccured = true;
}
- if (errorsOccured)
+ if(errorsOccured)
{
delete _input;
throw ::Ice::MarshalException(__FILE__, __LINE__);
@@ -476,14 +476,14 @@ IceXML::StreamI::readEnum(const string& name, const ::Ice::StringSeq& table)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
string value = toString(child.getNodeValue());
::Ice::StringSeq::const_iterator p = find(table.begin(), table.end(), value);
- if (p == table.end())
+ if(p == table.end())
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -507,7 +507,7 @@ void
IceXML::StreamI::writeByteSeq(const string& name, const ::Ice::ByteSeq& seq)
{
startWrite(name);
- for (::Ice::ByteSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::ByteSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << (int)*p << "</e>";
}
@@ -520,14 +520,14 @@ IceXML::StreamI::readByte(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
string s = toString(child.getNodeValue());
::Ice::Int i = atoi(s.c_str());
- if (i < -127 || i > 128)
+ if(i < -127 || i > 128)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -549,21 +549,21 @@ IceXML::StreamI::readByte(const string& name)
// DOM_NodeList children = _input->current.getChildNodes();
//
// int nchildren = children.getLength();
-// for (int i = 0; i < nchildren; ++i)
+// for(int i = 0; i < nchildren; ++i)
// {
// DOM_Node child = children.item(i);
-// while (child.getNodeType() != DOM_Node::ELEMENT_NODE)
+// while(child.getNodeType() != DOM_Node::ELEMENT_NODE)
// {
// child = child.getNextSibling();
// }
// string name = toString(child.getNodeName());
-// if (name != seqElementName)
+// if(name != seqElementName)
// {
// throw ::Ice::MarshalException(__FILE__, __LINE__);
// }
//
// child = child.getFirstChild();
-// if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+// if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
// {
// throw ::Ice::MarshalException(__FILE__, __LINE__);
// }
@@ -586,10 +586,10 @@ IceXML::StreamI::readByteSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readByte(seqElementName);
}
@@ -612,7 +612,7 @@ void
IceXML::StreamI::writeBoolSeq(const string& name, const ::Ice::BoolSeq& seq)
{
startWrite(name);
- for (::Ice::BoolSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::BoolSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << ((*p) ? "true" : "false") << "</e>";
}
@@ -625,7 +625,7 @@ IceXML::StreamI::readBool(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -646,10 +646,10 @@ IceXML::StreamI::readBoolSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readBool(seqElementName);
}
@@ -672,7 +672,7 @@ void
IceXML::StreamI::writeShortSeq(const string& name, const ::Ice::ShortSeq& seq)
{
startWrite(name);
- for (::Ice::ShortSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::ShortSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << *p << "</e>";
}
@@ -685,14 +685,14 @@ IceXML::StreamI::readShort(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
string s = toString(child.getNodeValue());
::Ice::Int i = atoi(s.c_str());
- if (i < -32767 || i > 32768)
+ if(i < -32767 || i > 32768)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -711,10 +711,10 @@ IceXML::StreamI::readShortSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readShort(seqElementName);
}
@@ -737,7 +737,7 @@ void
IceXML::StreamI::writeIntSeq(const string& name, const ::Ice::IntSeq& seq)
{
startWrite(name);
- for (::Ice::IntSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::IntSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << *p << "</e>";
}
@@ -750,7 +750,7 @@ IceXML::StreamI::readInt(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -771,10 +771,10 @@ IceXML::StreamI::readIntSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readInt(seqElementName);
}
@@ -797,7 +797,7 @@ void
IceXML::StreamI::writeLongSeq(const string& name, const ::Ice::LongSeq& seq)
{
startWrite(name);
- for (::Ice::LongSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::LongSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << *p << "</e>";
}
@@ -810,7 +810,7 @@ IceXML::StreamI::readLong(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -831,10 +831,10 @@ IceXML::StreamI::readLongSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readLong(seqElementName);
}
@@ -857,7 +857,7 @@ void
IceXML::StreamI::writeFloatSeq(const string& name, const ::Ice::FloatSeq& seq)
{
startWrite(name);
- for (::Ice::FloatSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::FloatSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << *p << "</e>";
}
@@ -870,7 +870,7 @@ IceXML::StreamI::readFloat(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -891,10 +891,10 @@ IceXML::StreamI::readFloatSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readFloat(seqElementName);
}
@@ -917,7 +917,7 @@ void
IceXML::StreamI::writeDoubleSeq(const string& name, const ::Ice::DoubleSeq& seq)
{
startWrite(name);
- for (::Ice::DoubleSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::DoubleSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << *p << "</e>";
}
@@ -930,7 +930,7 @@ IceXML::StreamI::readDouble(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.isNull() || child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -951,10 +951,10 @@ IceXML::StreamI::readDoubleSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readDouble(seqElementName);
}
@@ -977,13 +977,13 @@ IceXML::StreamI::writeString(const string& name, const string& value)
// conversion if not necessary.
//
static const string allReserved = "<>'\"&";
- if (v.find_first_of(allReserved) != string::npos)
+ if(v.find_first_of(allReserved) != string::npos)
{
//
// First convert all & to &amp;
//
size_t pos = 0;
- while ((pos = v.find_first_of('&', pos)) != string::npos)
+ while((pos = v.find_first_of('&', pos)) != string::npos)
{
v.insert(pos+1, "amp;");
pos += 4;
@@ -994,7 +994,7 @@ IceXML::StreamI::writeString(const string& name, const string& value)
//
static const string reserved = "<>'\"";
pos = 0;
- while ((pos = v.find_first_of(reserved, pos)) != string::npos)
+ while((pos = v.find_first_of(reserved, pos)) != string::npos)
{
string replace;
switch(v[pos])
@@ -1031,7 +1031,7 @@ void
IceXML::StreamI::writeStringSeq(const string& name, const ::Ice::StringSeq& seq)
{
startWrite(name);
- for (::Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
+ for(::Ice::StringSeq::const_iterator p = seq.begin(); p != seq.end(); ++p)
{
_os << nl << "<e>" << *p << "</e>"; // TODO: Escape
}
@@ -1046,9 +1046,9 @@ IceXML::StreamI::readString(const string& name)
startRead(name);
DOM_Node child = _input->current.getFirstChild();
- if (!child.isNull())
+ if(!child.isNull())
{
- if (child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -1074,10 +1074,10 @@ IceXML::StreamI::readStringSeq(const string& name)
::Ice::Int size = readLength();
value.resize(size);
- if (size > 0)
+ if(size > 0)
{
_input->current = _input->current.getFirstChild();
- for (int i = 0; i < size; ++i)
+ for(int i = 0; i < size; ++i)
{
value[i] = readString(seqElementName);
}
@@ -1104,9 +1104,9 @@ IceXML::StreamI::readProxy(const string& name)
DOM_Node child = _input->current.getFirstChild();
string s;
- if (!child.isNull())
+ if(!child.isNull())
{
- if (child.getNodeType() != DOM_Node::TEXT_NODE)
+ if(child.getNodeType() != DOM_Node::TEXT_NODE)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -1131,7 +1131,7 @@ IceXML::StreamI::writeObject(const string& name, const ::Ice::ObjectPtr& obj)
// If the object doesn't exist in the map add it.
//
map<Ice::ObjectPtr, ObjectInfo>::iterator p = _objects.find(obj);
- if (p == _objects.end())
+ if(p == _objects.end())
{
ostringstream os;
os << "object" << _nextId++;
@@ -1139,7 +1139,7 @@ IceXML::StreamI::writeObject(const string& name, const ::Ice::ObjectPtr& obj)
obj, ObjectInfo(os.str(), !writeReference))).first;
}
- if (writeReference)
+ if(writeReference)
{
_os << nl << "<" << name << " href=\"#" << p->second.id << "\"/>";
}
@@ -1173,12 +1173,12 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
// readObjects list. Otherwise, it should be in the object-set at
// the top-level of the document.
//
- if (!href.empty())
+ if(!href.empty())
{
href = href.substr(1); // Skip the '#'
map<string, ::Ice::ObjectPtr>::const_iterator p = _input->readObjects.find(href);
- if (p != _input->readObjects.end())
+ if(p != _input->readObjects.end())
{
value = p->second;
endRead();
@@ -1191,13 +1191,13 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
//
_input->current = _input->parser->getDocument().getFirstChild();
_input->current = _input->current.getFirstChild();
- while (!_input->current.isNull())
+ while(!_input->current.isNull())
{
- if (_input->current.getNodeType() == DOM_Node::ELEMENT_NODE)
+ if(_input->current.getNodeType() == DOM_Node::ELEMENT_NODE)
{
string dummy;
readAttributes(id, type, dummy);
- if (id == href)
+ if(id == href)
{
break;
}
@@ -1207,7 +1207,7 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
//
// If the object isn't found, that's an error.
//
- if (_input->current.isNull())
+ if(_input->current.isNull())
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -1216,7 +1216,7 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
//
// Empty type indicates nil object.
//
- if (type.empty())
+ if(type.empty())
{
value = 0;
}
@@ -1224,7 +1224,7 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
{
static const string iceObject("::Ice::Object");
- if (type == iceObject)
+ if(type == iceObject)
{
value = new ::Ice::Object;
}
@@ -1238,19 +1238,19 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con
// can be created then throw a NoObjectFactoryException.
//
::Ice::ObjectFactoryPtr userFactory = _communicator->findObjectFactory(type);
- if (userFactory)
+ if(userFactory)
{
value = userFactory->create(type);
}
- if (!value && type == signatureType)
+ if(!value && type == signatureType)
{
assert(factory);
value = factory->create(type);
assert(value);
}
- if (!value)
+ if(!value)
{
throw ::Ice::NoObjectFactoryException(__FILE__, __LINE__);
}
@@ -1284,7 +1284,7 @@ IceXML::StreamI::endWrite()
_os << ee;
- if (_level == 0)
+ if(_level == 0)
{
dumpUnwrittenObjects();
}
@@ -1294,11 +1294,11 @@ IceXML::StreamI::endWrite()
void
IceXML::StreamI::startRead(const ::std::string& element)
{
- while (!_input->current.isNull() && _input->current.getNodeType() != DOM_Node::ELEMENT_NODE)
+ while(!_input->current.isNull() && _input->current.getNodeType() != DOM_Node::ELEMENT_NODE)
{
_input->current = _input->current.getNextSibling();
}
- if (_input->current.isNull())
+ if(_input->current.isNull())
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -1309,7 +1309,7 @@ IceXML::StreamI::startRead(const ::std::string& element)
//
static const string facets = "facets";
static const string facetsNS = "ice:facets";
- if ((element != facetsNS || nodeName != facets) && element != nodeName)
+ if((element != facetsNS || nodeName != facets) && element != nodeName)
{
throw ::Ice::MarshalException(__FILE__, __LINE__);
}
@@ -1344,9 +1344,9 @@ IceXML::StreamI::dumpUnwrittenObjects()
{
nwritten = 0;
map<Ice::ObjectPtr, ObjectInfo>::iterator p;
- for (p = _objects.begin(); p != _objects.end(); ++p)
+ for(p = _objects.begin(); p != _objects.end(); ++p)
{
- if (!p->second.written)
+ if(!p->second.written)
{
p->second.written = true;
writeObjectData("ice:object", p->second.id, p->first);
@@ -1358,7 +1358,7 @@ IceXML::StreamI::dumpUnwrittenObjects()
}
}
}
- while (_objects.size() != nwritten);
+ while(_objects.size() != nwritten);
}
void
@@ -1367,7 +1367,7 @@ IceXML::StreamI::writeObjectData(const string& name, const string& id, const Ice
string xsdType;
string typeId;
- if (obj)
+ if(obj)
{
//
// Convert the type-id to the equivalent schema type
@@ -1380,13 +1380,13 @@ IceXML::StreamI::writeObjectData(const string& name, const string& id, const Ice
xsdType.reserve(typeId.size() + xsdPrefix.size() + xsdSuffix.size());
xsdType += xsdPrefix;
unsigned int i = 0;
- if (typeId[0] == ':') // Skip the preceeding "::".
+ if(typeId[0] == ':') // Skip the preceeding "::".
{
i = 2;
}
- for (; i < typeId.size(); ++i)
+ for(; i < typeId.size(); ++i)
{
- if (typeId[i] == ':')
+ if(typeId[i] == ':')
{
xsdType += '.';
++i;
@@ -1406,13 +1406,13 @@ IceXML::StreamI::writeObjectData(const string& name, const string& id, const Ice
ostringstream os;
os << name << " id=\"" << id << "\" type=\"" << typeId << "\""
<< " xsi:type=\"" << xsdType << "\"";
- if (!obj)
+ if(!obj)
{
os << " xsi:nil=\"true\"";
}
startWrite(os.str());
- if (obj)
+ if(obj)
{
obj->__marshal(this);
}
@@ -1428,19 +1428,19 @@ IceXML::StreamI::readAttributes(::std::string& id, ::std::string& type, ::std::s
DOM_NamedNodeMap attributes = _input->current.getAttributes();
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string name = toString(attribute.getNodeName());
- if (name == idStr)
+ if(name == idStr)
{
id = toString(attribute.getNodeValue());
}
- else if (name == typeStr)
+ else if(name == typeStr)
{
type = toString(attribute.getNodeValue());
}
- else if (name == hrefStr)
+ else if(name == hrefStr)
{
href = toString(attribute.getNodeValue());
}
@@ -1454,11 +1454,11 @@ IceXML::StreamI::readLength()
DOM_NamedNodeMap attributes = _input->current.getAttributes();
int attrCount = attributes.getLength();
- for (int i = 0; i < attrCount; i++)
+ for(int i = 0; i < attrCount; i++)
{
DOM_Node attribute = attributes.item(i);
string name = toString(attribute.getNodeName());
- if (name == lengthStr)
+ if(name == lengthStr)
{
return atoi(toString(attribute.getNodeValue()).c_str());
}
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 16cfbe6edf5..719a66c8d1e 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -17,7 +17,7 @@ using namespace IceUtil;
char
Slice::ToIfdef::operator()(char c)
{
- if (!isalnum(c))
+ if(!isalnum(c))
{
return '_';
}
@@ -33,15 +33,15 @@ Slice::changeInclude(const string& orig, const vector<string>& includePaths)
string file = orig;
replace(file.begin(), file.end(), '\\', '/');
- for (vector<string>::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p)
+ for(vector<string>::const_iterator p = includePaths.begin(); p != includePaths.end(); ++p)
{
string includePath = *p;
replace(includePath.begin(), includePath.end(), '\\', '/');
- if (orig.compare(0, includePath.length(), *p) == 0)
+ if(orig.compare(0, includePath.length(), *p) == 0)
{
string s = orig.substr(includePath.length());
- if (s.size() < file.size())
+ if(s.size() < file.size())
{
file = s;
}
@@ -49,7 +49,7 @@ Slice::changeInclude(const string& orig, const vector<string>& includePaths)
}
string::size_type pos = file.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
file.erase(pos);
}
@@ -90,7 +90,7 @@ Slice::printVersionCheck(Output& out)
void
Slice::printDllExportStuff(Output& out, const string& dllExport)
{
- if (dllExport.size())
+ if(dllExport.size())
{
out << sp;
out << "\n#ifdef _WIN32";
@@ -124,25 +124,25 @@ Slice::typeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
return builtinTable[builtin->kind()];
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
return cl->scoped() + "Ptr";
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if (proxy)
+ if(proxy)
{
return proxy->_class()->scoped() + "Prx";
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if (contained)
+ if(contained)
{
return contained->scoped();
}
@@ -153,7 +153,7 @@ Slice::typeToString(const TypePtr& type)
string
Slice::returnTypeToString(const TypePtr& type)
{
- if (!type)
+ if(!type)
{
return "void";
}
@@ -180,31 +180,31 @@ Slice::inputTypeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
return inputBuiltinTable[builtin->kind()];
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
return "const " + cl->scoped() + "Ptr&";
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if (proxy)
+ if(proxy)
{
return "const " + proxy->_class()->scoped() + "Prx&";
}
EnumPtr en = EnumPtr::dynamicCast(type);
- if (en)
+ if(en)
{
return en->scoped();
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if (contained)
+ if(contained)
{
return "const " + contained->scoped() + "&";
}
@@ -231,25 +231,25 @@ Slice::outputTypeToString(const TypePtr& type)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
return outputBuiltinTable[builtin->kind()];
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
return cl->scoped() + "Ptr&";
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if (proxy)
+ if(proxy)
{
return proxy->_class()->scoped() + "Prx&";
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if (contained)
+ if(contained)
{
return contained->scoped() + "&";
}
@@ -262,7 +262,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
const string& str, bool pointer)
{
string stream;
- if (str.empty())
+ if(str.empty())
{
stream = marshal ? "__os" : "__is";
}
@@ -272,7 +272,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
string deref;
- if (pointer)
+ if(pointer)
{
deref = "->";
}
@@ -282,7 +282,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
string obj;
- if (stream.find("__") == 0)
+ if(stream.find("__") == 0)
{
obj = "__obj";
}
@@ -294,11 +294,11 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
string func = marshal ? "write(" : "read(";
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- if (builtin->kind() == Builtin::KindObject)
+ if(builtin->kind() == Builtin::KindObject)
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << deref << func << param << ");";
}
@@ -316,10 +316,10 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
out << sb;
- if (marshal)
+ if(marshal)
{
out << nl << "::Ice::ObjectPtr " << obj << " = " << param << ';';
out << nl << stream << deref << func << obj << ");";
@@ -330,7 +330,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
ClassDefPtr def = cl->definition();
string factory;
string type;
- if (def && !def->isAbstract())
+ if(def && !def->isAbstract())
{
factory = cl->scoped();
factory += "::_factory";
@@ -351,17 +351,17 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
StructPtr st = StructPtr::dynamicCast(type);
- if (st)
+ if(st)
{
out << nl << param << ".__" << func << (pointer ? "" : "&") << stream << ");";
return;
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
- if (builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy)
+ if(builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy)
{
out << nl << stream << deref << func << param << ");";
}
@@ -374,7 +374,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
- if (dict)
+ if(dict)
{
out << nl << dict->scope() << "__" << func << (pointer ? "" : "&") << stream << ", " << param << ", "
<< dict->scope() << "__U__" << dict->name() << "());";
@@ -382,7 +382,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
- if (!constructed)
+ if(!constructed)
{
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
assert(proxy);
@@ -395,11 +395,11 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
void
Slice::writeMarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
- for (list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
+ for(list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
{
writeMarshalUnmarshalCode(out, p->first, p->second, true);
}
- if (ret)
+ if(ret)
{
writeMarshalUnmarshalCode(out, ret, "__ret", true);
}
@@ -408,11 +408,11 @@ Slice::writeMarshalCode(Output& out, const list<pair<TypePtr, string> >& params,
void
Slice::writeUnmarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
- for (list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
+ for(list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
{
writeMarshalUnmarshalCode(out, p->first, p->second, false);
}
- if (ret)
+ if(ret)
{
writeMarshalUnmarshalCode(out, ret, "__ret", false);
}
@@ -422,12 +422,12 @@ void
Slice::writeAllocateCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
list<pair<TypePtr, string> > ps = params;
- if (ret)
+ if(ret)
{
ps.push_back(make_pair(ret, string("__ret")));
}
- for (list<pair<TypePtr, string> >::const_iterator p = ps.begin(); p != ps.end(); ++p)
+ for(list<pair<TypePtr, string> >::const_iterator p = ps.begin(); p != ps.end(); ++p)
{
out << nl << typeToString(p->first) << ' ' << p->second << ';';
}
@@ -438,7 +438,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
bool marshal, const string& tn, const string& str, bool pointer)
{
string stream;
- if (str.empty())
+ if(str.empty())
{
stream = marshal ? "__os" : "__is";
}
@@ -448,7 +448,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
string deref;
- if (pointer)
+ if(pointer)
{
deref = "->";
}
@@ -458,7 +458,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
string obj;
- if (stream.find("__") == 0)
+ if(stream.find("__") == 0)
{
obj = "__obj";
}
@@ -482,7 +482,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
"???"
};
string tagName;
- if (tn.empty())
+ if(tn.empty())
{
tagName = "\"";
tagName += param;
@@ -497,12 +497,12 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
string genFunc = marshal ? "ice_marshal(" : "ice_unmarshal(";
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- if (builtin->kind() == Builtin::KindObject)
+ if(builtin->kind() == Builtin::KindObject)
{
streamFunc += outputBuiltinTable[builtin->kind()];
- if (marshal)
+ if(marshal)
{
out << nl << stream << deref << streamFunc << "(" << tagName << ", " << param << ");";
}
@@ -515,7 +515,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
else
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << deref << streamFunc << outputBuiltinTable[builtin->kind()]
<< "(" << tagName << ", " << param << ");";
@@ -530,10 +530,10 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
out << sb;
- if (marshal)
+ if(marshal)
{
out << nl << "::Ice::ObjectPtr " << obj << " = " << param << ';';
out << nl << stream << deref << streamFunc << "Object(" << tagName << ", " << obj << ");";
@@ -544,7 +544,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
ClassDefPtr def = cl->definition();
string factory;
string type;
- if (def && !def->isAbstract())
+ if(def && !def->isAbstract())
{
factory = cl->scoped();
factory += "::_factory";
@@ -566,19 +566,19 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
StructPtr st = StructPtr::dynamicCast(type);
- if (st)
+ if(st)
{
out << nl << param << "." << genFunc << tagName << ", " << (pointer ? "" : "&") << stream << ");";
return;
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
- if (builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy)
+ if(builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy)
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << deref << streamFunc << outputBuiltinTable[builtin->kind()] << "Seq("
<< tagName << ", " << param << ");";
@@ -598,7 +598,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
- if (dict)
+ if(dict)
{
out << nl << dict->scope() << genFunc << tagName << ", " << (pointer ? "" : "&") << stream
<< ", " << param << ", " << dict->scope() << "__U__" << dict->name() << "());";
@@ -606,7 +606,7 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
- if (!constructed)
+ if(!constructed)
{
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
assert(proxy);
@@ -620,11 +620,11 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
void
Slice::writeGenericMarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
- for (list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
+ for(list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
{
writeGenericMarshalUnmarshalCode(out, p->first, p->second, true);
}
- if (ret)
+ if(ret)
{
writeGenericMarshalUnmarshalCode(out, ret, "__ret", true);
}
@@ -633,11 +633,11 @@ Slice::writeGenericMarshalCode(Output& out, const list<pair<TypePtr, string> >&
void
Slice::writeGenericUnmarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret)
{
- for (list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
+ for(list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p)
{
writeGenericMarshalUnmarshalCode(out, p->first, p->second, false);
}
- if (ret)
+ if(ret)
{
writeGenericMarshalUnmarshalCode(out, ret, "__ret", false);
}
diff --git a/cpp/src/Slice/GrammarUtil.h b/cpp/src/Slice/GrammarUtil.h
index d26447b9fe6..6c59d265b8a 100644
--- a/cpp/src/Slice/GrammarUtil.h
+++ b/cpp/src/Slice/GrammarUtil.h
@@ -1,135 +1,135 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef SLICE_GRAMMER_UTIL_H
-#define SLICE_GRAMMER_UTIL_H
-
-#include <Slice/Parser.h>
-
-namespace Slice
-{
-
-class StringTok;
-class StringListTok;
-class TypeStringTok;
-class TypeStringListTok;
-class BoolTok;
-class ExceptionListTok;
-class ClassListTok;
-class EnumeratorListTok;
-
-typedef ::IceUtil::Handle<StringTok> StringTokPtr;
-typedef ::IceUtil::Handle<StringListTok> StringListTokPtr;
-typedef ::IceUtil::Handle<TypeStringTok> TypeStringTokPtr;
-typedef ::IceUtil::Handle<TypeStringListTok> TypeStringListTokPtr;
-typedef ::IceUtil::Handle<BoolTok> BoolTokPtr;
-typedef ::IceUtil::Handle<ExceptionListTok> ExceptionListTokPtr;
-typedef ::IceUtil::Handle<ClassListTok> ClassListTokPtr;
-typedef ::IceUtil::Handle<EnumeratorListTok> EnumeratorListTokPtr;
-
-// ----------------------------------------------------------------------
-// StringTok
-// ----------------------------------------------------------------------
-
-class SLICE_API StringTok : public GrammarBase
-{
-public:
-
- StringTok() { }
- std::string v;
-};
-
-// ----------------------------------------------------------------------
-// StringListTok
-// ----------------------------------------------------------------------
-
-class SLICE_API StringListTok : public GrammarBase
-{
-public:
-
- StringListTok() { }
- StringList v;
-};
-
-// ----------------------------------------------------------------------
-// TypeStringTok
-// ----------------------------------------------------------------------
-
-class SLICE_API TypeStringTok : public GrammarBase
-{
-public:
-
- TypeStringTok() { }
- TypeString v;
-};
-
-// ----------------------------------------------------------------------
-// TypeStringListTok
-// ----------------------------------------------------------------------
-
-class SLICE_API TypeStringListTok : public GrammarBase
-{
-public:
-
- TypeStringListTok() { }
- TypeStringList v;
-};
-
-// ----------------------------------------------------------------------
-// BoolTok
-// ----------------------------------------------------------------------
-
-class SLICE_API BoolTok : public GrammarBase
-{
-public:
-
- BoolTok() { }
- bool v;
-};
-
-// ----------------------------------------------------------------------
-// ExceptionListTok
-// ----------------------------------------------------------------------
-
-class SLICE_API ExceptionListTok : public GrammarBase
-{
-public:
-
- ExceptionListTok() { }
- ExceptionList v;
-};
-
-// ----------------------------------------------------------------------
-// ClassListTok
-// ----------------------------------------------------------------------
-
-class SLICE_API ClassListTok : public GrammarBase
-{
-public:
-
- ClassListTok() { }
- ClassList v;
-};
-
-// ----------------------------------------------------------------------
-// EnumeratorListTok
-// ----------------------------------------------------------------------
-
-class SLICE_API EnumeratorListTok : public GrammarBase
-{
-public:
-
- EnumeratorListTok() { }
- EnumeratorList v;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef SLICE_GRAMMER_UTIL_H
+#define SLICE_GRAMMER_UTIL_H
+
+#include <Slice/Parser.h>
+
+namespace Slice
+{
+
+class StringTok;
+class StringListTok;
+class TypeStringTok;
+class TypeStringListTok;
+class BoolTok;
+class ExceptionListTok;
+class ClassListTok;
+class EnumeratorListTok;
+
+typedef ::IceUtil::Handle<StringTok> StringTokPtr;
+typedef ::IceUtil::Handle<StringListTok> StringListTokPtr;
+typedef ::IceUtil::Handle<TypeStringTok> TypeStringTokPtr;
+typedef ::IceUtil::Handle<TypeStringListTok> TypeStringListTokPtr;
+typedef ::IceUtil::Handle<BoolTok> BoolTokPtr;
+typedef ::IceUtil::Handle<ExceptionListTok> ExceptionListTokPtr;
+typedef ::IceUtil::Handle<ClassListTok> ClassListTokPtr;
+typedef ::IceUtil::Handle<EnumeratorListTok> EnumeratorListTokPtr;
+
+// ----------------------------------------------------------------------
+// StringTok
+// ----------------------------------------------------------------------
+
+class SLICE_API StringTok : public GrammarBase
+{
+public:
+
+ StringTok() { }
+ std::string v;
+};
+
+// ----------------------------------------------------------------------
+// StringListTok
+// ----------------------------------------------------------------------
+
+class SLICE_API StringListTok : public GrammarBase
+{
+public:
+
+ StringListTok() { }
+ StringList v;
+};
+
+// ----------------------------------------------------------------------
+// TypeStringTok
+// ----------------------------------------------------------------------
+
+class SLICE_API TypeStringTok : public GrammarBase
+{
+public:
+
+ TypeStringTok() { }
+ TypeString v;
+};
+
+// ----------------------------------------------------------------------
+// TypeStringListTok
+// ----------------------------------------------------------------------
+
+class SLICE_API TypeStringListTok : public GrammarBase
+{
+public:
+
+ TypeStringListTok() { }
+ TypeStringList v;
+};
+
+// ----------------------------------------------------------------------
+// BoolTok
+// ----------------------------------------------------------------------
+
+class SLICE_API BoolTok : public GrammarBase
+{
+public:
+
+ BoolTok() { }
+ bool v;
+};
+
+// ----------------------------------------------------------------------
+// ExceptionListTok
+// ----------------------------------------------------------------------
+
+class SLICE_API ExceptionListTok : public GrammarBase
+{
+public:
+
+ ExceptionListTok() { }
+ ExceptionList v;
+};
+
+// ----------------------------------------------------------------------
+// ClassListTok
+// ----------------------------------------------------------------------
+
+class SLICE_API ClassListTok : public GrammarBase
+{
+public:
+
+ ClassListTok() { }
+ ClassList v;
+};
+
+// ----------------------------------------------------------------------
+// EnumeratorListTok
+// ----------------------------------------------------------------------
+
+class SLICE_API EnumeratorListTok : public GrammarBase
+{
+public:
+
+ EnumeratorListTok() { }
+ EnumeratorList v;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index 7b69646e53b..3cc2450da05 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -49,7 +49,7 @@ Slice::JavaGenerator::open(const string& absolute)
assert(_out == 0);
string::size_type pos = absolute.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
package = absolute.substr(0, pos);
file = absolute.substr(pos + 1);
@@ -62,12 +62,12 @@ Slice::JavaGenerator::open(const string& absolute)
string::size_type start = 0;
do
{
- if (!path.empty())
+ if(!path.empty())
{
path += "/";
}
pos = dir.find('.', start);
- if (pos != string::npos)
+ if(pos != string::npos)
{
path += dir.substr(start, pos - start);
start = pos + 1;
@@ -80,7 +80,7 @@ Slice::JavaGenerator::open(const string& absolute)
struct stat st;
int result;
result = stat(path.c_str(), &st);
- if (result == 0)
+ if(result == 0)
{
continue;
}
@@ -89,14 +89,14 @@ Slice::JavaGenerator::open(const string& absolute)
#else
result = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
#endif
- if (result != 0)
+ if(result != 0)
{
cerr << "can't create directory `" << path << "': "
<< strerror(errno) << endl;
return false;
}
}
- while (pos != string::npos);
+ while(pos != string::npos);
}
else
{
@@ -107,14 +107,14 @@ Slice::JavaGenerator::open(const string& absolute)
//
// Open class file
//
- if (!path.empty())
+ if(!path.empty())
{
path += "/";
}
path += file;
_out = new Output();
_out->open(path.c_str());
- if (!(*_out))
+ if(!(*_out))
{
cerr << "can't open `" << path << "' for writing: "
<< strerror(errno) << endl;
@@ -124,7 +124,7 @@ Slice::JavaGenerator::open(const string& absolute)
printHeader();
- if (!package.empty())
+ if(!package.empty())
{
*_out << sp << nl << "package " << package << ';';
}
@@ -170,17 +170,17 @@ Slice::JavaGenerator::fixKwd(const string& name) const
int i = 0;
int j = sizeof(keywords) / sizeof(const char*);
- while (i < j)
+ while(i < j)
{
int mid = (i + j) / 2;
string str = keywords[mid];
int n = str.compare(name);
- if (n == 0)
+ if(n == 0)
{
string result = "_" + name;
return result;
}
- else if (n > 0)
+ else if(n > 0)
{
j = mid;
}
@@ -202,7 +202,7 @@ Slice::JavaGenerator::getAbsolute(const string& scoped,
string result;
string::size_type start = 0;
- if (!scope.empty())
+ if(!scope.empty())
{
//
// Only remove the scope if the resulting symbol is unscoped.
@@ -212,10 +212,10 @@ Slice::JavaGenerator::getAbsolute(const string& scoped,
// scope=::A, scoped=::A::B::C, result=::A::B::C
//
string::size_type scopeSize = scope.size();
- if (scoped.compare(0, scopeSize, scope) == 0)
+ if(scoped.compare(0, scopeSize, scope) == 0)
{
start = scoped.find(':', scopeSize);
- if (start == string::npos)
+ if(start == string::npos)
{
start = scopeSize;
}
@@ -229,7 +229,7 @@ Slice::JavaGenerator::getAbsolute(const string& scoped,
//
// Skip leading "::"
//
- if (scoped[start] == ':')
+ if(scoped[start] == ':')
{
assert(scoped[start + 1] == ':');
start += 2;
@@ -243,7 +243,7 @@ Slice::JavaGenerator::getAbsolute(const string& scoped,
{
pos = scoped.find(':', start);
string fix;
- if (pos == string::npos)
+ if(pos == string::npos)
{
fix = prefix + fixKwd(scoped.substr(start)) + suffix;
}
@@ -254,15 +254,15 @@ Slice::JavaGenerator::getAbsolute(const string& scoped,
start = pos + 2;
}
- if (!result.empty())
+ if(!result.empty())
{
result += ".";
}
result += fix;
}
- while (pos != string::npos);
+ while(pos != string::npos);
- if (!_package.empty())
+ if(!_package.empty())
{
return _package + "." + result;
}
@@ -307,16 +307,16 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
"Ice.LocalObjectHolder"
};
- if (!type)
+ if(!type)
{
assert(mode == TypeModeReturn);
return "void";
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- if (mode == TypeModeOut)
+ if(mode == TypeModeOut)
{
return builtinHolderTable[builtin->kind()];
}
@@ -327,10 +327,10 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
string result = getAbsolute(cl->scoped(), scope);
- if (mode == TypeModeOut)
+ if(mode == TypeModeOut)
{
result += "Holder";
}
@@ -338,10 +338,10 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if (proxy)
+ if(proxy)
{
string result = getAbsolute(proxy->_class()->scoped() + "Prx", scope);
- if (mode == TypeModeOut)
+ if(mode == TypeModeOut)
{
result += "Holder";
}
@@ -349,9 +349,9 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
- if (dict)
+ if(dict)
{
- if (mode == TypeModeOut)
+ if(mode == TypeModeOut)
{
return getAbsolute(dict->scoped(), scope) + "Holder";
}
@@ -362,21 +362,21 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
- if (mode == TypeModeOut)
+ if(mode == TypeModeOut)
{
return getAbsolute(seq->scoped(), scope) + "Holder";
}
else
{
string listType = findMetaData(metaData);
- if (listType.empty())
+ if(listType.empty())
{
list<string> l = seq->getMetaData();
listType = findMetaData(l);
}
- if (!listType.empty())
+ if(!listType.empty())
{
return listType;
}
@@ -389,9 +389,9 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if (contained)
+ if(contained)
{
- if (mode == TypeModeOut)
+ if(mode == TypeModeOut)
{
return getAbsolute(contained->scoped(), scope) + "Holder";
}
@@ -416,7 +416,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
{
string stream = marshal ? "__os" : "__is";
string v;
- if (holder)
+ if(holder)
{
v = param + ".value";
}
@@ -426,13 +426,13 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- switch (builtin->kind())
+ switch(builtin->kind())
{
case Builtin::KindByte:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeByte(" << v << ");";
}
@@ -444,7 +444,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindBool:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeBool(" << v << ");";
}
@@ -456,7 +456,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindShort:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeShort(" << v << ");";
}
@@ -468,7 +468,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindInt:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeInt(" << v << ");";
}
@@ -480,7 +480,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindLong:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeLong(" << v << ");";
}
@@ -492,7 +492,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindFloat:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeFloat(" << v << ");";
}
@@ -504,7 +504,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindDouble:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeDouble(" << v << ");";
}
@@ -516,7 +516,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindString:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeString(" << v << ");";
}
@@ -528,7 +528,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObject:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeObject(" << v << ");";
}
@@ -540,7 +540,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObjectProxy:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeProxy(" << v << ");";
}
@@ -560,10 +560,10 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
ProxyPtr prx = ProxyPtr::dynamicCast(type);
- if (prx)
+ if(prx)
{
string typeS = typeToString(type, TypeModeIn, scope);
- if (marshal)
+ if(marshal)
{
out << nl << typeS << "Helper.__write(" << stream << ", " << v << ");";
}
@@ -575,9 +575,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeObject(" << v << ");";
}
@@ -585,7 +585,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
{
string typeS = typeToString(type, TypeModeIn, scope);
ClassDefPtr def = cl->definition();
- if (def && !def->isAbstract())
+ if(def && !def->isAbstract())
{
out << nl << v << " = (" << typeS << ')' << stream << ".readObject(" << typeS << ".ice_staticId(), "
<< typeS << "._factory);";
@@ -599,9 +599,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
StructPtr st = StructPtr::dynamicCast(type);
- if (st)
+ if(st)
{
- if (marshal)
+ if(marshal)
{
out << nl << v << ".__write(" << stream << ");";
}
@@ -615,9 +615,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
EnumPtr en = EnumPtr::dynamicCast(type);
- if (en)
+ if(en)
{
- if (marshal)
+ if(marshal)
{
out << nl << v << ".__write(" << stream << ");";
}
@@ -630,7 +630,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
writeSequenceMarshalUnmarshalCode(out, scope, seq, v, marshal, iter, true, metaData);
return;
@@ -639,7 +639,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
assert(constructed);
string typeS = getAbsolute(constructed->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
}
@@ -679,14 +679,14 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
//
string listType = findMetaData(metaData);
list<string> typeMetaData = seq->getMetaData();
- if (listType.empty())
+ if(listType.empty())
{
listType = findMetaData(typeMetaData);
}
else
{
string s = findMetaData(typeMetaData);
- if (listType != s)
+ if(listType != s)
{
useHelper = false;
}
@@ -695,10 +695,10 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
//
// If we can use the sequence's helper, it's easy.
//
- if (useHelper)
+ if(useHelper)
{
string typeS = getAbsolute(seq->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
}
@@ -715,7 +715,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
int depth = 0;
TypePtr origContent = seq->type();
SequencePtr s = SequencePtr::dynamicCast(origContent);
- while (s)
+ while(s)
{
depth++;
origContent = s->type();
@@ -723,12 +723,12 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
string origContentS = typeToString(origContent, TypeModeIn, scope);
- if (!listType.empty())
+ if(!listType.empty())
{
BuiltinPtr b = BuiltinPtr::dynamicCast(seq->type());
- if (b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
+ if(b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeSize(" << v << ".size());";
ostringstream o;
@@ -736,10 +736,10 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
string it = o.str();
iter++;
out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while (" << it << ".hasNext())";
+ out << nl << "while(" << it << ".hasNext())";
out << sb;
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -805,16 +805,16 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
ostringstream o;
o << origContentS << "[]";
int d = depth;
- while (d--)
+ while(d--)
{
o << "[]";
}
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readByteSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Byte(__seq" << iter << "[__i" << iter << "]));";
@@ -825,7 +825,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindBool:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readByteSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(__seq" << iter << "[__i" << iter
@@ -837,7 +837,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindShort:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readShortSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Short(__seq" << iter << "[__i" << iter << "]));";
@@ -848,7 +848,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindInt:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readIntSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Integer(__seq" << iter << "[__i" << iter << "]));";
@@ -859,7 +859,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindLong:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readLongSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Long(__seq" << iter << "[__i" << iter << "]));";
@@ -870,7 +870,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindFloat:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readFloatSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Float(__seq" << iter << "[__i" << iter << "]));";
@@ -881,7 +881,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindDouble:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readDoubleSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Double(__seq" << iter << "[__i" << iter << "]));";
@@ -892,7 +892,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindString:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readStringSeq();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(__seq" << iter << "[__i" << iter << "]);";
@@ -913,7 +913,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
string typeS = getAbsolute(seq->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeSize(" << v << ".size());";
ostringstream o;
@@ -921,7 +921,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
iter++;
string it = o.str();
out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while (" << it << ".hasNext())";
+ out << nl << "while(" << it << ".hasNext())";
out << sb;
out << nl << origContentS << " __elem = (" << origContentS << ")" << it << ".next();";
writeMarshalUnmarshalCode(out, scope, seq->type(), "__elem", true, iter, false);
@@ -931,7 +931,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << v << " = new " << listType << "();";
out << nl << "int __len" << iter << " = " << stream << ".readSize();";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
<< "++)";
out << sb;
out << nl << origContentS << " __elem;";
@@ -945,13 +945,13 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
BuiltinPtr b = BuiltinPtr::dynamicCast(seq->type());
- if (b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
+ if(b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeByteSeq(" << v << ");";
}
@@ -963,7 +963,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindBool:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeBoolSeq(" << v << ");";
}
@@ -975,7 +975,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindShort:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeShortSeq(" << v << ");";
}
@@ -987,7 +987,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindInt:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeIntSeq(" << v << ");";
}
@@ -999,7 +999,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindLong:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeLongSeq(" << v << ");";
}
@@ -1011,7 +1011,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindFloat:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeFloatSeq(" << v << ");";
}
@@ -1023,7 +1023,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindDouble:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeDoubleSeq(" << v << ");";
}
@@ -1035,7 +1035,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindString:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeStringSeq(" << v << ");";
}
@@ -1056,10 +1056,10 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeSize(" << v << ".length);";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
<< "++)";
out << sb;
ostringstream o;
@@ -1073,12 +1073,12 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "int __len" << iter << " = " << stream << ".readSize();";
out << nl << v << " = new " << origContentS << "[__len" << iter << "]";
int d = depth;
- while (d--)
+ while(d--)
{
out << "[]";
}
out << ';';
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
<< "++)";
out << sb;
ostringstream o;
@@ -1104,7 +1104,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
{
string stream = marshal ? "__os" : "__is";
string v;
- if (holder)
+ if(holder)
{
v = param + ".value";
}
@@ -1114,7 +1114,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
string name;
- if (tn.empty())
+ if(tn.empty())
{
name = "\"" + param + "\"";
}
@@ -1124,13 +1124,13 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- switch (builtin->kind())
+ switch(builtin->kind())
{
case Builtin::KindByte:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeByte(" << name << ", " << v << ");";
}
@@ -1142,7 +1142,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindBool:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeBool(" << name << ", " << v << ");";
}
@@ -1154,7 +1154,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindShort:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeShort(" << name << ", " << v << ");";
}
@@ -1166,7 +1166,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindInt:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeInt(" << name << ", " << v << ");";
}
@@ -1178,7 +1178,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindLong:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeLong(" << name << ", " << v << ");";
}
@@ -1190,7 +1190,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindFloat:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeFloat(" << name << ", " << v << ");";
}
@@ -1202,7 +1202,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindDouble:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeDouble(" << name << ", " << v << ");";
}
@@ -1214,7 +1214,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindString:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeString(" << name << ", " << v << ");";
}
@@ -1226,7 +1226,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObject:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeObject(" << name << ", " << v << ");";
}
@@ -1238,7 +1238,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
case Builtin::KindObjectProxy:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeProxy(" << name << ", " << v << ");";
}
@@ -1258,10 +1258,10 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
ProxyPtr prx = ProxyPtr::dynamicCast(type);
- if (prx)
+ if(prx)
{
string typeS = typeToString(type, TypeModeIn, scope);
- if (marshal)
+ if(marshal)
{
out << nl << typeS << "Helper.ice_marshal(" << name << ", " << stream << ", " << v << ");";
}
@@ -1273,9 +1273,9 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeObject(" << name << ", " << v << ");";
}
@@ -1283,7 +1283,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
{
string typeS = typeToString(type, TypeModeIn, scope);
ClassDefPtr def = cl->definition();
- if (def && !def->isAbstract())
+ if(def && !def->isAbstract())
{
out << nl << v << " = (" << typeS << ')' << stream << ".readObject(" << name << ", " << typeS
<< ".ice_staticId(), " << typeS << "._factory);";
@@ -1297,9 +1297,9 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
StructPtr st = StructPtr::dynamicCast(type);
- if (st)
+ if(st)
{
- if (marshal)
+ if(marshal)
{
out << nl << v << ".ice_marshal(" << name << ", " << stream << ");";
}
@@ -1313,9 +1313,9 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
EnumPtr en = EnumPtr::dynamicCast(type);
- if (en)
+ if(en)
{
- if (marshal)
+ if(marshal)
{
out << nl << v << ".ice_marshal(" << name << ", " << stream << ");";
}
@@ -1328,7 +1328,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
writeGenericSequenceMarshalUnmarshalCode(out, scope, seq, name, v, marshal, iter, true, metaData);
return;
@@ -1337,7 +1337,7 @@ Slice::JavaGenerator::writeGenericMarshalUnmarshalCode(Output& out,
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
assert(constructed);
string typeS = getAbsolute(constructed->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << typeS << "Helper.ice_marshal(" << name << ", " << stream << ", " << v << ");";
}
@@ -1378,14 +1378,14 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
//
string listType = findMetaData(metaData);
list<string> typeMetaData = seq->getMetaData();
- if (listType.empty())
+ if(listType.empty())
{
listType = findMetaData(typeMetaData);
}
else
{
string s = findMetaData(typeMetaData);
- if (listType != s)
+ if(listType != s)
{
useHelper = false;
}
@@ -1394,10 +1394,10 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
//
// If we can use the sequence's helper, it's easy.
//
- if (useHelper)
+ if(useHelper)
{
string typeS = getAbsolute(seq->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << typeS << "Helper.ice_marshal(" << name << ", " << stream << ", " << v << ");";
}
@@ -1414,7 +1414,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
int depth = 0;
TypePtr origContent = seq->type();
SequencePtr s = SequencePtr::dynamicCast(origContent);
- while (s)
+ while(s)
{
depth++;
origContent = s->type();
@@ -1422,12 +1422,12 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
string origContentS = typeToString(origContent, TypeModeIn, scope);
- if (!listType.empty())
+ if(!listType.empty())
{
BuiltinPtr b = BuiltinPtr::dynamicCast(seq->type());
- if (b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
+ if(b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".startWriteSequence(" << name << ", " << v << ".size());";
ostringstream o;
@@ -1435,10 +1435,10 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
string it = o.str();
iter++;
out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while (" << it << ".hasNext())";
+ out << nl << "while(" << it << ".hasNext())";
out << sb;
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -1505,16 +1505,16 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
ostringstream o;
o << origContentS << "[]";
int d = depth;
- while (d--)
+ while(d--)
{
o << "[]";
}
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readByteSeq(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Byte(__seq" << iter << "[__i" << iter << "]));";
@@ -1525,7 +1525,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindBool:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readByteSeq(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(__seq" << iter << "[__i" << iter
@@ -1537,7 +1537,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindShort:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readShortSeq(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Short(__seq" << iter << "[__i" << iter << "]));";
@@ -1548,7 +1548,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindInt:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readIntSeq(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Integer(__seq" << iter << "[__i" << iter << "]));";
@@ -1559,7 +1559,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindLong:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readLongSeq(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Long(__seq" << iter << "[__i" << iter << "]));";
@@ -1570,7 +1570,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
case Builtin::KindFloat:
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readFloatSeq(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Float(__seq" << iter << "[__i" << iter << "]));";
@@ -1582,7 +1582,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readDoubleSeq(" << name
<< ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(new java.lang.Double(__seq" << iter << "[__i" << iter << "]));";
@@ -1594,7 +1594,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << o.str() << " __seq" << iter << " = " << stream << ".readStringSeq(" << name
<< ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __seq" << iter
<< ".length; __i" << iter << "++)";
out << sb;
out << nl << v << ".add(__seq" << iter << "[__i" << iter << "]);";
@@ -1615,7 +1615,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
else
{
string typeS = getAbsolute(seq->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".startWriteSequence(" << name << ", " << v << ".size());";
ostringstream o;
@@ -1623,7 +1623,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
iter++;
string it = o.str();
out << nl << "java.util.Iterator " << it << " = " << v << ".iterator();";
- out << nl << "while (" << it << ".hasNext())";
+ out << nl << "while(" << it << ".hasNext())";
out << sb;
out << nl << origContentS << " __elem = (" << origContentS << ")" << it << ".next();";
writeGenericMarshalUnmarshalCode(out, scope, seq->type(), "\"e\"", "__elem", true, iter, false);
@@ -1634,7 +1634,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << v << " = new " << listType << "();";
out << nl << "int __len" << iter << " = " << stream << ".startReadSequence(" << name << ");";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
<< "++)";
out << sb;
out << nl << origContentS << " __elem;";
@@ -1648,13 +1648,13 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
else
{
BuiltinPtr b = BuiltinPtr::dynamicCast(seq->type());
- if (b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
+ if(b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeByteSeq(" << name << ", " << v << ");";
}
@@ -1666,7 +1666,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindBool:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeBoolSeq(" << name << ", " << v << ");";
}
@@ -1678,7 +1678,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindShort:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeShortSeq(" << name << ", " << v << ");";
}
@@ -1690,7 +1690,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindInt:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeIntSeq(" << name << ", " << v << ");";
}
@@ -1702,7 +1702,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindLong:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeLongSeq(" << name << ", " << v << ");";
}
@@ -1714,7 +1714,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindFloat:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeFloatSeq(" << name << ", " << v << ");";
}
@@ -1726,7 +1726,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindDouble:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeDoubleSeq(" << name << ", " << v << ");";
}
@@ -1738,7 +1738,7 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
}
case Builtin::KindString:
{
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".writeStringSeq(" << name << ", " << v << ");";
}
@@ -1760,10 +1760,10 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
else
{
string typeS = getAbsolute(seq->scoped(), scope);
- if (marshal)
+ if(marshal)
{
out << nl << stream << ".startWriteSequence(" << name << ", " << v << ".length);";
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
<< "++)";
out << sb;
ostringstream o;
@@ -1778,12 +1778,12 @@ Slice::JavaGenerator::writeGenericSequenceMarshalUnmarshalCode(Output& out,
out << nl << "int __len" << iter << " = " << stream << ".startReadSequence(" << name << ");";
out << nl << v << " = new " << origContentS << "[__len" << iter << "]";
int d = depth;
- while (d--)
+ while(d--)
{
out << "[]";
}
out << ';';
- out << nl << "for (int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
<< "++)";
out << sb;
ostringstream o;
@@ -1821,9 +1821,9 @@ string
Slice::JavaGenerator::findMetaData(const list<string>& metaData)
{
static const string prefix = "java:";
- for (list<string>::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
+ for(list<string>::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
{
- if ((*q).find(prefix) == 0)
+ if((*q).find(prefix) == 0)
{
return (*q).substr(prefix.size());
}
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 8fd318910e1..4bf0998c922 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -160,7 +160,7 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) :
_name(name)
{
ContainedPtr cont = ContainedPtr::dynamicCast(_container);
- if (cont)
+ if(cont)
{
_scoped = cont->scoped();
}
@@ -188,10 +188,10 @@ ModulePtr
Slice::Container::createModule(const string& name)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ModulePtr module = ModulePtr::dynamicCast(*p);
- if (module)
+ if(module)
{
continue; // Reopening modules is permissible
}
@@ -212,12 +212,12 @@ ClassDefPtr
Slice::Container::createClassDef(const string& name, bool intf, const ClassList& bases, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*p);
- if (decl)
+ if(decl)
{
- if (checkInterfaceAndLocal(name, false, intf, decl->isInterface(), local, decl->isLocal()))
+ if(checkInterfaceAndLocal(name, false, intf, decl->isInterface(), local, decl->isLocal()))
{
continue;
}
@@ -226,16 +226,16 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
}
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if (def)
+ if(def)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
def->updateIncludeLevel();
return def;
}
string msg = "redefinition of ";
- if (intf)
+ if(intf)
{
msg += "interface";
}
@@ -253,7 +253,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
string msg = "redefinition of `";
msg += name;
msg += "' as ";
- if (intf)
+ if(intf)
{
msg += "interface";
}
@@ -268,7 +268,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
ClassDefPtr def = new ClassDef(this, name, intf, bases, local);
_contents.push_back(def);
- for (ContainedList::const_iterator q = matches.begin(); q != matches.end(); ++q)
+ for(ContainedList::const_iterator q = matches.begin(); q != matches.end(); ++q)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
decl->_definition = def;
@@ -291,12 +291,12 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
ClassDefPtr def;
ContainedList matches = _unit->findContents(thisScope() + name);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDefPtr clDef = ClassDefPtr::dynamicCast(*p);
- if (clDef)
+ if(clDef)
{
- if (checkInterfaceAndLocal(name, true, intf, clDef->isInterface(), local, clDef->isLocal()))
+ if(checkInterfaceAndLocal(name, true, intf, clDef->isInterface(), local, clDef->isLocal()))
{
assert(!def);
def = clDef;
@@ -307,9 +307,9 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
}
ClassDeclPtr clDecl = ClassDeclPtr::dynamicCast(*p);
- if (clDecl)
+ if(clDecl)
{
- if (checkInterfaceAndLocal(name, false, intf, clDecl->isInterface(), local, clDecl->isLocal()))
+ if(checkInterfaceAndLocal(name, false, intf, clDecl->isInterface(), local, clDecl->isLocal()))
{
continue;
}
@@ -320,7 +320,7 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
string msg = "declaration of already defined `";
msg += name;
msg += "' as ";
- if (intf)
+ if(intf)
{
msg += "interface";
}
@@ -337,12 +337,12 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
// have a declaration for the class in this container, we don't
// create another one.
//
- for (ContainedList::const_iterator q = _contents.begin(); q != _contents.end(); ++q)
+ for(ContainedList::const_iterator q = _contents.begin(); q != _contents.end(); ++q)
{
- if ((*q)->name() == name)
+ if((*q)->name() == name)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- if (decl)
+ if(decl)
{
return decl;
}
@@ -354,7 +354,7 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
ClassDeclPtr decl = new ClassDecl(this, name, intf, local);
_contents.push_back(decl);
- if (def)
+ if(def)
{
decl->_definition = def;
}
@@ -366,12 +366,12 @@ ExceptionPtr
Slice::Container::createException(const string& name, const ExceptionPtr& base, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
ExceptionPtr p = ExceptionPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
p->updateIncludeLevel();
return p;
@@ -400,12 +400,12 @@ StructPtr
Slice::Container::createStruct(const string& name, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
StructPtr p = StructPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
p->updateIncludeLevel();
return p;
@@ -434,12 +434,12 @@ SequencePtr
Slice::Container::createSequence(const string& name, const TypePtr& type, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
SequencePtr p = SequencePtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -467,12 +467,12 @@ DictionaryPtr
Slice::Container::createDictionary(const string& name, const TypePtr& keyType, const TypePtr& valueType, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DictionaryPtr p = DictionaryPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -500,12 +500,12 @@ EnumPtr
Slice::Container::createEnum(const string& name, bool local)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
EnumPtr p = EnumPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -533,12 +533,12 @@ EnumeratorPtr
Slice::Container::createEnumerator(const string& name)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
EnumeratorPtr p = EnumeratorPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -593,9 +593,9 @@ Slice::Container::lookupType(const string& scoped, bool printError)
"LocalObject"
};
- for (unsigned int i = 0; i < sizeof(builtinTable) / sizeof(const char*); ++i)
+ for(unsigned int i = 0; i < sizeof(builtinTable) / sizeof(const char*); ++i)
{
- if (sc == builtinTable[i])
+ if(sc == builtinTable[i])
{
TypeList result;
result.push_back(_unit->builtin(static_cast<Builtin::Kind>(i)));
@@ -625,30 +625,30 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
//
// Absolute scoped name?
//
- if (sc.size() >= 2 && sc[0] == ':')
+ if(sc.size() >= 2 && sc[0] == ':')
{
return _unit->lookupTypeNoBuiltin(sc.substr(2), printError);
}
TypeList results;
- if (sc.rfind('*') == sc.length() - 1)
+ if(sc.rfind('*') == sc.length() - 1)
{
//
// Proxies.
//
ContainedList matches = _unit->findContents(thisScope() + sc.substr(0, sc.length() - 1));
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if (def)
+ if(def)
{
continue; // Ignore class definitions
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if (!cl)
+ if(!cl)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -666,18 +666,18 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
// Non-Proxies.
//
ContainedList matches = _unit->findContents(thisScope() + sc);
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
- if (def)
+ if(def)
{
continue; // Ignore class definitions
}
ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
- if (ex)
+ if(ex)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -688,9 +688,9 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
}
TypePtr type = TypePtr::dynamicCast(*p);
- if (!type)
+ if(!type)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -703,12 +703,12 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
}
}
- if (results.empty())
+ if(results.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if (!contained)
+ if(!contained)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -741,27 +741,27 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
//
// Absolute scoped name?
//
- if (sc.size() >= 2 && sc[0] == ':')
+ if(sc.size() >= 2 && sc[0] == ':')
{
return _unit->lookupContained(sc.substr(2), printError);
}
ContainedList matches = _unit->findContents(thisScope() + sc);
ContainedList results;
- for (ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
+ for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
- if (!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions
+ if(!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions
{
results.push_back(*p);
}
}
- if (results.empty())
+ if(results.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if (!contained)
+ if(!contained)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += sc;
@@ -782,18 +782,18 @@ ExceptionPtr
Slice::Container::lookupException(const string& scoped, bool printError)
{
ContainedList contained = lookupContained(scoped, printError);
- if (contained.empty())
+ if(contained.empty())
{
return 0;
}
ExceptionList exceptions;
- for (ContainedList::iterator p = contained.begin(); p != contained.end(); ++p)
+ for(ContainedList::iterator p = contained.begin(); p != contained.end(); ++p)
{
ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
- if (!ex)
+ if(!ex)
{
- if (printError)
+ if(printError)
{
string msg = "`";
msg += scoped;
@@ -812,10 +812,10 @@ ModuleList
Slice::Container::modules()
{
ModuleList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ModulePtr q = ModulePtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -827,10 +827,10 @@ ClassList
Slice::Container::classes()
{
ClassList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ClassDefPtr q = ClassDefPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -842,10 +842,10 @@ ExceptionList
Slice::Container::exceptions()
{
ExceptionList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -857,10 +857,10 @@ StructList
Slice::Container::structs()
{
StructList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
StructPtr q = StructPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -872,10 +872,10 @@ SequenceList
Slice::Container::sequences()
{
SequenceList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
SequencePtr q = SequencePtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -887,10 +887,10 @@ DictionaryList
Slice::Container::dictionaries()
{
DictionaryList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DictionaryPtr q = DictionaryPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -902,10 +902,10 @@ EnumList
Slice::Container::enums()
{
EnumList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
EnumPtr q = EnumPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -916,16 +916,16 @@ Slice::Container::enums()
bool
Slice::Container::hasNonLocalClassDecls()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
- if (cl && !cl->isLocal())
+ if(cl && !cl->isLocal())
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasNonLocalClassDecls())
+ if(container && container->hasNonLocalClassDecls())
{
return true;
}
@@ -937,15 +937,15 @@ Slice::Container::hasNonLocalClassDecls()
bool
Slice::Container::hasClassDecls()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (ClassDeclPtr::dynamicCast(*p))
+ if(ClassDeclPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasClassDecls())
+ if(container && container->hasClassDecls())
{
return true;
}
@@ -957,15 +957,15 @@ Slice::Container::hasClassDecls()
bool
Slice::Container::hasClassDefs()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (ClassDefPtr::dynamicCast(*p))
+ if(ClassDefPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasClassDefs())
+ if(container && container->hasClassDefs())
{
return true;
}
@@ -977,20 +977,20 @@ Slice::Container::hasClassDefs()
bool
Slice::Container::hasOtherConstructedOrExceptions()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (ConstructedPtr::dynamicCast(*p) && !ClassDeclPtr::dynamicCast(*p) && !ClassDefPtr::dynamicCast(*p))
+ if(ConstructedPtr::dynamicCast(*p) && !ClassDeclPtr::dynamicCast(*p) && !ClassDefPtr::dynamicCast(*p))
{
return true;
}
- if (ExceptionPtr::dynamicCast(*p))
+ if(ExceptionPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container && container->hasOtherConstructedOrExceptions())
+ if(container && container->hasOtherConstructedOrExceptions())
{
return true;
}
@@ -1004,7 +1004,7 @@ Slice::Container::thisScope()
{
string s;
ContainedPtr contained = ContainedPtr::dynamicCast(this);
- if (contained)
+ if(contained)
{
s = contained->scoped();
}
@@ -1015,26 +1015,26 @@ Slice::Container::thisScope()
void
Slice::Container::mergeModules()
{
- for (ContainedList::iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ModulePtr mod1 = ModulePtr::dynamicCast(*p);
- if (!mod1)
+ if(!mod1)
{
continue;
}
ContainedList::iterator q = p;
++q;
- while (q != _contents.end())
+ while(q != _contents.end())
{
ModulePtr mod2 = ModulePtr::dynamicCast(*q);
- if (!mod2)
+ if(!mod2)
{
++q;
continue;
}
- if (mod1->name() != mod2->name())
+ if(mod1->name() != mod2->name())
{
++q;
continue;
@@ -1042,7 +1042,7 @@ Slice::Container::mergeModules()
mod1->_contents.splice(mod1->_contents.end(), mod2->_contents);
- if (mod1->_comment.length() < mod2->_comment.length())
+ if(mod1->_comment.length() < mod2->_comment.length())
{
mod1->_comment.swap(mod2->_comment);
}
@@ -1066,10 +1066,10 @@ Slice::Container::sort()
void
Slice::Container::sortContents()
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if (container)
+ if(container)
{
container->sort();
container->sortContents();
@@ -1080,7 +1080,7 @@ Slice::Container::sortContents()
void
Slice::Container::visit(ParserVisitor* visitor)
{
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
(*p)->visit(visitor);
}
@@ -1090,10 +1090,10 @@ void
Slice::Container::containerRecDependencies(set<ConstructedPtr>& dependencies)
{
ContainedList::iterator p;
- for (p = _contents.begin(); p != _contents.end(); ++p)
+ for(p = _contents.begin(); p != _contents.end(); ++p)
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(*p);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -1112,7 +1112,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
bool local, bool localOther)
{
string definedOrDeclared;
- if (defined)
+ if(defined)
{
definedOrDeclared = "defined";
}
@@ -1121,7 +1121,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
definedOrDeclared = "declared";
}
- if (!intf && intfOther)
+ if(!intf && intfOther)
{
string msg = "class `";
msg += name;
@@ -1132,7 +1132,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if (intf && !intfOther)
+ if(intf && !intfOther)
{
string msg = "interface `";
msg += name;
@@ -1143,7 +1143,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if (!local && localOther)
+ if(!local && localOther)
{
string msg = "non-local `";
msg += name;
@@ -1154,7 +1154,7 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return false;
}
- if (local && !localOther)
+ if(local && !localOther)
{
string msg = "local `";
msg += name;
@@ -1187,12 +1187,12 @@ Slice::Module::uses(const ContainedPtr&)
void
Slice::Module::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitModuleStart(this))
+ if(visitor->visitModuleStart(this))
{
Container::visit(visitor);
visitor->visitModuleEnd(this);
@@ -1276,12 +1276,12 @@ Slice::ClassDecl::visit(ParserVisitor* visitor)
void
Slice::ClassDecl::recDependencies(set<ConstructedPtr>& dependencies)
{
- if (_definition)
+ if(_definition)
{
_definition->containerRecDependencies(dependencies);
ClassList bases = _definition->bases();
ClassList::iterator p;
- for (p = bases.begin(); p != bases.end(); ++p)
+ for(p = bases.begin(); p != bases.end(); ++p)
{
(*p)->declaration()->recDependencies(dependencies);
}
@@ -1317,12 +1317,12 @@ Slice::ClassDef::createOperation(const string& name,
const ExceptionList& throws)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
OperationPtr p = OperationPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1346,11 +1346,11 @@ Slice::ClassDef::createOperation(const string& name,
allParams.insert(allParams.end(), outParams.begin(), outParams.end());
TypeStringList::const_iterator p = allParams.begin();
- while (p != allParams.end())
+ while(p != allParams.end())
{
TypeStringList::const_iterator q = p;
++q;
- while (q != allParams.end())
+ while(q != allParams.end())
{
//
// Complain about duplicate parameters only if they are
@@ -1359,7 +1359,7 @@ Slice::ClassDef::createOperation(const string& name,
// signature (but the missing parameters have been reported
// already).
//
- if (p->second == q->second && p->second != "")
+ if(p->second == q->second && p->second != "")
{
string msg = "duplicate parameter `";
msg += p->second;
@@ -1373,10 +1373,10 @@ Slice::ClassDef::createOperation(const string& name,
}
}
- if (name == this->name())
+ if(name == this->name())
{
string msg;
- if (isInterface())
+ if(isInterface())
{
msg = "interface name `";
}
@@ -1401,12 +1401,12 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
assert(!isInterface());
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1425,10 +1425,10 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (name == this->name())
+ if(name == this->name())
{
string msg;
- if (isInterface())
+ if(isInterface())
{
msg = "interface name `";
}
@@ -1467,7 +1467,7 @@ Slice::ClassDef::allBases()
ClassList result = _bases;
result.sort();
result.unique();
- for (ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
+ for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
ClassList li = (*p)->allBases();
result.merge(li);
@@ -1480,10 +1480,10 @@ OperationList
Slice::ClassDef::operations()
{
OperationList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
OperationPtr q = OperationPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1497,7 +1497,7 @@ Slice::ClassDef::allOperations()
OperationList result = operations();
result.sort();
result.unique();
- for (ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
+ for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
OperationList li = (*p)->allOperations();
result.merge(li);
@@ -1510,10 +1510,10 @@ DataMemberList
Slice::ClassDef::dataMembers()
{
DataMemberList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1524,19 +1524,19 @@ Slice::ClassDef::dataMembers()
bool
Slice::ClassDef::isAbstract()
{
- if (isInterface() || _bases.size() > 1) // Is this an interface, or does it derive from interfaces?
+ if(isInterface() || _bases.size() > 1) // Is this an interface, or does it derive from interfaces?
{
return true;
}
- if (!_bases.empty() && _bases.front()->isAbstract())
+ if(!_bases.empty() && _bases.front()->isAbstract())
{
return true;
}
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if (OperationPtr::dynamicCast(*p))
+ if(OperationPtr::dynamicCast(*p))
{
return true;
}
@@ -1580,12 +1580,12 @@ Slice::ClassDef::uses(const ContainedPtr&)
void
Slice::ClassDef::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitClassDefStart(this))
+ if(visitor->visitClassDefStart(this))
{
Container::visit(visitor);
visitor->visitClassDefEnd(this);
@@ -1607,7 +1607,7 @@ Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, boo
// interfaces
//
#ifndef NDEBUG
- for (ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
+ for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
assert(p == _bases.begin() || (*p)->isInterface());
}
@@ -1646,12 +1646,12 @@ DataMemberPtr
Slice::Exception::createDataMember(const string& name, const TypePtr& type)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1670,7 +1670,7 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (name == this->name())
+ if(name == this->name())
{
string msg = "exception name `";
msg += name;
@@ -1688,10 +1688,10 @@ DataMemberList
Slice::Exception::dataMembers()
{
DataMemberList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1709,7 +1709,7 @@ ExceptionList
Slice::Exception::allBases()
{
ExceptionList result;
- if (_base)
+ if(_base)
{
result = _base->allBases();
result.push_front(_base);
@@ -1739,12 +1739,12 @@ Slice::Exception::uses(const ContainedPtr&)
void
Slice::Exception::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitExceptionStart(this))
+ if(visitor->visitExceptionStart(this))
{
Container::visit(visitor);
visitor->visitExceptionEnd(this);
@@ -1768,12 +1768,12 @@ DataMemberPtr
Slice::Struct::createDataMember(const string& name, const TypePtr& type)
{
ContainedList matches = _unit->findContents(thisScope() + name);
- if (!matches.empty())
+ if(!matches.empty())
{
DataMemberPtr p = DataMemberPtr::dynamicCast(matches.front());
- if (p)
+ if(p)
{
- if (_unit->ignRedefs())
+ if(_unit->ignRedefs())
{
return p;
}
@@ -1792,7 +1792,7 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (name == this->name())
+ if(name == this->name())
{
string msg = "struct name `";
msg += name;
@@ -1801,7 +1801,7 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
return 0;
}
- if (type.get() == this)
+ if(type.get() == this)
{
string msg = "struct `";
msg += name;
@@ -1819,10 +1819,10 @@ DataMemberList
Slice::Struct::dataMembers()
{
DataMemberList result;
- for (ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
DataMemberPtr q = DataMemberPtr::dynamicCast(*p);
- if (q)
+ if(q)
{
result.push_back(q);
}
@@ -1845,12 +1845,12 @@ Slice::Struct::uses(const ContainedPtr&)
void
Slice::Struct::visit(ParserVisitor* visitor)
{
- if (_includeLevel > 0)
+ if(_includeLevel > 0)
{
return;
}
- if (visitor->visitStructStart(this))
+ if(visitor->visitStructStart(this))
{
Container::visit(visitor);
visitor->visitStructEnd(this);
@@ -1892,7 +1892,7 @@ bool
Slice::Sequence::uses(const ContainedPtr& contained)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -1910,7 +1910,7 @@ void
Slice::Sequence::recDependencies(set<ConstructedPtr>& dependencies)
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_type);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -1953,7 +1953,7 @@ Slice::Dictionary::uses(const ContainedPtr& contained)
{
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_keyType);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -1961,7 +1961,7 @@ Slice::Dictionary::uses(const ContainedPtr& contained)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_valueType);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -1981,7 +1981,7 @@ Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies)
{
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_keyType);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -1990,7 +1990,7 @@ Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies)
{
ConstructedPtr constructed = ConstructedPtr::dynamicCast(_valueType);
- if (constructed && dependencies.find(constructed) != dependencies.end())
+ if(constructed && dependencies.find(constructed) != dependencies.end())
{
dependencies.insert(constructed);
constructed->recDependencies(dependencies);
@@ -2118,7 +2118,7 @@ Slice::Operation::uses(const ContainedPtr& contained)
{
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_returnType);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2126,19 +2126,19 @@ Slice::Operation::uses(const ContainedPtr& contained)
TypeStringList::const_iterator p;
- for (p = _inParams.begin(); p != _inParams.end(); ++p)
+ for(p = _inParams.begin(); p != _inParams.end(); ++p)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(p->first);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
}
- for (p = _outParams.begin(); p != _outParams.end(); ++p)
+ for(p = _outParams.begin(); p != _outParams.end(); ++p)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(p->first);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2146,10 +2146,10 @@ Slice::Operation::uses(const ContainedPtr& contained)
ExceptionList::const_iterator q;
- for (q = _throws.begin(); q != _throws.end(); ++q)
+ for(q = _throws.begin(); q != _throws.end(); ++q)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(*q);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2196,7 +2196,7 @@ bool
Slice::DataMember::uses(const ContainedPtr& contained)
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
- if (contained2 && contained2 == contained)
+ if(contained2 && contained2 == contained)
{
return true;
}
@@ -2239,18 +2239,18 @@ Slice::Unit::setComment(const string& comment)
_currentComment = "";
string::size_type end = 0;
- while (true)
+ while(true)
{
string::size_type begin = comment.find_first_not_of(" \t\r\n*", end);
- if (begin == string::npos)
+ if(begin == string::npos)
{
break;
}
end = comment.find('\n', begin);
- if (end != string::npos)
+ if(end != string::npos)
{
- if (end + 1 > begin)
+ if(end + 1 > begin)
{
_currentComment += comment.substr(begin, end + 1 - begin);
}
@@ -2258,9 +2258,9 @@ Slice::Unit::setComment(const string& comment)
else
{
end = comment.find_last_not_of(" \t\r\n*");
- if (end != string::npos)
+ if(end != string::npos)
{
- if (end + 1 > begin)
+ if(end + 1 > begin)
{
_currentComment += comment.substr(begin, end + 1 - begin);
}
@@ -2297,13 +2297,13 @@ Slice::Unit::scanPosition(const char* s)
string::size_type idx;
idx = line.find("line");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx + 4);
}
idx = line.find_first_not_of(" \t\r#");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
@@ -2311,18 +2311,18 @@ Slice::Unit::scanPosition(const char* s)
_currentLine = atoi(line.c_str()) - 1;
idx = line.find_first_of(" \t\r");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
}
idx = line.find_first_not_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
idx = line.find_first_of(" \t\r\"");
- if (idx != string::npos)
+ if(idx != string::npos)
{
_currentFile = line.substr(0, idx);
line.erase(0, idx + 1);
@@ -2333,21 +2333,21 @@ Slice::Unit::scanPosition(const char* s)
}
idx = line.find_first_not_of(" \t\r");
- if (idx != string::npos)
+ if(idx != string::npos)
{
line.erase(0, idx);
int val = atoi(line.c_str());
- if (val == 1)
+ if(val == 1)
{
- if (++_currentIncludeLevel == 1)
+ if(++_currentIncludeLevel == 1)
{
- if (find(_includeFiles.begin(), _includeFiles.end(), _currentFile) == _includeFiles.end())
+ if(find(_includeFiles.begin(), _includeFiles.end(), _currentFile) == _includeFiles.end())
{
_includeFiles.push_back(_currentFile);
}
}
}
- else if (val == 2)
+ else if(val == 2)
{
--_currentIncludeLevel;
}
@@ -2355,7 +2355,7 @@ Slice::Unit::scanPosition(const char* s)
}
else
{
- if (_currentIncludeLevel == 0)
+ if(_currentIncludeLevel == 0)
{
_topLevelFile = _currentFile;
}
@@ -2366,7 +2366,7 @@ Slice::Unit::scanPosition(const char* s)
int
Slice::Unit::currentIncludeLevel()
{
- if (_all)
+ if(_all)
{
return 0;
}
@@ -2434,9 +2434,9 @@ Slice::Unit::removeContent(const ContainedPtr& contained)
map<string, ContainedList>::iterator p = _contentMap.find(scoped);
assert(p != _contentMap.end());
ContainedList::iterator q;
- for (q = p->second.begin(); q != p->second.end(); ++q)
+ for(q = p->second.begin(); q != p->second.end(); ++q)
{
- if (q->get() == contained.get())
+ if(q->get() == contained.get())
{
p->second.erase(q);
return;
@@ -2453,7 +2453,7 @@ Slice::Unit::findContents(const string& scoped)
map<string, ContainedList>::const_iterator p = _contentMap.find(scoped);
- if (p != _contentMap.end())
+ if(p != _contentMap.end())
{
return p->second;
}
@@ -2472,10 +2472,10 @@ Slice::Unit::findDerivedClasses(const ClassDefPtr& cl)
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ClassDefPtr r = ClassDefPtr::dynamicCast(*q);
- if (r)
+ if(r)
{
ClassList bases = r->bases();
- if (find(bases.begin(), bases.end(), cl) != bases.end())
+ if(find(bases.begin(), bases.end(), cl) != bases.end())
{
derived.push_back(r);
}
@@ -2496,10 +2496,10 @@ Slice::Unit::findDerivedExceptions(const ExceptionPtr& ex)
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ExceptionPtr r = ExceptionPtr::dynamicCast(*q);
- if (r)
+ if(r)
{
ExceptionPtr base = r->base();
- if (base && base == ex)
+ if(base && base == ex)
{
derived.push_back(r);
}
@@ -2519,7 +2519,7 @@ Slice::Unit::findUsedBy(const ContainedPtr& contained)
{
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
- if ((*q)->uses(contained))
+ if((*q)->uses(contained))
{
usedBy.push_back(*q);
}
@@ -2538,14 +2538,14 @@ Slice::Unit::usesProxies()
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ClassDeclPtr decl = ClassDeclPtr::dynamicCast(*q);
- if (decl && !decl->isLocal())
+ if(decl && !decl->isLocal())
{
return true;
}
}
}
- if (_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
+ if(_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
{
return true;
}
@@ -2561,25 +2561,25 @@ Slice::Unit::usesNonLocals()
for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
ConstructedPtr constr = ConstructedPtr::dynamicCast(*q);
- if (constr && !constr->isLocal())
+ if(constr && !constr->isLocal())
{
return true;
}
ExceptionPtr exc = ExceptionPtr::dynamicCast(*q);
- if (exc && !exc->isLocal())
+ if(exc && !exc->isLocal())
{
return true;
}
}
}
- if (_builtins.find(Builtin::KindObject) != _builtins.end())
+ if(_builtins.find(Builtin::KindObject) != _builtins.end())
{
return true;
}
- if (_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
+ if(_builtins.find(Builtin::KindObjectProxy) != _builtins.end())
{
return true;
}
@@ -2610,14 +2610,14 @@ Slice::Unit::parse(FILE* file, bool debug)
yyin = file;
int status = yyparse();
- if (_errors)
+ if(_errors)
{
status = EXIT_FAILURE;
}
- if (status == EXIT_FAILURE)
+ if(status == EXIT_FAILURE)
{
- while (!_containerStack.empty())
+ while(!_containerStack.empty())
{
popContainer();
}
@@ -2643,7 +2643,7 @@ Slice::Unit::destroy()
void
Slice::Unit::visit(ParserVisitor* visitor)
{
- if (visitor->visitUnitStart(this))
+ if(visitor->visitUnitStart(this))
{
Container::visit(visitor);
visitor->visitUnitEnd(this);
@@ -2654,7 +2654,7 @@ BuiltinPtr
Slice::Unit::builtin(Builtin::Kind kind)
{
map<Builtin::Kind, BuiltinPtr>::const_iterator p = _builtins.find(kind);
- if (p != _builtins.end())
+ if(p != _builtins.end())
{
return p->second;
}
diff --git a/cpp/src/Slice/dummyinclude/unistd.h b/cpp/src/Slice/dummyinclude/unistd.h
index 92d53d10b9b..a5868056a35 100644
--- a/cpp/src/Slice/dummyinclude/unistd.h
+++ b/cpp/src/Slice/dummyinclude/unistd.h
@@ -1,4 +1,4 @@
-//
-// Files generated by flex need unistd.h, which is not available on
-// Windows. Thus this dummy file.
-//
+//
+// Files generated by flex need unistd.h, which is not available on
+// Windows. Thus this dummy file.
+//
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 860e69ff20c..de127ea1e9c 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -27,38 +27,38 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c
_dllExport(dllExport),
_impl(imp)
{
- for (vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
+ for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
- if (p->length() && (*p)[p->length() - 1] != '/')
+ if(p->length() && (*p)[p->length() - 1] != '/')
{
*p += '/';
}
}
string::size_type pos = _base.rfind('/');
- if (pos != string::npos)
+ if(pos != string::npos)
{
_base.erase(0, pos + 1);
}
- if (_impl)
+ if(_impl)
{
string fileImplH = _base + "I.h";
string fileImplC = _base + "I.cpp";
- if (!dir.empty())
+ if(!dir.empty())
{
fileImplH = dir + '/' + fileImplH;
fileImplC = dir + '/' + fileImplC;
}
struct stat st;
- if (stat(fileImplH.c_str(), &st) == 0)
+ if(stat(fileImplH.c_str(), &st) == 0)
{
cerr << name << ": `" << fileImplH
<< "' already exists - will not overwrite" << endl;
return;
}
- if (stat(fileImplC.c_str(), &st) == 0)
+ if(stat(fileImplC.c_str(), &st) == 0)
{
cerr << name << ": `" << fileImplC
<< "' already exists - will not overwrite" << endl;
@@ -66,7 +66,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c
}
implH.open(fileImplH.c_str());
- if (!implH)
+ if(!implH)
{
cerr << name << ": can't open `" << fileImplH << "' for writing: "
<< strerror(errno) << endl;
@@ -74,7 +74,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c
}
implC.open(fileImplC.c_str());
- if (!implC)
+ if(!implC)
{
cerr << name << ": can't open `" << fileImplC << "' for writing: "
<< strerror(errno) << endl;
@@ -82,7 +82,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c
}
string s = fileImplH;
- if (_include.size())
+ if(_include.size())
{
s = _include + '/' + s;
}
@@ -94,21 +94,21 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c
string fileH = _base + ".h";
string fileC = _base + ".cpp";
- if (!dir.empty())
+ if(!dir.empty())
{
fileH = dir + '/' + fileH;
fileC = dir + '/' + fileC;
}
H.open(fileH.c_str());
- if (!H)
+ if(!H)
{
cerr << name << ": can't open `" << fileH << "' for writing: " << strerror(errno) << endl;
return;
}
C.open(fileC.c_str());
- if (!C)
+ if(!C)
{
cerr << name << ": can't open `" << fileC << "' for writing: " << strerror(errno) << endl;
return;
@@ -120,7 +120,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include, c
C << "\n// Generated from file `" << changeInclude(_base, _includePaths) << ".ice'\n";
string s = fileH;
- if (_include.size())
+ if(_include.size())
{
s = _include + '/' + s;
}
@@ -135,7 +135,7 @@ Slice::Gen::~Gen()
H << "\n\n#endif\n";
C << '\n';
- if (_impl)
+ if(_impl)
{
implH << "\n\n#endif\n";
implC << '\n';
@@ -145,11 +145,11 @@ Slice::Gen::~Gen()
bool
Slice::Gen::operator!() const
{
- if (!H || !C)
+ if(!H || !C)
{
return true;
}
- if (_impl && (!implH || !implC))
+ if(_impl && (!implH || !implC))
{
return true;
}
@@ -160,7 +160,7 @@ void
Slice::Gen::generate(const UnitPtr& unit)
{
C << "\n#include <";
- if (_include.size())
+ if(_include.size())
{
C << _include << '/';
}
@@ -170,7 +170,7 @@ Slice::Gen::generate(const UnitPtr& unit)
H << "\n#include <Ice/ProxyF.h>";
H << "\n#include <Ice/ObjectF.h>";
- if (unit->usesProxies())
+ if(unit->usesProxies())
{
H << "\n#include <Ice/Exception.h>";
H << "\n#include <Ice/LocalObject.h>";
@@ -200,7 +200,7 @@ Slice::Gen::generate(const UnitPtr& unit)
}
StringList includes = unit->includeFiles();
- for (StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
+ for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
{
H << "\n#include <" << changeInclude(*q, _includePaths) << ".h>";
}
@@ -209,7 +209,7 @@ Slice::Gen::generate(const UnitPtr& unit)
printVersionCheck(C);
printDllExportStuff(H, _dllExport);
- if (_dllExport.size())
+ if(_dllExport.size())
{
_dllExport += " ";
}
@@ -244,17 +244,17 @@ Slice::Gen::generate(const UnitPtr& unit)
ObjectVisitor objectVisitor(H, C, _dllExport);
unit->visit(&objectVisitor);
- if (_impl)
+ if(_impl)
{
implH << "\n#include <";
- if (_include.size())
+ if(_include.size())
{
implH << _include << '/';
}
implH << _base << ".h>";
implC << "#include <";
- if (_include.size())
+ if(_include.size())
{
implC << _include << '/';
}
@@ -273,7 +273,7 @@ Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllEx
bool
Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasOtherConstructedOrExceptions())
+ if(!p->hasOtherConstructedOrExceptions())
{
return false;
}
@@ -306,9 +306,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << sp << nl << "class " << name << " : ";
H.useCurrentPosAsIndent();
- if (!base)
+ if(!base)
{
- if (p->isLocal())
+ if(p->isLocal())
{
H << "public ::Ice::LocalException";
}
@@ -329,12 +329,12 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H.inc();
H << sp;
- if (p->isLocal())
+ if(p->isLocal())
{
H << nl << _dllExport << name << "(const char*, int);";
C << sp << nl << scoped.substr(2) << "::" << name << "(const char* file, int line) : ";
C.inc();
- if (!base)
+ if(!base)
{
C << nl << "::Ice::LocalException(file, line)";
}
@@ -354,7 +354,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
C << nl << "return name;";
C << eb;
- if (p->isLocal())
+ if(p->isLocal())
{
H << nl << _dllExport << "virtual void ice_print(::std::ostream&) const;";
}
@@ -371,7 +371,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
C << nl << "throw *this;";
C << eb;
- if (!p->isLocal())
+ if(!p->isLocal())
{
ExceptionList allBases = p->allBases();
StringList exceptionIds;
@@ -389,10 +389,10 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
<< "] =";
C << sb;
q = exceptionIds.begin();
- while (q != exceptionIds.end())
+ while(q != exceptionIds.end())
{
C << nl << '"' << *q << '"';
- if (++q != exceptionIds.end())
+ if(++q != exceptionIds.end())
{
C << ',';
}
@@ -410,7 +410,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
void
Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
- if (!p->isLocal())
+ if(!p->isLocal())
{
string name = p->name();
string scoped = p->scoped();
@@ -426,7 +426,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
TypeStringList memberList;
DataMemberList dataMembers = p->dataMembers();
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
memberList.push_back(make_pair((*q)->type(), (*q)->name()));
}
@@ -497,13 +497,13 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << eb;
C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator!=(const " << name << "& __rhs) const";
C << sb;
- C << nl << "if (this == &__rhs)";
+ C << nl << "if(this == &__rhs)";
C << sb;
C << nl << "return false;";
C << eb;
- for (q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- C << nl << "if (" << (*q)->name() << " != __rhs." << (*q)->name() << ')';
+ C << nl << "if(" << (*q)->name() << " != __rhs." << (*q)->name() << ')';
C << sb;
C << nl << "return true;";
C << eb;
@@ -512,17 +512,17 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << eb;
C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator<(const " << name << "& __rhs) const";
C << sb;
- C << nl << "if (this == &__rhs)";
+ C << nl << "if(this == &__rhs)";
C << sb;
C << nl << "return false;";
C << eb;
- for (q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- C << nl << "if (" << (*q)->name() << " < __rhs." << (*q)->name() << ')';
+ C << nl << "if(" << (*q)->name() << " < __rhs." << (*q)->name() << ')';
C << sb;
C << nl << "return true;";
C << eb;
- C << nl << "else if (__rhs." << (*q)->name() << " < " << (*q)->name() << ')';
+ C << nl << "else if(__rhs." << (*q)->name() << " < " << (*q)->name() << ')';
C << sb;
C << nl << "return false;";
C << eb;
@@ -530,7 +530,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << nl << "return false;";
C << eb;
- if (!p->isLocal())
+ if(!p->isLocal())
{
//
// Neither of these four member functions are virtual!
@@ -542,7 +542,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
H << nl << _dllExport << "void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&);";
TypeStringList memberList;
- for (q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
memberList.push_back(make_pair((*q)->type(), (*q)->name()));
}
@@ -590,14 +590,14 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
string name = p->name();
TypePtr type = p->type();
string s = typeToString(type);
- if (s[0] == ':')
+ if(s[0] == ':')
{
s.insert(0, " ");
}
H << sp << nl << "typedef ::std::vector<" << s << "> " << name << ';';
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (!p->isLocal() &&
+ if(!p->isLocal() &&
(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy))
{
string scoped = p->scoped();
@@ -634,7 +634,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
C << sb;
C << nl << "__os->writeSize(::Ice::Int(v.size()));";
C << nl << scoped << "::const_iterator p;";
- C << nl << "for (p = v.begin(); p != v.end(); ++p)";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
C << sb;
writeMarshalUnmarshalCode(C, type, "(*p)", true);
C << eb;
@@ -649,7 +649,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
// Don't use v.resize(sz) or v.reserve(sz) here, as it cannot
// be checked whether sz is a reasonable value.
//
- C << nl << "while (sz--)";
+ C << nl << "while(sz--)";
C << sb;
C << nl << "v.resize(v.size() + 1);";
writeMarshalUnmarshalCode(C, type, "v.back()", false);
@@ -662,7 +662,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
C << sb;
C << nl << "__os->startWriteSequence(__name, ::Ice::Int(v.size()));";
C << nl << scoped << "::const_iterator p;";
- C << nl << "for (p = v.begin(); p != v.end(); ++p)";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
C << sb;
writeGenericMarshalUnmarshalCode(C, type, "(*p)", true, "\"e\"");
C << eb;
@@ -677,7 +677,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
// Don't use v.resize(sz) or v.reserve(sz) here, as it cannot
// be checked whether sz is a reasonable value.
//
- C << nl << "while (sz--)";
+ C << nl << "while(sz--)";
C << sb;
C << nl << "v.resize(v.size() + 1);";
writeGenericMarshalUnmarshalCode(C, type, "v.back()", false, "\"e\"");
@@ -708,14 +708,14 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
TypePtr keyType = p->keyType();
TypePtr valueType = p->valueType();
string ks = typeToString(keyType);
- if (ks[0] == ':')
+ if(ks[0] == ':')
{
ks.insert(0, " ");
}
string vs = typeToString(valueType);
H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';';
- if (!p->isLocal())
+ if(!p->isLocal())
{
string scoped = p->scoped();
string scope = p->scope();
@@ -751,7 +751,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
C << sb;
C << nl << "__os->writeSize(::Ice::Int(v.size()));";
C << nl << scoped << "::const_iterator p;";
- C << nl << "for (p = v.begin(); p != v.end(); ++p)";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
C << sb;
writeMarshalUnmarshalCode(C, keyType, "p->first", true);
writeMarshalUnmarshalCode(C, valueType, "p->second", true);
@@ -763,7 +763,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
C << sb;
C << nl << "::Ice::Int sz;";
C << nl << "__is->readSize(sz);";
- C << nl << "while (sz--)";
+ C << nl << "while(sz--)";
C << sb;
C << nl << "::std::pair<" << ks << ", " << vs << "> pair;";
writeMarshalUnmarshalCode(C, keyType, "pair.first", false);
@@ -778,7 +778,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
C << sb;
C << nl << "__os->startWriteDictionary(__name, ::Ice::Int(v.size()));";
C << nl << scoped << "::const_iterator p;";
- C << nl << "for (p = v.begin(); p != v.end(); ++p)";
+ C << nl << "for(p = v.begin(); p != v.end(); ++p)";
C << sb;
C << nl << "__os->startWriteDictionaryElement();";
writeGenericMarshalUnmarshalCode(C, keyType, "p->first", true, "\"key\"");
@@ -792,7 +792,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
<< "const ::Ice::StreamPtr& __is, " << scoped << "& v, " << scope << "__U__" << name << ')';
C << sb;
C << nl << "::Ice::Int sz = __is->startReadDictionary(__name);";
- C << nl << "while (sz--)";
+ C << nl << "while(sz--)";
C << sb;
C << nl << "::std::pair<" << ks << ", " << vs << "> pair;";
C << nl << "__is->startReadDictionaryElement();";
@@ -828,17 +828,17 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
H << sp << nl << "enum " << name;
H << sb;
EnumeratorList::const_iterator en = enumerators.begin();
- while (en != enumerators.end())
+ while(en != enumerators.end())
{
H << nl << (*en)->name();
- if (++en != enumerators.end())
+ if(++en != enumerators.end())
{
H << ',';
}
}
H << eb << ';';
- if (!p->isLocal())
+ if(!p->isLocal())
{
string scoped = p->scoped();
string scope = p->scope();
@@ -857,11 +857,11 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped
<< " v)";
C << sb;
- if (sz <= 0x7f)
+ if(sz <= 0x7f)
{
C << nl << "__os->write(static_cast< ::Ice::Byte>(v));";
}
- else if (sz <= 0x7fff)
+ else if(sz <= 0x7fff)
{
C << nl << "__os->write(static_cast< ::Ice::Short>(v));";
}
@@ -874,13 +874,13 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped
<< "& v)";
C << sb;
- if (sz <= 0x7f)
+ if(sz <= 0x7f)
{
C << nl << "::Ice::Byte val;";
C << nl << "__is->read(val);";
C << nl << "v = static_cast< " << scoped << ">(val);";
}
- else if (sz <= 0x7fff)
+ else if(sz <= 0x7fff)
{
C << nl << "::Ice::Short val;";
C << nl << "__is->read(val);";
@@ -901,10 +901,10 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
C << nl << "static const ::std::string " << "__RT__" << name << "[] =";
C << sb;
en = enumerators.begin();
- while (en != enumerators.end())
+ while(en != enumerators.end())
{
C << nl << "\"" << (*en)->name() << "\"";
- if (++en != enumerators.end())
+ if(++en != enumerators.end())
{
C << ',';
}
@@ -931,7 +931,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
void
Slice::Gen::TypesVisitor::emitExceptionBase(const ExceptionPtr& base, const std::string& call)
{
- if (base)
+ if(base)
{
C.zeroIndent();
C << nl << "#ifdef _WIN32"; // COMPILERBUG
@@ -955,7 +955,7 @@ Slice::Gen::ProxyDeclVisitor::ProxyDeclVisitor(Output& h, Output& c, const strin
bool
Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -974,7 +974,7 @@ Slice::Gen::ProxyDeclVisitor::visitUnitEnd(const UnitPtr& p)
bool
Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -995,7 +995,7 @@ Slice::Gen::ProxyDeclVisitor::visitModuleEnd(const ModulePtr& p)
void
Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return;
}
@@ -1016,7 +1016,7 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllEx
bool
Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1035,7 +1035,7 @@ Slice::Gen::ProxyVisitor::visitUnitEnd(const UnitPtr& p)
bool
Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1056,7 +1056,7 @@ Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p)
bool
Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -1066,7 +1066,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassList bases = p->bases();
H << sp << nl << "class " << _dllExport << name << " : ";
- if (bases.empty())
+ if(bases.empty())
{
H << "virtual public ::IceProxy::Ice::Object";
}
@@ -1074,10 +1074,10 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
H.useCurrentPosAsIndent();
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
H << "virtual public ::IceProxy" << (*q)->scoped();
- if (++q != bases.end())
+ if(++q != bases.end())
{
H << ',' << nl;
}
@@ -1157,7 +1157,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
string paramsDecl = "("; // With declarators
string args = "(";
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
string typeString = inputTypeToString(q->first);
params += typeString;
@@ -1170,7 +1170,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
args += ", ";
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
string typeString = outputTypeToString(q->first);
params += typeString;
@@ -1191,7 +1191,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << sp << nl << retS << nl << "IceProxy" << scoped << paramsDecl;
C << sb;
C << nl << "int __cnt = 0;";
- C << nl << "while (true)";
+ C << nl << "while(true)";
C << sb;
C << nl << "::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase = __getDelegate();";
C << nl << "::IceDelegate" << scope.substr(0, scope.size() - 2) << "* __del = dynamic_cast< ::IceDelegate"
@@ -1199,12 +1199,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl << "try";
C << sb;
C << nl;
- if (ret)
+ if(ret)
{
C << "return ";
}
C << "__del->" << name << args << ";";
- if (!ret)
+ if(!ret)
{
C << nl << "return;";
}
@@ -1217,7 +1217,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << sb;
list<string> metaData = p->getMetaData();
bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end();
- if (nonmutating)
+ if(nonmutating)
{
C << nl << "__handleException(*__ex.get(), __cnt);";
}
@@ -1242,7 +1242,7 @@ Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string&
bool
Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1261,7 +1261,7 @@ Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p)
bool
Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1282,7 +1282,7 @@ Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr& p)
bool
Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -1291,7 +1291,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassList bases = p->bases();
H << sp << nl << "class " << _dllExport << name << " : ";
- if (bases.empty())
+ if(bases.empty())
{
H << "virtual public ::IceDelegate::Ice::Object";
}
@@ -1299,10 +1299,10 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
H.useCurrentPosAsIndent();
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
H << "virtual public ::IceDelegate" << (*q)->scoped();
- if (++q != bases.end())
+ if(++q != bases.end())
{
H << ',' << nl;
}
@@ -1337,14 +1337,14 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
string params = "(";
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
string typeString = inputTypeToString(q->first);
params += typeString;
params += ", ";
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
string typeString = outputTypeToString(q->first);
params += typeString;
@@ -1364,7 +1364,7 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(Output& h, Output& c, const strin
bool
Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1383,7 +1383,7 @@ Slice::Gen::DelegateMVisitor::visitUnitEnd(const UnitPtr& p)
bool
Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1404,7 +1404,7 @@ Slice::Gen::DelegateMVisitor::visitModuleEnd(const ModulePtr& p)
bool
Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -1416,17 +1416,17 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp << nl << "class " << _dllExport << name << " : ";
H.useCurrentPosAsIndent();
H << "virtual public ::IceDelegate" << scoped << ',';
- if (bases.empty())
+ if(bases.empty())
{
H << nl << "virtual public ::IceDelegateM::Ice::Object";
}
else
{
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
H << nl << "virtual public ::IceDelegateM" << (*q)->scoped();
- if (++q != bases.end())
+ if(++q != bases.end())
{
H << ',';
}
@@ -1463,7 +1463,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
string params = "(";
string paramsDecl = "("; // With declarators
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
string typeString = inputTypeToString(q->first);
params += typeString;
@@ -1474,7 +1474,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
paramsDecl += ", ";
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
string typeString = outputTypeToString(q->first);
params += typeString;
@@ -1500,35 +1500,35 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end();
C << nl << "::IceInternal::Outgoing __out(__connection, __reference, __operation, "
<< (nonmutating ? "true" : "false") << ", __context);";
- if (ret || !outParams.empty() || !throws.empty())
+ if(ret || !outParams.empty() || !throws.empty())
{
C << nl << "::IceInternal::BasicStream* __is = __out.is();";
}
- if (!inParams.empty())
+ if(!inParams.empty())
{
C << nl << "::IceInternal::BasicStream* __os = __out.os();";
}
writeMarshalCode(C, inParams, 0);
- C << nl << "if (!__out.invoke())";
+ C << nl << "if(!__out.invoke())";
C << sb;
- if (!throws.empty())
+ if(!throws.empty())
{
ExceptionList::const_iterator r;
C << nl << "static ::std::string __throws[] =";
C << sb;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
C << nl << '"' << (*r)->scoped() << '"';
- if (r != throws.end())
+ if(r != throws.end())
{
C << ',';
}
}
C << eb << ';';
- C << nl << "switch (__is->throwException(__throws, __throws + " << throws.size() << "))";
+ C << nl << "switch(__is->throwException(__throws, __throws + " << throws.size() << "))";
C << sb;
int cnt = 0;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
C << nl << "case " << cnt++ << ':';
C << sb;
@@ -1547,7 +1547,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << eb;
writeAllocateCode(C, TypeStringList(), ret);
writeUnmarshalCode(C, outParams, ret);
- if (ret)
+ if(ret)
{
C << nl << "return __ret;";
}
@@ -1562,7 +1562,7 @@ Slice::Gen::DelegateDVisitor::DelegateDVisitor(Output& h, Output& c, const strin
bool
Slice::Gen::DelegateDVisitor::visitUnitStart(const UnitPtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1581,7 +1581,7 @@ Slice::Gen::DelegateDVisitor::visitUnitEnd(const UnitPtr& p)
bool
Slice::Gen::DelegateDVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasNonLocalClassDecls())
+ if(!p->hasNonLocalClassDecls())
{
return false;
}
@@ -1602,7 +1602,7 @@ Slice::Gen::DelegateDVisitor::visitModuleEnd(const ModulePtr& p)
bool
Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -1614,17 +1614,17 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp << nl << "class " << _dllExport << name << " : ";
H.useCurrentPosAsIndent();
H << "virtual public ::IceDelegate" << scoped << ',';
- if (bases.empty())
+ if(bases.empty())
{
H << nl << "virtual public ::IceDelegateD::Ice::Object";
}
else
{
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
H << nl << "virtual public ::IceDelegateD" << (*q)->scoped();
- if (++q != bases.end())
+ if(++q != bases.end())
{
H << ',';
}
@@ -1665,7 +1665,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
string paramsDecl = "("; // With declarators
string args = "(";
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
string typeString = inputTypeToString(q->first);
params += typeString;
@@ -1678,7 +1678,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
args += ", ";
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
string typeString = outputTypeToString(q->first);
params += typeString;
@@ -1703,11 +1703,11 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end();
C << nl << "__initCurrent(__current, \"" << name << "\", " << (nonmutating ? "true" : "false")
<< ", __context);";
- C << nl << "while (true)";
+ C << nl << "while(true)";
C << sb;
C << nl << "::IceInternal::Direct __direct(__adapter, __current);";
C << nl << cl->scoped() << "* __servant = dynamic_cast< " << cl->scoped() << "*>(__direct.facetServant().get());";
- C << nl << "if (!__servant)";
+ C << nl << "if(!__servant)";
C << sb;
C << nl << "::Ice::OperationNotExistException __opEx(__FILE__, __LINE__);";
C << nl << "__opEx.operation = __current.operation;";
@@ -1716,12 +1716,12 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
C << nl << "try";
C << sb;
C << nl;
- if (ret)
+ if(ret)
{
C << "return ";
}
C << "__servant->" << name << args << ';';
- if (!ret)
+ if(!ret)
{
C << nl << "return;";
}
@@ -1730,7 +1730,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
throws.sort();
throws.unique();
ExceptionList::const_iterator r;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
C << nl << "catch (const " << (*r)->scoped() << "&)";
C << sb;
@@ -1761,7 +1761,7 @@ Slice::Gen::ObjectDeclVisitor::ObjectDeclVisitor(Output& h, Output& c, const str
bool
Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasClassDecls())
+ if(!p->hasClassDecls())
{
return false;
}
@@ -1798,7 +1798,7 @@ Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dll
bool
Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasClassDefs())
+ if(!p->hasClassDefs())
{
return false;
}
@@ -1826,9 +1826,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
string exp1;
string exp2;
- if (_dllExport.size())
+ if(_dllExport.size())
{
- if (p->hasDataMembers())
+ if(p->hasDataMembers())
{
exp2 = _dllExport;
}
@@ -1841,9 +1841,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp;
H << nl << "class " << exp1 << name << " : ";
H.useCurrentPosAsIndent();
- if (bases.empty())
+ if(bases.empty())
{
- if (p->isLocal())
+ if(p->isLocal())
{
H << "virtual public ::Ice::LocalObject";
}
@@ -1855,10 +1855,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
H << "virtual public " << (*q)->scoped();
- if (++q != bases.end())
+ if(++q != bases.end())
{
H << ',' << nl;
}
@@ -1870,7 +1870,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << nl << "public:";
H.inc();
- if (!p->isLocal())
+ if(!p->isLocal())
{
ClassList allBases = p->allBases();
StringList ids;
@@ -1895,7 +1895,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << nl << exp2 << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current());";
H << nl << exp2 << "static const ::std::string& ice_staticId();";
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
H << sp << nl << exp2 << "static ::Ice::ObjectFactoryPtr _factory;";
H << nl << exp2 << "static const ::Ice::ObjectFactoryPtr& ice_factory();";
@@ -1904,10 +1904,10 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "const ::std::string " << scoped.substr(2) << "::__ids[" << ids.size() << "] =";
C << sb;
q = ids.begin();
- while (q != ids.end())
+ while(q != ids.end())
{
C << nl << '"' << *q << '"';
- if (++q != ids.end())
+ if(++q != ids.end())
{
C << ',';
}
@@ -1948,12 +1948,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
string scoped = p->scoped();
string scope = p->scope();
- if (!p->isLocal())
+ if(!p->isLocal())
{
string exp2;
- if (_dllExport.size())
+ if(_dllExport.size())
{
- if (p->hasDataMembers())
+ if(p->hasDataMembers())
{
exp2 = _dllExport;
}
@@ -1961,13 +1961,13 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
ClassList bases = p->bases();
ClassDefPtr base;
- if (!bases.empty() && !bases.front()->isInterface())
+ if(!bases.empty() && !bases.front()->isInterface())
{
base = bases.front();
}
OperationList allOps = p->allOperations();
- if (!allOps.empty())
+ if(!allOps.empty())
{
StringList allOpNames;
transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::memFun(&Operation::name));
@@ -1989,10 +1989,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "::std::string " << scoped.substr(2) << "::__all[] =";
C << sb;
q = allOpNames.begin();
- while (q != allOpNames.end())
+ while(q != allOpNames.end())
{
C << nl << '"' << *q << '"';
- if (++q != allOpNames.end())
+ if(++q != allOpNames.end())
{
C << ',';
}
@@ -2004,15 +2004,15 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << sb;
C << nl << "::std::pair<const ::std::string*, const ::std::string*> r = "
<< "::std::equal_range(__all, __all + " << allOpNames.size() << ", current.operation);";
- C << nl << "if (r.first == r.second)";
+ C << nl << "if(r.first == r.second)";
C << sb;
C << nl << "return ::IceInternal::DispatchOperationNotExist;";
C << eb;
C << sp;
- C << nl << "switch (r.first - __all)";
+ C << nl << "switch(r.first - __all)";
C << sb;
int i = 0;
- for (q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
{
C << nl << "case " << i++ << ':';
C << sb;
@@ -2040,7 +2040,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
TypeStringList memberList;
DataMemberList dataMembers = p->dataMembers();
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
memberList.push_back(make_pair((*q)->type(), (*q)->name()));
}
@@ -2079,7 +2079,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
writeGenericMarshalUnmarshalCode(C, p->declaration(), "value", false, "__name");
C << eb;
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
string name = p->name();
string factoryName = "__F__";
@@ -2112,7 +2112,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << eb << ';';
- if (p->isLocal())
+ if(p->isLocal())
{
C << sp;
C << nl << "bool" << nl << scope.substr(2) << "operator==(const " << scoped
@@ -2188,9 +2188,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
string paramsDecl = "("; // With declarators
string args = "(";
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- if (q != inParams.begin())
+ if(q != inParams.begin())
{
params += ", ";
paramsDecl += ", ";
@@ -2205,9 +2205,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
args += q->second;
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- if (q != outParams.begin() || !inParams.empty())
+ if(q != outParams.begin() || !inParams.empty())
{
params += ", ";
paramsDecl += ", ";
@@ -2222,9 +2222,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
args += q->second;
}
- if (!cl->isLocal())
+ if(!cl->isLocal())
{
- if (!inParams.empty() || !outParams.empty())
+ if(!inParams.empty() || !outParams.empty())
{
params += ", ";
paramsDecl += ", ";
@@ -2242,9 +2242,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
}
string exp2;
- if (_dllExport.size())
+ if(_dllExport.size())
{
- if (cl->hasDataMembers())
+ if(cl->hasDataMembers())
{
exp2 = _dllExport;
}
@@ -2253,7 +2253,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
H << sp;
H << nl << exp2 << "virtual " << retS << ' ' << name << params << " = 0;";
- if (!cl->isLocal())
+ if(!cl->isLocal())
{
ExceptionList throws = p->throws();
throws.sort();
@@ -2265,34 +2265,34 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
C << nl << "::IceInternal::DispatchStatus" << nl << scope.substr(2) << "___" << name
<< "(::IceInternal::Incoming& __in, const ::Ice::Current& __current)";
C << sb;
- if (!inParams.empty())
+ if(!inParams.empty())
{
C << nl << "::IceInternal::BasicStream* __is = __in.is();";
}
- if (ret || !outParams.empty() || !throws.empty())
+ if(ret || !outParams.empty() || !throws.empty())
{
C << nl << "::IceInternal::BasicStream* __os = __in.os();";
}
writeAllocateCode(C, inParams, 0);
writeUnmarshalCode(C, inParams, 0);
writeAllocateCode(C, outParams, 0);
- if (!throws.empty())
+ if(!throws.empty())
{
C << nl << "try";
C << sb;
}
C << nl;
- if (ret)
+ if(ret)
{
C << retS << " __ret = ";
}
C << name << args << ';';
writeMarshalCode(C, outParams, ret);
- if (!throws.empty())
+ if(!throws.empty())
{
C << eb;
ExceptionList::const_iterator r;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
C << nl << "catch (const " << (*r)->scoped() << "& __ex)";
C << sb;
@@ -2318,7 +2318,7 @@ Slice::Gen::ObjectVisitor::visitDataMember(const DataMemberPtr& p)
void
Slice::Gen::ObjectVisitor::emitClassBase(const ClassDefPtr& base, const std::string& call)
{
- if (base)
+ if(base)
{
C.zeroIndent();
C << nl << "#ifdef _WIN32"; // COMPILERBUG
@@ -2357,7 +2357,7 @@ Slice::Gen::IceInternalVisitor::IceInternalVisitor(Output& h, Output& c, const s
bool
Slice::Gen::IceInternalVisitor::visitUnitStart(const UnitPtr& p)
{
- if (!p->hasClassDecls())
+ if(!p->hasClassDecls())
{
return false;
}
@@ -2383,7 +2383,7 @@ Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p)
H << sp;
H << nl << _dllExport << "void incRef(" << scoped << "*);";
H << nl << _dllExport << "void decRef(" << scoped << "*);";
- if (!p->isLocal())
+ if(!p->isLocal())
{
H << sp;
H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);";
@@ -2415,7 +2415,7 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "p->__decRef();";
C << eb;
- if (!p->isLocal())
+ if(!p->isLocal())
{
C << sp;
C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)";
@@ -2434,12 +2434,12 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
<< scoped << "Prx& d)";
C << sb;
C << nl << "d = 0;";
- C << nl << "if (b)";
+ C << nl << "if(b)";
C << sb;
- C << nl << "if (f == b->ice_getFacet())";
+ C << nl << "if(f == b->ice_getFacet())";
C << sb;
C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b.get());";
- C << nl << "if (!d && b->ice_isA(\"" << scoped << "\"))";
+ C << nl << "if(!d && b->ice_isA(\"" << scoped << "\"))";
C << sb;
C << nl << "d = new ::IceProxy" << scoped << ";";
C << nl << "d->__copyFrom(b);";
@@ -2450,7 +2450,7 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "::Ice::ObjectPrx bb = b->ice_newFacet(f);";
C << nl << "try";
C << sb;
- C << nl << "if (bb->ice_isA(\"" << scoped << "\"))";
+ C << nl << "if(bb->ice_isA(\"" << scoped << "\"))";
C << sb;
C << nl << "d = new ::IceProxy" << scoped << ";";
C << nl << "d->__copyFrom(bb);";
@@ -2468,12 +2468,12 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
<< scoped << "Prx& d)";
C << sb;
C << nl << "d = 0;";
- C << nl << "if (b)";
+ C << nl << "if(b)";
C << sb;
- C << nl << "if (f == b->ice_getFacet())";
+ C << nl << "if(f == b->ice_getFacet())";
C << sb;
C << nl << "d = dynamic_cast< ::IceProxy" << scoped << "*>(b.get());";
- C << nl << "if (!d)";
+ C << nl << "if(!d)";
C << sb;
C << nl << "d = new ::IceProxy" << scoped << ";";
C << nl << "d->__copyFrom(b);";
@@ -2500,7 +2500,7 @@ Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dll
bool
Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasClassDecls())
+ if(!p->hasClassDecls())
{
return false;
}
@@ -2528,7 +2528,7 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
H << sp;
H << nl << "typedef ::IceInternal::Handle< " << scoped << "> " << name << "Ptr;";
- if (!p->isLocal())
+ if(!p->isLocal())
{
H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
@@ -2547,7 +2547,7 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
bool
Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (!p->isLocal())
+ if(!p->isLocal())
{
string scoped = p->scoped();
string scope = p->scope();
@@ -2565,7 +2565,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sb;
C << nl << "::Ice::ObjectPrx proxy;";
C << nl << "__is->read(proxy);";
- C << nl << "if (!proxy)";
+ C << nl << "if(!proxy)";
C << sb;
C << nl << "v = 0;";
C << eb;
@@ -2588,7 +2588,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
<< "const ::Ice::StreamPtr& __is, " << scoped << "Prx& v)";
C << sb;
C << nl << "::Ice::ObjectPrx proxy = __is->readProxy(__name);";
- C << nl << "if (!proxy)";
+ C << nl << "if(!proxy)";
C << sb;
C << nl << "v = 0;";
C << eb;
@@ -2613,9 +2613,9 @@ void
Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- switch (builtin->kind())
+ switch(builtin->kind())
{
case Builtin::KindBool:
{
@@ -2653,28 +2653,28 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type)
}
ProxyPtr prx = ProxyPtr::dynamicCast(type);
- if (prx)
+ if(prx)
{
out << nl << "return 0;";
return;
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
out << nl << "return 0;";
return;
}
StructPtr st = StructPtr::dynamicCast(type);
- if (st)
+ if(st)
{
out << nl << "return " << st->scoped() << "();";
return;
}
EnumPtr en = EnumPtr::dynamicCast(type);
- if (en)
+ if(en)
{
EnumeratorList enumerators = en->getEnumerators();
out << nl << "return " << en->scope() << enumerators.front()->name() << ';';
@@ -2682,7 +2682,7 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type)
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
out << nl << "return " << seq->scoped() << "();";
return;
@@ -2696,7 +2696,7 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type)
bool
Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p)
{
- if (!p->hasClassDefs())
+ if(!p->hasClassDefs())
{
return false;
}
@@ -2718,7 +2718,7 @@ Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr& p)
bool
Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
return false;
}
@@ -2730,7 +2730,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassList bases = p->bases();
ClassDefPtr base;
- if (!bases.empty() && !bases.front()->isInterface())
+ if(!bases.empty() && !bases.front()->isInterface())
{
base = bases.front();
}
@@ -2740,7 +2740,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
H.useCurrentPosAsIndent();
H << "virtual public " << name;
ClassList::const_iterator q;
- for (q = bases.begin(); q != bases.end(); ++q)
+ for(q = bases.begin(); q != bases.end(); ++q)
{
H << ',' << nl << "virtual public " << (*q)->scoped() << "I";
}
@@ -2757,7 +2757,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Operations
//
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = (*r);
string opName = op->name();
@@ -2771,27 +2771,27 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
H << sp << nl << "virtual " << retS << ' ' << opName << '(';
H.useCurrentPosAsIndent();
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- if (q != inParams.begin())
+ if(q != inParams.begin())
{
H << ',' << nl;
}
string typeString = inputTypeToString(q->first);
H << typeString;
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- if (!inParams.empty() || q != outParams.begin())
+ if(!inParams.empty() || q != outParams.begin())
{
H << ',' << nl;
}
string typeString = outputTypeToString(q->first);
H << typeString;
}
- if (!p->isLocal())
+ if(!p->isLocal())
{
- if (!inParams.empty() || !outParams.empty())
+ if(!inParams.empty() || !outParams.empty())
{
H << ',' << nl;
}
@@ -2802,27 +2802,27 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sp << nl << retS << nl << scoped.substr(2) << "I::" << opName << '(';
C.useCurrentPosAsIndent();
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- if (q != inParams.begin())
+ if(q != inParams.begin())
{
C << ',' << nl;
}
string typeString = inputTypeToString(q->first);
C << typeString << ' ' << q->second;
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- if (!inParams.empty() || q != outParams.begin())
+ if(!inParams.empty() || q != outParams.begin())
{
C << ',' << nl;
}
string typeString = outputTypeToString(q->first);
C << typeString << ' ' << q->second;
}
- if (!p->isLocal())
+ if(!p->isLocal())
{
- if (!inParams.empty() || !outParams.empty())
+ if(!inParams.empty() || !outParams.empty())
{
C << ',' << nl;
}
@@ -2835,7 +2835,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Return value
//
- if (ret)
+ if(ret)
{
writeReturn(C, ret);
}
diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h
index 71ca45f81cc..7e7d4abc0bb 100644
--- a/cpp/src/slice2cpp/Gen.h
+++ b/cpp/src/slice2cpp/Gen.h
@@ -1,294 +1,294 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GEN_H
-#define GEN_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-
-class Gen : public ::IceUtil::noncopyable
-{
-public:
-
- Gen(const std::string&,
- const std::string&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&,
- const std::string&,
- bool);
- ~Gen();
-
- bool operator!() const; // Returns true if there was a constructor error
-
- void generate(const UnitPtr&);
-
-private:
-
- ::IceUtil::Output H;
- ::IceUtil::Output C;
-
- ::IceUtil::Output implH;
- ::IceUtil::Output implC;
-
- std::string _base;
- std::string _include;
- std::vector<std::string> _includePaths;
- std::string _dllExport;
- bool _impl;
-
- class TypesVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
-
- private:
-
- void emitExceptionBase(const ExceptionPtr&, const std::string&);
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class ProxyDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- ProxyDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class ProxyVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- ProxyVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class DelegateVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- DelegateVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class DelegateMVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- DelegateMVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class DelegateDVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- DelegateDVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class ObjectDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- ObjectDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class ObjectVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
-
- private:
-
- void emitClassBase(const ClassDefPtr&, const std::string&);
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class IceInternalVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- IceInternalVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class HandleVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
- };
-
- class ImplVisitor : public ::IceUtil::noncopyable, public ParserVisitor
- {
- public:
-
- ImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
-
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
-
- private:
-
- ::IceUtil::Output& H;
- ::IceUtil::Output& C;
-
- std::string _dllExport;
-
- //
- // Generate code to return a dummy value
- //
- void writeReturn(::IceUtil::Output&, const TypePtr&);
- };
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GEN_H
+#define GEN_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+
+namespace Slice
+{
+
+class Gen : public ::IceUtil::noncopyable
+{
+public:
+
+ Gen(const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&,
+ const std::string&,
+ bool);
+ ~Gen();
+
+ bool operator!() const; // Returns true if there was a constructor error
+
+ void generate(const UnitPtr&);
+
+private:
+
+ ::IceUtil::Output H;
+ ::IceUtil::Output C;
+
+ ::IceUtil::Output implH;
+ ::IceUtil::Output implC;
+
+ std::string _base;
+ std::string _include;
+ std::vector<std::string> _includePaths;
+ std::string _dllExport;
+ bool _impl;
+
+ class TypesVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+
+ private:
+
+ void emitExceptionBase(const ExceptionPtr&, const std::string&);
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class ProxyDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ ProxyDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class ProxyVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ ProxyVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class DelegateVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ DelegateVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class DelegateMVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ DelegateMVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class DelegateDVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ DelegateDVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class ObjectDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ ObjectDeclVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class ObjectVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+
+ private:
+
+ void emitClassBase(const ClassDefPtr&, const std::string&);
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class IceInternalVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ IceInternalVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class HandleVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual void visitClassDecl(const ClassDeclPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+ };
+
+ class ImplVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ ImplVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitModuleEnd(const ModulePtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+ ::IceUtil::Output& C;
+
+ std::string _dllExport;
+
+ //
+ // Generate code to return a dummy value
+ //
+ void writeReturn(::IceUtil::Output&, const TypePtr&);
+ };
+};
+
+}
+
+#endif
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index 8d8c02dee57..cd81f3c674e 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -46,58 +46,58 @@ main(int argc, char* argv[])
bool debug = false;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if (path.length())
+ if(path.length())
{
includePaths.push_back(path);
}
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--include-dir") == 0)
+ else if(strcmp(argv[idx], "--include-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -105,15 +105,15 @@ main(int argc, char* argv[])
}
include = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--output-dir") == 0)
+ else if(strcmp(argv[idx], "--output-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -121,15 +121,15 @@ main(int argc, char* argv[])
}
output = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--dll-export") == 0)
+ else if(strcmp(argv[idx], "--dll-export") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -137,22 +137,22 @@ main(int argc, char* argv[])
}
dllExport = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--impl") == 0)
+ else if(strcmp(argv[idx], "--impl") == 0)
{
impl = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -164,7 +164,7 @@ main(int argc, char* argv[])
}
}
- if (argc < 2)
+ if(argc < 2)
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
@@ -173,17 +173,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for (idx = 1 ; idx < argc ; ++idx)
+ for(idx = 1 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
return EXIT_FAILURE;
@@ -191,7 +191,7 @@ main(int argc, char* argv[])
base.erase(pos);
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -204,7 +204,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -219,7 +219,7 @@ main(int argc, char* argv[])
pclose(cppHandle);
#endif
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -227,7 +227,7 @@ main(int argc, char* argv[])
{
Gen gen(argv[0], base, include, includePaths, dllExport, output,
impl);
- if (!gen)
+ if(!gen)
{
unit->destroy();
return EXIT_FAILURE;
diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp
index e3617dbbdd7..378d6f653c6 100644
--- a/cpp/src/slice2docbook/Gen.cpp
+++ b/cpp/src/slice2docbook/Gen.cpp
@@ -19,7 +19,7 @@ Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool no
_standAlone(standAlone),
_noGlobals(noGlobals)
{
- if (chapter)
+ if(chapter)
{
_chapter = "chapter";
}
@@ -29,7 +29,7 @@ Slice::Gen::Gen(const string& name, const string& file, bool standAlone, bool no
}
O.open(file.c_str());
- if (!O)
+ if(!O)
{
cerr << name << ": can't open `" << file << "' for writing: " << strerror(errno) << endl;
return;
@@ -64,7 +64,7 @@ Slice::Gen::generate(const UnitPtr& unit)
bool
Slice::Gen::visitUnitStart(const UnitPtr& p)
{
- if (_standAlone)
+ if(_standAlone)
{
O << "<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\">";
printHeader();
@@ -75,7 +75,7 @@ Slice::Gen::visitUnitStart(const UnitPtr& p)
printHeader();
}
- if (!_noGlobals)
+ if(!_noGlobals)
{
start(_chapter, "Global Module");
// start("section", "Overview");
@@ -89,7 +89,7 @@ Slice::Gen::visitUnitStart(const UnitPtr& p)
void
Slice::Gen::visitUnitEnd(const UnitPtr& p)
{
- if (_standAlone)
+ if(_standAlone)
{
end();
}
@@ -120,11 +120,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
modules.erase(remove_if(modules.begin(), modules.end(), ::IceUtil::memFun(&Contained::includeLevel)),
modules.end());
- if (!modules.empty())
+ if(!modules.empty())
{
start("section", "Module Index");
start("variablelist");
- for (ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
+ for(ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
{
start("varlistentry");
start("term");
@@ -150,11 +150,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
remove_copy_if(classesAndInterfaces.begin(), classesAndInterfaces.end(), back_inserter(interfaces),
not1(::IceUtil::memFun(&ClassDef::isInterface)));
- if (!classes.empty())
+ if(!classes.empty())
{
start("section", "Class Index");
start("variablelist");
- for (ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
+ for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
{
start("varlistentry");
start("term");
@@ -169,11 +169,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
end();
}
- if (!interfaces.empty())
+ if(!interfaces.empty())
{
start("section", "Interface Index");
start("variablelist");
- for (ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
+ for(ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
{
start("varlistentry");
start("term");
@@ -192,11 +192,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
exceptions.erase(remove_if(exceptions.begin(), exceptions.end(), ::IceUtil::memFun(&Contained::includeLevel)),
exceptions.end());
- if (!exceptions.empty())
+ if(!exceptions.empty())
{
start("section", "Exception Index");
start("variablelist");
- for (ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
+ for(ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
{
start("varlistentry");
start("term");
@@ -215,11 +215,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
structs.erase(remove_if(structs.begin(), structs.end(), ::IceUtil::memFun(&Contained::includeLevel)),
structs.end());
- if (!structs.empty())
+ if(!structs.empty())
{
start("section", "Struct Index");
start("variablelist");
- for (StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
+ for(StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
{
start("varlistentry");
start("term");
@@ -238,11 +238,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
sequences.erase(remove_if(sequences.begin(), sequences.end(), ::IceUtil::memFun(&Contained::includeLevel)),
sequences.end());
- if (!sequences.empty())
+ if(!sequences.empty())
{
start("section", "Sequence Index");
start("variablelist");
- for (SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
+ for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
{
start("varlistentry");
start("term");
@@ -262,11 +262,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
::IceUtil::memFun(&Contained::includeLevel)),
dictionaries.end());
- if (!dictionaries.empty())
+ if(!dictionaries.empty())
{
start("section", "Dictionary Index");
start("variablelist");
- for (DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
+ for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
{
start("varlistentry");
start("term");
@@ -285,11 +285,11 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
enums.erase(remove_if(enums.begin(), enums.end(), ::IceUtil::memFun(&Contained::includeLevel)),
enums.end());
- if (!enums.empty())
+ if(!enums.empty())
{
start("section", "Enum Index");
start("variablelist");
- for (EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
+ for(EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
{
start("varlistentry");
start("term");
@@ -307,13 +307,13 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
end();
{
- for (SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
+ for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
O << nl << "<synopsis>";
printMetaData(*q);
- if ((*q)->isLocal())
+ if((*q)->isLocal())
{
O << "local ";
}
@@ -326,13 +326,13 @@ Slice::Gen::visitContainer(const ContainerPtr& p)
}
{
- for (DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
+ for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
O << nl << "<synopsis>";
printMetaData(*q);
- if ((*q)->isLocal())
+ if((*q)->isLocal())
{
O << "local ";
}
@@ -357,11 +357,11 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
O.zeroIndent();
O << nl << "<synopsis>";
printMetaData(p);
- if (p->isLocal())
+ if(p->isLocal())
{
O << "local ";
}
- if (p->isInterface())
+ if(p->isInterface())
{
O << "interface";
}
@@ -371,7 +371,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
}
O << " <classname>" << p->name() << "</classname>";
ClassList bases = p->bases();
- if (!bases.empty() && !bases.front()->isInterface())
+ if(!bases.empty() && !bases.front()->isInterface())
{
O.inc();
O << nl << "extends ";
@@ -381,10 +381,10 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
O.dec();
O.dec();
}
- if (!bases.empty())
+ if(!bases.empty())
{
O.inc();
- if (p->isInterface())
+ if(p->isInterface())
{
O << nl << "extends ";
}
@@ -394,10 +394,10 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
}
O.inc();
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
O << nl << toString(*q, p);
- if (++q != bases.end())
+ if(++q != bases.end())
{
O << ",";
}
@@ -410,11 +410,11 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
printComment(p);
OperationList operations = p->operations();
- if (!operations.empty())
+ if(!operations.empty())
{
start("section", "Operation Index");
start("variablelist");
- for (OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
+ for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
{
start("varlistentry");
start("term");
@@ -430,11 +430,11 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
}
DataMemberList dataMembers = p->dataMembers();
- if (!dataMembers.empty())
+ if(!dataMembers.empty())
{
start("section", "Data Member Index");
start("variablelist");
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
start("varlistentry");
start("term");
@@ -452,7 +452,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
end();
{
- for (OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
+ for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
@@ -464,23 +464,23 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
O.inc();
TypeStringList inputParams = (*q)->inputParameters();
TypeStringList::const_iterator r = inputParams.begin();
- while (r != inputParams.end())
+ while(r != inputParams.end())
{
O << nl << toString(r->first, p) << " <parameter>" << r->second << "</parameter>";
- if (++r != inputParams.end())
+ if(++r != inputParams.end())
{
O << ',';
}
}
TypeStringList outputParams = (*q)->outputParameters();
- if (!outputParams.empty())
+ if(!outputParams.empty())
{
O << ';';
r = outputParams.begin();
- while (r != outputParams.end())
+ while(r != outputParams.end())
{
O << nl << toString(r->first, p) << " <parameter>" << r->second << "</parameter>";
- if (++r != outputParams.end())
+ if(++r != outputParams.end())
{
O << ',';
}
@@ -489,16 +489,16 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
O << ')';
O.dec();
ExceptionList throws = (*q)->throws();
- if (!throws.empty())
+ if(!throws.empty())
{
O.inc();
O << nl << "throws";
O.inc();
ExceptionList::const_iterator r = throws.begin();
- while (r != throws.end())
+ while(r != throws.end())
{
O << nl << toString(*r, p);
- if (++r != throws.end())
+ if(++r != throws.end())
{
O << ',';
}
@@ -514,7 +514,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
}
{
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
@@ -543,13 +543,13 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
O.zeroIndent();
O << nl << "<synopsis>";
printMetaData(p);
- if (p->isLocal())
+ if(p->isLocal())
{
O << "local ";
}
O << "exception <classname>" << p->name() << "</classname>";
ExceptionPtr base = p->base();
- if (base)
+ if(base)
{
O.inc();
O << nl << "extends ";
@@ -563,11 +563,11 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
printComment(p);
DataMemberList dataMembers = p->dataMembers();
- if (!dataMembers.empty())
+ if(!dataMembers.empty())
{
start("section", "Data Member Index");
start("variablelist");
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
start("varlistentry");
start("term");
@@ -585,7 +585,7 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
end();
{
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
@@ -614,7 +614,7 @@ Slice::Gen::visitStructStart(const StructPtr& p)
O.zeroIndent();
O << nl << "<synopsis>";
printMetaData(p);
- if (p->isLocal())
+ if(p->isLocal())
{
O << "local ";
}
@@ -624,11 +624,11 @@ Slice::Gen::visitStructStart(const StructPtr& p)
printComment(p);
DataMemberList dataMembers = p->dataMembers();
- if (!dataMembers.empty())
+ if(!dataMembers.empty())
{
start("section", "Data Member Index");
start("variablelist");
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
start("varlistentry");
start("term");
@@ -646,7 +646,7 @@ Slice::Gen::visitStructStart(const StructPtr& p)
end();
{
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
@@ -674,7 +674,7 @@ Slice::Gen::visitEnum(const EnumPtr& p)
O.zeroIndent();
O << nl << "<synopsis>";
printMetaData(p);
- if (p->isLocal())
+ if(p->isLocal())
{
O << "local ";
}
@@ -684,11 +684,11 @@ Slice::Gen::visitEnum(const EnumPtr& p)
printComment(p);
EnumeratorList enumerators = p->getEnumerators();
- if (!enumerators.empty())
+ if(!enumerators.empty())
{
start("section", "Enumerator Index");
start("variablelist");
- for (EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
+ for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
{
start("varlistentry");
start("term");
@@ -706,7 +706,7 @@ Slice::Gen::visitEnum(const EnumPtr& p)
end();
{
- for (EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
+ for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
{
start("section id=" + containedToId(*q), (*q)->name());
O.zeroIndent();
@@ -749,19 +749,19 @@ Slice::Gen::getComment(const ContainedPtr& contained, const ContainerPtr& contai
{
string s = contained->comment();
string comment;
- for (unsigned int i = 0; i < s.size(); ++i)
+ for(unsigned int i = 0; i < s.size(); ++i)
{
- if (s[i] == '\\' && i + 1 < s.size() && s[i + 1] == '[')
+ if(s[i] == '\\' && i + 1 < s.size() && s[i + 1] == '[')
{
comment += '[';
++i;
}
- else if (s[i] == '[')
+ else if(s[i] == '[')
{
string literal;
- for (++i; i < s.size(); ++i)
+ for(++i; i < s.size(); ++i)
{
- if (s[i] == ']')
+ if(s[i] == ']')
{
break;
}
@@ -789,16 +789,16 @@ Slice::Gen::getTagged(const string& tag, string& comment)
{
StringList result;
string::size_type begin = 0;
- while (begin < comment.size())
+ while(begin < comment.size())
{
begin = comment.find("@" + tag, begin);
- if (begin == string::npos)
+ if(begin == string::npos)
{
return result;
}
string::size_type pos1 = comment.find_first_not_of(" \t\r\n", begin + tag.size() + 1);
- if (pos1 == string::npos)
+ if(pos1 == string::npos)
{
comment.erase(begin);
return result;
@@ -809,7 +809,7 @@ Slice::Gen::getTagged(const string& tag, string& comment)
comment.erase(begin, pos2 - 1 - begin);
string::size_type pos3 = line.find_last_not_of(" \t\r\n");
- if (pos3 != string::npos)
+ if(pos3 != string::npos)
{
line.erase(pos3 + 1);
}
@@ -824,14 +824,14 @@ Slice::Gen::printMetaData(const ContainedPtr& p)
{
list<string> metaData = p->getMetaData();
- if (!metaData.empty())
+ if(!metaData.empty())
{
O << "[";
list<string>::const_iterator q = metaData.begin();
- while (q != metaData.end())
+ while(q != metaData.end())
{
O << " \"" << *q << "\"";
- if (++q != metaData.end())
+ if(++q != metaData.end())
{
O << ",";
}
@@ -844,7 +844,7 @@ void
Slice::Gen::printComment(const ContainedPtr& p)
{
ContainerPtr container = ContainerPtr::dynamicCast(p);
- if (!container)
+ if(!container)
{
container = p->container();
}
@@ -858,7 +858,7 @@ Slice::Gen::printComment(const ContainedPtr& p)
start("para");
string::size_type pos = comment.find_last_not_of(" \t\r\n");
- if (pos != string::npos)
+ if(pos != string::npos)
{
comment.erase(pos + 1);
O.zeroIndent();
@@ -868,22 +868,22 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
- if (!par.empty())
+ if(!par.empty())
{
start("section", "Parameters");
start("variablelist");
- for (StringList::const_iterator q = par.begin(); q != par.end(); ++q)
+ for(StringList::const_iterator q = par.begin(); q != par.end(); ++q)
{
string::size_type pos;
string term;
pos = q->find_first_of(" \t\r\n");
- if (pos != string::npos)
+ if(pos != string::npos)
{
term = q->substr(0, pos);
}
string item;
pos = q->find_first_not_of(" \t\r\n", pos);
- if (pos != string::npos)
+ if(pos != string::npos)
{
item = q->substr(pos);
}
@@ -905,7 +905,7 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
}
- if (!ret.empty())
+ if(!ret.empty())
{
start("section", "Return Value");
start("para");
@@ -914,22 +914,22 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
}
- if (!throws.empty())
+ if(!throws.empty())
{
start("section", "Exceptions");
start("variablelist");
- for (StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
+ for(StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
{
string::size_type pos;
string term;
pos = q->find_first_of(" \t\r\n");
- if (pos != string::npos)
+ if(pos != string::npos)
{
term = q->substr(0, pos);
}
string item;
pos = q->find_first_not_of(" \t\r\n", pos);
- if (pos != string::npos)
+ if(pos != string::npos)
{
item = q->substr(pos);
}
@@ -951,16 +951,16 @@ Slice::Gen::printComment(const ContainedPtr& p)
ClassList derivedClasses;
ClassDefPtr def = ClassDefPtr::dynamicCast(p);
- if (def)
+ if(def)
{
derivedClasses = p->unit()->findDerivedClasses(def);
}
- if (!derivedClasses.empty())
+ if(!derivedClasses.empty())
{
start("section", "Derived Classes and Interfaces");
start("para");
start("simplelist type=\"inline\"");
- for (ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
+ for(ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
{
start("member");
O << nl << toString(*q, container);
@@ -973,16 +973,16 @@ Slice::Gen::printComment(const ContainedPtr& p)
ExceptionList derivedExceptions;
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
- if (ex)
+ if(ex)
{
derivedExceptions = p->unit()->findDerivedExceptions(ex);
}
- if (!derivedExceptions.empty())
+ if(!derivedExceptions.empty())
{
start("section", "Derived Exceptions");
start("para");
start("simplelist type=\"inline\"");
- for (ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
+ for(ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
{
start("member");
O << nl << toString(*q, container);
@@ -995,7 +995,7 @@ Slice::Gen::printComment(const ContainedPtr& p)
ContainedList usedBy;
ConstructedPtr constructed;
- if (def)
+ if(def)
{
constructed = def->declaration();
}
@@ -1003,16 +1003,16 @@ Slice::Gen::printComment(const ContainedPtr& p)
{
constructed = ConstructedPtr::dynamicCast(p);
}
- if (constructed)
+ if(constructed)
{
usedBy = p->unit()->findUsedBy(constructed);
}
- if (!usedBy.empty())
+ if(!usedBy.empty())
{
start("section", "Used By");
start("para");
start("simplelist type=\"inline\"");
- for (ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
+ for(ContainedList::const_iterator q = usedBy.begin(); q != usedBy.end(); ++q)
{
start("member");
O << nl << toString(*q, container);
@@ -1023,12 +1023,12 @@ Slice::Gen::printComment(const ContainedPtr& p)
end();
}
- if (!see.empty())
+ if(!see.empty())
{
start("section", "See Also");
start("para");
start("simplelist type=\"inline\"");
- for (StringList::const_iterator q = see.begin(); q != see.end(); ++q)
+ for(StringList::const_iterator q = see.begin(); q != see.end(); ++q)
{
start("member");
O << nl << toString(*q, container);
@@ -1044,7 +1044,7 @@ void
Slice::Gen::printSummary(const ContainedPtr& p)
{
ContainerPtr container = ContainerPtr::dynamicCast(p);
- if (!container)
+ if(!container)
{
container = p->container();
}
@@ -1085,7 +1085,7 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
assert(contained);
string scoped = contained->scoped();
- if (scoped[0] == ':')
+ if(scoped[0] == ':')
{
scoped.erase(0, 2);
}
@@ -1093,9 +1093,9 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
string id;
id.reserve(scoped.size());
- for (unsigned int i = 0; i < scoped.size(); ++i)
+ for(unsigned int i = 0; i < scoped.size(); ++i)
{
- if (scoped[i] == ':')
+ if(scoped[i] == ':')
{
id += '.';
++i;
@@ -1126,7 +1126,7 @@ Slice::Gen::getScopedMinimized(const ContainedPtr& contained, const ContainerPtr
ContainerPtr p = container;
ContainedPtr q = ContainedPtr::dynamicCast(p);
- if (!q) // Container is the global module
+ if(!q) // Container is the global module
{
return s.substr(2);
}
@@ -1136,7 +1136,7 @@ Slice::Gen::getScopedMinimized(const ContainedPtr& contained, const ContainerPtr
string s2 = q->scoped();
s2 += "::";
- if (s.find(s2) == 0)
+ if(s.find(s2) == 0)
{
return s.substr(s2.size());
}
@@ -1172,16 +1172,16 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
- if (builtin)
+ if(builtin)
{
s = builtinTable[builtin->kind()];
tag = "type";
}
ProxyPtr proxy = ProxyPtr::dynamicCast(p);
- if (proxy)
+ if(proxy)
{
- if (withLink && proxy->_class()->includeLevel() == 0)
+ if(withLink && proxy->_class()->includeLevel() == 0)
{
linkend = containedToId(proxy->_class());
}
@@ -1191,14 +1191,14 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p);
- if (cl)
+ if(cl)
{
//
// We must generate the id from the definition, not from the
// declaration, provided that a definition is available.
//
ContainedPtr definition = cl->definition();
- if (withLink && definition && definition->includeLevel() == 0)
+ if(withLink && definition && definition->includeLevel() == 0)
{
linkend = containedToId(definition);
}
@@ -1207,9 +1207,9 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
}
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
- if (ex)
+ if(ex)
{
- if (withLink && ex->includeLevel() == 0)
+ if(withLink && ex->includeLevel() == 0)
{
linkend = containedToId(ex);
}
@@ -1218,9 +1218,9 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
}
StructPtr st = StructPtr::dynamicCast(p);
- if (st)
+ if(st)
{
- if (withLink && st->includeLevel() == 0)
+ if(withLink && st->includeLevel() == 0)
{
linkend = containedToId(st);
}
@@ -1229,9 +1229,9 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
}
EnumeratorPtr en = EnumeratorPtr::dynamicCast(p);
- if (en)
+ if(en)
{
- if (withLink && en->includeLevel() == 0)
+ if(withLink && en->includeLevel() == 0)
{
linkend = containedToId(en);
}
@@ -1239,11 +1239,11 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
tag = "constant";
}
- if (s.empty())
+ if(s.empty())
{
ContainedPtr contained = ContainedPtr::dynamicCast(p);
assert(contained);
- if (withLink && contained->includeLevel() == 0)
+ if(withLink && contained->includeLevel() == 0)
{
linkend = containedToId(contained);
}
@@ -1251,7 +1251,7 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container,
tag = "type";
}
- if (linkend.empty())
+ if(linkend.empty())
{
return "<" + tag + ">" + s + "</" + tag + ">";
}
@@ -1267,13 +1267,13 @@ Slice::Gen::toString(const string& str, const ContainerPtr& container, bool with
string s = str;
TypeList types = container->lookupType(s, false);
- if (!types.empty())
+ if(!types.empty())
{
return toString(types.front(), container, withLink);
}
ContainedList contList = container->lookupContained(s, false);
- if (!contList.empty())
+ if(!contList.empty())
{
return toString(contList.front(), container, withLink);
}
diff --git a/cpp/src/slice2docbook/Gen.h b/cpp/src/slice2docbook/Gen.h
index c4aa636875d..e2fad7840d0 100644
--- a/cpp/src/slice2docbook/Gen.h
+++ b/cpp/src/slice2docbook/Gen.h
@@ -1,67 +1,67 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GEN_H
-#define GEN_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-#include <stack>
-
-namespace Slice
-{
-
-class Gen : public ::IceUtil::noncopyable, public ParserVisitor
-{
-public:
-
- Gen(const std::string&, const std::string&, bool, bool, bool);
- virtual ~Gen();
-
- bool operator!() const; // Returns true if there was a constructor error
-
- void generate(const UnitPtr&);
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual void visitUnitEnd(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitContainer(const ContainerPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitEnum(const EnumPtr&);
-
-private:
-
- void printHeader();
- std::string getComment(const ContainedPtr&, const ContainerPtr&, bool);
- StringList getTagged(const std::string&, std::string&);
- void printMetaData(const ContainedPtr&);
- void printComment(const ContainedPtr&);
- void printSummary(const ContainedPtr&);
- void start(const std::string&);
- void start(const std::string&, const std::string&);
- void end();
-
- std::string containedToId(const ContainedPtr&);
- std::string getScopedMinimized(const ContainedPtr&, const ContainerPtr&);
- std::string toString(const SyntaxTreeBasePtr&, const ContainerPtr&, bool = true);
- std::string toString(const std::string&, const ContainerPtr&, bool = true);
-
- ::IceUtil::XMLOutput O;
-
- bool _standAlone;
- bool _noGlobals;
- std::string _chapter;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GEN_H
+#define GEN_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+#include <stack>
+
+namespace Slice
+{
+
+class Gen : public ::IceUtil::noncopyable, public ParserVisitor
+{
+public:
+
+ Gen(const std::string&, const std::string&, bool, bool, bool);
+ virtual ~Gen();
+
+ bool operator!() const; // Returns true if there was a constructor error
+
+ void generate(const UnitPtr&);
+
+ virtual bool visitUnitStart(const UnitPtr&);
+ virtual void visitUnitEnd(const UnitPtr&);
+ virtual bool visitModuleStart(const ModulePtr&);
+ virtual void visitContainer(const ContainerPtr&);
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitEnum(const EnumPtr&);
+
+private:
+
+ void printHeader();
+ std::string getComment(const ContainedPtr&, const ContainerPtr&, bool);
+ StringList getTagged(const std::string&, std::string&);
+ void printMetaData(const ContainedPtr&);
+ void printComment(const ContainedPtr&);
+ void printSummary(const ContainedPtr&);
+ void start(const std::string&);
+ void start(const std::string&, const std::string&);
+ void end();
+
+ std::string containedToId(const ContainedPtr&);
+ std::string getScopedMinimized(const ContainedPtr&, const ContainerPtr&);
+ std::string toString(const SyntaxTreeBasePtr&, const ContainerPtr&, bool = true);
+ std::string toString(const std::string&, const ContainerPtr&, bool = true);
+
+ ::IceUtil::XMLOutput O;
+
+ bool _standAlone;
+ bool _noGlobals;
+ std::string _chapter;
+};
+
+}
+
+#endif
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp
index 9fc7c400144..0918a2f10d2 100644
--- a/cpp/src/slice2docbook/Main.cpp
+++ b/cpp/src/slice2docbook/Main.cpp
@@ -45,77 +45,77 @@ main(int argc, char* argv[])
bool chapter = false;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-s") == 0 || strcmp(argv[idx], "--stand-alone") == 0)
+ else if(strcmp(argv[idx], "-s") == 0 || strcmp(argv[idx], "--stand-alone") == 0)
{
standAlone = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--no-globals") == 0)
+ else if(strcmp(argv[idx], "--no-globals") == 0)
{
noGlobals = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--chapter") == 0)
+ else if(strcmp(argv[idx], "--chapter") == 0)
{
chapter = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -127,7 +127,7 @@ main(int argc, char* argv[])
}
}
- if (argc < 2)
+ if(argc < 2)
{
cerr << argv[0] << ": no docbook file specified" << endl;
usage(argv[0]);
@@ -137,18 +137,18 @@ main(int argc, char* argv[])
string docbook(argv[1]);
string suffix;
string::size_type pos = docbook.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = docbook.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".sgml")
+ if(suffix != ".sgml")
{
cerr << argv[0] << ": docbook file must end with `.sgml'" << endl;
return EXIT_FAILURE;
}
- if (argc < 3)
+ if(argc < 3)
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
@@ -159,17 +159,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for (idx = 2 ; idx < argc ; ++idx)
+ for(idx = 2 ; idx < argc ; ++idx)
{
string file(argv[idx]);
string suffix;
string::size_type pos = file.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = file.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
unit->destroy();
@@ -177,7 +177,7 @@ main(int argc, char* argv[])
}
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
unit->destroy();
@@ -191,7 +191,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: " << strerror(errno) << endl;
unit->destroy();
@@ -208,10 +208,10 @@ main(int argc, char* argv[])
}
- if (status == EXIT_SUCCESS)
+ if(status == EXIT_SUCCESS)
{
Gen gen(argv[0], docbook, standAlone, noGlobals, chapter);
- if (!gen)
+ if(!gen)
{
unit->destroy();
return EXIT_FAILURE;
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index cb2aaf11a88..d7d6e2168c3 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -49,15 +49,15 @@ usage(const char* n)
bool
checkIdentifier(string n, string t, string s)
{
- if (s.empty() || (!isalpha(s[0]) && s[0] != '_'))
+ if(s.empty() || (!isalpha(s[0]) && s[0] != '_'))
{
cerr << n << ": `" << t << "' is not a valid type name" << endl;
return false;
}
- for (unsigned int i = 1; i < s.size(); ++i)
+ for(unsigned int i = 1; i < s.size(); ++i)
{
- if (!isalnum(s[i]) && s[i] != '_')
+ if(!isalnum(s[i]) && s[i] != '_')
{
cerr << n << ": `" << t << "' is not a valid type name" << endl;
return false;
@@ -72,7 +72,7 @@ printFreezeTypes(Output& out, const vector<Dict>& dicts)
{
out << '\n';
out << "\n// Freeze types in this file:";
- for (vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
+ for(vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
{
out << "\n// name=\"" << p->name << "\", key=\"" << p->key << "\", value=\"" << p->value << "\"";
}
@@ -122,19 +122,19 @@ bool
writeCodecs(const string& n, UnitPtr& unit, const Dict& dict, Output& H, Output& C, const string& dllExport)
{
string absolute = dict.name;
- if (absolute.find("::") == 0)
+ if(absolute.find("::") == 0)
{
absolute.erase(0, 2);
}
string name = absolute;
vector<string> scope;
string::size_type pos;
- while ((pos = name.find("::")) != string::npos)
+ while((pos = name.find("::")) != string::npos)
{
string s = name.substr(0, pos);
name.erase(0, pos + 2);
- if (!checkIdentifier(n, absolute, s))
+ if(!checkIdentifier(n, absolute, s))
{
return false;
}
@@ -142,13 +142,13 @@ writeCodecs(const string& n, UnitPtr& unit, const Dict& dict, Output& H, Output&
scope.push_back(s);
}
- if (!checkIdentifier(n, absolute, name))
+ if(!checkIdentifier(n, absolute, name))
{
return false;
}
TypeList keyTypes = unit->lookupType(dict.key, false);
- if (keyTypes.empty())
+ if(keyTypes.empty())
{
cerr << n << ": `" << dict.key << "' is not a valid type" << endl;
return false;
@@ -156,7 +156,7 @@ writeCodecs(const string& n, UnitPtr& unit, const Dict& dict, Output& H, Output&
TypePtr keyType = keyTypes.front();
TypeList valueTypes = unit->lookupType(dict.value, false);
- if (valueTypes.empty())
+ if(valueTypes.empty())
{
cerr << n << ": `" << dict.value << "' is not a valid type" << endl;
return false;
@@ -165,7 +165,7 @@ writeCodecs(const string& n, UnitPtr& unit, const Dict& dict, Output& H, Output&
vector<string>::const_iterator q;
- for (q = scope.begin(); q != scope.end(); ++q)
+ for(q = scope.begin(); q != scope.end(); ++q)
{
H << sp;
H << nl << "namespace " << *q << nl << '{';
@@ -177,7 +177,7 @@ writeCodecs(const string& n, UnitPtr& unit, const Dict& dict, Output& H, Output&
H << sp << nl << "typedef Freeze::DBMap< " << typeToString(keyType) << ", " << typeToString(valueType) << ", "
<< name << "KeyCodec, " << name << "ValueCodec> " << name << ";";
- for (q = scope.begin(); q != scope.end(); ++q)
+ for(q = scope.begin(); q != scope.end(); ++q)
{
H << sp;
H << nl << '}';
@@ -201,39 +201,39 @@ main(int argc, char* argv[])
vector<Dict> dicts;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if (path.length())
+ if(path.length())
{
includePaths.push_back(path);
}
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--dict") == 0)
+ else if(strcmp(argv[idx], "--dict") == 0)
{
- if (idx + 1 >= argc || argv[idx + 1][0] == '-')
+ if(idx + 1 >= argc || argv[idx + 1][0] == '-')
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -247,34 +247,34 @@ main(int argc, char* argv[])
string::size_type pos;
pos = s.find(',');
- if (pos != string::npos)
+ if(pos != string::npos)
{
dict.name = s.substr(0, pos);
s.erase(0, pos + 1);
}
pos = s.find(',');
- if (pos != string::npos)
+ if(pos != string::npos)
{
dict.key = s.substr(0, pos);
s.erase(0, pos + 1);
}
dict.value = s;
- if (dict.name.empty())
+ if(dict.name.empty())
{
cerr << argv[0] << ": " << argv[idx] << ": no name specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
- if (dict.key.empty())
+ if(dict.key.empty())
{
cerr << argv[0] << ": " << argv[idx] << ": no key specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
- if (dict.value.empty())
+ if(dict.value.empty())
{
cerr << argv[0] << ": " << argv[idx] << ": no value specified" << endl;
usage(argv[0]);
@@ -283,34 +283,34 @@ main(int argc, char* argv[])
dicts.push_back(dict);
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--include-dir") == 0)
+ else if(strcmp(argv[idx], "--include-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -318,15 +318,15 @@ main(int argc, char* argv[])
}
include = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--dll-export") == 0)
+ else if(strcmp(argv[idx], "--dll-export") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -334,15 +334,15 @@ main(int argc, char* argv[])
}
dllExport = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--output-dir") == 0)
+ else if(strcmp(argv[idx], "--output-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -350,13 +350,13 @@ main(int argc, char* argv[])
}
output = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -368,14 +368,14 @@ main(int argc, char* argv[])
}
}
- if (dicts.empty())
+ if(dicts.empty())
{
cerr << argv[0] << ": no Freeze types specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
- if (argc < 2)
+ if(argc < 2)
{
cerr << argv[0] << ": no file name base specified" << endl;
usage(argv[0]);
@@ -386,7 +386,7 @@ main(int argc, char* argv[])
fileH += ".h";
string fileC = argv[1];
fileC += ".cpp";
- if (!output.empty())
+ if(!output.empty())
{
fileH = output + '/' + fileH;
fileC = output + '/' + fileC;
@@ -398,17 +398,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for (idx = 2 ; idx < argc ; ++idx)
+ for(idx = 2 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
return EXIT_FAILURE;
@@ -418,7 +418,7 @@ main(int argc, char* argv[])
includes.push_back(base + ".h");
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -431,7 +431,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: " << strerror(errno) << endl;
unit->destroy();
@@ -447,15 +447,15 @@ main(int argc, char* argv[])
#endif
}
- if (status == EXIT_SUCCESS)
+ if(status == EXIT_SUCCESS)
{
unit->mergeModules();
unit->sort();
{
- for (vector<string>::iterator p = includePaths.begin(); p != includePaths.end(); ++p)
+ for(vector<string>::iterator p = includePaths.begin(); p != includePaths.end(); ++p)
{
- if (p->length() && (*p)[p->length() - 1] != '/')
+ if(p->length() && (*p)[p->length() - 1] != '/')
{
*p += '/';
}
@@ -464,7 +464,7 @@ main(int argc, char* argv[])
Output H;
H.open(fileH.c_str());
- if (!H)
+ if(!H)
{
cerr << argv[0] << ": can't open `" << fileH << "' for writing: " << strerror(errno) << endl;
unit->destroy();
@@ -475,7 +475,7 @@ main(int argc, char* argv[])
Output C;
C.open(fileC.c_str());
- if (!C)
+ if(!C)
{
cerr << argv[0] << ": can't open `" << fileC << "' for writing: " << strerror(errno) << endl;
unit->destroy();
@@ -492,7 +492,7 @@ main(int argc, char* argv[])
H << "\n#include <Freeze/Map.h>";
{
- for (StringList::const_iterator p = includes.begin(); p != includes.end(); ++p)
+ for(StringList::const_iterator p = includes.begin(); p != includes.end(); ++p)
{
H << "\n#include <" << changeInclude(*p, includePaths) << ".h>";
}
@@ -500,7 +500,7 @@ main(int argc, char* argv[])
C << "\n#include <Ice/BasicStream.h>";
C << "\n#include <";
- if (include.size())
+ if(include.size())
{
C << include << '/';
}
@@ -510,17 +510,17 @@ main(int argc, char* argv[])
printVersionCheck(C);
printDllExportStuff(H, dllExport);
- if (dllExport.size())
+ if(dllExport.size())
{
dllExport += " ";
}
{
- for (vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
+ for(vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
{
try
{
- if (!writeCodecs(argv[0], unit, *p, H, C, dllExport))
+ if(!writeCodecs(argv[0], unit, *p, H, C, dllExport))
{
unit->destroy();
return EXIT_FAILURE;
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index 3db69abe047..02cda7ace4c 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -59,7 +59,7 @@ FreezeGenerator::generate(UnitPtr& unit, const Dict& dict)
string name;
string::size_type pos = dict.name.rfind('.');
- if (pos == string::npos)
+ if(pos == string::npos)
{
name = dict.name;
}
@@ -69,7 +69,7 @@ FreezeGenerator::generate(UnitPtr& unit, const Dict& dict)
}
TypeList keyTypes = unit->lookupType(dict.key, false);
- if (keyTypes.empty())
+ if(keyTypes.empty())
{
cerr << _prog << ": `" << dict.key << "' is not a valid type" << endl;
return false;
@@ -77,14 +77,14 @@ FreezeGenerator::generate(UnitPtr& unit, const Dict& dict)
TypePtr keyType = keyTypes.front();
TypeList valueTypes = unit->lookupType(dict.value, false);
- if (valueTypes.empty())
+ if(valueTypes.empty())
{
cerr << _prog << ": `" << dict.value << "' is not a valid type" << endl;
return false;
}
TypePtr valueType = valueTypes.front();
- if (!open(dict.name))
+ if(!open(dict.name))
{
cerr << _prog << ": unable to open class " << dict.name << endl;
return false;
@@ -106,12 +106,12 @@ FreezeGenerator::generate(UnitPtr& unit, const Dict& dict)
//
// encode/decode
//
- for (int i = 0; i < 2; i++)
+ for(int i = 0; i < 2; i++)
{
string keyValue;
TypePtr type;
- if (i == 0)
+ if(i == 0)
{
keyValue = "Key";
type = keyType;
@@ -124,10 +124,10 @@ FreezeGenerator::generate(UnitPtr& unit, const Dict& dict)
string typeS, valS;
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if (b)
+ if(b)
{
typeS = builtinTable[b->kind()];
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -221,9 +221,9 @@ FreezeGenerator::generate(UnitPtr& unit, const Dict& dict)
out << nl << "__buf.position(0);";
iter = 0;
out << nl << typeS << " __r;";
- if (b)
+ if(b)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -323,39 +323,39 @@ main(int argc, char* argv[])
vector<Dict> dicts;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if (path.length())
+ if(path.length())
{
includePaths.push_back(path);
}
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--dict") == 0)
+ else if(strcmp(argv[idx], "--dict") == 0)
{
- if (idx + 1 >= argc || argv[idx + 1][0] == '-')
+ if(idx + 1 >= argc || argv[idx + 1][0] == '-')
{
cerr << argv[0] << ": argument expected for `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -369,34 +369,34 @@ main(int argc, char* argv[])
string::size_type pos;
pos = s.find(',');
- if (pos != string::npos)
+ if(pos != string::npos)
{
dict.name = s.substr(0, pos);
s.erase(0, pos + 1);
}
pos = s.find(',');
- if (pos != string::npos)
+ if(pos != string::npos)
{
dict.key = s.substr(0, pos);
s.erase(0, pos + 1);
}
dict.value = s;
- if (dict.name.empty())
+ if(dict.name.empty())
{
cerr << argv[0] << ": " << argv[idx] << ": no name specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
- if (dict.key.empty())
+ if(dict.key.empty())
{
cerr << argv[0] << ": " << argv[idx] << ": no key specified" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
- if (dict.value.empty())
+ if(dict.value.empty())
{
cerr << argv[0] << ": " << argv[idx] << ": no value specified" << endl;
usage(argv[0]);
@@ -405,34 +405,34 @@ main(int argc, char* argv[])
dicts.push_back(dict);
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--include-dir") == 0)
+ else if(strcmp(argv[idx], "--include-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -440,15 +440,15 @@ main(int argc, char* argv[])
}
include = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--output-dir") == 0)
+ else if(strcmp(argv[idx], "--output-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -456,13 +456,13 @@ main(int argc, char* argv[])
}
output = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -474,7 +474,7 @@ main(int argc, char* argv[])
}
}
- if (dicts.empty())
+ if(dicts.empty())
{
cerr << argv[0] << ": no Freeze types specified" << endl;
usage(argv[0]);
@@ -487,24 +487,24 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for (idx = 1 ; idx < argc ; ++idx)
+ for(idx = 1 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
return EXIT_FAILURE;
}
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -517,7 +517,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: " << strerror(errno) << endl;
unit->destroy();
@@ -533,18 +533,18 @@ main(int argc, char* argv[])
#endif
}
- if (status == EXIT_SUCCESS)
+ if(status == EXIT_SUCCESS)
{
unit->mergeModules();
unit->sort();
FreezeGenerator gen(argv[0], output);
- for (vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
+ for(vector<Dict>::const_iterator p = dicts.begin(); p != dicts.end(); ++p)
{
try
{
- if (!gen.generate(unit, *p))
+ if(!gen.generate(unit, *p))
{
unit->destroy();
return EXIT_FAILURE;
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 92a2ae38f03..452bc302622 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -34,9 +34,9 @@ Slice::JavaVisitor::getParams(const OperationPtr& op, const string& scope)
string params;
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- if (q != inParams.begin())
+ if(q != inParams.begin())
{
params += ", ";
}
@@ -47,9 +47,9 @@ Slice::JavaVisitor::getParams(const OperationPtr& op, const string& scope)
params += fixKwd(q->second);
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- if (q != outParams.begin() || !inParams.empty())
+ if(q != outParams.begin() || !inParams.empty())
{
params += ", ";
}
@@ -72,9 +72,9 @@ Slice::JavaVisitor::getArgs(const OperationPtr& op, const string& scope)
string args;
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
- if (q != inParams.begin())
+ if(q != inParams.begin())
{
args += ", ";
}
@@ -82,9 +82,9 @@ Slice::JavaVisitor::getArgs(const OperationPtr& op, const string& scope)
args += fixKwd(q->second);
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
- if (q != outParams.begin() || !inParams.empty())
+ if(q != outParams.begin() || !inParams.empty())
{
args += ", ";
}
@@ -118,7 +118,7 @@ Slice::JavaVisitor::writeThrowsClause(const string& scope,
localCount = count_if(throws.begin(), throws.end(), exceptionIsLocal);
Output& out = output();
- if (throws.size() - localCount > 0)
+ if(throws.size() - localCount > 0)
{
out.inc();
out << nl;
@@ -126,11 +126,11 @@ Slice::JavaVisitor::writeThrowsClause(const string& scope,
out.useCurrentPosAsIndent();
ExceptionList::const_iterator r;
int count = 0;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
- if (!(*r)->isLocal())
+ if(!(*r)->isLocal())
{
- if (count > 0)
+ if(count > 0)
{
out << "," << nl;
}
@@ -159,9 +159,9 @@ Slice::JavaVisitor::writeDelegateThrowsClause(const string& scope,
// Don't include local exceptions in the throws clause
//
ExceptionList::const_iterator r;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
- if (!(*r)->isLocal())
+ if(!(*r)->isLocal())
{
out << "," << nl;
out << getAbsolute((*r)->scoped(), scope);
@@ -176,9 +176,9 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
const list<string>& metaData)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- switch (builtin->kind())
+ switch(builtin->kind())
{
case Builtin::KindByte:
case Builtin::KindShort:
@@ -218,7 +218,7 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
case Builtin::KindObjectProxy:
case Builtin::KindLocalObject:
{
- out << nl << "if (" << name << " != null)";
+ out << nl << "if(" << name << " != null)";
out << sb;
out << nl << "__h = 5 * __h + " << name << ".hashCode();";
out << eb;
@@ -229,9 +229,9 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
}
ProxyPtr prx = ProxyPtr::dynamicCast(type);
- if (prx)
+ if(prx)
{
- out << nl << "if (" << name << " != null)";
+ out << nl << "if(" << name << " != null)";
out << sb;
out << nl << "__h = 5 * __h + " << name << ".hashCode();";
out << eb;
@@ -239,9 +239,9 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if (cl)
+ if(cl)
{
- out << nl << "if (" << name << " != null)";
+ out << nl << "if(" << name << " != null)";
out << sb;
out << nl << "__h = 5 * __h + " << name << ".hashCode();";
out << eb;
@@ -249,22 +249,22 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if (seq)
+ if(seq)
{
string listType = findMetaData(metaData);
- if (listType.empty())
+ if(listType.empty())
{
list<string> l = seq->getMetaData();
listType = findMetaData(l);
}
- if (!listType.empty())
+ if(!listType.empty())
{
out << nl << "__h = 5 * __h + " << name << ".hashCode();";
}
else
{
- out << nl << "for (int __i" << iter << " = 0; __i" << iter
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter
<< " < " << name << ".length; __i" << iter << "++)";
out << sb;
ostringstream elem;
@@ -308,10 +308,10 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sp << nl << "public static final String[] __ids =";
out << sb;
q = ids.begin();
- while (q != ids.end())
+ while(q != ids.end())
{
out << nl << '"' << *q << '"';
- if (++q != ids.end())
+ if(++q != ids.end())
{
out << ',';
}
@@ -360,7 +360,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
OperationList ops = p->operations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = (*r);
ContainerPtr container = op->container();
@@ -391,11 +391,11 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
remove_if(throws.begin(), throws.end(), exceptionIsLocal);
- if (!inParams.empty())
+ if(!inParams.empty())
{
out << nl << "IceInternal.BasicStream __is = __in.is();";
}
- if (!outParams.empty() || ret || throws.size() > 0)
+ if(!outParams.empty() || ret || throws.size() > 0)
{
out << nl << "IceInternal.BasicStream __os = __in.os();";
}
@@ -404,7 +404,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
// Unmarshal 'in' params
//
iter = 0;
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
string typeS = typeToString(q->first, TypeModeIn, scope);
out << nl << typeS << ' ' << fixKwd(q->second) << ';';
@@ -414,13 +414,13 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
// Create holders for 'out' params
//
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
string typeS = typeToString(q->first, TypeModeOut, scope);
out << nl << typeS << ' ' << fixKwd(q->second) << " = new " << typeS << "();";
}
- if (!throws.empty())
+ if(!throws.empty())
{
out << nl << "try";
out << sb;
@@ -430,16 +430,16 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
// Call servant
//
out << nl;
- if (ret)
+ if(ret)
{
out << retS << " __ret = ";
}
out << "__obj." << opName << '(';
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
out << fixKwd(q->second) << ", ";
}
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
out << fixKwd(q->second) << ", ";
}
@@ -448,14 +448,14 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
// Marshal 'out' params
//
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
writeMarshalUnmarshalCode(out, scope, q->first, fixKwd(q->second), true, iter, true);
}
//
// Marshal result
//
- if (ret)
+ if(ret)
{
writeMarshalUnmarshalCode(out, scope, ret, "__ret", true, iter);
}
@@ -465,11 +465,11 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
// User exceptions
//
- if (!throws.empty())
+ if(!throws.empty())
{
out << eb;
ExceptionList::const_iterator r;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
string exS = getAbsolute((*r)->scoped(), scope);
out << nl << "catch (" << exS << " ex)";
@@ -487,7 +487,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
// __dispatch
//
OperationList allOps = p->allOperations();
- if (!allOps.empty())
+ if(!allOps.empty())
{
StringList allOpNames;
transform(allOps.begin(), allOps.end(), back_inserter(allOpNames),
@@ -505,10 +505,10 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sp << nl << "private final static String[] __all =";
out << sb;
q = allOpNames.begin();
- while (q != allOpNames.end())
+ while(q != allOpNames.end())
{
out << nl << '"' << *q << '"';
- if (++q != allOpNames.end())
+ if(++q != allOpNames.end())
{
out << ',';
}
@@ -519,36 +519,36 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
<< nl << "__dispatch(IceInternal.Incoming in, Ice.Current current)";
out << sb;
out << nl << "int pos = java.util.Arrays.binarySearch(__all, current.operation);";
- out << nl << "if (pos < 0)";
+ out << nl << "if(pos < 0)";
out << sb;
out << nl << "return IceInternal.DispatchStatus.DispatchOperationNotExist;";
out << eb;
- out << sp << nl << "switch (pos)";
+ out << sp << nl << "switch(pos)";
out << sb;
int i = 0;
- for (q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ for(q = allOpNames.begin(); q != allOpNames.end(); ++q)
{
string opName = fixKwd(*q);
out << nl << "case " << i++ << ':';
out << sb;
- if (opName == "ice_facets")
+ if(opName == "ice_facets")
{
out << nl << "return ___ice_facets(this, in, current);";
}
- else if (opName == "ice_id")
+ else if(opName == "ice_id")
{
out << nl << "return ___ice_id(this, in, current);";
}
- else if (opName == "ice_ids")
+ else if(opName == "ice_ids")
{
out << nl << "return ___ice_ids(this, in, current);";
}
- else if (opName == "ice_isA")
+ else if(opName == "ice_isA")
{
out << nl << "return ___ice_isA(this, in, current);";
}
- else if (opName == "ice_ping")
+ else if(opName == "ice_ping")
{
out << nl << "return ___ice_ping(this, in, current);";
}
@@ -557,21 +557,21 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
// There's probably a better way to do this
//
- for (OperationList::const_iterator r = allOps.begin(); r != allOps.end(); ++r)
+ for(OperationList::const_iterator r = allOps.begin(); r != allOps.end(); ++r)
{
- if ((*r)->name() == (*q))
+ if((*r)->name() == (*q))
{
ContainerPtr container = (*r)->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
assert(cl);
- if (cl->scoped() == p->scoped())
+ if(cl->scoped() == p->scoped())
{
out << nl << "return ___" << opName << "(this, in, current);";
}
else
{
string base;
- if (cl->isInterface())
+ if(cl->isInterface())
{
base = getAbsolute(cl->scoped(), scope, "_", "Disp");
}
@@ -684,12 +684,12 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Don't generate an Operations interface for non-abstract classes
//
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
return false;
}
- if (!open(absolute + "Operations"))
+ if(!open(absolute + "Operations"))
{
return false;
}
@@ -700,17 +700,17 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
// Generate the operations interface
//
out << sp << nl << "public interface " << name << "Operations";
- if ((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
+ if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
{
out << " extends ";
out.useCurrentPosAsIndent();
ClassList::const_iterator q = bases.begin();
bool first = true;
- while (q != bases.end())
+ while(q != bases.end())
{
- if ((*q)->isAbstract())
+ if((*q)->isAbstract())
{
- if (!first)
+ if(!first)
{
out << ',' << nl;
}
@@ -756,9 +756,9 @@ Slice::Gen::OpsVisitor::visitOperation(const OperationPtr& p)
out << sp;
out << nl;
out << retS << ' ' << name << '(' << params;
- if (!cl->isLocal())
+ if(!cl->isLocal())
{
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -791,12 +791,12 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Don't generate a TIE class for a non-abstract class
//
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
return false;
}
- if (!open(absolute + "Tie"))
+ if(!open(absolute + "Tie"))
{
return false;
}
@@ -807,9 +807,9 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
// Generate the TIE class
//
out << sp << nl << "public class " << name << "Tie";
- if (p->isInterface())
+ if(p->isInterface())
{
- if (p->isLocal())
+ if(p->isLocal())
{
out << " implements " << name;
}
@@ -846,11 +846,11 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public boolean" << nl << "equals(java.lang.Object rhs)";
out << sb;
- out << nl << "if (this == rhs)";
+ out << nl << "if(this == rhs)";
out << sb;
out << nl << "return true;";
out << eb;
- out << nl << "if (!(rhs instanceof " << name << "Tie))";
+ out << nl << "if(!(rhs instanceof " << name << "Tie))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -864,7 +864,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
string opName = fixKwd((*r)->name());
@@ -877,9 +877,9 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
out << nl;
out << "public " << retS << nl << opName << '(' << params;
- if (!p->isLocal())
+ if(!p->isLocal())
{
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -893,14 +893,14 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
writeThrowsClause(scope, throws);
out << sb;
out << nl;
- if (ret)
+ if(ret)
{
out << "return ";
}
out << "_ice_delegate." << opName << '(' << args;
- if (!p->isLocal())
+ if(!p->isLocal())
{
- if (!args.empty())
+ if(!args.empty())
{
out << ", ";
}
@@ -934,7 +934,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped);
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -944,15 +944,15 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Local interfaces map to Java interfaces
//
- if (p->isInterface())
+ if(p->isInterface())
{
out << sp << nl << "public interface " << name << " extends ";
out.useCurrentPosAsIndent();
out << name << "Operations";
- if (!bases.empty())
+ if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
out << ',' << nl << getAbsolute((*q)->scoped(), scope);
q++;
@@ -963,15 +963,15 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
out << sp << nl << "public ";
- if (p->isAbstract())
+ if(p->isAbstract())
{
out << "abstract ";
}
out << "class " << name;
out.useCurrentPosAsIndent();
- if (bases.empty() || bases.front()->isInterface())
+ if(bases.empty() || bases.front()->isInterface())
{
- if (p->isLocal())
+ if(p->isLocal())
{
out << " extends Ice.LocalObject";
}
@@ -992,33 +992,33 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
// Implement interfaces
//
StringList implements;
- if (p->isAbstract())
+ if(p->isAbstract())
{
implements.push_back(name + "Operations");
}
- if (!bases.empty())
+ if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
implements.push_back(getAbsolute((*q)->scoped(), scope));
q++;
}
}
- if (_clone && !p->isAbstract())
+ if(_clone && !p->isAbstract())
{
implements.push_back("java.lang.Cloneable");
}
- if (!implements.empty())
+ if(!implements.empty())
{
out << nl << " implements ";
out.useCurrentPosAsIndent();
StringList::const_iterator q = implements.begin();
- while (q != implements.end())
+ while(q != implements.end())
{
- if (q != implements.begin())
+ if(q != implements.begin())
{
out << nl << ',';
}
@@ -1037,13 +1037,13 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// hashCode
//
- if (!p->isInterface())
+ if(!p->isInterface())
{
bool baseHasDataMembers = false;
ClassList l = p->bases();
- while (!l.empty() && !l.front()->isInterface())
+ while(!l.empty() && !l.front()->isInterface())
{
- if (l.front()->hasDataMembers())
+ if(l.front()->hasDataMembers())
{
baseHasDataMembers = true;
break;
@@ -1051,12 +1051,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
l = l.front()->bases();
}
- if (p->hasDataMembers() || baseHasDataMembers)
+ if(p->hasDataMembers() || baseHasDataMembers)
{
out << sp << nl << "public int"
<< nl << "hashCode()";
out << sb;
- if (p->hasDataMembers())
+ if(p->hasDataMembers())
{
DataMemberList members = p->dataMembers();
DataMemberList::const_iterator d;
@@ -1064,13 +1064,13 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "int __h = 0;";
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
list<string> metaData = (*d)->getMetaData();
writeHashCode(out, (*d)->type(), memberName, iter, metaData);
}
- if (baseHasDataMembers)
+ if(baseHasDataMembers)
{
out << nl << "__h = 5 * __h + super.hashCode();";
}
@@ -1087,7 +1087,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// clone
//
- if (_clone && !p->isAbstract())
+ if(_clone && !p->isAbstract())
{
out << sp << nl << "public java.lang.Object"
<< nl << "clone()";
@@ -1098,15 +1098,15 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
// Perform a shallow copy. Start with the base members.
//
ClassList cl = p->bases();
- while (!cl.empty())
+ while(!cl.empty())
{
- if (cl.front()->isAbstract())
+ if(cl.front()->isAbstract())
{
break;
}
DataMemberList members = cl.front()->dataMembers();
DataMemberList::const_iterator d;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
out << nl << "__result." << memberName << " = " << memberName << ';';
@@ -1117,7 +1117,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList members = p->dataMembers();
DataMemberList::const_iterator d;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
out << nl << "__result." << memberName << " = " << memberName << ';';
@@ -1127,7 +1127,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
}
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
out << sp;
out << nl << "private static class __F implements Ice.ObjectFactory";
@@ -1149,7 +1149,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
}
- if (!p->isInterface() && !p->isLocal())
+ if(!p->isInterface() && !p->isLocal())
{
//
// __dispatch, etc.
@@ -1167,7 +1167,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
<< nl << "__write(IceInternal.BasicStream __os)";
out << sb;
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
list<string> metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, scope, (*d)->type(), fixKwd((*d)->name()), true, iter, false, metaData);
@@ -1182,7 +1182,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
<< nl << "__read(IceInternal.BasicStream __is)";
out << sb;
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
list<string> metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, scope, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData);
@@ -1197,7 +1197,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "super.__marshal(__os);"; // Base must come first (due to schema rules).
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string s = (*d)->name();
list<string> metaData = (*d)->getMetaData();
@@ -1213,7 +1213,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "super.__unmarshal(__is);"; // Base must come first (due to schema rules).
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string s = (*d)->name();
list<string> metaData = (*d)->getMetaData();
@@ -1254,7 +1254,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped);
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -1263,9 +1263,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
out << sp << nl << "public class " << name << " extends ";
- if (!base)
+ if(!base)
{
- if (p->isLocal())
+ if(p->isLocal())
{
out << "Ice.LocalException";
}
@@ -1285,7 +1285,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
out << nl << "return \"" << scoped.substr(2) << "\";";
out << eb;
- if (!p->isLocal())
+ if(!p->isLocal())
{
ExceptionList allBases = p->allBases();
StringList exceptionIds;
@@ -1300,10 +1300,10 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
out << sp << nl << "private static final String[] __exceptionIds =";
out << sb;
q = exceptionIds.begin();
- while (q != exceptionIds.end())
+ while(q != exceptionIds.end())
{
out << nl << '"' << *q << '"';
- if (++q != exceptionIds.end())
+ if(++q != exceptionIds.end())
{
out << ',';
}
@@ -1323,7 +1323,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
Output& out = output();
- if (!p->isLocal())
+ if(!p->isLocal())
{
string name = fixKwd(p->name());
string scoped = p->scoped();
@@ -1341,12 +1341,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
<< nl << "__write(IceInternal.BasicStream __os)";
out << sb;
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
list<string> metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, scope, (*d)->type(), fixKwd((*d)->name()), true, iter, false, metaData);
}
- if (base)
+ if(base)
{
out << nl << "super.__write(__os);";
}
@@ -1359,12 +1359,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
<< nl << "__read(IceInternal.BasicStream __is)";
out << sb;
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
list<string> metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, scope, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData);
}
- if (base)
+ if(base)
{
out << nl << "super.__read(__is);";
}
@@ -1376,12 +1376,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp << nl << "public void"
<< nl << "__marshal(Ice.Stream __os)";
out << sb;
- if (base)
+ if(base)
{
out << nl << "super.__marshal(__os);"; // Base must come first (due to schema rules).
}
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string s = (*d)->name();
list<string> metaData = (*d)->getMetaData();
@@ -1396,12 +1396,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp << nl << "public void"
<< nl << "__unmarshal(Ice.Stream __is)";
out << sb;
- if (base)
+ if(base)
{
out << nl << "super.__unmarshal(__is);"; // Base must come first (due to schema rules).
}
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string s = (*d)->name();
list<string> metaData = (*d)->getMetaData();
@@ -1432,7 +1432,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
string scoped = p->scoped();
string absolute = getAbsolute(scoped);
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -1440,7 +1440,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
Output& out = output();
out << sp << nl << "public final class " << name;
- if (_clone)
+ if(_clone)
{
out << " implements java.lang.Cloneable";
}
@@ -1462,7 +1462,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
string typeS = typeToString(p, TypeModeIn, scope);
- if (!members.empty())
+ if(!members.empty())
{
//
// equals
@@ -1478,15 +1478,15 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << nl << "catch (ClassCastException ex)";
out << sb;
out << eb;
- out << sp << nl << "if (_r != null)";
+ out << sp << nl << "if(_r != null)";
out << sb;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
BuiltinPtr b = BuiltinPtr::dynamicCast((*d)->type());
- if (b)
+ if(b)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
case Builtin::KindBool:
@@ -1496,7 +1496,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
case Builtin::KindFloat:
case Builtin::KindDouble:
{
- out << nl << "if (" << memberName << " != _r." << memberName << ")";
+ out << nl << "if(" << memberName << " != _r." << memberName << ")";
out << sb;
out << nl << "return false;";
out << eb;
@@ -1508,7 +1508,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
case Builtin::KindObjectProxy:
case Builtin::KindLocalObject:
{
- out << nl << "if (!" << memberName << ".equals(_r." << memberName << "))";
+ out << nl << "if(!" << memberName << ".equals(_r." << memberName << "))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -1518,7 +1518,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
else
{
- out << nl << "if (!" << memberName << ".equals(_r." << memberName << "))";
+ out << nl << "if(!" << memberName << ".equals(_r." << memberName << "))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -1537,7 +1537,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sb;
out << nl << "int __h = 0;";
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
list<string> metaData = (*d)->getMetaData();
@@ -1550,7 +1550,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
//
// clone()
//
- if (_clone)
+ if(_clone)
{
string name = fixKwd(p->name());
@@ -1563,7 +1563,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
// Perform a shallow copy.
//
DataMemberList::const_iterator d;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
out << nl << "__result." << memberName << " = " << memberName << ';';
@@ -1573,7 +1573,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
}
- if (!p->isLocal())
+ if(!p->isLocal())
{
//
// __write
@@ -1581,7 +1581,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sp << nl << "public final void" << nl << "__write(IceInternal.BasicStream __os)";
out << sb;
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
list<string> metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, scope, (*d)->type(), fixKwd((*d)->name()), true, iter, false, metaData);
@@ -1594,7 +1594,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sp << nl << "public final void" << nl << "__read(IceInternal.BasicStream __is)";
out << sb;
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
list<string> metaData = (*d)->getMetaData();
writeMarshalUnmarshalCode(out, scope, (*d)->type(), fixKwd((*d)->name()), false, iter, false, metaData);
@@ -1609,7 +1609,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sb;
out << nl << "__os.startWriteStruct(__name);";
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string s = (*d)->name();
list<string> metaData = (*d)->getMetaData();
@@ -1627,7 +1627,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sb;
out << nl << "__is.startReadStruct(__name);";
iter = 0;
- for (d = members.begin(); d != members.end(); ++d)
+ for(d = members.begin(); d != members.end(); ++d)
{
string s = (*d)->name();
list<string> metaData = (*d)->getMetaData();
@@ -1664,7 +1664,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
EnumeratorList::const_iterator en;
int sz = enumerators.size();
- if (!open(absolute))
+ if(!open(absolute))
{
return;
}
@@ -1678,7 +1678,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "private int __value;";
out << sp;
int n;
- for (en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
+ for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n)
{
string member = fixKwd((*en)->name());
out << nl << "public static final int _" << member << " = "
@@ -1704,7 +1704,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "__values[val] = this;";
out << eb;
- if (!p->isLocal())
+ if(!p->isLocal())
{
//
// __write
@@ -1712,11 +1712,11 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << sp << nl << "public final void" << nl
<< "__write(IceInternal.BasicStream __os)";
out << sb;
- if (sz <= 0x7f)
+ if(sz <= 0x7f)
{
out << nl << "__os.writeByte((byte)__value);";
}
- else if (sz <= 0x7fff)
+ else if(sz <= 0x7fff)
{
out << nl << "__os.writeShort((short)__value);";
}
@@ -1732,11 +1732,11 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << sp << nl << "public static " << name << nl
<< "__read(IceInternal.BasicStream __is)";
out << sb;
- if (sz <= 0x7f)
+ if(sz <= 0x7f)
{
out << nl << "int __v = __is.readByte();";
}
- else if (sz <= 0x7fff)
+ else if(sz <= 0x7fff)
{
out << nl << "int __v = __is.readShort();";
}
@@ -1750,10 +1750,10 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << sp << nl << "final static private String[] __T =";
out << sb;
en = enumerators.begin();
- while (en != enumerators.end())
+ while(en != enumerators.end())
{
out << nl << "\"" << (*en)->name() << "\"";
- if (++en != enumerators.end())
+ if(++en != enumerators.end())
{
out << ',';
}
@@ -1794,12 +1794,12 @@ Slice::Gen::HolderVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDeclPtr decl = p->declaration();
writeHolder(decl);
- if (!p->isLocal())
+ if(!p->isLocal())
{
string name = fixKwd(p->name());
string absolute = getAbsolute(p->scoped());
- if (open(absolute + "PrxHolder"))
+ if(open(absolute + "PrxHolder"))
{
Output& out = output();
out << sp << nl << "public final class " << name << "PrxHolder";
@@ -1854,7 +1854,7 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
string absolute = getAbsolute(contained->scoped());
string holder = absolute + "Holder";
- if (open(holder))
+ if(open(holder))
{
Output& out = output();
string typeS = typeToString(p, TypeModeIn, contained->scope());
@@ -1882,7 +1882,7 @@ Slice::Gen::HelperVisitor::HelperVisitor(const string& dir,
bool
Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -1896,7 +1896,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped);
- if (!open(absolute + "PrxHelper"))
+ if(!open(absolute + "PrxHelper"))
{
return false;
}
@@ -1917,7 +1917,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = (*r);
string opName = fixKwd(op->name());
@@ -1942,12 +1942,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
writeThrowsClause(scope, throws);
out << sb;
out << nl;
- if (ret)
+ if(ret)
{
out << "return ";
}
out << opName << '(' << args;
- if (!args.empty())
+ if(!args.empty())
{
out << ", ";
}
@@ -1957,7 +1957,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
out << nl;
out << "public final " << retS << nl << opName << '(' << params;
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -1965,7 +1965,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
writeThrowsClause(scope, throws);
out << sb;
out << nl << "int __cnt = 0;";
- out << nl << "while (true)";
+ out << nl << "while(true)";
out << sb;
out << nl << "Ice._ObjectDel __delBase = __getDelegate();";
out << nl << '_' << name << "Del __del = (_" << name
@@ -1973,17 +1973,17 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "try";
out << sb;
out << nl;
- if (ret)
+ if(ret)
{
out << "return ";
}
out << "__del." << opName << '(' << args;
- if (!args.empty())
+ if(!args.empty())
{
out << ", ";
}
out << "__context);";
- if (!ret)
+ if(!ret)
{
out << nl << "return;";
}
@@ -1996,7 +1996,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
list<string> metaData = op->getMetaData();
bool nonmutating = find(metaData.begin(), metaData.end(), "nonmutating") != metaData.end();
- if (nonmutating)
+ if(nonmutating)
{
out << nl << "__cnt = __handleException(__ex.get(), __cnt);";
}
@@ -2026,9 +2026,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
<< nl << "checkedCast(Ice.ObjectPrx p, String facet)";
out << sb;
out << nl << name << "Prx result = null;";
- out << nl << "if (p != null)";
+ out << nl << "if(p != null)";
out << sb;
- out << nl << "if (facet.equals(p.ice_getFacet()))";
+ out << nl << "if(facet.equals(p.ice_getFacet()))";
out << sb;
out << nl << "try";
out << sb;
@@ -2036,7 +2036,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
out << nl << "catch (ClassCastException ex)";
out << sb;
- out << nl << "if (p.ice_isA(\"" << scoped << "\"))";
+ out << nl << "if(p.ice_isA(\"" << scoped << "\"))";
out << sb;
out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
out << nl << "h.__copyFrom(p);";
@@ -2049,7 +2049,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "Ice.ObjectPrx pp = p.ice_newFacet(facet);";
out << nl << "try";
out << sb;
- out << nl << "if (pp.ice_isA(\"" << scoped << "\"))";
+ out << nl << "if(pp.ice_isA(\"" << scoped << "\"))";
out << sb;
out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
out << nl << "h.__copyFrom(pp);";
@@ -2078,9 +2078,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
<< nl << "uncheckedCast(Ice.ObjectPrx p, String facet)";
out << sb;
out << nl << name << "Prx result = null;";
- out << nl << "if (p != null)";
+ out << nl << "if(p != null)";
out << sb;
- out << nl << "if (facet.equals(p.ice_getFacet()))";
+ out << nl << "if(facet.equals(p.ice_getFacet()))";
out << sb;
out << nl << "try";
out << sb;
@@ -2139,7 +2139,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
<< nl << "__read(IceInternal.BasicStream __is)";
out << sb;
out << nl << "Ice.ObjectPrx proxy = __is.readProxy();";
- out << nl << "if (proxy != null)";
+ out << nl << "if(proxy != null)";
out << sb;
out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
out << nl << "result.__copyFrom(proxy);";
@@ -2164,7 +2164,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
<< nl << "ice_unmarshal(String __name, Ice.Stream __is)";
out << sb;
out << nl << "Ice.ObjectPrx proxy = __is.readProxy(__name);";
- out << nl << "if (proxy != null)";
+ out << nl << "if(proxy != null)";
out << sb;
out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
out << nl << "result.__copyFrom(proxy);";
@@ -2185,7 +2185,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
//
// Don't generate helper for a sequence of a local type
//
- if (p->isLocal())
+ if(p->isLocal())
{
return;
}
@@ -2196,7 +2196,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
string scope = p->scope();
string typeS = typeToString(p, TypeModeIn, scope);
- if (open(helper))
+ if(open(helper))
{
Output& out = output();
int iter;
@@ -2259,7 +2259,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
//
// Don't generate helper for a dictionary containing a local type
//
- if (p->isLocal())
+ if(p->isLocal())
{
return;
}
@@ -2270,7 +2270,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
string absolute = getAbsolute(p->scoped());
string helper = absolute + "Helper";
- if (open(helper))
+ if(open(helper))
{
Output& out = output();
string name = fixKwd(p->name());
@@ -2290,16 +2290,16 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sb;
out << nl << "__os.writeSize(__v.size());";
out << nl << "java.util.Iterator __i = __v.entrySet().iterator();";
- out << nl << "while (__i.hasNext())";
+ out << nl << "while(__i.hasNext())";
out << sb;
out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i.next();";
iter = 0;
- for (i = 0; i < 2; i++)
+ for(i = 0; i < 2; i++)
{
string val;
string arg;
TypePtr type;
- if (i == 0)
+ if(i == 0)
{
arg = "__e.getKey()";
type = key;
@@ -2311,9 +2311,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if (b)
+ if(b)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -2364,7 +2364,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
}
}
- if (val.empty())
+ if(val.empty())
{
val = "((" + typeToString(type, TypeModeIn, scope) + ")" + arg + ")";
}
@@ -2381,14 +2381,14 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sb;
out << nl << "int __sz = __is.readSize();";
out << nl << "java.util.Map __r = new java.util.HashMap(__sz);";
- out << nl << "for (int __i = 0; __i < __sz; __i++)";
+ out << nl << "for(int __i = 0; __i < __sz; __i++)";
out << sb;
iter = 0;
- for (i = 0; i < 2; i++)
+ for(i = 0; i < 2; i++)
{
string arg;
TypePtr type;
- if (i == 0)
+ if(i == 0)
{
arg = "__key";
type = key;
@@ -2400,9 +2400,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if (b)
+ if(b)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -2480,18 +2480,18 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sb;
out << nl << "__os.startWriteDictionary(__name, __v.size());";
out << nl << "java.util.Iterator __i = __v.entrySet().iterator();";
- out << nl << "while (__i.hasNext())";
+ out << nl << "while(__i.hasNext())";
out << sb;
out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i.next();";
out << nl << "__os.startWriteDictionaryElement();";
iter = 0;
- for (i = 0; i < 2; i++)
+ for(i = 0; i < 2; i++)
{
string val;
string arg;
TypePtr type;
string tag;
- if (i == 0)
+ if(i == 0)
{
arg = "__e.getKey()";
type = key;
@@ -2505,9 +2505,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if (b)
+ if(b)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -2558,7 +2558,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
}
}
- if (val.empty())
+ if(val.empty())
{
val = "((" + typeToString(type, TypeModeIn, scope) + ")" + arg + ")";
}
@@ -2576,16 +2576,16 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sb;
out << nl << "int __sz = __is.startReadDictionary(__name);";
out << nl << "java.util.Map __r = new java.util.HashMap(__sz);";
- out << nl << "for (int __i = 0; __i < __sz; __i++)";
+ out << nl << "for(int __i = 0; __i < __sz; __i++)";
out << sb;
out << nl << "__is.startReadDictionaryElement();";
iter = 0;
- for (i = 0; i < 2; i++)
+ for(i = 0; i < 2; i++)
{
string arg;
TypePtr type;
string tag;
- if (i == 0)
+ if(i == 0)
{
arg = "__key";
type = key;
@@ -2599,9 +2599,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if (b)
+ if(b)
{
- switch (b->kind())
+ switch(b->kind())
{
case Builtin::KindByte:
{
@@ -2695,7 +2695,7 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir,
bool
Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -2706,7 +2706,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped);
- if (!open(absolute + "Prx"))
+ if(!open(absolute + "Prx"))
{
return false;
}
@@ -2717,7 +2717,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
// Generate a Java interface as the user-visible type
//
out << sp << nl << "public interface " << name << "Prx extends ";
- if (bases.empty())
+ if(bases.empty())
{
out << "Ice.ObjectPrx";
}
@@ -2725,10 +2725,10 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out.useCurrentPosAsIndent();
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
out << getAbsolute((*q)->scoped(), scope) << "Prx";
- if (++q != bases.end())
+ if(++q != bases.end())
{
out << ',' << nl;
}
@@ -2779,7 +2779,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << ';';
out << nl;
out << "public " << retS << ' ' << name << '(' << params;
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -2797,7 +2797,7 @@ Slice::Gen::DelegateVisitor::DelegateVisitor(const string& dir,
bool
Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -2808,7 +2808,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped, "", "_", "Del");
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -2817,7 +2817,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp << nl << "public interface _" << name
<< "Del extends ";
- if (bases.empty())
+ if(bases.empty())
{
out << "Ice._ObjectDel";
}
@@ -2825,10 +2825,10 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out.useCurrentPosAsIndent();
ClassList::const_iterator q = bases.begin();
- while (q != bases.end())
+ while(q != bases.end())
{
out << getAbsolute((*q)->scoped(), scope, "_", "Del");
- if (++q != bases.end())
+ if(++q != bases.end())
{
out << ',' << nl;
}
@@ -2841,7 +2841,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->operations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = (*r);
string opName = fixKwd(op->name());
@@ -2857,7 +2857,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
out << nl;
out << retS << ' ' << opName << '(' << params;
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -2881,7 +2881,7 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(const string& dir,
bool
Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -2892,7 +2892,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped, "", "_", "DelM");
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -2906,7 +2906,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = (*r);
string opName = fixKwd(op->name());
@@ -2934,7 +2934,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
out << nl;
out << "public " << retS << nl << opName << '(' << params;
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -2947,23 +2947,23 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
<< (nonmutating ? "true" : "false") << ", __context);";
out << nl << "try";
out << sb;
- if (!inParams.empty())
+ if(!inParams.empty())
{
out << nl << "IceInternal.BasicStream __os = __out.os();";
}
- if (!outParams.empty() || ret || throws.size() > 0)
+ if(!outParams.empty() || ret || throws.size() > 0)
{
out << nl << "IceInternal.BasicStream __is = __out.is();";
}
iter = 0;
- for (q = inParams.begin(); q != inParams.end(); ++q)
+ for(q = inParams.begin(); q != inParams.end(); ++q)
{
writeMarshalUnmarshalCode(out, scope, q->first, fixKwd(q->second),
true, iter);
}
- out << nl << "if (!__out.invoke())";
+ out << nl << "if(!__out.invoke())";
out << sb;
- if (throws.size() > 0)
+ if(throws.size() > 0)
{
//
// The try/catch block is necessary because throwException()
@@ -2974,9 +2974,9 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "final String[] __throws =";
out << sb;
ExceptionList::const_iterator r;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
- if (r != throws.begin())
+ if(r != throws.begin())
{
out << ",";
}
@@ -2984,10 +2984,10 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << eb;
out << ';';
- out << nl << "switch (__is.throwException(__throws))";
+ out << nl << "switch(__is.throwException(__throws))";
out << sb;
int count = 0;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
out << nl << "case " << count << ':';
out << sb;
@@ -3000,7 +3000,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << eb;
out << eb;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
out << nl << "catch (" << getAbsolute((*r)->scoped(), scope)
<< " __ex)";
@@ -3015,13 +3015,13 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "throw new Ice.UnknownUserException();";
out << eb;
- for (q = outParams.begin(); q != outParams.end(); ++q)
+ for(q = outParams.begin(); q != outParams.end(); ++q)
{
writeMarshalUnmarshalCode(out, scope, q->first, fixKwd(q->second),
false, iter, true);
}
- if (ret)
+ if(ret)
{
out << nl << retS << " __ret;";
writeMarshalUnmarshalCode(out, scope, ret, "__ret", false, iter);
@@ -3052,7 +3052,7 @@ Slice::Gen::DelegateDVisitor::DelegateDVisitor(const string& dir,
bool
Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal())
+ if(p->isLocal())
{
return false;
}
@@ -3063,7 +3063,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped, "", "_", "DelD");
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -3077,7 +3077,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = (*r);
string opName = fixKwd(op->name());
@@ -3104,7 +3104,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
out << nl;
out << "public " << retS << nl << opName << '(' << params;
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -3116,7 +3116,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "Ice.Current __current = new Ice.Current();";
out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << (nonmutating ? "true" : "false")
<< ", __context);";
- out << nl << "while (true)";
+ out << nl << "while(true)";
out << sb;
out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__adapter, __current);";
out << nl << "try";
@@ -3135,23 +3135,23 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "try";
out << sb;
out << nl;
- if (ret)
+ if(ret)
{
out << "return ";
}
out << "__servant." << opName << '(' << args;
- if (!args.empty())
+ if(!args.empty())
{
out << ", ";
}
out << "__current);";
- if (!ret)
+ if(!ret)
{
out << nl << "return;";
}
out << eb;
ExceptionList::const_iterator r;
- for (r = throws.begin(); r != throws.end(); ++r)
+ for(r = throws.begin(); r != throws.end(); ++r)
{
out << nl << "catch (" << getAbsolute((*r)->scoped(), scope) << " __ex)";
out << sb;
@@ -3198,7 +3198,7 @@ Slice::Gen::DispatcherVisitor::DispatcherVisitor(const string& dir,
bool
Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (p->isLocal() || !p->isInterface())
+ if(p->isLocal() || !p->isInterface())
{
return false;
}
@@ -3209,7 +3209,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped, "", "_", "Disp");
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -3238,9 +3238,9 @@ void
Slice::Gen::BaseImplVisitor::writeReturn(Output& out, const TypePtr& type)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if (builtin)
+ if(builtin)
{
- switch (builtin->kind())
+ switch(builtin->kind())
{
case Builtin::KindBool:
{
@@ -3298,9 +3298,9 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& scope, co
string params = getParams(op, scope);
out << sp << nl << "public " << retS << nl << opName << "(" << params;
- if (!local)
+ if(!local)
{
- if (!params.empty())
+ if(!params.empty())
{
out << ", ";
}
@@ -3318,7 +3318,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& scope, co
//
// Return value
//
- if (ret)
+ if(ret)
{
writeReturn(out, ret);
}
@@ -3335,7 +3335,7 @@ Slice::Gen::ImplVisitor::ImplVisitor(const string& dir,
bool
Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
return false;
}
@@ -3346,7 +3346,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped, "", "", "I");
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -3354,9 +3354,9 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
Output& out = output();
out << sp << nl << "public final class " << name << 'I';
- if (p->isInterface())
+ if(p->isInterface())
{
- if (p->isLocal())
+ if(p->isLocal())
{
out << " implements " << name;
}
@@ -3378,7 +3378,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
writeOperation(out, scope, *r, p->isLocal());
}
@@ -3398,7 +3398,7 @@ Slice::Gen::ImplTieVisitor::ImplTieVisitor(const string& dir,
bool
Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if (!p->isAbstract())
+ if(!p->isAbstract())
{
return false;
}
@@ -3409,7 +3409,7 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
string scope = p->scope();
string absolute = getAbsolute(scoped, "", "", "I");
- if (!open(absolute))
+ if(!open(absolute))
{
return false;
}
@@ -3426,7 +3426,7 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
bool inheritImpl = (!p->isInterface() && !bases.empty() && !bases.front()->isInterface()) || (bases.size() == 1);
out << sp << nl << "public class " << name << 'I';
- if (inheritImpl)
+ if(inheritImpl)
{
out << " extends " << fixKwd(bases.front()->name()) << 'I';
}
@@ -3441,16 +3441,16 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
ops.sort();
OperationList baseOps;
- if (inheritImpl)
+ if(inheritImpl)
{
baseOps = bases.front()->allOperations();
baseOps.sort();
}
OperationList::const_iterator r;
- for (r = ops.begin(); r != ops.end(); ++r)
+ for(r = ops.begin(); r != ops.end(); ++r)
{
- if (inheritImpl && binary_search(baseOps.begin(), baseOps.end(), *r))
+ if(inheritImpl && binary_search(baseOps.begin(), baseOps.end(), *r))
{
out << sp;
out << nl << "/*";
diff --git a/cpp/src/slice2java/Gen.h b/cpp/src/slice2java/Gen.h
index 02e6128317e..e08e1a08ccc 100644
--- a/cpp/src/slice2java/Gen.h
+++ b/cpp/src/slice2java/Gen.h
@@ -1,244 +1,244 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GEN_H
-#define GEN_H
-
-#include <Slice/JavaUtil.h>
-
-namespace Slice
-{
-
-class JavaVisitor : public JavaGenerator, public ParserVisitor
-{
-public:
-
- virtual ~JavaVisitor();
-
-protected:
-
- JavaVisitor(const std::string&, const std::string&);
-
- //
- // Compose the parameter list for an operation
- //
- std::string getParams(const OperationPtr&, const std::string&);
-
- //
- // Compose the argument list for an operation
- //
- std::string getArgs(const OperationPtr&, const std::string&);
-
- //
- // Generate a throws clause containing only non-local exceptions
- //
- void writeThrowsClause(const std::string&, const ExceptionList&);
-
- //
- // Generate a throws clause for delegate operations containing only
- // non-local exceptions
- //
- void writeDelegateThrowsClause(const std::string&, const ExceptionList&);
-
- //
- // Generate code to compute a hash code for a type
- //
- void writeHashCode(::IceUtil::Output&, const TypePtr&, const std::string&, int&,
- const std::list<std::string>& = std::list<std::string>());
-
- //
- // Generate dispatch methods for a class or interface
- //
- void writeDispatch(::IceUtil::Output&, const ClassDefPtr&);
-};
-
-class Gen : public ::IceUtil::noncopyable
-{
-public:
-
- Gen(const std::string&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&,
- const std::string&,
- bool);
- ~Gen();
-
- bool operator!() const; // Returns true if there was a constructor error
-
- void generate(const UnitPtr&);
- void generateTie(const UnitPtr&);
- void generateImpl(const UnitPtr&);
- void generateImplTie(const UnitPtr&);
-
-private:
-
- std::string _base;
- std::vector<std::string> _includePaths;
- std::string _package;
- std::string _dir;
- bool _clone;
-
- class OpsVisitor : public JavaVisitor
- {
- public:
-
- OpsVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
- };
-
- class TieVisitor : public JavaVisitor
- {
- public:
-
- TieVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class TypesVisitor : public JavaVisitor
- {
- public:
-
- TypesVisitor(const std::string&, const std::string&, bool);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
-
- private:
-
- bool _clone;
- };
-
- class HolderVisitor : public JavaVisitor
- {
- public:
-
- HolderVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
-
- private:
-
- void writeHolder(const TypePtr&);
- };
-
- class HelperVisitor : public JavaVisitor
- {
- public:
-
- HelperVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- };
-
- class ProxyVisitor : public JavaVisitor
- {
- public:
-
- ProxyVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual void visitOperation(const OperationPtr&);
- };
-
- class DelegateVisitor : public JavaVisitor
- {
- public:
-
- DelegateVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class DelegateMVisitor : public JavaVisitor
- {
- public:
-
- DelegateMVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class DelegateDVisitor : public JavaVisitor
- {
- public:
-
- DelegateDVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class DispatcherVisitor : public JavaVisitor
- {
- public:
-
- DispatcherVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class BaseImplVisitor : public JavaVisitor
- {
- protected:
-
- //
- // Generate code to return a value
- //
- void writeReturn(::IceUtil::Output&, const TypePtr&);
-
- //
- // Generate an operation
- //
- void writeOperation(::IceUtil::Output&, const std::string&, const OperationPtr&, bool);
-
- public:
-
- BaseImplVisitor(const std::string&, const std::string&);
- };
-
- class ImplVisitor : public BaseImplVisitor
- {
- public:
-
- ImplVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class ImplTieVisitor : public BaseImplVisitor
- {
- public:
-
- ImplTieVisitor(const std::string&, const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GEN_H
+#define GEN_H
+
+#include <Slice/JavaUtil.h>
+
+namespace Slice
+{
+
+class JavaVisitor : public JavaGenerator, public ParserVisitor
+{
+public:
+
+ virtual ~JavaVisitor();
+
+protected:
+
+ JavaVisitor(const std::string&, const std::string&);
+
+ //
+ // Compose the parameter list for an operation
+ //
+ std::string getParams(const OperationPtr&, const std::string&);
+
+ //
+ // Compose the argument list for an operation
+ //
+ std::string getArgs(const OperationPtr&, const std::string&);
+
+ //
+ // Generate a throws clause containing only non-local exceptions
+ //
+ void writeThrowsClause(const std::string&, const ExceptionList&);
+
+ //
+ // Generate a throws clause for delegate operations containing only
+ // non-local exceptions
+ //
+ void writeDelegateThrowsClause(const std::string&, const ExceptionList&);
+
+ //
+ // Generate code to compute a hash code for a type
+ //
+ void writeHashCode(::IceUtil::Output&, const TypePtr&, const std::string&, int&,
+ const std::list<std::string>& = std::list<std::string>());
+
+ //
+ // Generate dispatch methods for a class or interface
+ //
+ void writeDispatch(::IceUtil::Output&, const ClassDefPtr&);
+};
+
+class Gen : public ::IceUtil::noncopyable
+{
+public:
+
+ Gen(const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&,
+ const std::string&,
+ bool);
+ ~Gen();
+
+ bool operator!() const; // Returns true if there was a constructor error
+
+ void generate(const UnitPtr&);
+ void generateTie(const UnitPtr&);
+ void generateImpl(const UnitPtr&);
+ void generateImplTie(const UnitPtr&);
+
+private:
+
+ std::string _base;
+ std::vector<std::string> _includePaths;
+ std::string _package;
+ std::string _dir;
+ bool _clone;
+
+ class OpsVisitor : public JavaVisitor
+ {
+ public:
+
+ OpsVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ };
+
+ class TieVisitor : public JavaVisitor
+ {
+ public:
+
+ TieVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class TypesVisitor : public JavaVisitor
+ {
+ public:
+
+ TypesVisitor(const std::string&, const std::string&, bool);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+
+ private:
+
+ bool _clone;
+ };
+
+ class HolderVisitor : public JavaVisitor
+ {
+ public:
+
+ HolderVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+
+ private:
+
+ void writeHolder(const TypePtr&);
+ };
+
+ class HelperVisitor : public JavaVisitor
+ {
+ public:
+
+ HelperVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ };
+
+ class ProxyVisitor : public JavaVisitor
+ {
+ public:
+
+ ProxyVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ };
+
+ class DelegateVisitor : public JavaVisitor
+ {
+ public:
+
+ DelegateVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class DelegateMVisitor : public JavaVisitor
+ {
+ public:
+
+ DelegateMVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class DelegateDVisitor : public JavaVisitor
+ {
+ public:
+
+ DelegateDVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class DispatcherVisitor : public JavaVisitor
+ {
+ public:
+
+ DispatcherVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class BaseImplVisitor : public JavaVisitor
+ {
+ protected:
+
+ //
+ // Generate code to return a value
+ //
+ void writeReturn(::IceUtil::Output&, const TypePtr&);
+
+ //
+ // Generate an operation
+ //
+ void writeOperation(::IceUtil::Output&, const std::string&, const OperationPtr&, bool);
+
+ public:
+
+ BaseImplVisitor(const std::string&, const std::string&);
+ };
+
+ class ImplVisitor : public BaseImplVisitor
+ {
+ public:
+
+ ImplVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class ImplTieVisitor : public BaseImplVisitor
+ {
+ public:
+
+ ImplTieVisitor(const std::string&, const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+};
+
+}
+
+#endif
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp
index 94103c2f0f0..9b180d6caba 100644
--- a/cpp/src/slice2java/Main.cpp
+++ b/cpp/src/slice2java/Main.cpp
@@ -50,62 +50,62 @@ main(int argc, char* argv[])
bool debug = false;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if (path.length())
+ if(path.length())
{
includePaths.push_back(path);
}
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 ||
+ else if(strncmp(argv[idx], "-D", 2) == 0 ||
strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 ||
+ else if(strcmp(argv[idx], "-h") == 0 ||
strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 ||
+ else if(strcmp(argv[idx], "-v") == 0 ||
strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 ||
+ else if(strcmp(argv[idx], "-d") == 0 ||
strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--output-dir") == 0)
+ else if(strcmp(argv[idx], "--output-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx]
<< "'" << endl;
@@ -114,15 +114,15 @@ main(int argc, char* argv[])
}
output = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--package") == 0)
+ else if(strcmp(argv[idx], "--package") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx]
<< "'" << endl;
@@ -131,49 +131,49 @@ main(int argc, char* argv[])
}
package = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--tie") == 0)
+ else if(strcmp(argv[idx], "--tie") == 0)
{
tie = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--impl") == 0)
+ else if(strcmp(argv[idx], "--impl") == 0)
{
impl = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--impl-tie") == 0)
+ else if(strcmp(argv[idx], "--impl-tie") == 0)
{
implTie = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--clone") == 0)
+ else if(strcmp(argv[idx], "--clone") == 0)
{
clone = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'"
<< endl;
@@ -186,14 +186,14 @@ main(int argc, char* argv[])
}
}
- if (argc < 2)
+ if(argc < 2)
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
- if (impl && implTie)
+ if(impl && implTie)
{
cerr << argv[0] << ": cannot specify both --impl and --impl-tie" << endl;
usage(argv[0]);
@@ -202,17 +202,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for (idx = 1 ; idx < argc ; ++idx)
+ for(idx = 1 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
return EXIT_FAILURE;
@@ -220,7 +220,7 @@ main(int argc, char* argv[])
base.erase(pos);
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << argv[idx]
<< "' for reading: " << strerror(errno) << endl;
@@ -234,7 +234,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: "
<< strerror(errno) << endl;
@@ -250,28 +250,28 @@ main(int argc, char* argv[])
pclose(cppHandle);
#endif
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
else
{
Gen gen(argv[0], base, includePaths, package, output, clone);
- if (!gen)
+ if(!gen)
{
unit->destroy();
return EXIT_FAILURE;
}
gen.generate(unit);
- if (tie)
+ if(tie)
{
gen.generateTie(unit);
}
- if (impl)
+ if(impl)
{
gen.generateImpl(unit);
}
- if (implTie)
+ if(implTie)
{
gen.generateImplTie(unit);
}
diff --git a/cpp/src/slice2wsdl/Gen.cpp b/cpp/src/slice2wsdl/Gen.cpp
index cbaa6984fd8..503975aaf5a 100644
--- a/cpp/src/slice2wsdl/Gen.cpp
+++ b/cpp/src/slice2wsdl/Gen.cpp
@@ -30,16 +30,16 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include,
_dir(dir)
{
_orgName = "http://www.noorg.org"; // TODO: argument!
- for (vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
+ for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
- if (p->length() && (*p)[p->length() - 1] != '/')
+ if(p->length() && (*p)[p->length() - 1] != '/')
{
*p += '/';
}
}
string::size_type pos = _base.rfind('/');
- if (pos != string::npos)
+ if(pos != string::npos)
{
_base.erase(0, pos + 1);
}
@@ -56,13 +56,13 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
//string fileO = _base + ".wsdl";
string fileO = containedToId(p) + p->name() + ".wsdl";
- if (!_dir.empty())
+ if(!_dir.empty())
{
fileO = _dir + '/' + fileO;
}
O.open(fileO.c_str());
- if (!O)
+ if(!O)
{
cerr << _name << ": can't open `" << fileO << "' for writing: " << strerror(errno) << endl;
return false;
@@ -91,7 +91,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
- for (OperationList::const_iterator q = ops.begin(); q != ops.end(); ++q)
+ for(OperationList::const_iterator q = ops.begin(); q != ops.end(); ++q)
{
emitMessage(O, *q);
}
@@ -102,7 +102,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
os << "wsdl:portType name=\"" << scopeId << "PortType\"";
O << se(os.str());
- for (OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
+ for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
{
emitOperation(O, *r);
}
@@ -142,7 +142,7 @@ Slice::Gen::emitMessage(XMLOutput& O, const OperationPtr& p)
O << se(os.str());
list<string> metaData = p->getMetaData();
- for (list<string>::iterator iter = metaData.begin(); iter != metaData.end(); ++iter)
+ for(list<string>::iterator iter = metaData.begin(); iter != metaData.end(); ++iter)
{
O << nl << "<wsdl:part name=\"" << *iter << "\"/>";
}
@@ -195,7 +195,7 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
assert(contained);
string scoped = contained->scope();
- if (scoped[0] == ':')
+ if(scoped[0] == ':')
{
scoped.erase(0, 2);
}
@@ -204,9 +204,9 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
id.reserve(scoped.size());
- for (unsigned int i = 0; i < scoped.size(); ++i)
+ for(unsigned int i = 0; i < scoped.size(); ++i)
{
- if (scoped[i] == ':')
+ if(scoped[i] == ':')
{
id += '.';
++i;
diff --git a/cpp/src/slice2wsdl/Gen.h b/cpp/src/slice2wsdl/Gen.h
index e35402764ad..8192dee73a2 100644
--- a/cpp/src/slice2wsdl/Gen.h
+++ b/cpp/src/slice2wsdl/Gen.h
@@ -1,59 +1,59 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GEN_H
-#define GEN_H
-
-#include <Slice/Parser.h>
-#include <stack>
-
-namespace IceUtil
-{
-
-class XMLOutput;
-
-}
-
-namespace Slice
-{
-
-class Gen : public ::IceUtil::noncopyable, public ParserVisitor
-{
-public:
-
- Gen(const std::string&,
- const std::string&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&);
- virtual ~Gen();
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
-
-private:
-
- void emitMessage(::IceUtil::XMLOutput&, const OperationPtr&);
- void emitOperation(::IceUtil::XMLOutput&, const OperationPtr&);
-
- void printHeader(::IceUtil::XMLOutput&);
-
- std::string containedToId(const ContainedPtr&);
-
- std::string _name;
- std::string _base;
- std::string _include;
- std::string _orgName;
- std::vector<std::string> _includePaths;
- std::string _dir;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GEN_H
+#define GEN_H
+
+#include <Slice/Parser.h>
+#include <stack>
+
+namespace IceUtil
+{
+
+class XMLOutput;
+
+}
+
+namespace Slice
+{
+
+class Gen : public ::IceUtil::noncopyable, public ParserVisitor
+{
+public:
+
+ Gen(const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&);
+ virtual ~Gen();
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+private:
+
+ void emitMessage(::IceUtil::XMLOutput&, const OperationPtr&);
+ void emitOperation(::IceUtil::XMLOutput&, const OperationPtr&);
+
+ void printHeader(::IceUtil::XMLOutput&);
+
+ std::string containedToId(const ContainedPtr&);
+
+ std::string _name;
+ std::string _base;
+ std::string _include;
+ std::string _orgName;
+ std::vector<std::string> _includePaths;
+ std::string _dir;
+};
+
+}
+
+#endif
diff --git a/cpp/src/slice2wsdl/Main.cpp b/cpp/src/slice2wsdl/Main.cpp
index a814b6e514d..507329be3d6 100644
--- a/cpp/src/slice2wsdl/Main.cpp
+++ b/cpp/src/slice2wsdl/Main.cpp
@@ -40,58 +40,58 @@ main(int argc, char* argv[])
vector<string> includePaths;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if (path.length())
+ if(path.length())
{
includePaths.push_back(path);
}
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--include-dir") == 0)
+ else if(strcmp(argv[idx], "--include-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -99,15 +99,15 @@ main(int argc, char* argv[])
}
include = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--output-dir") == 0)
+ else if(strcmp(argv[idx], "--output-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -115,13 +115,13 @@ main(int argc, char* argv[])
}
output = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -133,7 +133,7 @@ main(int argc, char* argv[])
}
}
- if (argc < 2)
+ if(argc < 2)
{
usage(argv[0]);
return EXIT_FAILURE;
@@ -146,12 +146,12 @@ main(int argc, char* argv[])
string base(sourceFile);
string suffix;
string::size_type pos = base.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
unit->destroy();
@@ -160,7 +160,7 @@ main(int argc, char* argv[])
base.erase(pos);
ifstream test(sourceFile.c_str());
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << sourceFile << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -173,7 +173,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: " << strerror(errno) << endl;
unit->destroy();
@@ -189,7 +189,7 @@ main(int argc, char* argv[])
pclose(cppHandle);
#endif
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
@@ -197,17 +197,17 @@ main(int argc, char* argv[])
{
Gen gen(argv[0], base, include, includePaths, output);
- if (argc > 2)
+ if(argc > 2)
{
- for (idx = 2 ; idx < argc; ++idx)
+ for(idx = 2 ; idx < argc; ++idx)
{
ClassDeclPtr classDecl;
TypeList classTypes = unit->lookupType(argv[idx], false);
- if (!classTypes.empty())
+ if(!classTypes.empty())
{
classDecl = ClassDeclPtr::dynamicCast(classTypes.front());
}
- if (!classDecl)
+ if(!classDecl)
{
cerr << argv[0] << ": invalid type: " << argv[idx] << endl;
status = EXIT_FAILURE;
diff --git a/cpp/src/slice2xsd/Gen.cpp b/cpp/src/slice2xsd/Gen.cpp
index 17c0b284383..d529205b505 100644
--- a/cpp/src/slice2xsd/Gen.cpp
+++ b/cpp/src/slice2xsd/Gen.cpp
@@ -25,28 +25,28 @@ Slice::Gen::Gen(const string& name, const string& base, const string& include,
_includePaths(includePaths)
{
_orgName = "http://www.noorg.org"; // TODO: argument!
- for (vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
+ for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
- if (p->length() && (*p)[p->length() - 1] != '/')
+ if(p->length() && (*p)[p->length() - 1] != '/')
{
*p += '/';
}
}
string::size_type pos = _base.rfind('/');
- if (pos != string::npos)
+ if(pos != string::npos)
{
_base.erase(0, pos + 1);
}
string fileO = _base + ".xsd";
- if (!dir.empty())
+ if(!dir.empty())
{
fileO = dir + '/' + fileO;
}
O.open(fileO.c_str());
- if (!O)
+ if(!O)
{
cerr << name << ": can't open `" << fileO << "' for writing: " << strerror(errno) << endl;
return;
@@ -88,7 +88,7 @@ Slice::Gen::generate(const UnitPtr& unit)
O << nl << "<xs:import namespace=\"http://www.mutablerealms.com/schemas\" schemaLocation=\"ice.xsd\"/>";
StringList includes = unit->includeFiles();
- for (StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
+ for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
{
O << sp;
O << nl << "<xs:include schemaLocation=\"" << changeInclude(*q, _includePaths) << ".xsd\"/>";
@@ -120,7 +120,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
string extension = "xs:extension base=\"";
ClassList bases = p->bases();
- if (bases.empty() || bases.front()->isInterface())
+ if(bases.empty() || bases.front()->isInterface())
{
extension += "ice:_internal.object";
}
@@ -136,7 +136,7 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p)
DataMemberList dataMembers = p->dataMembers();
O << se("xs:sequence");
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
emitElement((*q)->name(), (*q)->type());
}
@@ -172,7 +172,7 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
// Emit base Data
//
ExceptionPtr base = p->base();
- if (base)
+ if(base)
{
string baseScopeId = containedToId(base);
@@ -189,14 +189,14 @@ Slice::Gen::visitExceptionStart(const ExceptionPtr& p)
O << se("xs:sequence");
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
emitElement((*q)->name(), (*q)->type());
}
O << ee; // xs:sequence
- if (base)
+ if(base)
{
O << ee; // xs:extension
O << ee; // xs:complexContent
@@ -226,7 +226,7 @@ Slice::Gen::visitStructStart(const StructPtr& p)
DataMemberList dataMembers = p->dataMembers();
O << se("xs:sequence");
- for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
emitElement((*q)->name(), (*q)->type());
}
@@ -260,7 +260,7 @@ Slice::Gen::visitOperation(const OperationPtr& p)
O << se("xs:sequence");
TypeStringList::const_iterator q;
- for (q = in.begin(); q != in.end(); ++q)
+ for(q = in.begin(); q != in.end(); ++q)
{
emitElement(q->second, q->first);
}
@@ -280,12 +280,12 @@ Slice::Gen::visitOperation(const OperationPtr& p)
annotate("operation");
O << se("xs:sequence");
- if (ret)
+ if(ret)
{
emitElement("__return", ret);
//O << nl << "<xs:element name=\"__return\" type=\"" << toString(ret) << "\"/>";
}
- for (q = out.begin(); q != out.end(); ++q)
+ for(q = out.begin(); q != out.end(); ++q)
{
emitElement(q->second, q->first);
}
@@ -313,7 +313,7 @@ Slice::Gen::visitEnum(const EnumPtr& p)
O << se("xs:restriction base=\"xs:string\"");
- for (EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
+ for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
{
O << nl << "<xs:enumeration value=\"" << (*q)->name() << "\"/>";
}
@@ -348,7 +348,7 @@ Slice::Gen::visitSequence(const SequencePtr& p)
<< "\" minOccurs=\"0\" maxOccurs=\"unbounded\"";
O << se(os.str());
ProxyPtr proxy = ProxyPtr::dynamicCast(p->type());
- if (proxy)
+ if(proxy)
{
annotate(proxy->_class()->scoped());
}
@@ -387,7 +387,7 @@ Slice::Gen::visitDictionary(const DictionaryPtr& p)
os << "xs:element name=\"key\" type=\"" << toString(p->keyType()) << "\"";
O << se(os.str());
ProxyPtr proxy = ProxyPtr::dynamicCast(p->keyType());
- if (proxy)
+ if(proxy)
{
annotate(proxy->_class()->scoped());
}
@@ -396,7 +396,7 @@ Slice::Gen::visitDictionary(const DictionaryPtr& p)
os << "xs:element name=\"value\" type=\"" << toString(p->valueType()) << "\"";
O << se(os.str());
proxy = ProxyPtr::dynamicCast(p->valueType());
- if (proxy)
+ if(proxy)
{
annotate(proxy->_class()->scoped());
}
@@ -477,7 +477,7 @@ Slice::Gen::emitElement(const string& name, const TypePtr& type)
os << "xs:element name=\"" << name << "\" type=\"" << toString(type) << '"';
O << se(os.str());
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
- if (proxy)
+ if(proxy)
{
annotate(proxy->_class()->scoped());
}
@@ -490,7 +490,7 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
assert(contained);
string scoped = contained->scope();
- if (scoped[0] == ':')
+ if(scoped[0] == ':')
{
scoped.erase(0, 2);
}
@@ -499,9 +499,9 @@ Slice::Gen::containedToId(const ContainedPtr& contained)
id.reserve(scoped.size());
- for (unsigned int i = 0; i < scoped.size(); ++i)
+ for(unsigned int i = 0; i < scoped.size(); ++i)
{
- if (scoped[i] == ':')
+ if(scoped[i] == ':')
{
id += '.';
++i;
@@ -538,20 +538,20 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p)
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
- if (builtin)
+ if(builtin)
{
s = builtinTable[builtin->kind()];
//tag = "type";
}
ProxyPtr proxy = ProxyPtr::dynamicCast(p);
- if (proxy)
+ if(proxy)
{
s = "ice:_internal.proxyType";
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p);
- if (cl)
+ if(cl)
{
string scopeId = containedToId(cl);
//s = "tns:" + internalId + scopeId + cl->name() + "Type";
@@ -559,42 +559,42 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p)
}
ExceptionPtr ex = ExceptionPtr::dynamicCast(p);
- if (ex)
+ if(ex)
{
string scopeId = containedToId(ex);
s = "tns:" + internalId + scopeId + ex->name() + "Type";
}
StructPtr st = StructPtr::dynamicCast(p);
- if (st)
+ if(st)
{
string scopeId = containedToId(st);
s = "tns:" + internalId + scopeId + st->name() + "Type";
}
EnumeratorPtr en = EnumeratorPtr::dynamicCast(p);
- if (en)
+ if(en)
{
string scopeId = containedToId(en);
s = "tns:" + internalId + scopeId + en->name() + "Type";
}
SequencePtr sq = SequencePtr::dynamicCast(p);
- if (sq)
+ if(sq)
{
string scopeId = containedToId(sq);
s = "tns:" + internalId + scopeId + sq->name() + "Type";
}
DictionaryPtr di = DictionaryPtr::dynamicCast(p);
- if (di)
+ if(di)
{
string scopeId = containedToId(di);
s = "tns:" + internalId + scopeId + di->name() + "Type";
}
EnumPtr em = EnumPtr::dynamicCast(p);
- if (em)
+ if(em)
{
string scopeId = containedToId(em);
s = "tns:" + internalId + scopeId + em->name() + "Type";
diff --git a/cpp/src/slice2xsd/Gen.h b/cpp/src/slice2xsd/Gen.h
index aedc4c3af95..2bfb2d5c9f2 100644
--- a/cpp/src/slice2xsd/Gen.h
+++ b/cpp/src/slice2xsd/Gen.h
@@ -1,63 +1,63 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// MutableRealms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef GEN_H
-#define GEN_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-#include <stack>
-
-namespace Slice
-{
-
-class Gen : public ::IceUtil::noncopyable, public ParserVisitor
-{
-public:
-
- Gen(const std::string&,
- const std::string&,
- const std::string&,
- const std::vector<std::string>&,
- const std::string&);
- virtual ~Gen();
-
- bool operator!() const; // Returns true if there was a constructor error
-
- void generate(const UnitPtr&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
-
-private:
-
- void printHeader();
- void annotate(const ::std::string&);
- void emitElement(const ::std::string&, const TypePtr&);
-
- std::string containedToId(const ContainedPtr&);
- std::string toString(const SyntaxTreeBasePtr&);
-
- ::IceUtil::XMLOutput O;
-
- std::string _base;
- std::string _include;
- std::string _orgName;
- std::vector<std::string> _includePaths;
-};
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef GEN_H
+#define GEN_H
+
+#include <Slice/Parser.h>
+#include <IceUtil/OutputUtil.h>
+#include <stack>
+
+namespace Slice
+{
+
+class Gen : public ::IceUtil::noncopyable, public ParserVisitor
+{
+public:
+
+ Gen(const std::string&,
+ const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&);
+ virtual ~Gen();
+
+ bool operator!() const; // Returns true if there was a constructor error
+
+ void generate(const UnitPtr&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+
+private:
+
+ void printHeader();
+ void annotate(const ::std::string&);
+ void emitElement(const ::std::string&, const TypePtr&);
+
+ std::string containedToId(const ContainedPtr&);
+ std::string toString(const SyntaxTreeBasePtr&);
+
+ ::IceUtil::XMLOutput O;
+
+ std::string _base;
+ std::string _include;
+ std::string _orgName;
+ std::vector<std::string> _includePaths;
+};
+
+}
+
+#endif
diff --git a/cpp/src/slice2xsd/Main.cpp b/cpp/src/slice2xsd/Main.cpp
index ce97a00c8a7..d385e690182 100644
--- a/cpp/src/slice2xsd/Main.cpp
+++ b/cpp/src/slice2xsd/Main.cpp
@@ -40,58 +40,58 @@ main(int argc, char* argv[])
vector<string> includePaths;
int idx = 1;
- while (idx < argc)
+ while(idx < argc)
{
- if (strncmp(argv[idx], "-I", 2) == 0)
+ if(strncmp(argv[idx], "-I", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
string path = argv[idx] + 2;
- if (path.length())
+ if(path.length())
{
includePaths.push_back(path);
}
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
+ else if(strncmp(argv[idx], "-D", 2) == 0 || strncmp(argv[idx], "-U", 2) == 0)
{
cpp += ' ';
cpp += argv[idx];
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ else if(strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
{
usage(argv[0]);
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ else if(strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
{
cout << ICE_STRING_VERSION << endl;
return EXIT_SUCCESS;
}
- else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ else if(strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
{
debug = true;
- for (int i = idx ; i + 1 < argc ; ++i)
+ for(int i = idx ; i + 1 < argc ; ++i)
{
argv[i] = argv[i + 1];
}
--argc;
}
- else if (strcmp(argv[idx], "--include-dir") == 0)
+ else if(strcmp(argv[idx], "--include-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -99,15 +99,15 @@ main(int argc, char* argv[])
}
include = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (strcmp(argv[idx], "--output-dir") == 0)
+ else if(strcmp(argv[idx], "--output-dir") == 0)
{
- if (idx + 1 >= argc)
+ if(idx + 1 >= argc)
{
cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -115,13 +115,13 @@ main(int argc, char* argv[])
}
output = argv[idx + 1];
- for (int i = idx ; i + 2 < argc ; ++i)
+ for(int i = idx ; i + 2 < argc ; ++i)
{
argv[i] = argv[i + 2];
}
argc -= 2;
}
- else if (argv[idx][0] == '-')
+ else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
usage(argv[0]);
@@ -133,7 +133,7 @@ main(int argc, char* argv[])
}
}
- if (argc < 2)
+ if(argc < 2)
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
@@ -142,17 +142,17 @@ main(int argc, char* argv[])
int status = EXIT_SUCCESS;
- for (idx = 1 ; idx < argc ; ++idx)
+ for(idx = 1 ; idx < argc ; ++idx)
{
string base(argv[idx]);
string suffix;
string::size_type pos = base.rfind('.');
- if (pos != string::npos)
+ if(pos != string::npos)
{
suffix = base.substr(pos);
transform(suffix.begin(), suffix.end(), suffix.begin(), tolower);
}
- if (suffix != ".ice")
+ if(suffix != ".ice")
{
cerr << argv[0] << ": input files must end with `.ice'" << endl;
unit->destroy();
@@ -161,7 +161,7 @@ main(int argc, char* argv[])
base.erase(pos);
ifstream test(argv[idx]);
- if (!test)
+ if(!test)
{
cerr << argv[0] << ": can't open `" << argv[idx] << "' for reading: " << strerror(errno) << endl;
return EXIT_FAILURE;
@@ -174,7 +174,7 @@ main(int argc, char* argv[])
#else
FILE* cppHandle = popen(cmd.c_str(), "r");
#endif
- if (cppHandle == 0)
+ if(cppHandle == 0)
{
cerr << argv[0] << ": can't run C++ preprocessor: " << strerror(errno) << endl;
unit->destroy();
@@ -190,14 +190,14 @@ main(int argc, char* argv[])
pclose(cppHandle);
#endif
- if (parseStatus == EXIT_FAILURE)
+ if(parseStatus == EXIT_FAILURE)
{
status = EXIT_FAILURE;
}
else
{
Gen gen(argv[0], base, include, includePaths, output);
- if (!gen)
+ if(!gen)
{
unit->destroy();
return EXIT_FAILURE;
diff --git a/cpp/src/slice2xsd/Validate.cpp b/cpp/src/slice2xsd/Validate.cpp
index e0089682b14..abc1c621a96 100644
--- a/cpp/src/slice2xsd/Validate.cpp
+++ b/cpp/src/slice2xsd/Validate.cpp
@@ -105,7 +105,7 @@ main(int argc, char** argv)
return 1;
}
- if (argc < 2)
+ if(argc < 2)
{
usage(argv[0]);
return EXIT_FAILURE;
@@ -136,7 +136,7 @@ main(int argc, char** argv)
{
parser->parse(argv[1]);
int errorCount = parser->getErrorCount();
- if (errorCount > 0)
+ if(errorCount > 0)
errorsOccured = true;
}