diff --git a/.clang-format b/.clang-format index c572489fffb..14d89a189e5 100644 --- a/.clang-format +++ b/.clang-format @@ -11,6 +11,7 @@ AllowAllParametersOfDeclarationOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowShortIfStatementsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: TopLevel +BinPackArguments: false BinPackParameters: false BreakBeforeBraces: Allman ColumnLimit: 120 @@ -35,6 +36,7 @@ AllowAllParametersOfDeclarationOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowShortIfStatementsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: TopLevel +BinPackArguments: false BinPackParameters: false BreakBeforeBraces: Allman ColumnLimit: 120 diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml new file mode 100644 index 00000000000..b3c293623fb --- /dev/null +++ b/.github/workflows/clang_format.yml @@ -0,0 +1,33 @@ +name: Clang Format + +on: + workflow_dispatch: + push: + branches: ["main"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["main"] + +jobs: + clang-format: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Clang Format + run: | + # This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/ + wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh + chmod +x /tmp/llvm.sh + sudo /tmp/llvm.sh 18 + sudo apt-get install -y clang-format-18 + rm /tmp/llvm.sh + + - name: Clang format version + run: clang-format-18 --version + + - name: Run Clang Format + run: | + find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.mm" | xargs clang-format-18 --style=file --fallback-style=none --Werror --dry-run + find cpp -name "*.m" | xargs clang-format-18 --style=file --fallback-style=none --Werror --dry-run diff --git a/cpp/include/Ice/IconvStringConverter.h b/cpp/include/Ice/IconvStringConverter.h index 4c690a77ff0..6659f4dfd14 100644 --- a/cpp/include/Ice/IconvStringConverter.h +++ b/cpp/include/Ice/IconvStringConverter.h @@ -202,7 +202,9 @@ namespace IceInternal if (count == size_t(-1)) { throw Ice::IllegalConversionException( - __FILE__, __LINE__, errno == 0 ? "Unknown error" : IceUtilInternal::errorToString(errno)); + __FILE__, + __LINE__, + errno == 0 ? "Unknown error" : IceUtilInternal::errorToString(errno)); } return reinterpret_cast(outbuf); } @@ -260,7 +262,9 @@ namespace IceInternal if (count == size_t(-1)) { throw Ice::IllegalConversionException( - __FILE__, __LINE__, errno == 0 ? "Unknown error" : IceUtilInternal::errorToString(errno)); + __FILE__, + __LINE__, + errno == 0 ? "Unknown error" : IceUtilInternal::errorToString(errno)); } target.resize(target.size() - (outbytesleft / sizeof(charT))); diff --git a/cpp/include/Ice/InputStream.h b/cpp/include/Ice/InputStream.h index f5b9872b626..828da68433c 100644 --- a/cpp/include/Ice/InputStream.h +++ b/cpp/include/Ice/InputStream.h @@ -629,8 +629,9 @@ namespace Ice void read(std::int32_t tag, std::optional& v) { if (readOptional( - tag, StreamOptionalHelper< - T, StreamableTraits::helper, StreamableTraits::fixedLength>::optionalFormat)) + tag, + StreamOptionalHelper::helper, StreamableTraits::fixedLength>:: + optionalFormat)) { v.emplace(); StreamOptionalHelper::helper, StreamableTraits::fixedLength>::read(this, *v); diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index bb922d95136..e2b803712af 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -127,7 +127,8 @@ namespace IceInternal assert(_object->total > 0); for (typename std::map>::const_iterator p = _subMaps.begin(); - p != _subMaps.end(); ++p) + p != _subMaps.end(); + ++p) { p->second.first->destroy(); // Break cyclic reference counts. } @@ -201,7 +202,8 @@ namespace IceInternal TPtr metrics = std::dynamic_pointer_cast(_object->ice_clone()); for (typename std::map>::const_iterator p = _subMaps.begin(); - p != _subMaps.end(); ++p) + p != _subMaps.end(); + ++p) { metrics.get()->*p->second.second = p->second.first->getMetrics(); } @@ -251,7 +253,8 @@ namespace IceInternal } } _subMaps.insert(std::make_pair( - p->first, std::make_pair(p->second.first, p->second.second->create(subMapPrefix, properties)))); + p->first, + std::make_pair(p->second.first, p->second.second->create(subMapPrefix, properties)))); } } @@ -318,7 +321,8 @@ namespace IceInternal if (p != _subMaps.end()) { return std::pair( - p->second.second->clone()->shared_from_this(), p->second.first); + p->second.second->clone()->shared_from_this(), + p->second.first); } return std::pair(MetricsMapIPtr(nullptr), static_cast(0)); } @@ -359,7 +363,8 @@ namespace IceInternal std::ostringstream os; std::vector::const_iterator q = _groupBySeparators.begin(); for (std::vector::const_iterator p = _groupByAttributes.begin(); - p != _groupByAttributes.end(); ++p) + p != _groupByAttributes.end(); + ++p) { os << helper(*p); if (q != _groupBySeparators.end()) @@ -398,7 +403,8 @@ namespace IceInternal p = _objects .insert(typename std::map::value_type( - key, std::make_shared(shared_from_this(), t, _detachedQueue.end()))) + key, + std::make_shared(shared_from_this(), t, _detachedQueue.end()))) .first; } p->second->attach(helper); @@ -485,7 +491,8 @@ namespace IceInternal void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::*member) { _subMaps[subMap] = std::pair( - member, std::make_shared>(nullptr)); + member, + std::make_shared>(nullptr)); } private: diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h index 327705dbe99..ddb701e02d5 100644 --- a/cpp/include/Ice/MetricsObserverI.h +++ b/cpp/include/Ice/MetricsObserverI.h @@ -54,7 +54,8 @@ namespace IceMX ~AttributeResolverT() { for (typename std::map::iterator p = _attributes.begin(); - p != _attributes.end(); ++p) + p != _attributes.end(); + ++p) { delete p->second; } @@ -83,27 +84,31 @@ namespace IceMX template void add(const std::string& name, Y Helper::*member) { _attributes.insert(typename std::map::value_type( - name, new HelperMemberResolver(name, member))); + name, + new HelperMemberResolver(name, member))); } template void add(const std::string& name, Y (Helper::*memberFn)() const) { _attributes.insert(typename std::map::value_type( - name, new HelperMemberFunctionResolver(name, memberFn))); + name, + new HelperMemberFunctionResolver(name, memberFn))); } template void add(const std::string& name, O (Helper::*getFn)() const, Y I::*member) { _attributes.insert(typename std::map::value_type( - name, new MemberResolver(name, getFn, member))); + name, + new MemberResolver(name, getFn, member))); } template void add(const std::string& name, O (Helper::*getFn)() const, Y (I::*memberFn)() const) { _attributes.insert(typename std::map::value_type( - name, new MemberFunctionResolver(name, getFn, memberFn))); + name, + new MemberFunctionResolver(name, getFn, memberFn))); } // @@ -114,7 +119,8 @@ namespace IceMX void add(const std::string& name, O (Helper::*getFn)() const, Y (I::*memberFn)() const noexcept) { _attributes.insert(typename std::map::value_type( - name, new MemberFunctionResolver(name, getFn, memberFn))); + name, + new MemberFunctionResolver(name, getFn, memberFn))); } private: diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h index be71874e29d..fd061f928b6 100644 --- a/cpp/include/Ice/OutputStream.h +++ b/cpp/include/Ice/OutputStream.h @@ -401,8 +401,9 @@ namespace Ice } if (writeOptional( - tag, StreamOptionalHelper< - T, StreamableTraits::helper, StreamableTraits::fixedLength>::optionalFormat)) + tag, + StreamOptionalHelper::helper, StreamableTraits::fixedLength>:: + optionalFormat)) { StreamOptionalHelper::helper, StreamableTraits::fixedLength>::write(this, *v); } diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp index 2d70dc9a520..c55a9291338 100644 --- a/cpp/src/Glacier2/Blobject.cpp +++ b/cpp/src/Glacier2/Blobject.cpp @@ -206,8 +206,9 @@ Glacier2::Blobject::invoke( bool override; try { - override = _requestQueue->addRequest(make_shared( - proxy, inParams, current, _forwardContext, _context, std::move(response), exception)); + override = _requestQueue->addRequest( + make_shared< + Request>(proxy, inParams, current, _forwardContext, _context, std::move(response), exception)); } catch (const ObjectNotExistException&) { @@ -271,14 +272,24 @@ Glacier2::Blobject::invoke( Context ctx = current.ctx; ctx.insert(_context.begin(), _context.end()); proxy->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(amiResponse), std::move(exception), - std::move(amiSent), ctx); + current.operation, + current.mode, + inParams, + std::move(amiResponse), + std::move(exception), + std::move(amiSent), + ctx); } else { proxy->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(amiResponse), std::move(exception), - std::move(amiSent), current.ctx); + current.operation, + current.mode, + inParams, + std::move(amiResponse), + std::move(exception), + std::move(amiSent), + current.ctx); } } else @@ -286,13 +297,22 @@ Glacier2::Blobject::invoke( if (_context.size() > 0) { proxy->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(amiResponse), std::move(exception), - std::move(amiSent), _context); + current.operation, + current.mode, + inParams, + std::move(amiResponse), + std::move(exception), + std::move(amiSent), + _context); } else { proxy->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(amiResponse), std::move(exception), + current.operation, + current.mode, + inParams, + std::move(amiResponse), + std::move(exception), std::move(amiSent)); } } diff --git a/cpp/src/Glacier2/FilterManager.cpp b/cpp/src/Glacier2/FilterManager.cpp index 52b720c4903..025e8c01383 100644 --- a/cpp/src/Glacier2/FilterManager.cpp +++ b/cpp/src/Glacier2/FilterManager.cpp @@ -212,5 +212,8 @@ Glacier2::FilterManager::create(shared_ptr instance, const string& use auto identityFilter = make_shared(allowIdSeq); return make_shared( - std::move(instance), std::move(categoryFilter), std::move(adapterIdFilter), std::move(identityFilter)); + std::move(instance), + std::move(categoryFilter), + std::move(adapterIdFilter), + std::move(identityFilter)); } diff --git a/cpp/src/Glacier2/Glacier2Router.cpp b/cpp/src/Glacier2/Glacier2Router.cpp index 0fae2508f7d..ee0d856fff5 100644 --- a/cpp/src/Glacier2/Glacier2Router.cpp +++ b/cpp/src/Glacier2/Glacier2Router.cpp @@ -317,7 +317,10 @@ RouterService::start(int argc, char* argv[], int& status) } _sessionRouter = make_shared( - _instance, std::move(verifier), std::move(sessionManager), std::move(sslVerifier), + _instance, + std::move(verifier), + std::move(sessionManager), + std::move(sslVerifier), std::move(sslSessionManager)); // @@ -442,7 +445,8 @@ RouterService::initializeCommunicator( "Glacier2CryptPermissionsVerifier:createCryptPermissionsVerifier"); initData.properties->setProperty( - "Glacier2CryptPermissionsVerifier.Glacier2.PermissionsVerifier", cryptPasswords); + "Glacier2CryptPermissionsVerifier.Glacier2.PermissionsVerifier", + cryptPasswords); } } diff --git a/cpp/src/Glacier2/Instance.cpp b/cpp/src/Glacier2/Instance.cpp index 545f217d2ae..ef501c3c356 100644 --- a/cpp/src/Glacier2/Instance.cpp +++ b/cpp/src/Glacier2/Instance.cpp @@ -50,7 +50,8 @@ Glacier2::Instance::Instance( if (o) { const_cast&>(_observer) = make_shared( - o->getFacet(), _properties->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2")); + o->getFacet(), + _properties->getPropertyWithDefault("Glacier2.InstanceName", "Glacier2")); } } diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp index e8194974401..52946fa5f24 100644 --- a/cpp/src/Glacier2/RequestQueue.cpp +++ b/cpp/src/Glacier2/RequestQueue.cpp @@ -57,13 +57,23 @@ Glacier2::Request::invoke( Ice::Context ctx = _current.ctx; ctx.insert(_sslContext.begin(), _sslContext.end()); _proxy->ice_invokeAsync( - _current.operation, _current.mode, inPair, std::move(response), std::move(exception), std::move(sent), + _current.operation, + _current.mode, + inPair, + std::move(response), + std::move(exception), + std::move(sent), ctx); } else { _proxy->ice_invokeAsync( - _current.operation, _current.mode, inPair, std::move(response), std::move(exception), std::move(sent), + _current.operation, + _current.mode, + inPair, + std::move(response), + std::move(exception), + std::move(sent), _current.ctx); } } @@ -72,13 +82,23 @@ Glacier2::Request::invoke( if (_sslContext.size() > 0) { _proxy->ice_invokeAsync( - _current.operation, _current.mode, inPair, std::move(response), std::move(exception), std::move(sent), + _current.operation, + _current.mode, + inPair, + std::move(response), + std::move(exception), + std::move(sent), _sslContext); } else { _proxy->ice_invokeAsync( - _current.operation, _current.mode, inPair, std::move(response), std::move(exception), std::move(sent)); + _current.operation, + _current.mode, + inPair, + std::move(response), + std::move(exception), + std::move(sent)); } } } diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp index 254263e39f1..04b93eecf8b 100644 --- a/cpp/src/Glacier2/SessionRouterI.cpp +++ b/cpp/src/Glacier2/SessionRouterI.cpp @@ -125,8 +125,12 @@ namespace Glacier2 ctx.insert(_context.begin(), _context.end()); auto self = static_pointer_cast(shared_from_this()); _sessionRouter->_verifier->checkPermissionsAsync( - _user, _password, [self](bool ok, string reason) { self->checkPermissionsResponse(ok, reason); }, - [self](exception_ptr e) { self->checkPermissionsException(e); }, nullptr, ctx); + _user, + _password, + [self](bool ok, string reason) { self->checkPermissionsResponse(ok, reason); }, + [self](exception_ptr e) { self->checkPermissionsException(e); }, + nullptr, + ctx); } shared_ptr createFilterManager() final { return FilterManager::create(_instance, _user, true); } @@ -137,7 +141,8 @@ namespace Glacier2 ctx.insert(_context.begin(), _context.end()); auto self = shared_from_this(); _sessionRouter->_sessionManager->createAsync( - _user, _control, + _user, + _control, [self](optional session) { if (session) @@ -150,7 +155,9 @@ namespace Glacier2 CannotCreateSessionException("Session manager returned a null session proxy"))); } }, - [self](exception_ptr e) { self->createException(e); }, nullptr, ctx); + [self](exception_ptr e) { self->createException(e); }, + nullptr, + ctx); } void finished(const optional& session) final { _response(session); } @@ -218,8 +225,11 @@ namespace Glacier2 auto self = static_pointer_cast(shared_from_this()); _sessionRouter->_sslVerifier->authorizeAsync( - _sslInfo, [self](bool ok, const string& reason) { self->authorizeResponse(ok, reason); }, - [self](exception_ptr e) { self->authorizeException(e); }, nullptr, ctx); + _sslInfo, + [self](bool ok, const string& reason) { self->authorizeResponse(ok, reason); }, + [self](exception_ptr e) { self->authorizeException(e); }, + nullptr, + ctx); } shared_ptr createFilterManager() final { return FilterManager::create(_instance, _user, false); } @@ -231,7 +241,8 @@ namespace Glacier2 auto self = static_pointer_cast(shared_from_this()); _sessionRouter->_sslSessionManager->createAsync( - _sslInfo, _control, + _sslInfo, + _control, [self](optional session) { if (session) @@ -244,7 +255,9 @@ namespace Glacier2 CannotCreateSessionException("Session manager returned a null session proxy"))); } }, - [self](exception_ptr e) { self->createException(e); }, nullptr, ctx); + [self](exception_ptr e) { self->createException(e); }, + nullptr, + ctx); } void finished(const optional& session) final { _response(session); } @@ -600,7 +613,12 @@ SessionRouterI::createSessionAsync( } auto session = make_shared( - std::move(response), std::move(exception), std::move(userId), std::move(password), current, shared_from_this()); + std::move(response), + std::move(exception), + std::move(userId), + std::move(password), + current, + shared_from_this()); session->create(); } @@ -659,7 +677,12 @@ SessionRouterI::createSessionFromSecureConnectionAsync( } auto session = make_shared( - std::move(response), std::move(exception), userDN, sslinfo, current, shared_from_this()); + std::move(response), + std::move(exception), + userDN, + sslinfo, + current, + shared_from_this()); session->create(); } @@ -695,8 +718,8 @@ SessionRouterI::refreshSessionAsync( session->ice_pingAsync( [responseCb = std::move(response)] { responseCb(); }, - [exceptionCb = std::move(exception), sessionRouter = shared_from_this(), - connection = current.con](exception_ptr e) + [exceptionCb = std::move(exception), sessionRouter = shared_from_this(), connection = current.con]( + exception_ptr e) { exceptionCb(e); sessionRouter->destroySession(connection); diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp index bd0e0283bab..8cf731c37fb 100644 --- a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp +++ b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp @@ -298,7 +298,9 @@ namespace } unique_ptr> data(CFDataCreateWithBytesNoCopy( - kCFAllocatorDefault, reinterpret_cast(salt.c_str()), static_cast(salt.size()), + kCFAllocatorDefault, + reinterpret_cast(salt.c_str()), + static_cast(salt.size()), kCFAllocatorNull)); SecTransformSetAttribute(decoder.get(), kSecTransformInputAttributeName, data.get(), &error); @@ -318,9 +320,15 @@ namespace vector checksumBuffer1(checksumLength); OSStatus status = CCKeyDerivationPBKDF( - kCCPBKDF2, password.c_str(), password.size(), CFDataGetBytePtr(saltBuffer.get()), - static_cast(CFDataGetLength(saltBuffer.get())), algorithmId, static_cast(rounds), - checksumBuffer1.data(), checksumLength); + kCCPBKDF2, + password.c_str(), + password.size(), + CFDataGetBytePtr(saltBuffer.get()), + static_cast(CFDataGetLength(saltBuffer.get())), + algorithmId, + static_cast(rounds), + checksumBuffer1.data(), + checksumLength); if (status != errSecSuccess) { return false; @@ -333,8 +341,10 @@ namespace return false; } data.reset(CFDataCreateWithBytesNoCopy( - kCFAllocatorDefault, reinterpret_cast(checksum.c_str()), - static_cast(checksum.size()), kCFAllocatorNull)); + kCFAllocatorDefault, + reinterpret_cast(checksum.c_str()), + static_cast(checksum.size()), + kCFAllocatorNull)); SecTransformSetAttribute(decoder.get(), kSecTransformInputAttributeName, data.get(), &error); if (error) { @@ -350,14 +360,21 @@ namespace } vector checksumBuffer2( - CFDataGetBytePtr(data.get()), CFDataGetBytePtr(data.get()) + CFDataGetLength(data.get())); + CFDataGetBytePtr(data.get()), + CFDataGetBytePtr(data.get()) + CFDataGetLength(data.get())); return checksumBuffer1 == checksumBuffer2; # else DWORD saltLength = static_cast(salt.size()); vector saltBuffer(saltLength); if (!CryptStringToBinary( - salt.c_str(), static_cast(salt.size()), CRYPT_STRING_BASE64, &saltBuffer[0], &saltLength, 0, 0)) + salt.c_str(), + static_cast(salt.size()), + CRYPT_STRING_BASE64, + &saltBuffer[0], + &saltLength, + 0, + 0)) { return false; } @@ -374,8 +391,15 @@ namespace vector passwordBuffer(password.begin(), password.end()); DWORD status = BCryptDeriveKeyPBKDF2( - algorithmHandle, &passwordBuffer[0], static_cast(passwordBuffer.size()), &saltBuffer[0], saltLength, - rounds, &checksumBuffer1[0], static_cast(checksumLength), 0); + algorithmHandle, + &passwordBuffer[0], + static_cast(passwordBuffer.size()), + &saltBuffer[0], + saltLength, + rounds, + &checksumBuffer1[0], + static_cast(checksumLength), + 0); BCryptCloseAlgorithmProvider(algorithmHandle, 0); @@ -388,8 +412,13 @@ namespace vector checksumBuffer2(checksumLength); if (!CryptStringToBinary( - checksum.c_str(), static_cast(checksum.size()), CRYPT_STRING_BASE64, &checksumBuffer2[0], - &checksumBuffer2Length, 0, 0)) + checksum.c_str(), + static_cast(checksum.size()), + CRYPT_STRING_BASE64, + &checksumBuffer2[0], + &checksumBuffer2Length, + 0, + 0)) { return false; } diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 69d0200f8a1..2398fa380f3 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -219,7 +219,9 @@ SessionHelperI::internalObjectAdapter() if (!_useCallbacks) { throw Ice::InitializationException( - __FILE__, __LINE__, "Object adapter not available, call SessionFactoryHelper.setUseCallbacks(true)"); + __FILE__, + __LINE__, + "Object adapter not available, call SessionFactoryHelper.setUseCallbacks(true)"); } return _adapter; } @@ -371,7 +373,9 @@ SessionHelperI::connectImpl(const ConnectStrategyPtr& factory) assert(!_destroy); auto thread = std::thread( - [session = shared_from_this(), callback = _callback, factory = std::move(factory), + [session = shared_from_this(), + callback = _callback, + factory = std::move(factory), startFuture = startPromise.get_future()]() { startFuture.wait(); // Wait for the thread to be registered with the thread callback. @@ -390,7 +394,8 @@ SessionHelperI::connectImpl(const ConnectStrategyPtr& factory) session->_destroy = true; } session->dispatchCallback( - [callback, session, ex = current_exception()]() { callback->connectFailed(session, ex); }, nullptr); + [callback, session, ex = current_exception()]() { callback->connectFailed(session, ex); }, + nullptr); return; } @@ -421,7 +426,8 @@ SessionHelperI::connectImpl(const ConnectStrategyPtr& factory) } session->dispatchCallbackAndWait( - [callback, session]() { callback->createdCommunicator(session); }, nullptr); + [callback, session]() { callback->createdCommunicator(session); }, + nullptr); Glacier2::RouterPrx routerPrx(*communicator->getDefaultRouter()); optional sessionPrx = factory->connect(routerPrx); @@ -438,7 +444,8 @@ SessionHelperI::connectImpl(const ConnectStrategyPtr& factory) } session->dispatchCallback( - [session, ex = current_exception()]() { session->_callback->connectFailed(session, ex); }, nullptr); + [session, ex = current_exception()]() { session->_callback->connectFailed(session, ex); }, + nullptr); } }); _threadCB->add(this, std::move(thread)); @@ -520,7 +527,8 @@ SessionHelperI::connected(const Glacier2::RouterPrx& router, const optionalconnected(session); }, conn); + [callback = _callback, session = shared_from_this()]() { callback->connected(session); }, + conn); } } @@ -610,7 +618,9 @@ Glacier2::SessionFactoryHelper::SessionFactoryHelper( if (!properties) { throw Ice::InitializationException( - __FILE__, __LINE__, "Attempt to create a SessionFactoryHelper with a null Properties argument"); + __FILE__, + __LINE__, + "Attempt to create a SessionFactoryHelper with a null Properties argument"); } _initData.properties = properties; setDefaultProperties(); @@ -796,7 +806,10 @@ Glacier2::SessionFactoryHelper::connect() { lock_guard lock(_mutex); session = make_shared( - make_shared(shared_from_this()), _callback, createInitData(), getRouterFinderStr(), + make_shared(shared_from_this()), + _callback, + createInitData(), + getRouterFinderStr(), _useCallbacks); context = _context; } @@ -812,7 +825,10 @@ Glacier2::SessionFactoryHelper::connect(const string& user, const string& passwo { lock_guard lock(_mutex); session = make_shared( - make_shared(shared_from_this()), _callback, createInitData(), getRouterFinderStr(), + make_shared(shared_from_this()), + _callback, + createInitData(), + getRouterFinderStr(), _useCallbacks); context = _context; } diff --git a/cpp/src/Ice/ACM.cpp b/cpp/src/Ice/ACM.cpp index e0f7e8d20b3..bd27c19c28d 100644 --- a/cpp/src/Ice/ACM.cpp +++ b/cpp/src/Ice/ACM.cpp @@ -130,7 +130,8 @@ IceInternal::FactoryACMMonitor::add(const ConnectionIPtr& connection) { _connections.insert(connection); _instance->timer()->scheduleRepeated( - shared_from_this(), chrono::duration_cast(_config.timeout) / 2); + shared_from_this(), + chrono::duration_cast(_config.timeout) / 2); } else { diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp index 1633f8ffb27..fa1121ea590 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.cpp +++ b/cpp/src/Ice/CollocatedRequestHandler.cpp @@ -163,12 +163,20 @@ CollocatedRequestHandler::invokeAsyncRequest(OutgoingAsyncBase* outAsync, int ba { // Don't invoke from the user thread if async or invocation timeout is set _adapter->getThreadPool()->execute(make_shared( - outAsync->shared_from_this(), outAsync->getOs(), shared_from_this(), requestId, batchRequestNum)); + outAsync->shared_from_this(), + outAsync->getOs(), + shared_from_this(), + requestId, + batchRequestNum)); } else if (_hasExecutor) { _adapter->getThreadPool()->executeFromThisThread(make_shared( - outAsync->shared_from_this(), outAsync->getOs(), shared_from_this(), requestId, batchRequestNum)); + outAsync->shared_from_this(), + outAsync->getOs(), + shared_from_this(), + requestId, + batchRequestNum)); } else // Optimization: directly call invokeAll if there's no custom executor. { @@ -326,7 +334,13 @@ CollocatedRequestHandler::invokeAll(OutputStream* os, int32_t requestId, int32_t } Incoming incoming( - _reference->getInstance().get(), shared_from_this(), nullptr, _adapter, _response, 0, requestId); + _reference->getInstance().get(), + shared_from_this(), + nullptr, + _adapter, + _response, + 0, + requestId); incoming.invoke(servantManager, &is); --invokeNum; } @@ -367,6 +381,6 @@ CollocatedRequestHandler::handleException(int requestId, std::exception_ptr ex) // We invoke the exception using a thread-pool thread. If the invocation is a lambda async invocation, we want // the callbacks to execute in a thread-pool thread - never in the application thread that sent the exception // via AMD. - outAsync->invokeExceptionAsync(); + outAsync->invokeExceptionAsync(); } } diff --git a/cpp/src/Ice/Communicator.cpp b/cpp/src/Ice/Communicator.cpp index 8d802d08c9f..050e7be7310 100644 --- a/cpp/src/Ice/Communicator.cpp +++ b/cpp/src/Ice/Communicator.cpp @@ -25,7 +25,8 @@ Ice::Communicator::flushBatchRequestsAsync(CompressBatch compress) { auto promise = std::make_shared>(); flushBatchRequestsAsync( - compress, [promise](std::exception_ptr ex) { promise->set_exception(ex); }, + compress, + [promise](std::exception_ptr ex) { promise->set_exception(ex); }, [promise](bool) { promise->set_value(); }); return promise->get_future(); } diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index faf54ba4bfc..9d7cc1f2c7e 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -133,7 +133,9 @@ ConnectRequestHandler::setConnection(Ice::ConnectionIPtr connection, bool compre { auto self = shared_from_this(); if (!ri->addProxyAsync( - _reference, [self] { self->flushRequests(); }, [self](exception_ptr ex) { self->setException(ex); })) + _reference, + [self] { self->flushRequests(); }, + [self](exception_ptr ex) { self->setException(ex); })) { return; // The request handler will be initialized once addProxyAsync completes. } diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp index d52ac91e02d..1a9895d652a 100644 --- a/cpp/src/Ice/Connection.cpp +++ b/cpp/src/Ice/Connection.cpp @@ -34,7 +34,8 @@ Ice::Connection::flushBatchRequestsAsync(CompressBatch compress) { auto promise = std::make_shared>(); flushBatchRequestsAsync( - compress, [promise](std::exception_ptr ex) { promise->set_exception(ex); }, + compress, + [promise](std::exception_ptr ex) { promise->set_exception(ex); }, [promise](bool) { promise->set_value(); }); return promise->get_future(); } @@ -50,7 +51,8 @@ Ice::Connection::heartbeatAsync() { auto promise = std::make_shared>(); heartbeatAsync( - [promise](std::exception_ptr ex) { promise->set_exception(ex); }, [promise](bool) { promise->set_value(); }); + [promise](std::exception_ptr ex) { promise->set_exception(ex); }, + [promise](bool) { promise->set_value(); }); return promise->get_future(); } diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index dcf673911b2..4074b73e4b8 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -226,7 +226,13 @@ IceInternal::OutgoingConnectionFactory::createAsync( } auto cb = make_shared( - _instance, shared_from_this(), endpoints, hasMore, std::move(response), std::move(exception), selType); + _instance, + shared_from_this(), + endpoints, + hasMore, + std::move(response), + std::move(exception), + selType); cb->getConnectors(); } @@ -581,7 +587,13 @@ IceInternal::OutgoingConnectionFactory::createConnection(const TransceiverPtr& t } connection = ConnectionI::create( - _communicator, _instance, _monitor, transceiver, ci.connector, ci.endpoint->compress(false), nullptr); + _communicator, + _instance, + _monitor, + transceiver, + ci.connector, + ci.endpoint->compress(false), + nullptr); } catch (const Ice::LocalException&) { @@ -976,7 +988,8 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::nextEndpoint() assert(_endpointsIter != _endpoints.end()); (*_endpointsIter) ->connectorsAsync( - _selType, [self](const vector& connectors) { self->connectors(connectors); }, + _selType, + [self](const vector& connectors) { self->connectors(connectors); }, [self](exception_ptr ex) { self->exception(ex); }); } catch (const std::exception&) @@ -1303,7 +1316,9 @@ IceInternal::IncomingConnectionFactory::connections() const // Only copy connections which have not been destroyed. // remove_copy_if( - _connections.begin(), _connections.end(), back_inserter(result), + _connections.begin(), + _connections.end(), + back_inserter(result), [](const ConnectionIPtr& conn) { return !conn->isActiveOrHolding(); }); return result; } @@ -1470,7 +1485,13 @@ IceInternal::IncomingConnectionFactory::message(ThreadPoolCurrent& current) try { connection = ConnectionI::create( - _adapter->getCommunicator(), _instance, _monitor, transceiver, 0, _endpoint, _adapter); + _adapter->getCommunicator(), + _instance, + _monitor, + transceiver, + 0, + _endpoint, + _adapter); } catch (const LocalException& ex) { diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 704e5606b3d..7cd299d10c4 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -80,8 +80,16 @@ namespace void run() final { _connection->dispatch( - _connectionStartCompleted, _sentCBs, _compress, _requestId, _invokeNum, _servantManager, _adapter, - _outAsync, _heartbeatCallback, _stream); + _connectionStartCompleted, + _sentCBs, + _compress, + _requestId, + _invokeNum, + _servantManager, + _adapter, + _outAsync, + _heartbeatCallback, + _stream); } private: @@ -590,7 +598,10 @@ Ice::ConnectionI::updateObserver() assert(_instance->initializationData().observer); ConnectionObserverPtr o = _instance->initializationData().observer->getConnectionObserver( - initConnectionInfo(), _endpoint, toConnectionState(_state), _observer.get()); + initConnectionInfo(), + _endpoint, + toConnectionState(_state), + _observer.get()); _observer.attach(o); } @@ -1470,7 +1481,9 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) if (m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3]) { throw BadMagicException( - __FILE__, __LINE__, "", + __FILE__, + __LINE__, + "", Ice::ByteSeq( reinterpret_cast(&m[0]), reinterpret_cast(&m[0]) + sizeof(magic))); @@ -1568,8 +1581,15 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) { newOp = static_cast( newOp | parseMessage( - current.stream, invokeNum, requestId, compress, servantManager, adapter, outAsync, - heartbeatCallback, dispatchCount)); + current.stream, + invokeNum, + requestId, + compress, + servantManager, + adapter, + outAsync, + heartbeatCallback, + dispatchCount)); } if (readyOp & SocketOperationWrite) @@ -1642,20 +1662,46 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) // executeFromThisThread dispatches to the correct DispatchQueue #ifdef ICE_SWIFT _threadPool->executeFromThisThread(make_shared( - shared_from_this(), std::move(connectionStartCompleted), sentCBs, compress, requestId, invokeNum, - servantManager, adapter, outAsync, heartbeatCallback, current.stream)); + shared_from_this(), + std::move(connectionStartCompleted), + sentCBs, + compress, + requestId, + invokeNum, + servantManager, + adapter, + outAsync, + heartbeatCallback, + current.stream)); #else if (!_hasExecutor) // Optimization, call dispatch() directly if there's no executor. { dispatch( - connectionStartCompleted, sentCBs, compress, requestId, invokeNum, servantManager, adapter, outAsync, - heartbeatCallback, current.stream); + connectionStartCompleted, + sentCBs, + compress, + requestId, + invokeNum, + servantManager, + adapter, + outAsync, + heartbeatCallback, + current.stream); } else { _threadPool->executeFromThisThread(make_shared( - shared_from_this(), std::move(connectionStartCompleted), sentCBs, compress, requestId, invokeNum, - servantManager, adapter, outAsync, heartbeatCallback, current.stream)); + shared_from_this(), + std::move(connectionStartCompleted), + sentCBs, + compress, + requestId, + invokeNum, + servantManager, + adapter, + outAsync, + heartbeatCallback, + current.stream)); } #endif } @@ -2083,10 +2129,10 @@ Ice::ConnectionI::ConnectionI( _connector(connector), _endpoint(endpoint), _adapter(adapter), - _hasExecutor(_instance->initializationData().executor), // Cached for better performance. - _logger(_instance->initializationData().logger), // Cached for better performance. - _traceLevels(_instance->traceLevels()), // Cached for better performance. - _timer(_instance->timer()), // Cached for better performance. + _hasExecutor(_instance->initializationData().executor), // Cached for better performance. + _logger(_instance->initializationData().logger), // Cached for better performance. + _traceLevels(_instance->traceLevels()), // Cached for better performance. + _timer(_instance->timer()), // Cached for better performance. _writeTimeout(new TimeoutCallback(this)), _writeTimeoutScheduled(false), _readTimeout(new TimeoutCallback(this)), @@ -2390,8 +2436,9 @@ Ice::ConnectionI::setState(State state) ConnectionState newState = toConnectionState(state); if (oldState != newState) { - _observer.attach(_instance->initializationData().observer->getConnectionObserver( - initConnectionInfo(), _endpoint, newState, _observer.get())); + _observer.attach( + _instance->initializationData() + .observer->getConnectionObserver(initConnectionInfo(), _endpoint, newState, _observer.get())); } if (_observer && state == StateClosed && _exception) { @@ -2629,7 +2676,9 @@ Ice::ConnectionI::validate(SocketOperation operation) if (m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3]) { throw BadMagicException( - __FILE__, __LINE__, "", + __FILE__, + __LINE__, + "", Ice::ByteSeq( reinterpret_cast(&m[0]), reinterpret_cast(&m[0]) + sizeof(magic))); @@ -3044,8 +3093,13 @@ Ice::ConnectionI::doCompress(OutputStream& uncompressed, OutputStream& compresse unsigned int compressedLen = static_cast(uncompressedLen * 1.01 + 600); compressed.b.resize(headerSize + sizeof(int32_t) + compressedLen); int bzError = BZ2_bzBuffToBuffCompress( - reinterpret_cast(&compressed.b[0]) + headerSize + sizeof(int32_t), &compressedLen, - reinterpret_cast(&uncompressed.b[0]) + headerSize, uncompressedLen, _compressionLevel, 0, 0); + reinterpret_cast(&compressed.b[0]) + headerSize + sizeof(int32_t), + &compressedLen, + reinterpret_cast(&uncompressed.b[0]) + headerSize, + uncompressedLen, + _compressionLevel, + 0, + 0); if (bzError != BZ_OK) { throw CompressionException(__FILE__, __LINE__, "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError)); @@ -3109,8 +3163,12 @@ Ice::ConnectionI::doUncompress(InputStream& compressed, InputStream& uncompresse unsigned int uncompressedLen = static_cast(uncompressedSize - headerSize); unsigned int compressedLen = static_cast(compressed.b.size() - headerSize - sizeof(int32_t)); int bzError = BZ2_bzBuffToBuffDecompress( - reinterpret_cast(&uncompressed.b[0]) + headerSize, &uncompressedLen, - reinterpret_cast(&compressed.b[0]) + headerSize + sizeof(int32_t), compressedLen, 0, 0); + reinterpret_cast(&uncompressed.b[0]) + headerSize, + &uncompressedLen, + reinterpret_cast(&compressed.b[0]) + headerSize + sizeof(int32_t), + compressedLen, + 0, + 0); if (bzError != BZ_OK) { throw CompressionException(__FILE__, __LINE__, "BZ2_bzBuffToBuffCompress failed" + getBZ2Error(bzError)); @@ -3201,7 +3259,9 @@ Ice::ConnectionI::parseMessage( if (_state >= StateClosing) { trace( - "received request during closing\n(ignored by server, client will retry)", stream, _logger, + "received request during closing\n(ignored by server, client will retry)", + stream, + _logger, _traceLevels); } else @@ -3221,8 +3281,10 @@ Ice::ConnectionI::parseMessage( if (_state >= StateClosing) { trace( - "received batch request during closing\n(ignored by server, client will retry)", stream, - _logger, _traceLevels); + "received batch request during closing\n(ignored by server, client will retry)", + stream, + _logger, + _traceLevels); } else { @@ -3375,7 +3437,13 @@ Ice::ConnectionI::invokeAll( assert(!response || invokeNum == 1); Incoming incoming( - _instance.get(), shared_from_this(), shared_from_this(), adapter, response, compress, requestId); + _instance.get(), + shared_from_this(), + shared_from_this(), + adapter, + response, + compress, + requestId); // // Dispatch the incoming request. diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp index 06f873f5053..ad12b3620dd 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.cpp +++ b/cpp/src/Ice/DefaultsAndOverrides.cpp @@ -36,7 +36,9 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro if (!isAddressValid(defaultSourceAddress)) { throw InitializationException( - __FILE__, __LINE__, "invalid IP address set for Ice.Default.SourceAddress: `" + value + "'"); + __FILE__, + __LINE__, + "invalid IP address set for Ice.Default.SourceAddress: `" + value + "'"); } } @@ -111,7 +113,9 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro else { throw EndpointSelectionTypeParseException( - __FILE__, __LINE__, "illegal value `" + value + "'; expected `Random' or `Ordered'"); + __FILE__, + __LINE__, + "illegal value `" + value + "'; expected `Random' or `Ordered'"); } const_cast(defaultTimeout) = properties->getPropertyAsIntWithDefault("Ice.Default.Timeout", 60000); diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp index 42cb615d7ba..7f16ece660e 100644 --- a/cpp/src/Ice/EndpointFactoryManager.cpp +++ b/cpp/src/Ice/EndpointFactoryManager.cpp @@ -109,7 +109,9 @@ IceInternal::EndpointFactoryManager::create(const string& str, bool oaEndpoint) if (!v.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unrecognized argument `" + v.front() + "' in endpoint `" + str + "'"); + __FILE__, + __LINE__, + "unrecognized argument `" + v.front() + "' in endpoint `" + str + "'"); } return e; } @@ -124,7 +126,9 @@ IceInternal::EndpointFactoryManager::create(const string& str, bool oaEndpoint) if (!v.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unrecognized argument `" + v.front() + "' in endpoint `" + str + "'"); + __FILE__, + __LINE__, + "unrecognized argument `" + v.front() + "' in endpoint `" + str + "'"); } factory = get(ue->type()); if (factory) diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index a37cf0e8892..900adcf279c 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -49,7 +49,10 @@ namespace IceInternal string type = v->ice_id(); throw Ice::UnexpectedObjectException( - __FILE__, __LINE__, "expected element of type `" + expectedType + "' but received `" + type + "'", type, + __FILE__, + __LINE__, + "expected element of type `" + expectedType + "' but received `" + type + "'", + type, expectedType); } diff --git a/cpp/src/Ice/IPEndpointI.cpp b/cpp/src/Ice/IPEndpointI.cpp index b873e806992..57ee25a05d2 100644 --- a/cpp/src/Ice/IPEndpointI.cpp +++ b/cpp/src/Ice/IPEndpointI.cpp @@ -97,7 +97,11 @@ IceInternal::IPEndpointI::connectorsAsync( std::function exception) const { _instance->resolve( - _host, _port, selType, const_cast(this)->shared_from_this(), std::move(response), + _host, + _port, + selType, + const_cast(this)->shared_from_this(), + std::move(response), std::move(exception)); } @@ -145,7 +149,12 @@ IceInternal::IPEndpointI::expandHost(EndpointIPtr& publish) const } vector
addrs = getAddresses( - _host, _port, _instance->protocolSupport(), Ice::EndpointSelectionType::Ordered, _instance->preferIPv6(), true); + _host, + _port, + _instance->protocolSupport(), + Ice::EndpointSelectionType::Ordered, + _instance->preferIPv6(), + true); vector endpoints; if (addrs.size() == 1) @@ -391,7 +400,9 @@ IceInternal::IPEndpointI::initWithOptions(vector& args, bool oaEndpoint) else { throw Ice::EndpointParseException( - __FILE__, __LINE__, "`-h *' not valid for proxy endpoint `" + toString() + "'"); + __FILE__, + __LINE__, + "`-h *' not valid for proxy endpoint `" + toString() + "'"); } } @@ -400,7 +411,9 @@ IceInternal::IPEndpointI::initWithOptions(vector& args, bool oaEndpoint) if (oaEndpoint) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "`--sourceAddress' not valid for object adapter endpoint `" + toString() + "'"); + __FILE__, + __LINE__, + "`--sourceAddress' not valid for object adapter endpoint `" + toString() + "'"); } } else if (!oaEndpoint) @@ -417,7 +430,9 @@ IceInternal::IPEndpointI::checkOption(const string& option, const string& argume if (argument.empty()) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "no argument provided for -h option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -h option in endpoint " + endpoint); } const_cast(_host) = argument; } @@ -426,18 +441,24 @@ IceInternal::IPEndpointI::checkOption(const string& option, const string& argume if (argument.empty()) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "no argument provided for -p option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -p option in endpoint " + endpoint); } istringstream p(argument); if (!(p >> const_cast(_port)) || !p.eof()) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "invalid port value `" + argument + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid port value `" + argument + "' in endpoint " + endpoint); } else if (_port < 0 || _port > 65535) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "port value `" + argument + "' out of range in endpoint " + endpoint); + __FILE__, + __LINE__, + "port value `" + argument + "' out of range in endpoint " + endpoint); } } else if (option == "--sourceAddress") @@ -445,13 +466,17 @@ IceInternal::IPEndpointI::checkOption(const string& option, const string& argume if (argument.empty()) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "no argument provided for --sourceAddress option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for --sourceAddress option in endpoint " + endpoint); } const_cast(_sourceAddr) = getNumericAddress(argument); if (!isAddressValid(_sourceAddr)) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "invalid IP address provided for --sourceAddress option in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid IP address provided for --sourceAddress option in endpoint " + endpoint); } } else @@ -660,7 +685,8 @@ IceInternal::EndpointHostResolver::updateObserver() const CommunicatorObserverPtr& observer = _instance->initializationData().observer; if (observer) { - _observer.attach(observer->getThreadObserver( - "Communicator", "Ice.HostResolver", ThreadState::ThreadStateIdle, _observer.get())); + _observer.attach( + observer + ->getThreadObserver("Communicator", "Ice.HostResolver", ThreadState::ThreadStateIdle, _observer.get())); } } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index d64ac71b58f..44a15cfc52f 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -157,8 +157,7 @@ Incoming::sendResponse() } catch (const LocalException&) { - _responseHandler->invokeException( - _current.requestId, current_exception(), 1); // Fatal invocation exception + _responseHandler->invokeException(_current.requestId, current_exception(), 1); // Fatal invocation exception } _observer.detach(); @@ -178,8 +177,7 @@ Incoming::sendException(std::exception_ptr exc) } catch (const LocalException&) { - _responseHandler->invokeException( - _current.requestId, current_exception(), 1); // Fatal invocation exception + _responseHandler->invokeException(_current.requestId, current_exception(), 1); // Fatal invocation exception } } diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp index 57421e7085d..eaeebca4ebd 100644 --- a/cpp/src/Ice/Initialize.cpp +++ b/cpp/src/Ice/Initialize.cpp @@ -487,7 +487,9 @@ Ice::stringToIdentity(const string& s) catch (const IceUtil::IllegalArgumentException& ex) { throw IdentityParseException( - __FILE__, __LINE__, "invalid category in identity `" + s + "': " + ex.reason()); + __FILE__, + __LINE__, + "invalid category in identity `" + s + "': " + ex.reason()); } if (slash + 1 < s.size()) @@ -499,7 +501,9 @@ Ice::stringToIdentity(const string& s) catch (const IceUtil::IllegalArgumentException& ex) { throw IdentityParseException( - __FILE__, __LINE__, "invalid name in identity `" + s + "': " + ex.reason()); + __FILE__, + __LINE__, + "invalid name in identity `" + s + "': " + ex.reason()); } } } diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index 4f62ee617dd..f395721c6ce 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -2018,7 +2018,10 @@ Ice::InputStream::EncapsDecoder10::readInstance() if (!_sliceValues) { throw NoValueFactoryException( - __FILE__, __LINE__, "no value factory found and value slicing is disabled", _typeId); + __FILE__, + __LINE__, + "no value factory found and value slicing is disabled", + _typeId); } // @@ -2319,7 +2322,8 @@ Ice::InputStream::EncapsDecoder11::skipSlice() if (_current->sliceType == ValueSlice) { throw NoValueFactoryException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "no value factory found and compact format prevents " "slicing (the sender should use the sliced format instead)", _current->typeId); @@ -2449,7 +2453,10 @@ Ice::InputStream::EncapsDecoder11::readInstance(int32_t index, PatchFunc patchFu if (!_sliceValues) { throw NoValueFactoryException( - __FILE__, __LINE__, "no value factory found and value slicing is disabled", _current->typeId); + __FILE__, + __LINE__, + "no value factory found and value slicing is disabled", + _current->typeId); } // diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index e37ebdfd044..d9c86ffc66b 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -123,7 +123,8 @@ namespace int notDestroyedCount = 0; for (std::list::const_iterator p = instanceList->begin(); - p != instanceList->end(); ++p) + p != instanceList->end(); + ++p) { if (!(*p)->destroyed()) { @@ -198,7 +199,10 @@ Timer::updateObserver(const Ice::Instrumentation::CommunicatorObserverPtr& obsv) lock_guard lock(_mutex); assert(obsv); _observer.attach(obsv->getThreadObserver( - "Communicator", "Ice.Timer", Instrumentation::ThreadState::ThreadStateIdle, _observer.get())); + "Communicator", + "Ice.Timer", + Instrumentation::ThreadState::ThreadStateIdle, + _observer.get())); _hasObserver.exchange(_observer.get() ? 1 : 0); } @@ -215,7 +219,8 @@ Timer::runTimerTask(const IceUtil::TimerTaskPtr& task) if (threadObserver) { threadObserver->stateChanged( - Instrumentation::ThreadState::ThreadStateIdle, Instrumentation::ThreadState::ThreadStateInUseForOther); + Instrumentation::ThreadState::ThreadStateIdle, + Instrumentation::ThreadState::ThreadStateInUseForOther); } try { @@ -235,7 +240,8 @@ Timer::runTimerTask(const IceUtil::TimerTaskPtr& task) if (threadObserver) { threadObserver->stateChanged( - Instrumentation::ThreadState::ThreadStateInUseForOther, Instrumentation::ThreadState::ThreadStateIdle); + Instrumentation::ThreadState::ThreadStateInUseForOther, + Instrumentation::ThreadState::ThreadStateIdle); } } else @@ -683,7 +689,8 @@ IceInternal::Instance::setServerProcessProxy(const ObjectAdapterPtr& adminAdapte } throw InitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "Locator `" + _proxyFactory->proxyToString(locator) + "' knows nothing about server `" + serverId + "'"); } @@ -1054,7 +1061,10 @@ IceInternal::Instance::initialize(const Ice::CommunicatorPtr& communicator) sz = 0; } _initData.logger = make_shared( - _initData.properties->getProperty("Ice.ProgramName"), logfile, true, static_cast(sz)); + _initData.properties->getProperty("Ice.ProgramName"), + logfile, + true, + static_cast(sz)); } else { @@ -1062,7 +1072,9 @@ IceInternal::Instance::initialize(const Ice::CommunicatorPtr& communicator) if (dynamic_pointer_cast(_initData.logger)) { _initData.logger = make_shared( - _initData.properties->getProperty("Ice.ProgramName"), "", logStdErrConvert); + _initData.properties->getProperty("Ice.ProgramName"), + "", + logStdErrConvert); } } } @@ -1148,7 +1160,9 @@ IceInternal::Instance::initialize(const Ice::CommunicatorPtr& communicator) else if (toStringModeStr != "Unicode") { throw InitializationException( - __FILE__, __LINE__, "The value for Ice.ToStringMode must be Unicode, ASCII or Compat"); + __FILE__, + __LINE__, + "The value for Ice.ToStringMode must be Unicode, ASCII or Compat"); } const_cast(_acceptClassCycles) = _initData.properties->getPropertyAsInt("Ice.AcceptClassCycles") > 0; @@ -1170,7 +1184,9 @@ IceInternal::Instance::initialize(const Ice::CommunicatorPtr& communicator) else { throw Ice::InitializationException( - __FILE__, __LINE__, "'" + implicitContextKind + "' is not a valid value for Ice.ImplicitContext"); + __FILE__, + __LINE__, + "'" + implicitContextKind + "' is not a valid value for Ice.ImplicitContext"); } _routerManager = make_shared(); diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp index 4752666bae2..fd9dcb8d4d6 100644 --- a/cpp/src/Ice/InstrumentationI.cpp +++ b/cpp/src/Ice/InstrumentationI.cpp @@ -738,7 +738,9 @@ InvocationObserverI::getRemoteObserver( delegate = _delegate->getRemoteObserver(connection, endpoint, requestId, size); } return getObserverWithDelegate( - "Remote", RemoteInvocationHelper(connection, endpoint, requestId, size), delegate); + "Remote", + RemoteInvocationHelper(connection, endpoint, requestId, size), + delegate); } catch (const exception&) { @@ -757,7 +759,9 @@ InvocationObserverI::getCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, delegate = _delegate->getCollocatedObserver(adapter, requestId, size); } return getObserverWithDelegate( - "Collocated", CollocatedInvocationHelper(adapter, requestId, size), delegate); + "Collocated", + CollocatedInvocationHelper(adapter, requestId, size), + delegate); } catch (const exception&) { diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index be255906945..97b371d45f3 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -308,7 +308,9 @@ IceInternal::LocatorInfo::RequestCallback::response(const LocatorInfoPtr& locato if (_reference->getInstance()->traceLevels()->location >= 1) { locatorInfo->trace( - "retrieved adapter for well-known object from locator, adding to locator cache", _reference, r); + "retrieved adapter for well-known object from locator, adding to locator cache", + _reference, + r); } locatorInfo->getEndpoints(r, _reference, _ttl, _callback); return; @@ -620,8 +622,7 @@ IceInternal::LocatorInfo::getEndpointsException(const ReferencePtr& ref, std::ex if (ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); - out << "adapter not found" - << "\n"; + out << "adapter not found" << "\n"; out << "adapter = " << ref->getAdapterId(); } @@ -632,13 +633,14 @@ IceInternal::LocatorInfo::getEndpointsException(const ReferencePtr& ref, std::ex if (ref->getInstance()->traceLevels()->location >= 1) { Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat); - out << "object not found" - << "\n"; + out << "object not found" << "\n"; out << "object = " << Ice::identityToString(ref->getIdentity(), ref->getInstance()->toStringMode()); } throw NotRegisteredException( - __FILE__, __LINE__, "object", + __FILE__, + __LINE__, + "object", Ice::identityToString(ref->getIdentity(), ref->getInstance()->toStringMode())); } catch (const NotRegisteredException&) @@ -729,7 +731,9 @@ IceInternal::LocatorInfo::trace(const string& msg, const ReferencePtr& ref, cons const char* sep = endpoints.size() > 1 ? ":" : ""; ostringstream o; transform( - endpoints.begin(), endpoints.end(), ostream_iterator(o, sep), + endpoints.begin(), + endpoints.end(), + ostream_iterator(o, sep), [](const EndpointPtr& endpoint) { return endpoint->toString(); }); out << "endpoints = " << o.str(); } diff --git a/cpp/src/Ice/LoggerAdminI.cpp b/cpp/src/Ice/LoggerAdminI.cpp index be95a4535ad..58e2cc4b469 100644 --- a/cpp/src/Ice/LoggerAdminI.cpp +++ b/cpp/src/Ice/LoggerAdminI.cpp @@ -338,7 +338,8 @@ namespace { auto self = shared_from_this(); remoteLogger->initAsync( - logger->getPrefix(), initLogMessages, + logger->getPrefix(), + initLogMessages, [self, logger, remoteLogger]() { if (self->_traceLevel > 1) @@ -585,7 +586,8 @@ namespace { LogMessage logMessage = { LogMessageType::PrintMessage, - chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), "", + chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), + "", message}; _localLogger->print(message); @@ -597,7 +599,8 @@ namespace LogMessage logMessage = { LogMessageType::TraceMessage, chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), - category, message}; + category, + message}; _localLogger->trace(category, message); log(logMessage); @@ -607,7 +610,8 @@ namespace { LogMessage logMessage = { LogMessageType::WarningMessage, - chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), "", + chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), + "", message}; _localLogger->warning(message); @@ -618,7 +622,8 @@ namespace { LogMessage logMessage = { LogMessageType::ErrorMessage, - chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), "", + chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(), + "", message}; _localLogger->error(message); diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp index 5d3446c5a90..dd1a0555192 100644 --- a/cpp/src/Ice/MetricsAdminI.cpp +++ b/cpp/src/Ice/MetricsAdminI.cpp @@ -23,7 +23,12 @@ using namespace IceMX; namespace { const string suffixes[] = { - "Disabled", "GroupBy", "Accept.*", "Reject.*", "RetainDetached", "Map.*", + "Disabled", + "GroupBy", + "Accept.*", + "Reject.*", + "RetainDetached", + "Map.*", }; void validateProperties(const string& prefix, const PropertiesPtr& properties) diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 16fb5d559d3..6df5bfe3141 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -76,12 +76,16 @@ namespace if (preferIPv6) { stable_partition( - addrs.begin(), addrs.end(), [](const Address& ss) { return ss.saStorage.ss_family == AF_INET6; }); + addrs.begin(), + addrs.end(), + [](const Address& ss) { return ss.saStorage.ss_family == AF_INET6; }); } else { stable_partition( - addrs.begin(), addrs.end(), [](const Address& ss) { return ss.saStorage.ss_family != AF_INET6; }); + addrs.begin(), + addrs.end(), + [](const Address& ss) { return ss.saStorage.ss_family != AF_INET6; }); } } } @@ -633,7 +637,8 @@ namespace { struct sockaddr_in addrin; memcpy( - &addrin, paddrs->FirstUnicastAddress->Address.lpSockaddr, + &addrin, + paddrs->FirstUnicastAddress->Address.lpSockaddr, paddrs->FirstUnicastAddress->Address.iSockaddrLength); delete[] buf; return addrin.sin_addr; @@ -1293,7 +1298,13 @@ IceInternal::inetAddrToString(const Address& ss) char namebuf[1024]; namebuf[0] = '\0'; getnameinfo( - &ss.sa, static_cast(size), namebuf, static_cast(sizeof(namebuf)), 0, 0, NI_NUMERICHOST); + &ss.sa, + static_cast(size), + namebuf, + static_cast(sizeof(namebuf)), + 0, + 0, + NI_NUMERICHOST); return string(namebuf); } @@ -2076,8 +2087,15 @@ IceInternal::doConnectAsync(SOCKET fd, const Address& addr, const Address& sourc GUID GuidConnectEx = WSAID_CONNECTEX; // The Guid DWORD dwBytes; if (WSAIoctl( - fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &GuidConnectEx, sizeof(GuidConnectEx), &ConnectEx, - sizeof(ConnectEx), &dwBytes, nullptr, nullptr) == SOCKET_ERROR) + fd, + SIO_GET_EXTENSION_FUNCTION_POINTER, + &GuidConnectEx, + sizeof(GuidConnectEx), + &ConnectEx, + sizeof(ConnectEx), + &dwBytes, + nullptr, + nullptr) == SOCKET_ERROR) { throw SocketException(__FILE__, __LINE__, getSocketErrno()); } diff --git a/cpp/src/Ice/NetworkProxy.cpp b/cpp/src/Ice/NetworkProxy.cpp index c16ed5aaa5c..9131206f2fe 100644 --- a/cpp/src/Ice/NetworkProxy.cpp +++ b/cpp/src/Ice/NetworkProxy.cpp @@ -254,7 +254,8 @@ HTTPNetworkProxy::resolveHost(ProtocolSupport protocol) const { assert(!_host.empty()); return make_shared( - getAddresses(_host, _port, protocol, Ice::EndpointSelectionType::Random, false, true)[0], protocol); + getAddresses(_host, _port, protocol, Ice::EndpointSelectionType::Random, false, true)[0], + protocol); } Address @@ -296,7 +297,8 @@ IceInternal::createNetworkProxy(const Ice::PropertiesPtr& properties, ProtocolSu if (!proxyHost.empty()) { return make_shared( - proxyHost, properties->getPropertyAsIntWithDefault("Ice.HTTPProxyPort", 1080)); + proxyHost, + properties->getPropertyAsIntWithDefault("Ice.HTTPProxyPort", 1080)); } return nullptr; diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 72389ab0a32..234743a600a 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -250,7 +250,8 @@ Ice::BlobjectAsync::_iceDispatch(Incoming& incoming) } incomingPtr->completed(); }, - [incomingPtr](std::exception_ptr ex) { incomingPtr->completed(ex); }, incomingPtr->current()); + [incomingPtr](std::exception_ptr ex) { incomingPtr->completed(ex); }, + incomingPtr->current()); } catch (...) { @@ -276,7 +277,8 @@ Ice::BlobjectArrayAsync::_iceDispatch(Incoming& incoming) incomingPtr->writeParamEncaps(outE.first, static_cast(outE.second - outE.first), ok); incomingPtr->completed(); }, - [incomingPtr](std::exception_ptr ex) { incomingPtr->completed(ex); }, incomingPtr->current()); + [incomingPtr](std::exception_ptr ex) { incomingPtr->completed(ex); }, + incomingPtr->current()); } catch (...) { diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index 4eb405b76a5..88a0c98d772 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -40,7 +40,9 @@ IceInternal::ObjectAdapterFactory::shutdown() // Deactivate outside the thread synchronization, to avoid deadlocks. for_each( - adapters.begin(), adapters.end(), [](const shared_ptr& adapter) { adapter->deactivate(); }); + adapters.begin(), + adapters.end(), + [](const shared_ptr& adapter) { adapter->deactivate(); }); } void @@ -60,7 +62,8 @@ IceInternal::ObjectAdapterFactory::waitForShutdown() // Now we wait for deactivation of each object adapter. for_each( - adapters.begin(), adapters.end(), + adapters.begin(), + adapters.end(), [](const shared_ptr& adapter) { adapter->waitForDeactivate(); }); } @@ -106,7 +109,9 @@ IceInternal::ObjectAdapterFactory::updateObservers(void (ObjectAdapterI::*fn)()) } for_each( - adapters.begin(), adapters.end(), [fn](const shared_ptr& adapter) { (adapter.get()->*fn)(); }); + adapters.begin(), + adapters.end(), + [fn](const shared_ptr& adapter) { (adapter.get()->*fn)(); }); } ObjectAdapterPtr diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 495a39f5899..3117e4fd6f3 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -88,7 +88,8 @@ Ice::ObjectAdapterI::activate() if (_state != StateUninitialized) { for_each( - _incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), + _incomingConnectionFactories.begin(), + _incomingConnectionFactories.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->activate(); }); return; } @@ -141,7 +142,8 @@ Ice::ObjectAdapterI::activate() lock_guard lock(_mutex); assert(_state == StateActivating); for_each( - _incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), + _incomingConnectionFactories.begin(), + _incomingConnectionFactories.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->activate(); }); _state = StateActive; _conditionVariable.notify_all(); @@ -156,7 +158,8 @@ Ice::ObjectAdapterI::hold() checkForDeactivation(); _state = StateHeld; for_each( - _incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), + _incomingConnectionFactories.begin(), + _incomingConnectionFactories.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->hold(); }); } @@ -173,7 +176,8 @@ Ice::ObjectAdapterI::waitForHold() } for_each( - incomingConnectionFactories.begin(), incomingConnectionFactories.end(), + incomingConnectionFactories.begin(), + incomingConnectionFactories.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->waitUntilHolding(); }); } @@ -227,7 +231,8 @@ Ice::ObjectAdapterI::deactivate() noexcept } for_each( - _incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), + _incomingConnectionFactories.begin(), + _incomingConnectionFactories.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->destroy(); }); _instance->outgoingConnectionFactory()->removeAdapter(shared_from_this()); @@ -262,7 +267,8 @@ Ice::ObjectAdapterI::waitForDeactivate() noexcept // Now we wait until all incoming connection factories are finished. for_each( - incomingConnectionFactories.begin(), incomingConnectionFactories.end(), + incomingConnectionFactories.begin(), + incomingConnectionFactories.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->waitUntilFinished(); }); } @@ -564,7 +570,9 @@ Ice::ObjectAdapterI::getEndpoints() const noexcept EndpointSeq endpoints; transform( - _incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), back_inserter(endpoints), + _incomingConnectionFactories.begin(), + _incomingConnectionFactories.end(), + back_inserter(endpoints), [](const IncomingConnectionFactoryPtr& factory) { return factory->endpoint(); }); return endpoints; } @@ -700,7 +708,8 @@ Ice::ObjectAdapterI::isLocal(const ReferencePtr& ref) const for (vector::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { for (vector::const_iterator q = _incomingConnectionFactories.begin(); - q != _incomingConnectionFactories.end(); ++q) + q != _incomingConnectionFactories.end(); + ++q) { if ((*q)->isLocal(*p)) { @@ -746,7 +755,9 @@ Ice::ObjectAdapterI::updateConnectionObservers() f = _incomingConnectionFactories; } for_each( - f.begin(), f.end(), [](const IncomingConnectionFactoryPtr& factory) { factory->updateConnectionObservers(); }); + f.begin(), + f.end(), + [](const IncomingConnectionFactoryPtr& factory) { factory->updateConnectionObservers(); }); } void @@ -912,7 +923,9 @@ Ice::ObjectAdapterI::initialize(optional router) catch (const ProxyParseException&) { throw InitializationException( - __FILE__, __LINE__, "invalid proxy options `" + proxyOptions + "' for object adapter `" + _name + "'"); + __FILE__, + __LINE__, + "invalid proxy options `" + proxyOptions + "' for object adapter `" + _name + "'"); } const_cast(_acm) = @@ -959,7 +972,9 @@ Ice::ObjectAdapterI::initialize(optional router) if (_routerInfo->getAdapter()) { throw AlreadyRegisteredException( - __FILE__, __LINE__, "object adapter with router", + __FILE__, + __LINE__, + "object adapter with router", _communicator->identityToString(router->ice_getIdentity())); } @@ -1328,7 +1343,9 @@ ObjectAdapterI::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locator EndpointSeq endpts = proxy ? proxy->ice_getEndpoints() : EndpointSeq(); ostringstream o; transform( - endpts.begin(), endpts.end(), ostream_iterator(o, endpts.size() > 1 ? ":" : ""), + endpts.begin(), + endpts.end(), + ostream_iterator(o, endpts.size() > 1 ? ":" : ""), [](const EndpointPtr& endpoint) { return endpoint->toString(); }); out << o.str(); } diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp index 4e4414f3b38..b400d8de1aa 100644 --- a/cpp/src/Ice/OpaqueEndpointI.cpp +++ b/cpp/src/Ice/OpaqueEndpointI.cpp @@ -313,19 +313,25 @@ IceInternal::OpaqueEndpointI::checkOption(const string& option, const string& ar if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -t option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -t option in endpoint " + endpoint); } istringstream p(argument); int32_t t; if (!(p >> t) || !p.eof()) { throw EndpointParseException( - __FILE__, __LINE__, "invalid type value `" + argument + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid type value `" + argument + "' in endpoint " + endpoint); } else if (t < 0 || t > 65535) { throw EndpointParseException( - __FILE__, __LINE__, "type value `" + argument + "' out of range in endpoint " + endpoint); + __FILE__, + __LINE__, + "type value `" + argument + "' out of range in endpoint " + endpoint); } _type = static_cast(t); return true; @@ -340,7 +346,9 @@ IceInternal::OpaqueEndpointI::checkOption(const string& option, const string& ar if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -v option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -v option in endpoint " + endpoint); } for (string::size_type i = 0; i < argument.size(); ++i) { @@ -361,7 +369,9 @@ IceInternal::OpaqueEndpointI::checkOption(const string& option, const string& ar if (argument.empty()) { throw Ice::EndpointParseException( - __FILE__, __LINE__, "no argument provided for -e option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -e option in endpoint " + endpoint); } try @@ -371,7 +381,8 @@ IceInternal::OpaqueEndpointI::checkOption(const string& option, const string& ar catch (const Ice::VersionParseException& ex) { throw Ice::EndpointParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "invalid encoding version `" + argument + "' in endpoint " + endpoint + ":\n" + ex.str); } return true; diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 4d2b329c1b0..b9605c49a23 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -367,7 +367,8 @@ ProxyOutgoingAsyncBase::exception(std::exception_ptr exc) // connection locked so we can't just retry here. // _instance->retryQueue()->add( - shared_from_this(), _proxy._getRequestHandlerCache()->handleException(exc, _handler, _mode, _sent, _cnt)); + shared_from_this(), + _proxy._getRequestHandlerCache()->handleException(exc, _handler, _mode, _sent, _cnt)); return false; } @@ -522,8 +523,8 @@ ProxyOutgoingAsyncBase::invokeImpl(bool userThread) _childObserver.failed(ex.ice_id()); _childObserver.detach(); } - int interval = _proxy._getRequestHandlerCache()->handleException( - current_exception(), _handler, _mode, _sent, _cnt); + int interval = _proxy._getRequestHandlerCache() + ->handleException(current_exception(), _handler, _mode, _sent, _cnt); if (interval > 0) { diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index e9229735759..9e8293e3750 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -395,7 +395,9 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St catch (const IceUtilInternal::BadOptException& ex) { throw PluginInitializationException( - __FILE__, __LINE__, "invalid arguments for plug-in `" + name + "':\n" + ex.reason); + __FILE__, + __LINE__, + "invalid arguments for plug-in `" + name + "':\n" + ex.reason); } assert(!args.empty()); diff --git a/cpp/src/Ice/Properties.cpp b/cpp/src/Ice/Properties.cpp index 996abfafcdd..60f663749e2 100644 --- a/cpp/src/Ice/Properties.cpp +++ b/cpp/src/Ice/Properties.cpp @@ -266,7 +266,8 @@ Ice::Properties::setProperty(string_view key, string_view value) } if (!found && IceUtilInternal::match( - IceUtilInternal::toUpper(currentKey), IceUtilInternal::toUpper(prop.pattern))) + IceUtilInternal::toUpper(currentKey), + IceUtilInternal::toUpper(prop.pattern))) { found = true; mismatchCase = true; @@ -378,7 +379,8 @@ Ice::Properties::load(string_view file) if ((err = RegOpenKeyExW(key, keyName.c_str(), 0, KEY_QUERY_VALUE, &iceKey)) != ERROR_SUCCESS) { throw InitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "could not open Windows registry key `" + string{file} + "':\n" + IceUtilInternal::errorToString(err)); } @@ -388,12 +390,23 @@ Ice::Properties::load(string_view file) try { err = RegQueryInfoKey( - iceKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &numValues, &maxNameSize, &maxDataSize, - nullptr, nullptr); + iceKey, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + &numValues, + &maxNameSize, + &maxDataSize, + nullptr, + nullptr); if (err != ERROR_SUCCESS) { throw InitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "could not open Windows registry key `" + string{file} + "':\n" + IceUtilInternal::errorToString(err)); } @@ -442,12 +455,16 @@ Ice::Properties::load(string_view file) { vector expandedValue(1024); DWORD sz = ExpandEnvironmentStringsW( - valueW.c_str(), &expandedValue[0], static_cast(expandedValue.size())); + valueW.c_str(), + &expandedValue[0], + static_cast(expandedValue.size())); if (sz >= expandedValue.size()) { expandedValue.resize(sz + 1); if (ExpandEnvironmentStringsW( - valueW.c_str(), &expandedValue[0], static_cast(expandedValue.size())) == 0) + valueW.c_str(), + &expandedValue[0], + static_cast(expandedValue.size())) == 0) { ostringstream os; os << "could not expand variable in property `" << name diff --git a/cpp/src/Ice/Protocol.cpp b/cpp/src/Ice/Protocol.cpp index 599279366a0..40df0d53c55 100644 --- a/cpp/src/Ice/Protocol.cpp +++ b/cpp/src/Ice/Protocol.cpp @@ -130,7 +130,8 @@ namespace Ice // const EncodingVersion currentProtocolEncoding = { - IceInternal::protocolEncodingMajor, IceInternal::protocolEncodingMinor}; + IceInternal::protocolEncodingMajor, + IceInternal::protocolEncodingMinor}; const ProtocolVersion Protocol_1_0 = {1, 0}; diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index fba98a560ef..3cc6ff4ed42 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -440,7 +440,10 @@ Ice::ObjectPrx::_endpoints(const EndpointSeq& newEndpoints) const auto currentEndpoints = _reference->getEndpoints(); if (equal( - endpoints.begin(), endpoints.end(), currentEndpoints.begin(), currentEndpoints.end(), + endpoints.begin(), + endpoints.end(), + currentEndpoints.begin(), + currentEndpoints.end(), targetEqualTo)) { return _reference; diff --git a/cpp/src/Ice/ProxyAsync.cpp b/cpp/src/Ice/ProxyAsync.cpp index f069dc81557..80793dc24e5 100644 --- a/cpp/src/Ice/ProxyAsync.cpp +++ b/cpp/src/Ice/ProxyAsync.cpp @@ -311,7 +311,13 @@ Ice::ObjectPrx::ice_isAAsync( const Ice::Context& context) const { return makeLambdaOutgoing( - std::move(response), std::move(ex), std::move(sent), this, &ObjectPrx::_iceI_isA, typeId, context); + std::move(response), + std::move(ex), + std::move(sent), + this, + &ObjectPrx::_iceI_isA, + typeId, + context); } std::future @@ -327,8 +333,12 @@ Ice::ObjectPrx::_iceI_isA(const shared_ptr>& outAsync, stri static constexpr string_view operationName = "ice_isA"; _checkTwowayOnly(operationName); outAsync->invoke( - operationName, OperationMode::Nonmutating, FormatType::DefaultFormat, ctx, - [&](Ice::OutputStream* os) { os->write(typeId, false); }, nullptr); + operationName, + OperationMode::Nonmutating, + FormatType::DefaultFormat, + ctx, + [&](Ice::OutputStream* os) { os->write(typeId, false); }, + nullptr); } void @@ -345,7 +355,12 @@ Ice::ObjectPrx::ice_pingAsync( const Ice::Context& context) const { return makeLambdaOutgoing( - std::move(response), std::move(ex), std::move(sent), this, &ObjectPrx::_iceI_ping, context); + std::move(response), + std::move(ex), + std::move(sent), + this, + &ObjectPrx::_iceI_ping, + context); } std::future @@ -375,7 +390,12 @@ Ice::ObjectPrx::ice_idsAsync( const Ice::Context& context) const { return makeLambdaOutgoing>( - std::move(response), std::move(ex), std::move(sent), this, &ObjectPrx::_iceI_ids, context); + std::move(response), + std::move(ex), + std::move(sent), + this, + &ObjectPrx::_iceI_ids, + context); } std::future> @@ -390,7 +410,12 @@ Ice::ObjectPrx::_iceI_ids(const shared_ptr>>& outA static constexpr string_view operationName = "ice_ids"; _checkTwowayOnly(operationName); outAsync->invoke( - operationName, OperationMode::Nonmutating, FormatType::DefaultFormat, ctx, nullptr, nullptr, + operationName, + OperationMode::Nonmutating, + FormatType::DefaultFormat, + ctx, + nullptr, + nullptr, [](Ice::InputStream* stream) { vector v; @@ -413,7 +438,12 @@ Ice::ObjectPrx::ice_idAsync( const Ice::Context& context) const { return makeLambdaOutgoing( - std::move(response), std::move(ex), std::move(sent), this, &ObjectPrx::_iceI_id, context); + std::move(response), + std::move(ex), + std::move(sent), + this, + &ObjectPrx::_iceI_id, + context); } std::future @@ -428,7 +458,12 @@ Ice::ObjectPrx::_iceI_id(const shared_ptr>& outAsync, con static constexpr string_view operationName = "ice_id"; _checkTwowayOnly(operationName); outAsync->invoke( - operationName, OperationMode::Nonmutating, FormatType::DefaultFormat, ctx, nullptr, nullptr, + operationName, + OperationMode::Nonmutating, + FormatType::DefaultFormat, + ctx, + nullptr, + nullptr, [](Ice::InputStream* stream) { string v; diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 1939b631733..f576439e5ab 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -1064,8 +1064,18 @@ ReferencePtr IceInternal::RoutableReference::changeConnection(const Ice::ConnectionIPtr& connection) const { return make_shared( - getInstance(), getCommunicator(), getIdentity(), getFacet(), getMode(), getSecure(), getProtocol(), - getEncoding(), connection, getInvocationTimeout(), getContext()->getValue(), getCompress()); + getInstance(), + getCommunicator(), + getIdentity(), + getFacet(), + getMode(), + getSecure(), + getProtocol(), + getEncoding(), + connection, + getInvocationTimeout(), + getContext()->getValue(), + getCompress()); } bool @@ -1257,10 +1267,11 @@ IceInternal::RoutableReference::operator==(const Reference& r) const // TODO: With C++14 we could use the version that receives four iterators and we don't need to explicitly // check the sizes are equal. // - if (_endpoints.size() != rhs->_endpoints.size() || - !equal( - _endpoints.begin(), _endpoints.end(), rhs->_endpoints.begin(), - Ice::TargetCompare, std::equal_to>())) + if (_endpoints.size() != rhs->_endpoints.size() || !equal( + _endpoints.begin(), + _endpoints.end(), + rhs->_endpoints.begin(), + Ice::TargetCompare, std::equal_to>())) { return false; } @@ -1383,7 +1394,10 @@ IceInternal::RoutableReference::operator<(const Reference& r) const return false; } if (lexicographical_compare( - _endpoints.begin(), _endpoints.end(), rhs->_endpoints.begin(), rhs->_endpoints.end(), + _endpoints.begin(), + _endpoints.end(), + rhs->_endpoints.begin(), + rhs->_endpoints.end(), Ice::TargetCompare, std::less>())) { return true; @@ -1486,7 +1500,8 @@ IceInternal::RoutableReference::getConnectionNoRouterInfoAsync( vector endpts = endpoints; _reference->applyOverrides(endpts); _reference->createConnectionAsync( - endpts, _response, + endpts, + _response, [reference = _reference, response = _response, exception = _exception, cached](std::exception_ptr exc) { try @@ -1549,7 +1564,9 @@ IceInternal::RoutableReference::getConnectionNoRouterInfoAsync( RoutableReferencePtr self = dynamic_pointer_cast(const_cast(this)->shared_from_this()); _locatorInfo->getEndpoints( - self, _locatorCacheTimeout, make_shared(self, std::move(response), std::move(exception))); + self, + _locatorCacheTimeout, + make_shared(self, std::move(response), std::move(exception))); } else { @@ -1589,7 +1606,11 @@ IceInternal::RoutableReference::createConnectionAsync( { // Get an existing connection or create one if there's no existing connection to one of the given endpoints. factory->createAsync( - endpoints, false, getEndpointSelection(), std::move(createConnectionSucceded), std::move(exception)); + endpoints, + false, + getEndpointSelection(), + std::move(createConnectionSucceded), + std::move(exception)); } else { @@ -1617,7 +1638,10 @@ IceInternal::RoutableReference::createConnectionAsync( void createAsync() { _factory->createAsync( - {_endpoints[_endpointIndex]}, true, _endpointSelection, _createConnectionSucceded, + {_endpoints[_endpointIndex]}, + true, + _endpointSelection, + _createConnectionSucceded, [self = shared_from_this()](exception_ptr e) { self->handleException(e); }); } @@ -1636,7 +1660,10 @@ IceInternal::RoutableReference::createConnectionAsync( const bool more = _endpointIndex != _endpoints.size() - 1; _factory->createAsync( - {_endpoints[_endpointIndex]}, more, _endpointSelection, _createConnectionSucceded, + {_endpoints[_endpointIndex]}, + more, + _endpointSelection, + _createConnectionSucceded, [self = shared_from_this()](exception_ptr e) { self->handleException(e); }); } @@ -1651,7 +1678,10 @@ IceInternal::RoutableReference::createConnectionAsync( }; auto state = make_shared( - std::move(endpoints), std::move(factory), getEndpointSelection(), std::move(createConnectionSucceded), + std::move(endpoints), + std::move(factory), + getEndpointSelection(), + std::move(createConnectionSucceded), std::move(exception)); state->createAsync(); } @@ -1700,7 +1730,8 @@ IceInternal::RoutableReference::filterEndpoints(const vector& allE // Filter out unknown endpoints. endpoints.erase( remove_if( - endpoints.begin(), endpoints.end(), + endpoints.begin(), + endpoints.end(), [](const EndpointIPtr& p) { return dynamic_cast(p.get()) != 0; }), endpoints.end()); diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index 0cdaf451b85..fddb796b182 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -36,7 +36,15 @@ IceInternal::ReferenceFactory::create( assert(!ident.name.empty()); return create( - ident, facet, tmpl->getMode(), tmpl->getSecure(), tmpl->getProtocol(), tmpl->getEncoding(), endpoints, "", ""); + ident, + facet, + tmpl->getMode(), + tmpl->getSecure(), + tmpl->getProtocol(), + tmpl->getEncoding(), + endpoints, + "", + ""); } ReferencePtr @@ -49,8 +57,15 @@ IceInternal::ReferenceFactory::create( assert(!ident.name.empty()); return create( - ident, facet, tmpl->getMode(), tmpl->getSecure(), tmpl->getProtocol(), tmpl->getEncoding(), - vector(), adapterId, ""); + ident, + facet, + tmpl->getMode(), + tmpl->getSecure(), + tmpl->getProtocol(), + tmpl->getEncoding(), + vector(), + adapterId, + ""); } ReferencePtr @@ -62,11 +77,18 @@ IceInternal::ReferenceFactory::create(const Identity& ident, const Ice::Connecti // Create new reference // return make_shared( - _instance, _communicator, ident, + _instance, + _communicator, + ident, "", // Facet connection->endpoint()->datagram() ? Reference::ModeDatagram : Reference::ModeTwoway, - connection->endpoint()->secure(), Ice::Protocol_1_0, _instance->defaultsAndOverrides()->defaultEncoding, - connection, -1, Ice::Context(), optional()); + connection->endpoint()->secure(), + Ice::Protocol_1_0, + _instance->defaultsAndOverrides()->defaultEncoding, + connection, + -1, + Ice::Context(), + optional()); } ReferencePtr @@ -178,7 +200,9 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (option.length() != 2 || option[0] != '-') { throw ProxyParseException( - __FILE__, __LINE__, "expected a proxy option but found `" + option + "' in `" + s + "'"); + __FILE__, + __LINE__, + "expected a proxy option but found `" + option + "' in `" + s + "'"); } // @@ -197,7 +221,9 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (end == string::npos) { throw ProxyParseException( - __FILE__, __LINE__, "mismatched quotes around value for " + option + " option in `" + s + "'"); + __FILE__, + __LINE__, + "mismatched quotes around value for " + option + " option in `" + s + "'"); } else if (end == 0) { @@ -247,7 +273,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (!argument.empty()) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "unexpected argument `" + argument + "' provided for -t option in `" + s + "'"); } mode = Reference::ModeTwoway; @@ -259,7 +286,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (!argument.empty()) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "unexpected argument `" + argument + "' provided for -o option in `" + s + "'"); } mode = Reference::ModeOneway; @@ -271,7 +299,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (!argument.empty()) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "unexpected argument `" + argument + "' provided for -O option in `" + s + "'"); } mode = Reference::ModeBatchOneway; @@ -283,7 +312,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (!argument.empty()) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "unexpected argument `" + argument + "' provided for -d option in `" + s + "'"); } mode = Reference::ModeDatagram; @@ -295,7 +325,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (!argument.empty()) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "unexpected argument `" + argument + "' provided for -D option in `" + s + "'"); } mode = Reference::ModeBatchDatagram; @@ -307,7 +338,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (!argument.empty()) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "unexpected argument `" + argument + "' provided for -s option in `" + s + "'"); } secure = true; @@ -328,7 +360,9 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP catch (const Ice::VersionParseException& ex) { throw ProxyParseException( - __FILE__, __LINE__, "invalid encoding version `" + argument + "' in `" + s + "':\n" + ex.str); + __FILE__, + __LINE__, + "invalid encoding version `" + argument + "' in `" + s + "':\n" + ex.str); } break; } @@ -347,7 +381,9 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP catch (const Ice::VersionParseException& ex) { throw ProxyParseException( - __FILE__, __LINE__, "invalid protocol version `" + argument + "' in `" + s + "':\n" + ex.str); + __FILE__, + __LINE__, + "invalid protocol version `" + argument + "' in `" + s + "':\n" + ex.str); } break; } @@ -434,7 +470,9 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP { assert(!unknownEndpoints.empty()); throw EndpointParseException( - __FILE__, __LINE__, "invalid endpoint `" + unknownEndpoints.front() + "' in `" + s + "'"); + __FILE__, + __LINE__, + "invalid endpoint `" + unknownEndpoints.front() + "' in `" + s + "'"); } else if ( unknownEndpoints.size() != 0 && @@ -485,7 +523,8 @@ IceInternal::ReferenceFactory::create(const string& str, const string& propertyP if (end != string::npos && s.find_first_not_of(delim, end) != string::npos) { throw ProxyParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "invalid trailing characters after `" + s.substr(0, end + 1) + "' in `" + s + "'"); } @@ -631,9 +670,16 @@ IceInternal::ReferenceFactory::ReferenceFactory(const InstancePtr& instance, con void IceInternal::ReferenceFactory::checkForUnknownProperties(const string& prefix) { - static const string suffixes[] = {"EndpointSelection", "ConnectionCached", "PreferSecure", "LocatorCacheTimeout", - "InvocationTimeout", "Locator", "Router", "CollocationOptimized", - "Context.*"}; + static const string suffixes[] = { + "EndpointSelection", + "ConnectionCached", + "PreferSecure", + "LocatorCacheTimeout", + "InvocationTimeout", + "Locator", + "Router", + "CollocationOptimized", + "Context.*"}; // // Do not warn about unknown properties list if Ice prefix, ie Ice, Glacier2, etc @@ -783,7 +829,9 @@ IceInternal::ReferenceFactory::create( else { throw EndpointSelectionTypeParseException( - __FILE__, __LINE__, "illegal value `" + type + "'; expected `Random' or `Ordered'"); + __FILE__, + __LINE__, + "illegal value `" + type + "'; expected `Random' or `Ordered'"); } } @@ -829,7 +877,23 @@ IceInternal::ReferenceFactory::create( // Create new reference // return make_shared( - _instance, _communicator, ident, facet, mode, secure, protocol, encoding, endpoints, adapterId, locatorInfo, - routerInfo, collocationOptimized, cacheConnection, preferSecure, endpointSelection, locatorCacheTimeout, - invocationTimeout, ctx); + _instance, + _communicator, + ident, + facet, + mode, + secure, + protocol, + encoding, + endpoints, + adapterId, + locatorInfo, + routerInfo, + collocationOptimized, + cacheConnection, + preferSecure, + endpointSelection, + locatorCacheTimeout, + invocationTimeout, + ctx); } diff --git a/cpp/src/Ice/SHA1.cpp b/cpp/src/Ice/SHA1.cpp index 8ce521769d7..268a0d51175 100644 --- a/cpp/src/Ice/SHA1.cpp +++ b/cpp/src/Ice/SHA1.cpp @@ -186,7 +186,8 @@ IceInternal::sha1(const byte* data, size_t length, vector& md) #elif defined(__APPLE__) md.resize(CC_SHA1_DIGEST_LENGTH); CC_SHA1( - reinterpret_cast(&data[0]), static_cast(length), + reinterpret_cast(&data[0]), + static_cast(length), reinterpret_cast(&md[0])); #else md.resize(SHA_DIGEST_LENGTH); diff --git a/cpp/src/Ice/Selector.cpp b/cpp/src/Ice/Selector.cpp index dbf7d85ddfc..8031a4445c7 100644 --- a/cpp/src/Ice/Selector.cpp +++ b/cpp/src/Ice/Selector.cpp @@ -58,7 +58,10 @@ Selector::initialize(EventHandler* handler) if (socket != INVALID_SOCKET) { if (CreateIoCompletionPort( - reinterpret_cast(socket), _handle, reinterpret_cast(handler), 0) == nullptr) + reinterpret_cast(socket), + _handle, + reinterpret_cast(handler), + 0) == nullptr) { throw Ice::SocketException(__FILE__, __LINE__, GetLastError()); } @@ -734,7 +737,11 @@ Selector::updateSelector() { # if defined(ICE_USE_KQUEUE) int rs = kevent( - _queueFd, &_changes[0], static_cast(_changes.size()), &_changes[0], static_cast(_changes.size()), + _queueFd, + &_changes[0], + static_cast(_changes.size()), + &_changes[0], + static_cast(_changes.size()), &zeroTimeout); if (rs < 0) { @@ -924,14 +931,25 @@ Selector::updateSelectorForEventHandler( { struct kevent ev; EV_SET( - &ev, fd, EVFILT_READ, EV_ADD | (handler->_disabled & SocketOperationRead ? EV_DISABLE : 0), 0, 0, handler); + &ev, + fd, + EVFILT_READ, + EV_ADD | (handler->_disabled & SocketOperationRead ? EV_DISABLE : 0), + 0, + 0, + handler); _changes.push_back(ev); } if (add & SocketOperationWrite) { struct kevent ev; EV_SET( - &ev, fd, EVFILT_WRITE, EV_ADD | (handler->_disabled & SocketOperationWrite ? EV_DISABLE : 0), 0, 0, + &ev, + fd, + EVFILT_WRITE, + EV_ADD | (handler->_disabled & SocketOperationWrite ? EV_DISABLE : 0), + 0, + 0, handler); _changes.push_back(ev); } @@ -966,7 +984,8 @@ namespace else if (callbackType == kCFSocketConnectCallBack) { reinterpret_cast(info)->readyCallback( - SocketOperationConnect, d ? *reinterpret_cast(d) : 0); + SocketOperationConnect, + d ? *reinterpret_cast(d) : 0); } } @@ -1005,13 +1024,17 @@ EventHandlerWrapper::EventHandlerWrapper(EventHandler* handler, Selector& select SOCKET fd = handler->getNativeInfo()->fd(); CFSocketContext ctx = {0, this, 0, 0, 0}; _socket.reset(CFSocketCreateWithNative( - kCFAllocatorDefault, fd, kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack, - eventHandlerSocketCallback, &ctx)); + kCFAllocatorDefault, + fd, + kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack, + eventHandlerSocketCallback, + &ctx)); // Disable automatic re-enabling of callbacks and closing of the native socket. CFSocketSetSocketFlags(_socket.get(), 0); CFSocketDisableCallBacks( - _socket.get(), kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack); + _socket.get(), + kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack); _source.reset(CFSocketCreateRunLoopSource(kCFAllocatorDefault, _socket.get(), 0)); } } @@ -1027,7 +1050,8 @@ EventHandlerWrapper::updateRunLoop() if (_socket) { CFSocketDisableCallBacks( - _socket.get(), kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack); + _socket.get(), + kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack); if (op) { CFSocketEnableCallBacks(_socket.get(), toCFCallbacks(op)); diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp index efb1a35a424..111a2878171 100644 --- a/cpp/src/Ice/ServantManager.cpp +++ b/cpp/src/Ice/ServantManager.cpp @@ -162,7 +162,10 @@ IceInternal::ServantManager::removeAllFacets(const Identity& ident) if (p == _servantMapMap.end()) { throw NotRegisteredException( - __FILE__, __LINE__, "servant", Ice::identityToString(ident, _instance->toStringMode())); + __FILE__, + __LINE__, + "servant", + Ice::identityToString(ident, _instance->toStringMode())); } FacetMap result = p->second; diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index 002bff1541f..d17a71322be 100644 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -187,8 +187,15 @@ namespace // to Windows API. // LONG err = RegCreateKeyExW( - HKEY_LOCAL_MACHINE, stringToWstring(createKey(source), stringConverter).c_str(), 0, - const_cast(L"REG_SZ"), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &d); + HKEY_LOCAL_MACHINE, + stringToWstring(createKey(source), stringConverter).c_str(), + 0, + const_cast(L"REG_SZ"), + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + 0, + &hKey, + &d); if (err != ERROR_SUCCESS) { @@ -212,7 +219,11 @@ namespace // DLL. // err = RegSetValueExW( - hKey, L"EventMessageFile", 0, REG_EXPAND_SZ, reinterpret_cast(path), + hKey, + L"EventMessageFile", + 0, + REG_EXPAND_SZ, + reinterpret_cast(path), static_cast((wcslen(path) * sizeof(wchar_t)) + 1)); if (err == ERROR_SUCCESS) @@ -223,7 +234,11 @@ namespace // DWORD typesSupported = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; err = RegSetValueExW( - hKey, L"TypesSupported", 0, REG_DWORD, reinterpret_cast(&typesSupported), + hKey, + L"TypesSupported", + 0, + REG_DWORD, + reinterpret_cast(&typesSupported), sizeof(typesSupported)); } if (err != ERROR_SUCCESS) @@ -517,7 +532,8 @@ Ice::Service::main(int argc, const char* const argv[], const InitializationData& { string eventLogSource = initData.properties->getPropertyWithDefault("Ice.EventLog.Source", name); _logger = make_shared( - make_shared(eventLogSource, stringConverter), ""); + make_shared(eventLogSource, stringConverter), + ""); setProcessLogger(_logger); } diff --git a/cpp/src/Ice/SystemdJournalI.cpp b/cpp/src/Ice/SystemdJournalI.cpp index 287aebdc536..7e1601bc7d2 100644 --- a/cpp/src/Ice/SystemdJournalI.cpp +++ b/cpp/src/Ice/SystemdJournalI.cpp @@ -55,7 +55,12 @@ void Ice::SystemdJournalI::write(int priority, const string& message) const { sd_journal_send( - "MESSAGE=%s", message.c_str(), "PRIORITY=%i", priority, "SYSLOG_IDENTIFIER=%s", _prefix.c_str(), + "MESSAGE=%s", + message.c_str(), + "PRIORITY=%i", + priority, + "SYSLOG_IDENTIFIER=%s", + _prefix.c_str(), NULL); // Using NULL is necessary for EL7, see #293 } diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp index 085404b97a3..32e686b0567 100644 --- a/cpp/src/Ice/TcpAcceptor.cpp +++ b/cpp/src/Ice/TcpAcceptor.cpp @@ -86,8 +86,15 @@ IceInternal::TcpAcceptor::startAccept() GUID GuidAcceptEx = WSAID_ACCEPTEX; // The Guid DWORD dwBytes; if (WSAIoctl( - _fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &GuidAcceptEx, sizeof(GuidAcceptEx), &AcceptEx, sizeof(AcceptEx), - &dwBytes, nullptr, nullptr) == SOCKET_ERROR) + _fd, + SIO_GET_EXTENSION_FUNCTION_POINTER, + &GuidAcceptEx, + sizeof(GuidAcceptEx), + &AcceptEx, + sizeof(AcceptEx), + &dwBytes, + nullptr, + nullptr) == SOCKET_ERROR) { throw SocketException(__FILE__, __LINE__, getSocketErrno()); } diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp index 88c0506ba21..cac07a96ea6 100644 --- a/cpp/src/Ice/TcpEndpointI.cpp +++ b/cpp/src/Ice/TcpEndpointI.cpp @@ -26,7 +26,8 @@ extern "C" Plugin* createIceTCP(const CommunicatorPtr& c, const string&, const StringSeq&) { return new EndpointFactoryPlugin( - c, make_shared(make_shared(c, TCPEndpointType, "tcp", false))); + c, + make_shared(make_shared(c, TCPEndpointType, "tcp", false))); } } @@ -130,7 +131,9 @@ AcceptorPtr IceInternal::TcpEndpointI::acceptor(const string&) const { return make_shared( - dynamic_pointer_cast(const_cast(this)->shared_from_this()), _instance, _host, + dynamic_pointer_cast(const_cast(this)->shared_from_this()), + _instance, + _host, _port); } @@ -281,7 +284,9 @@ IceInternal::TcpEndpointI::checkOption(const string& option, const string& argum if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -t option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -t option in endpoint " + endpoint); } if (argument == "infinite") @@ -294,7 +299,9 @@ IceInternal::TcpEndpointI::checkOption(const string& option, const string& argum if (!(t >> const_cast(_timeout)) || !t.eof() || _timeout < 1) { throw EndpointParseException( - __FILE__, __LINE__, "invalid timeout value `" + argument + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid timeout value `" + argument + "' in endpoint " + endpoint); } } return true; @@ -305,7 +312,9 @@ IceInternal::TcpEndpointI::checkOption(const string& option, const string& argum if (!argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unexpected argument `" + argument + "' provided for -z option in " + endpoint); + __FILE__, + __LINE__, + "unexpected argument `" + argument + "' provided for -z option in " + endpoint); } const_cast(_compress) = true; return true; diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 1b8bf440f4d..f652d6986e6 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -922,9 +922,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current) { Warning out(_instance->initializationData().logger); out << "thread pool `" << _prefix << "' is running low on threads\n" - << "Size=" << _size << ", " - << "SizeMax=" << _sizeMax << ", " - << "SizeWarn=" << _sizeWarn; + << "Size=" << _size << ", " << "SizeMax=" << _sizeMax << ", " << "SizeWarn=" << _sizeWarn; } if (!_destroyed) diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp index c76ea653e27..dcb5be2a8c6 100644 --- a/cpp/src/Ice/UdpEndpointI.cpp +++ b/cpp/src/Ice/UdpEndpointI.cpp @@ -23,7 +23,8 @@ extern "C" Plugin* createIceUDP(const CommunicatorPtr& c, const string&, const StringSeq&) { return new EndpointFactoryPlugin( - c, make_shared(make_shared(c, UDPEndpointType, "udp", false))); + c, + make_shared(make_shared(c, UDPEndpointType, "udp", false))); } } @@ -131,7 +132,15 @@ IceInternal::UdpEndpointI::compress(bool compress) const else { return make_shared( - _instance, _host, _port, _sourceAddr, _mcastInterface, _mcastTtl, _connect, _connectionId, compress); + _instance, + _host, + _port, + _sourceAddr, + _mcastInterface, + _mcastTtl, + _connect, + _connectionId, + compress); } } @@ -145,8 +154,12 @@ TransceiverPtr IceInternal::UdpEndpointI::transceiver() const { return make_shared( - dynamic_pointer_cast(const_cast(this)->shared_from_this()), _instance, _host, - _port, _mcastInterface, _connect); + dynamic_pointer_cast(const_cast(this)->shared_from_this()), + _instance, + _host, + _port, + _mcastInterface, + _connect); } AcceptorPtr @@ -166,7 +179,15 @@ IceInternal::UdpEndpointI::endpoint(const UdpTransceiverPtr& transceiver) const else { return make_shared( - _instance, _host, port, _sourceAddr, _mcastInterface, _mcastTtl, _connect, _connectionId, _compress); + _instance, + _host, + port, + _sourceAddr, + _mcastInterface, + _mcastTtl, + _connect, + _connectionId, + _compress); } } @@ -184,7 +205,9 @@ IceInternal::UdpEndpointI::initWithOptions(vector& args, bool oaEndpoint else { throw EndpointParseException( - __FILE__, __LINE__, "`--interface *' not valid for proxy endpoint `" + toString() + "'"); + __FILE__, + __LINE__, + "`--interface *' not valid for proxy endpoint `" + toString() + "'"); } } } @@ -372,7 +395,9 @@ IceInternal::UdpEndpointI::checkOption(const string& option, const string& argum if (!argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unexpected argument `" + argument + "' provided for -c option in " + endpoint); + __FILE__, + __LINE__, + "unexpected argument `" + argument + "' provided for -c option in " + endpoint); } const_cast(_connect) = true; } @@ -381,7 +406,9 @@ IceInternal::UdpEndpointI::checkOption(const string& option, const string& argum if (!argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unexpected argument `" + argument + "' provided for -z option in " + endpoint); + __FILE__, + __LINE__, + "unexpected argument `" + argument + "' provided for -z option in " + endpoint); } const_cast(_compress) = true; } @@ -390,7 +417,9 @@ IceInternal::UdpEndpointI::checkOption(const string& option, const string& argum if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for " + option + " option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for " + option + " option in endpoint " + endpoint); } try { @@ -404,7 +433,9 @@ IceInternal::UdpEndpointI::checkOption(const string& option, const string& argum catch (const VersionParseException& ex) { throw EndpointParseException( - __FILE__, __LINE__, "invalid version `" + argument + "' in endpoint " + endpoint + ":\n" + ex.str); + __FILE__, + __LINE__, + "invalid version `" + argument + "' in endpoint " + endpoint + ":\n" + ex.str); } } else if (option == "--interface") @@ -412,7 +443,9 @@ IceInternal::UdpEndpointI::checkOption(const string& option, const string& argum if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for --interface option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for --interface option in endpoint " + endpoint); } const_cast(_mcastInterface) = argument; } @@ -421,13 +454,17 @@ IceInternal::UdpEndpointI::checkOption(const string& option, const string& argum if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for --ttl option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for --ttl option in endpoint " + endpoint); } istringstream p(argument); if (!(p >> const_cast(_mcastTtl)) || !p.eof()) { throw EndpointParseException( - __FILE__, __LINE__, "invalid TTL value `" + argument + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid TTL value `" + argument + "' in endpoint " + endpoint); } } else @@ -447,7 +484,15 @@ IPEndpointIPtr IceInternal::UdpEndpointI::createEndpoint(const string& host, int port, const string& connectionId) const { return make_shared( - _instance, host, port, _sourceAddr, _mcastInterface, _mcastTtl, _connect, connectionId, _compress); + _instance, + host, + port, + _sourceAddr, + _mcastInterface, + _mcastTtl, + _connect, + connectionId, + _compress); } IceInternal::UdpEndpointFactory::UdpEndpointFactory(const ProtocolInstancePtr& instance) : _instance(instance) {} diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index ef3ba6bdb08..798d0179e89 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -172,7 +172,12 @@ IceInternal::UdpTransceiver::write(Buffer& buf) #ifdef _WIN32 ret = ::sendto( - _fd, reinterpret_cast(&buf.b[0]), static_cast(buf.b.size()), 0, &_peerAddr.sa, len); + _fd, + reinterpret_cast(&buf.b[0]), + static_cast(buf.b.size()), + 0, + &_peerAddr.sa, + len); #else ret = ::sendto(_fd, reinterpret_cast(&buf.b[0]), buf.b.size(), 0, &_peerAddr.sa, len); #endif diff --git a/cpp/src/Ice/WSEndpoint.cpp b/cpp/src/Ice/WSEndpoint.cpp index 5bd1179cdfd..11e25c83fb6 100644 --- a/cpp/src/Ice/WSEndpoint.cpp +++ b/cpp/src/Ice/WSEndpoint.cpp @@ -60,9 +60,11 @@ WSEndpointFactoryPlugin::WSEndpointFactoryPlugin(const CommunicatorPtr& communic const EndpointFactoryManagerPtr efm = getInstance(communicator)->endpointFactoryManager(); efm->add(make_shared( - make_shared(communicator, WSEndpointType, "ws", false), TCPEndpointType)); + make_shared(communicator, WSEndpointType, "ws", false), + TCPEndpointType)); efm->add(make_shared( - make_shared(communicator, WSSEndpointType, "wss", true), SSLEndpointType)); + make_shared(communicator, WSSEndpointType, "wss", true), + SSLEndpointType)); } void @@ -426,7 +428,8 @@ IceInternal::WSEndpoint::checkOption(const string& option, const string& argumen if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "no argument provided for -r option in endpoint " + endpoint + _delegate->options()); } const_cast(_resource) = argument; diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp index 5c6adc46069..a0003a01daf 100644 --- a/cpp/src/Ice/WSTransceiver.cpp +++ b/cpp/src/Ice/WSTransceiver.cpp @@ -1524,8 +1524,9 @@ IceInternal::WSTransceiver::preWrite(Buffer& buf) } else if (_writePayloadLength == 0) { - size_t n = min( - static_cast(_writeBuffer.b.end() - _writeBuffer.i), static_cast(buf.b.end() - buf.i)); + size_t n = + min(static_cast(_writeBuffer.b.end() - _writeBuffer.i), + static_cast(buf.b.end() - buf.i)); memcpy(_writeBuffer.i, buf.i, n); _writeBuffer.i += n; buf.i += n; diff --git a/cpp/src/Ice/ios/StreamEndpointI.cpp b/cpp/src/Ice/ios/StreamEndpointI.cpp index 27a28f90fdf..49003612842 100644 --- a/cpp/src/Ice/ios/StreamEndpointI.cpp +++ b/cpp/src/Ice/ios/StreamEndpointI.cpp @@ -221,7 +221,10 @@ AcceptorPtr IceObjC::StreamEndpointI::acceptor(const string&) const { return make_shared( - const_cast(this)->shared_from_this(), _streamInstance, _host, _port); + const_cast(this)->shared_from_this(), + _streamInstance, + _host, + _port); } IceObjC::StreamEndpointIPtr @@ -235,7 +238,13 @@ IceObjC::StreamEndpointI::endpoint(const StreamAcceptorPtr& a) const else { return make_shared( - _streamInstance, _host, port, _sourceAddr, _timeout, _connectionId, _compress); + _streamInstance, + _host, + port, + _sourceAddr, + _timeout, + _connectionId, + _compress); } } @@ -373,7 +382,9 @@ IceObjC::StreamEndpointI::checkOption(const string& option, const string& argume if (argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -t option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -t option in endpoint " + endpoint); } if (argument == "infinite") @@ -386,7 +397,9 @@ IceObjC::StreamEndpointI::checkOption(const string& option, const string& argume if (!(t >> const_cast(_timeout)) || !t.eof() || _timeout < 1) { throw EndpointParseException( - __FILE__, __LINE__, "invalid timeout value `" + argument + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid timeout value `" + argument + "' in endpoint " + endpoint); } } return true; @@ -397,7 +410,9 @@ IceObjC::StreamEndpointI::checkOption(const string& option, const string& argume if (!argument.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unexpected argument `" + argument + "' provided for -z option in " + endpoint); + __FILE__, + __LINE__, + "unexpected argument `" + argument + "' provided for -z option in " + endpoint); } const_cast(_compress) = true; return true; diff --git a/cpp/src/Ice/ios/StreamTransceiver.cpp b/cpp/src/Ice/ios/StreamTransceiver.cpp index a88ce9e251f..89bf6eac4e0 100644 --- a/cpp/src/Ice/ios/StreamTransceiver.cpp +++ b/cpp/src/Ice/ios/StreamTransceiver.cpp @@ -245,9 +245,13 @@ IceObjC::StreamTransceiver::initialize(Buffer& /*readBuffer*/, Buffer& /*writeBu if (_fd == INVALID_SOCKET) { if (!CFReadStreamSetProperty( - _readStream.get(), kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse) || + _readStream.get(), + kCFStreamPropertyShouldCloseNativeSocket, + kCFBooleanFalse) || !CFWriteStreamSetProperty( - _writeStream.get(), kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse)) + _writeStream.get(), + kCFStreamPropertyShouldCloseNativeSocket, + kCFBooleanFalse)) { throw Ice::SocketException(__FILE__, __LINE__, 0); } @@ -338,7 +342,9 @@ IceObjC::StreamTransceiver::write(Buffer& buf) assert(_fd != INVALID_SOCKET); CFIndex ret = CFWriteStreamWrite( - _writeStream.get(), reinterpret_cast(&*buf.i), static_cast(packetSize)); + _writeStream.get(), + reinterpret_cast(&*buf.i), + static_cast(packetSize)); if (ret == SOCKET_ERROR) { diff --git a/cpp/src/IceBT/AcceptorI.cpp b/cpp/src/IceBT/AcceptorI.cpp index 32613865d2d..bf9ffaa6a9f 100644 --- a/cpp/src/IceBT/AcceptorI.cpp +++ b/cpp/src/IceBT/AcceptorI.cpp @@ -203,12 +203,16 @@ IceBT::AcceptorI::AcceptorI( if (!parseDeviceAddress(s, da)) { throw EndpointParseException( - __FILE__, __LINE__, "invalid address value `" + s + "' in endpoint " + endpoint->toString()); + __FILE__, + __LINE__, + "invalid address value `" + s + "' in endpoint " + endpoint->toString()); } if (!_instance->engine()->adapterExists(s)) { throw EndpointParseException( - __FILE__, __LINE__, "no device found for `" + s + "' in endpoint " + endpoint->toString()); + __FILE__, + __LINE__, + "no device found for `" + s + "' in endpoint " + endpoint->toString()); } const_cast(_addr) = s; diff --git a/cpp/src/IceBT/EndpointI.cpp b/cpp/src/IceBT/EndpointI.cpp index a5b4beec132..380c58a3f6c 100644 --- a/cpp/src/IceBT/EndpointI.cpp +++ b/cpp/src/IceBT/EndpointI.cpp @@ -183,7 +183,13 @@ IceInternal::AcceptorPtr IceBT::EndpointI::acceptor(const string& adapterName) const { return make_shared( - const_cast(this)->shared_from_this(), _instance, adapterName, _addr, _uuid, _name, _channel); + const_cast(this)->shared_from_this(), + _instance, + adapterName, + _addr, + _uuid, + _name, + _channel); } vector @@ -459,7 +465,9 @@ IceBT::EndpointI::initWithOptions(vector& args, bool oaEndpoint) else { throw EndpointParseException( - __FILE__, __LINE__, "`-a *' not valid for proxy endpoint `" + toString() + "'"); + __FILE__, + __LINE__, + "`-a *' not valid for proxy endpoint `" + toString() + "'"); } } @@ -499,8 +507,8 @@ IceBT::EndpointI::initWithOptions(vector& args, bool oaEndpoint) IceBT::EndpointIPtr IceBT::EndpointI::endpoint(const AcceptorIPtr& acceptor) const { - return make_shared( - _instance, _addr, _uuid, _name, acceptor->effectiveChannel(), _timeout, _connectionId, _compress); + return make_shared< + EndpointI>(_instance, _addr, _uuid, _name, acceptor->effectiveChannel(), _timeout, _connectionId, _compress); } void @@ -524,12 +532,16 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (arg.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -a option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -a option in endpoint " + endpoint); } if (arg != "*" && !isValidDeviceAddress(arg)) { throw EndpointParseException( - __FILE__, __LINE__, "invalid argument provided for -a option in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid argument provided for -a option in endpoint " + endpoint); } const_cast(_addr) = arg; } @@ -538,7 +550,9 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (arg.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -u option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -u option in endpoint " + endpoint); } const_cast(_uuid) = arg; } @@ -547,14 +561,18 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (arg.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -c option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -c option in endpoint " + endpoint); } istringstream t(argument); if (!(t >> const_cast(_channel)) || !t.eof() || _channel < 0 || _channel > 30) { throw EndpointParseException( - __FILE__, __LINE__, "invalid channel value `" + arg + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid channel value `" + arg + "' in endpoint " + endpoint); } } else if (option == "-t") @@ -562,7 +580,9 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (arg.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for -t option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for -t option in endpoint " + endpoint); } if (arg == "infinite") @@ -575,7 +595,9 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (!(t >> const_cast(_timeout)) || !t.eof() || _timeout < 1) { throw EndpointParseException( - __FILE__, __LINE__, "invalid timeout value `" + arg + "' in endpoint " + endpoint); + __FILE__, + __LINE__, + "invalid timeout value `" + arg + "' in endpoint " + endpoint); } } } @@ -584,7 +606,9 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (!arg.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "unexpected argument `" + arg + "' provided for -z option in " + endpoint); + __FILE__, + __LINE__, + "unexpected argument `" + arg + "' provided for -z option in " + endpoint); } const_cast(_compress) = true; } @@ -593,7 +617,9 @@ IceBT::EndpointI::checkOption(const string& option, const string& argument, cons if (arg.empty()) { throw EndpointParseException( - __FILE__, __LINE__, "no argument provided for --name option in endpoint " + endpoint); + __FILE__, + __LINE__, + "no argument provided for --name option in endpoint " + endpoint); } const_cast(_name) = arg; } diff --git a/cpp/src/IceBT/Engine.cpp b/cpp/src/IceBT/Engine.cpp index 3ee96cd6a4e..18124519238 100644 --- a/cpp/src/IceBT/Engine.cpp +++ b/cpp/src/IceBT/Engine.cpp @@ -679,7 +679,10 @@ namespace IceBT // out DICT>> objpath_interfaces_and_properties); // DBus::MessagePtr msg = DBus::Message::createCall( - "org.bluez", "/", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); + "org.bluez", + "/", + "org.freedesktop.DBus.ObjectManager", + "GetManagedObjects"); DBus::AsyncResultPtr r = _dbusConnection->callAsync(msg); DBus::MessagePtr reply = r->waitUntilFinished(); if (reply->isError()) @@ -775,28 +778,33 @@ namespace IceBT args.push_back(make_shared(path)); args.push_back(make_shared(uuid)); auto dt = make_shared( - DBus::Type::getPrimitive(DBus::Type::KindString), make_shared()); + DBus::Type::getPrimitive(DBus::Type::KindString), + make_shared()); auto t = make_shared(dt); auto options = make_shared(t); if (!name.empty()) { options->elements.push_back(make_shared( - dt, make_shared("Name"), + dt, + make_shared("Name"), make_shared(make_shared(name)))); } if (channel != -1) { options->elements.push_back(make_shared( - dt, make_shared("Channel"), + dt, + make_shared("Channel"), make_shared(make_shared(channel)))); options->elements.push_back(make_shared( - dt, make_shared("Role"), + dt, + make_shared("Role"), make_shared(make_shared("server")))); } else { options->elements.push_back(make_shared( - dt, make_shared("Role"), + dt, + make_shared("Role"), make_shared(make_shared("client")))); } args.push_back(options); @@ -1192,7 +1200,8 @@ namespace IceBT lock_guard lock(_mutex); auto p = find_if( - _connectThreads.begin(), _connectThreads.end(), + _connectThreads.begin(), + _connectThreads.end(), [threadId](const thread& t) { return t.get_id() == threadId; }); if (p != _connectThreads.end()) // May be missing if destroy() was called. diff --git a/cpp/src/IceBT/TransceiverI.cpp b/cpp/src/IceBT/TransceiverI.cpp index 8ab1cc7251d..e1abc9e1507 100644 --- a/cpp/src/IceBT/TransceiverI.cpp +++ b/cpp/src/IceBT/TransceiverI.cpp @@ -119,7 +119,11 @@ IceBT::TransceiverI::getInfo() const { auto info = make_shared(); fdToAddressAndChannel( - _stream->fd(), info->localAddress, info->localChannel, info->remoteAddress, info->remoteChannel); + _stream->fd(), + info->localAddress, + info->localChannel, + info->remoteAddress, + info->remoteChannel); if (_stream->fd() != INVALID_SOCKET) { info->rcvSize = IceInternal::getRecvBufferSize(_stream->fd()); diff --git a/cpp/src/IceBT/Util.cpp b/cpp/src/IceBT/Util.cpp index f18de112230..59a60ba697e 100644 --- a/cpp/src/IceBT/Util.cpp +++ b/cpp/src/IceBT/Util.cpp @@ -60,7 +60,13 @@ IceBT::formatDeviceAddress(const DeviceAddress& addr) { char buf[64]; sprintf( - buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", addr.b[5], addr.b[4], addr.b[3], addr.b[2], addr.b[1], + buf, + "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", + addr.b[5], + addr.b[4], + addr.b[3], + addr.b[2], + addr.b[1], addr.b[0]); return IceUtilInternal::toUpper(string(buf)); } diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 1721fc34d88..5f20836c019 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -37,7 +37,9 @@ namespace catch (const IceUtilInternal::BadOptException& ex) { throw FailureException( - __FILE__, __LINE__, "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason); + __FILE__, + __LINE__, + "ServiceManager: invalid arguments for service `" + name + "':\n" + ex.reason); } assert(!args.empty()); @@ -336,7 +338,9 @@ IceBox::ServiceManagerI::start() if (services.empty()) { throw FailureException( - __FILE__, __LINE__, "ServiceManager: configuration must include at least one IceBox service"); + __FILE__, + __LINE__, + "ServiceManager: configuration must include at least one IceBox service"); } StringSeq loadOrder = properties->getPropertyAsList("IceBox.LoadOrder"); diff --git a/cpp/src/IceBridge/IceBridge.cpp b/cpp/src/IceBridge/IceBridge.cpp index 50c86c5ef2d..a4a9ff75c69 100644 --- a/cpp/src/IceBridge/IceBridge.cpp +++ b/cpp/src/IceBridge/IceBridge.cpp @@ -330,7 +330,11 @@ BridgeConnection::dispatch( else { send( - current.con == _incoming ? _outgoing : _incoming, inParams, std::move(response), std::move(error), current); + current.con == _incoming ? _outgoing : _incoming, + inParams, + std::move(response), + std::move(error), + current); } } @@ -357,17 +361,25 @@ BridgeConnection::send( prx = prx->ice_oneway(); } prx->ice_invokeAsync( - current.operation, current.mode, inParams, nullptr, error, - [response = std::move(response)](bool) { - response(true, {nullptr, nullptr}); - }, + current.operation, + current.mode, + inParams, + nullptr, + error, + [response = std::move(response)](bool) { response(true, {nullptr, nullptr}); }, current.ctx); } else { // Twoway request prx->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(response), error, nullptr, current.ctx); + current.operation, + current.mode, + inParams, + std::move(response), + error, + nullptr, + current.ctx); } } catch (const std::exception&) diff --git a/cpp/src/IceDB/IceDB.h b/cpp/src/IceDB/IceDB.h index 45fcda6ae5f..d0eec2f0a50 100644 --- a/cpp/src/IceDB/IceDB.h +++ b/cpp/src/IceDB/IceDB.h @@ -443,7 +443,8 @@ namespace IceDB { const size_t limit = val.mv_size; std::pair p( - reinterpret_cast(val.mv_data), reinterpret_cast(val.mv_data) + limit); + reinterpret_cast(val.mv_data), + reinterpret_cast(val.mv_data) + limit); Ice::OutputStream stream(ctx.communicator, ctx.encoding, p); stream.write(t); val.mv_size = stream.b.size(); diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp index b490f882a81..2ae0765fdf1 100644 --- a/cpp/src/IceDiscovery/LookupI.cpp +++ b/cpp/src/IceDiscovery/LookupI.cpp @@ -128,7 +128,10 @@ void AdapterRequest::invokeWithLookup(const string& domainId, const LookupPrx& lookup, const LookupReplyPrx& lookupReply) { lookup->findAdapterByIdAsync( - domainId, _id, lookupReply, nullptr, + domainId, + _id, + lookupReply, + nullptr, [self = shared_from_this()](exception_ptr ex) { self->_lookup->adapterRequestException(self, ex); }); } @@ -153,7 +156,10 @@ void ObjectRequest::invokeWithLookup(const string& domainId, const LookupPrx& lookup, const LookupReplyPrx& lookupReply) { lookup->findObjectByIdAsync( - domainId, _id, lookupReply, nullptr, + domainId, + _id, + lookupReply, + nullptr, [self = shared_from_this()](exception_ptr ex) { self->_lookup->objectRequestException(self, ex); }); } @@ -309,7 +315,8 @@ LookupI::findAdapter(const AdapterCB& cb, const std::string& adapterId) { p = _adapterRequests .insert(make_pair( - adapterId, make_shared(LookupIPtr(shared_from_this()), adapterId, _retryCount))) + adapterId, + make_shared(LookupIPtr(shared_from_this()), adapterId, _retryCount))) .first; } diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 5f7724ee279..d50bec095b2 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -603,7 +603,12 @@ Activator::activate( Process* pp = &it->second; if (!RegisterWaitForSingleObject( - &pp->waithnd, pp->hnd, activatorWaitCallback, pp, INFINITE, WT_EXECUTEDEFAULT | WT_EXECUTEONLYONCE)) + &pp->waithnd, + pp->hnd, + activatorWaitCallback, + pp, + INFINITE, + WT_EXECUTEDEFAULT | WT_EXECUTEONLYONCE)) { TerminateProcess(pp->hnd, 0); @@ -750,7 +755,11 @@ Activator::activate( ostringstream os; os << gid; reportChildError( - getSystemErrno(), errorFds[1], "cannot set process group id", os.str().c_str(), _traceLevels); + getSystemErrno(), + errorFds[1], + "cannot set process group id", + os.str().c_str(), + _traceLevels); } // @@ -768,7 +777,10 @@ Activator::activate( } } reportChildError( - getSystemErrno(), errorFds[1], "cannot set process supplementary groups", os.str().c_str(), + getSystemErrno(), + errorFds[1], + "cannot set process supplementary groups", + os.str().c_str(), _traceLevels); } @@ -777,7 +789,11 @@ Activator::activate( ostringstream os; os << uid; reportChildError( - getSystemErrno(), errorFds[1], "cannot set process user id", os.str().c_str(), _traceLevels); + getSystemErrno(), + errorFds[1], + "cannot set process user id", + os.str().c_str(), + _traceLevels); } // diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp index 9c03fe3f32b..61715110f59 100644 --- a/cpp/src/IceGrid/AdapterCache.cpp +++ b/cpp/src/IceGrid/AdapterCache.cpp @@ -201,7 +201,11 @@ AdapterCache::addServerAdapter(const AdapterDescriptor& desc, const shared_ptr( - *this, desc.replicaGroupId, "", make_shared("0"), ""); + *this, + desc.replicaGroupId, + "", + make_shared("0"), + ""); addImpl(desc.replicaGroupId, repEntry); } repEntry->addReplica(desc.id, entry); @@ -662,7 +666,8 @@ ReplicaGroupEntry::getLocatorAdapterInfo( { replicas = _replicas; sort( - replicas.begin(), replicas.end(), + replicas.begin(), + replicas.end(), [](const auto& lhs, const auto& rhs) { return lhs->getPriority() < rhs->getPriority(); }); } else if (dynamic_pointer_cast(_loadBalancing)) @@ -687,10 +692,11 @@ ReplicaGroupEntry::getLocatorAdapterInfo( // vector>> rl; transform( - replicas.begin(), replicas.end(), back_inserter(rl), - [loadSample](const auto& value) -> pair> { - return {value->getLeastLoadedNodeLoad(loadSample), value}; - }); + replicas.begin(), + replicas.end(), + back_inserter(rl), + [loadSample](const auto& value) -> pair> + { return {value->getLeastLoadedNodeLoad(loadSample), value}; }); sort(rl.begin(), rl.end(), [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); replicas.clear(); transform(rl.begin(), rl.end(), back_inserter(replicas), [](const auto& value) { return value.second; }); @@ -778,10 +784,11 @@ ReplicaGroupEntry::getLeastLoadedNodeLoad(LoadSample loadSample) const IceUtilInternal::shuffle(replicas.begin(), replicas.end()); vector>> rl; transform( - replicas.begin(), replicas.end(), back_inserter(rl), - [loadSample](const auto& value) -> pair> { - return {value->getLeastLoadedNodeLoad(loadSample), value}; - }); + replicas.begin(), + replicas.end(), + back_inserter(rl), + [loadSample](const auto& value) -> pair> + { return {value->getLeastLoadedNodeLoad(loadSample), value}; }); return min_element(rl.begin(), rl.end(), [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }) ->first; } diff --git a/cpp/src/IceGrid/AdminCallbackRouter.cpp b/cpp/src/IceGrid/AdminCallbackRouter.cpp index 4f915d79fb9..0714659074b 100644 --- a/cpp/src/IceGrid/AdminCallbackRouter.cpp +++ b/cpp/src/IceGrid/AdminCallbackRouter.cpp @@ -58,8 +58,12 @@ AdminCallbackRouter::ice_invokeAsync( // Call with AMI // target->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(response), + current.operation, + current.mode, + inParams, + std::move(response), [exception = std::move(exception)](exception_ptr) { exception(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); }, - nullptr, current.ctx); + nullptr, + current.ctx); } diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp index c21fe368662..f96ce2714e3 100644 --- a/cpp/src/IceGrid/AdminI.cpp +++ b/cpp/src/IceGrid/AdminI.cpp @@ -48,7 +48,10 @@ namespace try { return std::invoke( - std::forward(f), _proxy, std::forward(args)..., ::Ice::noExplicitContext); + std::forward(f), + _proxy, + std::forward(args)..., + ::Ice::noExplicitContext); } catch (const Ice::Exception&) { @@ -72,7 +75,11 @@ namespace } }; return std::invoke( - std::forward(f), _proxy, std::move(response), std::move(exceptionWrapper), nullptr, + std::forward(f), + _proxy, + std::move(response), + std::move(exceptionWrapper), + nullptr, Ice::noExplicitContext); } @@ -413,7 +420,9 @@ AdminI::startServerAsync(string id, function response, functionstartAsync(args...); }, std::move(response), std::move(exception)); + [](const auto& prx, auto... args) { prx->startAsync(args...); }, + std::move(response), + std::move(exception)); } void @@ -426,7 +435,8 @@ AdminI::stopServerAsync(string id, function response, functionstopAsync(args...); }, response, + [](const auto& prx, auto... args) { prx->stopAsync(args...); }, + response, [response, exception = std::move(exception)](exception_ptr ex) { try diff --git a/cpp/src/IceGrid/AdminRouter.cpp b/cpp/src/IceGrid/AdminRouter.cpp index ff0106c0a16..e56285466af 100644 --- a/cpp/src/IceGrid/AdminRouter.cpp +++ b/cpp/src/IceGrid/AdminRouter.cpp @@ -26,7 +26,9 @@ IceGrid::AdminRouter::invokeOnTarget( } target->ice_invokeAsync( - current.operation, current.mode, inParams, + current.operation, + current.mode, + inParams, [response, operation = current.operation, traceLevels = _traceLevels, target](bool ok, auto bytes) { if (traceLevels->admin > 0) @@ -67,5 +69,6 @@ IceGrid::AdminRouter::invokeOnTarget( exception(exptr); }, - nullptr, current.ctx); + nullptr, + current.ctx); } diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp index c26e3594430..fe8e1677141 100644 --- a/cpp/src/IceGrid/AdminSessionI.cpp +++ b/cpp/src/IceGrid/AdminSessionI.cpp @@ -30,13 +30,17 @@ namespace const Ice::Current& current) override { _proxy->ice_invokeAsync( - current.operation, current.mode, inParams, std::move(response), + current.operation, + current.mode, + inParams, + std::move(response), [exception = std::move(exception)](exception_ptr) { // Throw ObjectNotExistException, the subscriber is unreachable exception(make_exception_ptr(Ice::ObjectNotExistException(__FILE__, __LINE__))); }, - nullptr, current.ctx); + nullptr, + current.ctx); } private: @@ -155,7 +159,8 @@ AdminSessionI::setObservers( if (registryObserver) { setupObserverSubscription( - TopicName::RegistryObserver, addForwarder(registryObserver->ice_timeout(t)->ice_locator(l))); + TopicName::RegistryObserver, + addForwarder(registryObserver->ice_timeout(t)->ice_locator(l))); } else { @@ -174,7 +179,8 @@ AdminSessionI::setObservers( if (appObserver) { setupObserverSubscription( - TopicName::ApplicationObserver, addForwarder(appObserver->ice_timeout(t)->ice_locator(l))); + TopicName::ApplicationObserver, + addForwarder(appObserver->ice_timeout(t)->ice_locator(l))); } else { @@ -184,7 +190,8 @@ AdminSessionI::setObservers( if (adapterObserver) { setupObserverSubscription( - TopicName::AdapterObserver, addForwarder(adapterObserver->ice_timeout(t)->ice_locator(l))); + TopicName::AdapterObserver, + addForwarder(adapterObserver->ice_timeout(t)->ice_locator(l))); } else { @@ -194,7 +201,8 @@ AdminSessionI::setObservers( if (objectObserver) { setupObserverSubscription( - TopicName::ObjectObserver, addForwarder(objectObserver->ice_timeout(t)->ice_locator(l))); + TopicName::ObjectObserver, + addForwarder(objectObserver->ice_timeout(t)->ice_locator(l))); } else { @@ -264,7 +272,10 @@ AdminSessionI::openServerLog(string id, string path, int nLines, const Ice::Curr try { return addFileIterator( - _database->getServer(std::move(id))->getProxy(false, 5s), "#" + std::move(path), nLines, current); + _database->getServer(std::move(id))->getProxy(false, 5s), + "#" + std::move(path), + nLines, + current); } catch (const SynchronizationException&) { diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index a0464aa004c..4296d9668b1 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -285,7 +285,9 @@ Database::Database( } _applicationObserverTopic = make_shared( - _topicManager, toMap(txn, _applications), getSerial(txn, applicationsDbName)); + _topicManager, + toMap(txn, _applications), + getSerial(txn, applicationsDbName)); _adapterObserverTopic = make_shared(_topicManager, toMap(txn, _adapters), getSerial(txn, adaptersDbName)); _objectObserverTopic = @@ -1806,7 +1808,8 @@ Database::getObjectByTypeOnLeastLoadedNode( objectsWithLoad.push_back(make_pair(obj, load)); } return min_element( - objectsWithLoad.begin(), objectsWithLoad.end(), + objectsWithLoad.begin(), + objectsWithLoad.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }) ->first; } @@ -2062,7 +2065,10 @@ Database::checkForUpdate( set addedAdptRepGrps; set_difference( - newAdptRepGrps.begin(), newAdptRepGrps.end(), oldAdptRepGrps.begin(), oldAdptRepGrps.end(), + newAdptRepGrps.begin(), + newAdptRepGrps.end(), + oldAdptRepGrps.begin(), + oldAdptRepGrps.end(), set_inserter(addedAdptRepGrps)); for (const auto& repGrp : addedAdptRepGrps) { @@ -2071,7 +2077,10 @@ Database::checkForUpdate( vector invalidAdptRepGrps; set_intersection( - rmRepGrps.begin(), rmRepGrps.end(), newAdptRepGrps.begin(), newAdptRepGrps.end(), + rmRepGrps.begin(), + rmRepGrps.end(), + newAdptRepGrps.begin(), + newAdptRepGrps.end(), back_inserter(invalidAdptRepGrps)); if (!invalidAdptRepGrps.empty()) { diff --git a/cpp/src/IceGrid/DescriptorBuilder.cpp b/cpp/src/IceGrid/DescriptorBuilder.cpp index 4b7ea7c8b44..a0bf7ccb22b 100644 --- a/cpp/src/IceGrid/DescriptorBuilder.cpp +++ b/cpp/src/IceGrid/DescriptorBuilder.cpp @@ -614,7 +614,9 @@ CommunicatorDescriptorBuilder::finish() // before references to property sets. // _descriptor->propertySet.properties.insert( - _descriptor->propertySet.properties.begin(), _hiddenProperties.begin(), _hiddenProperties.end()); + _descriptor->propertySet.properties.begin(), + _hiddenProperties.begin(), + _hiddenProperties.end()); } void diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 095500b15e6..ffb7ddd0a16 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -380,7 +380,8 @@ Resolver::Resolver( } for (TemplateDescriptorDict::const_iterator t = _application->serverTemplates.begin(); - t != _application->serverTemplates.end(); ++t) + t != _application->serverTemplates.end(); + ++t) { if (t->first == "") { @@ -396,7 +397,11 @@ Resolver::Resolver( Ice::StringSeq wdups = params; Ice::StringSeq dups; set_difference( - wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()), back_inserter(dups)); + wdups.begin(), + wdups.end(), + params.begin(), + unique(params.begin(), params.end()), + back_inserter(dups)); if (!dups.empty()) { dups.erase(unique(dups.begin(), dups.end()), dups.end()); @@ -404,7 +409,8 @@ Resolver::Resolver( } } for (TemplateDescriptorDict::const_iterator t = _application->serviceTemplates.begin(); - t != _application->serviceTemplates.end(); ++t) + t != _application->serviceTemplates.end(); + ++t) { if (t->first == "") { @@ -419,7 +425,11 @@ Resolver::Resolver( Ice::StringSeq wdups = params; Ice::StringSeq dups; set_difference( - wdups.begin(), wdups.end(), params.begin(), unique(params.begin(), params.end()), back_inserter(dups)); + wdups.begin(), + wdups.end(), + params.begin(), + unique(params.begin(), params.end()), + back_inserter(dups)); if (!dups.empty()) { dups.erase(unique(dups.begin(), dups.end()), dups.end()); @@ -809,7 +819,8 @@ Resolver::hasReplicaGroup(const string& id) const } for (ReplicaGroupDescriptorSeq::const_iterator p = _application->replicaGroups.begin(); - p != _application->replicaGroups.end(); ++p) + p != _application->replicaGroups.end(); + ++p) { if (p->id == id) { @@ -1200,7 +1211,8 @@ CommunicatorHelper::print(const shared_ptr& communicator, Out } for (PropertyDescriptorSeq::const_iterator q = _desc->propertySet.properties.begin(); - q != _desc->propertySet.properties.end(); ++q) + q != _desc->propertySet.properties.end(); + ++q) { if (hiddenProperties.find(q->name) == hiddenProperties.end()) { @@ -1347,7 +1359,9 @@ ServiceHelper::instantiateImpl( if (p != serviceProps.end()) { instance->propertySet.properties.insert( - instance->propertySet.properties.end(), p->second.properties.begin(), p->second.properties.end()); + instance->propertySet.properties.end(), + p->second.properties.begin(), + p->second.properties.end()); } } @@ -1787,7 +1801,11 @@ ServiceInstanceHelper::instantiate(const Resolver& resolve, const PropertySetDes TemplateDescriptor tmpl = resolve.getServiceTemplate(_def._cpp_template); def = ServiceHelper(dynamic_pointer_cast(tmpl.descriptor)); parameterValues = instantiateParams( - resolve, _def._cpp_template, _def.parameterValues, tmpl.parameters, tmpl.parameterDefaults); + resolve, + _def._cpp_template, + _def.parameterValues, + tmpl.parameters, + tmpl.parameterDefaults); } // @@ -1891,7 +1909,11 @@ ServerInstanceHelper::init(const shared_ptr& definition, const TemplateDescriptor tmpl = resolve.getServerTemplate(_def._cpp_template); def = dynamic_pointer_cast(tmpl.descriptor); parameterValues = instantiateParams( - resolve, _def._cpp_template, _def.parameterValues, tmpl.parameters, tmpl.parameterDefaults); + resolve, + _def._cpp_template, + _def.parameterValues, + tmpl.parameters, + tmpl.parameterDefaults); } assert(def); @@ -1933,7 +1955,8 @@ ServerInstanceHelper::init(const shared_ptr& definition, const _instance.parameterValues = parameterValues; _instance.propertySet = svrResolve(_def.propertySet); for (PropertySetDescriptorDict::const_iterator p = _def.servicePropertySets.begin(); - p != _def.servicePropertySets.end(); ++p) + p != _def.servicePropertySets.end(); + ++p) { _instance.servicePropertySets.insert(make_pair(svrResolve(p->first), svrResolve(p->second))); } @@ -2196,7 +2219,8 @@ NodeHelper::update(const NodeUpdateDescriptor& update, const Resolver& appResolv set removed(update.removeServers.begin(), update.removeServers.end()); for (ServerInstanceDescriptorSeq::const_iterator q = update.serverInstances.begin(); - q != update.serverInstances.end(); ++q) + q != update.serverInstances.end(); + ++q) { ServerInstanceHelper helper(*q, resolve, false); if (!added.insert(helper.getId()).second) @@ -2416,7 +2440,8 @@ NodeHelper::print(Output& out) const if (!_instance.propertySets.empty()) { for (PropertySetDescriptorDict::const_iterator q = _instance.propertySets.begin(); - q != _instance.propertySets.end(); ++q) + q != _instance.propertySets.end(); + ++q) { out << nl << "properties `" << q->first << "'"; out << sb; @@ -2863,7 +2888,10 @@ ApplicationHelper::getReplicaGroups(set& replicaGroups, set& ada // this application. // set_difference( - allAdapterReplicaGroups.begin(), allAdapterReplicaGroups.end(), replicaGroups.begin(), replicaGroups.end(), + allAdapterReplicaGroups.begin(), + allAdapterReplicaGroups.end(), + replicaGroups.begin(), + replicaGroups.end(), set_inserter(adapterReplicaGroups)); } @@ -2952,7 +2980,8 @@ ApplicationHelper::print(Output& out, const ApplicationInfo& info) const if (!_instance.propertySets.empty()) { for (PropertySetDescriptorDict::const_iterator q = _instance.propertySets.begin(); - q != _instance.propertySets.end(); ++q) + q != _instance.propertySets.end(); + ++q) { out << nl << "properties `" << q->first << "'"; out << sb; @@ -2961,7 +2990,8 @@ ApplicationHelper::print(Output& out, const ApplicationInfo& info) const out << nl << "references = " << toString(q->second.references); } for (PropertyDescriptorSeq::const_iterator r = q->second.properties.begin(); - r != q->second.properties.end(); ++r) + r != q->second.properties.end(); + ++r) { out << nl << r->name << " = `" << r->value << "'"; } @@ -2984,7 +3014,8 @@ ApplicationHelper::print(Output& out, const ApplicationInfo& info) const out << nl << "replica groups"; out << sb; for (ReplicaGroupDescriptorSeq::const_iterator p = _instance.replicaGroups.begin(); - p != _instance.replicaGroups.end(); ++p) + p != _instance.replicaGroups.end(); + ++p) { out << nl << "id = `" << p->id << "' load balancing = `"; if (!p->loadBalancing) @@ -3024,7 +3055,8 @@ ApplicationHelper::print(Output& out, const ApplicationInfo& info) const out << nl << "server templates"; out << sb; for (TemplateDescriptorDict::const_iterator p = _instance.serverTemplates.begin(); - p != _instance.serverTemplates.end(); ++p) + p != _instance.serverTemplates.end(); + ++p) { out << nl << p->first; } @@ -3035,7 +3067,8 @@ ApplicationHelper::print(Output& out, const ApplicationInfo& info) const out << nl << "service templates"; out << sb; for (TemplateDescriptorDict::const_iterator p = _instance.serviceTemplates.begin(); - p != _instance.serviceTemplates.end(); ++p) + p != _instance.serviceTemplates.end(); + ++p) { out << nl << p->first; } @@ -3083,7 +3116,10 @@ ApplicationHelper::printDiff(Output& out, const ApplicationHelper& helper) const } { ReplicaGroupDescriptorSeq updated = getSeqUpdatedEltsWithEq( - helper._def.replicaGroups, _def.replicaGroups, getReplicaGroupId, replicaGroupEqual); + helper._def.replicaGroups, + _def.replicaGroups, + getReplicaGroupId, + replicaGroupEqual); Ice::StringSeq removed = getSeqRemovedElts(helper._def.replicaGroups, _def.replicaGroups, getReplicaGroupId); if (!updated.empty() || !removed.empty()) { diff --git a/cpp/src/IceGrid/DescriptorParser.cpp b/cpp/src/IceGrid/DescriptorParser.cpp index 7e4680a87a2..670ac4efcf6 100644 --- a/cpp/src/IceGrid/DescriptorParser.cpp +++ b/cpp/src/IceGrid/DescriptorParser.cpp @@ -550,7 +550,8 @@ namespace else if (_currentServerInstance.get()) { _currentServerInstance->addPropertySet( - _currentPropertySet->getService(), _currentPropertySet->getDescriptor()); + _currentPropertySet->getService(), + _currentPropertySet->getDescriptor()); } else if (_currentCommunicator) { @@ -559,12 +560,14 @@ namespace else if (_currentNode.get()) { _currentNode->addPropertySet( - _currentPropertySet->getId(), _currentPropertySet->getDescriptor()); + _currentPropertySet->getId(), + _currentPropertySet->getDescriptor()); } else if (_currentApplication.get()) { _currentApplication->addPropertySet( - _currentPropertySet->getId(), _currentPropertySet->getDescriptor()); + _currentPropertySet->getId(), + _currentPropertySet->getDescriptor()); } else { diff --git a/cpp/src/IceGrid/FileParserI.cpp b/cpp/src/IceGrid/FileParserI.cpp index 01898766b56..2e12660904e 100644 --- a/cpp/src/IceGrid/FileParserI.cpp +++ b/cpp/src/IceGrid/FileParserI.cpp @@ -16,7 +16,10 @@ FileParserI::parse(string file, AdminPrxPtr admin, const Ice::Current& current) try { return DescriptorParser::parseDescriptor( - std::move(file), Ice::StringSeq(), map(), current.adapter->getCommunicator(), + std::move(file), + Ice::StringSeq(), + map(), + current.adapter->getCommunicator(), std::move(admin)); } catch (const IceXML::ParserException& e) diff --git a/cpp/src/IceGrid/Grammar.cpp b/cpp/src/IceGrid/Grammar.cpp index 68c28a6b549..ba023134814 100644 --- a/cpp/src/IceGrid/Grammar.cpp +++ b/cpp/src/IceGrid/Grammar.cpp @@ -258,7 +258,7 @@ typedef short int yytype_int16; # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T)-1) +#define YYSIZE_MAXIMUM ((YYSIZE_T) - 1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -1521,7 +1521,11 @@ yyparse() conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow( - YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1, yysize * sizeof(*yyvsp), + YY_("memory exhausted"), + &yyss1, + yysize * sizeof(*yyssp), + &yyvs1, + yysize * sizeof(*yyvsp), &yystacksize); yyss = yyss1; @@ -2618,7 +2622,8 @@ yyparse() (yyvsp[(3) - (5)]).front() == "template") { parser->usage( - (yyvsp[(2) - (5)]).front() + " " + (yyvsp[(3) - (5)]).front(), (yyvsp[(4) - (5)]).front()); + (yyvsp[(2) - (5)]).front() + " " + (yyvsp[(3) - (5)]).front(), + (yyvsp[(4) - (5)]).front()); } else { @@ -2635,7 +2640,8 @@ yyparse() (yyvsp[(3) - (6)]).front() == "template") { parser->usage( - (yyvsp[(2) - (6)]).front() + " " + (yyvsp[(3) - (6)]).front(), (yyvsp[(4) - (6)]).front()); + (yyvsp[(2) - (6)]).front() + " " + (yyvsp[(3) - (6)]).front(), + (yyvsp[(4) - (6)]).front()); } else { diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index 344f894241a..709abfffa4a 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -449,8 +449,8 @@ NodeService::startImpl(int argc, char* argv[], int& status) // Identity id = stringToIdentity(instanceName + "/Node-" + name); NodePrx nodeProxy{_adapter->createProxy(id)}; - _node = make_shared( - _adapter, *_sessions, _activator, _timer, traceLevels, nodeProxy, name, mapper, instanceName); + _node = make_shared< + NodeI>(_adapter, *_sessions, _activator, _timer, traceLevels, nodeProxy, name, mapper, instanceName); _adapter->add(_node, nodeProxy->ice_getIdentity()); _adapter->addDefaultServant(make_shared(_node), _node->getServerAdminCategory()); diff --git a/cpp/src/IceGrid/IceGridRegistry.cpp b/cpp/src/IceGrid/IceGridRegistry.cpp index f2f5b7cadaf..de42978b0ad 100644 --- a/cpp/src/IceGrid/IceGridRegistry.cpp +++ b/cpp/src/IceGrid/IceGridRegistry.cpp @@ -171,7 +171,8 @@ RegistryService::initializeCommunicator( "Glacier2CryptPermissionsVerifier:createCryptPermissionsVerifier"); initData.properties->setProperty( - "Glacier2CryptPermissionsVerifier.IceGrid.Registry." + *p + "PermissionsVerifier", cryptPasswords); + "Glacier2CryptPermissionsVerifier.IceGrid.Registry." + *p + "PermissionsVerifier", + cryptPasswords); } } } diff --git a/cpp/src/IceGrid/LocatorI.cpp b/cpp/src/IceGrid/LocatorI.cpp index abd3760eaf6..444493b88f0 100644 --- a/cpp/src/IceGrid/LocatorI.cpp +++ b/cpp/src/IceGrid/LocatorI.cpp @@ -53,9 +53,13 @@ namespace if (!IceInternal::isSupported(_encoding, proxy->ice_getEncodingVersion())) { exception( - id, make_exception_ptr(Ice::UnsupportedEncodingException( - __FILE__, __LINE__, "server doesn't support requested encoding", _encoding, - proxy->ice_getEncodingVersion()))); + id, + make_exception_ptr(Ice::UnsupportedEncodingException( + __FILE__, + __LINE__, + "server doesn't support requested encoding", + _encoding, + proxy->ice_getEncodingVersion()))); return; } @@ -232,9 +236,13 @@ namespace if (!IceInternal::isSupported(_encoding, proxy->ice_getEncodingVersion())) { exception( - id, make_exception_ptr(Ice::UnsupportedEncodingException( - __FILE__, __LINE__, "server doesn't support requested encoding", _encoding, - proxy->ice_getEncodingVersion()))); + id, + make_exception_ptr(Ice::UnsupportedEncodingException( + __FILE__, + __LINE__, + "server doesn't support requested encoding", + _encoding, + proxy->ice_getEncodingVersion()))); return; } @@ -385,9 +393,13 @@ namespace if (!IceInternal::isSupported(_encoding, proxy->ice_getEncodingVersion())) { exception( - id, make_exception_ptr(Ice::UnsupportedEncodingException( - __FILE__, __LINE__, "server doesn't support requested encoding", _encoding, - proxy->ice_getEncodingVersion()))); + id, + make_exception_ptr(Ice::UnsupportedEncodingException( + __FILE__, + __LINE__, + "server doesn't support requested encoding", + _encoding, + proxy->ice_getEncodingVersion()))); return; } @@ -401,8 +413,8 @@ namespace if (_count > 1) { auto p = proxy->ice_identity(Ice::stringToIdentity("dummy")); - shared_ptr request = make_shared( - _response, _exception, _locator, _id, _encoding, _adapters, _count, p); + shared_ptr request = make_shared< + ReplicaGroupRequest>(_response, _exception, _locator, _id, _encoding, _adapters, _count, p); request->execute(); } else @@ -501,7 +513,13 @@ namespace if (!_waitForActivation) { _database->getLocatorAdapterInfo( - _id, _connection, _context, _adapters, _count, replicaGroup, roundRobin, + _id, + _connection, + _context, + _adapters, + _count, + replicaGroup, + roundRobin, _activatingOrFailed); } @@ -512,7 +530,14 @@ namespace // try again but this time we wait for the server activation. // _database->getLocatorAdapterInfo( - _id, _connection, _context, _adapters, _count, replicaGroup, roundRobin, _failed); + _id, + _connection, + _context, + _adapters, + _count, + replicaGroup, + roundRobin, + _failed); _waitForActivation = true; } break; @@ -731,14 +756,15 @@ LocatorI::findAdapterByIdAsync( { try { - _database->getLocatorAdapterInfo( - id, current.con, current.ctx, adapters, count, replicaGroup, roundRobin); + _database + ->getLocatorAdapterInfo(id, current.con, current.ctx, adapters, count, replicaGroup, roundRobin); break; } catch (const SynchronizationException&) { if (_database->addAdapterSyncCallback( - id, make_shared(self, response, exception, id, current))) + id, + make_shared(self, response, exception, id, current))) { return; } @@ -753,8 +779,8 @@ LocatorI::findAdapterByIdAsync( } else if (replicaGroup) { - request = make_shared( - response, exception, self, id, current.encoding, adapters, count, nullopt); + request = make_shared< + ReplicaGroupRequest>(response, exception, self, id, current.encoding, adapters, count, nullopt); } else { diff --git a/cpp/src/IceGrid/LocatorRegistryI.cpp b/cpp/src/IceGrid/LocatorRegistryI.cpp index b0651833018..5ab204db575 100644 --- a/cpp/src/IceGrid/LocatorRegistryI.cpp +++ b/cpp/src/IceGrid/LocatorRegistryI.cpp @@ -353,8 +353,14 @@ LocatorRegistryI::setAdapterDirectProxy( catch (const SynchronizationException&) { if (_database->addAdapterSyncCallback( - adapterId, make_shared( - shared_from_this(), response, exception, adapterId, replicaGroupId, proxy))) + adapterId, + make_shared( + shared_from_this(), + response, + exception, + adapterId, + replicaGroupId, + proxy))) { return; } diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index e5c4280b48e..16bc76ff02a 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -367,7 +367,9 @@ NodeEntry::loadServer( } } - auto response = [traceLevels = _cache.getTraceLevels(), entry, name = _name, + auto response = [traceLevels = _cache.getTraceLevels(), + entry, + name = _name, sessionTimeout](ServerPrxPtr serverPrx, AdapterPrxDict adapters, int at, int dt) { if (traceLevels && traceLevels->server > 1) @@ -381,7 +383,9 @@ NodeEntry::loadServer( // timeout is large enough. // entry->loadCallback( - std::move(serverPrx), std::move(adapters), chrono::seconds(at) + sessionTimeout, + std::move(serverPrx), + std::move(adapters), + chrono::seconds(at) + sessionTimeout, chrono::seconds(dt) + sessionTimeout); }; @@ -418,7 +422,10 @@ NodeEntry::loadServer( if (noRestart) { node->loadServerWithoutRestartAsync( - desc, _cache.getReplicaName(), std::move(response), std::move(exception)); + desc, + _cache.getReplicaName(), + std::move(response), + std::move(exception)); } else { @@ -507,13 +514,21 @@ NodeEntry::destroyServer( if (noRestart) { node->destroyServerWithoutRestartAsync( - info.descriptor->id, info.uuid, info.revision, _cache.getReplicaName(), std::move(response), + info.descriptor->id, + info.uuid, + info.revision, + _cache.getReplicaName(), + std::move(response), std::move(exception)); } else { node->destroyServerAsync( - info.descriptor->id, info.uuid, info.revision, _cache.getReplicaName(), std::move(response), + info.descriptor->id, + info.uuid, + info.revision, + _cache.getReplicaName(), + std::move(response), std::move(exception)); } } @@ -599,7 +614,8 @@ NodeEntry::checkSession(unique_lock& lock) const auto self = _selfRemovingPtr.lock(); assert(self); _proxy->registerWithReplicaAsync( - _cache.getReplicaCache().getInternalRegistry(), [self] { self->finishedRegistration(); }, + _cache.getReplicaCache().getInternalRegistry(), + [self] { self->finishedRegistration(); }, [self](exception_ptr ex) { self->finishedRegistration(ex); }); _proxy = nullopt; // Registration with the proxy is only attempted once. } @@ -730,7 +746,8 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const if (!info.descriptor->distrib.icepatch.empty()) { server->distrib = make_shared( - info.descriptor->distrib.icepatch, info.descriptor->distrib.directories); + info.descriptor->distrib.icepatch, + info.descriptor->distrib.directories); } server->options = info.descriptor->options; server->envs = info.descriptor->envs; @@ -894,7 +911,8 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const for (const auto& adapter : desc->adapters) { server->adapters.push_back(make_shared( - adapter.id, ignoreServerLifetime ? false : adapter.serverLifetime)); + adapter.id, + ignoreServerLifetime ? false : adapter.serverLifetime)); serverProps.push_back(createProperty("# Object adapter " + adapter.name)); diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index d5975fae3de..6f2670f8306 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -261,7 +261,12 @@ NodeI::loadServerAsync( const Ice::Current& current) { loadServer( - std::move(descriptor), std::move(replicaName), false, std::move(response), std::move(exception), current); + std::move(descriptor), + std::move(replicaName), + false, + std::move(response), + std::move(exception), + current); } void @@ -286,8 +291,14 @@ NodeI::destroyServerAsync( const Ice::Current& current) { destroyServer( - std::move(serverId), std::move(uuid), std::move(revision), std::move(replicaName), false, std::move(response), - std::move(exception), current); + std::move(serverId), + std::move(uuid), + std::move(revision), + std::move(replicaName), + false, + std::move(response), + std::move(exception), + current); } void @@ -301,8 +312,14 @@ NodeI::destroyServerWithoutRestartAsync( const Ice::Current& current) { destroyServer( - std::move(serverId), std::move(uuid), std::move(revision), std::move(replicaName), true, std::move(response), - std::move(exception), current); + std::move(serverId), + std::move(uuid), + std::move(revision), + std::move(replicaName), + true, + std::move(response), + std::move(exception), + current); } void @@ -747,7 +764,8 @@ NodeI::addObserver(const NodeSessionPrxPtr& session, const NodeObserverPrxPtr& o NodeDynamicInfo info = {_platform.getNodeInfo(), std::move(serverInfos), std::move(adapterInfos)}; queueUpdate( - observer, [observer, info = std::move(info)](auto&& response, auto&& exception) + observer, + [observer, info = std::move(info)](auto&& response, auto&& exception) { observer->nodeUpAsync(info, std::move(response), std::move(exception)); }); } diff --git a/cpp/src/IceGrid/NodeSessionI.cpp b/cpp/src/IceGrid/NodeSessionI.cpp index e3e1d4c8e98..09ccbfa7446 100644 --- a/cpp/src/IceGrid/NodeSessionI.cpp +++ b/cpp/src/IceGrid/NodeSessionI.cpp @@ -280,7 +280,10 @@ NodeSessionI::waitForApplicationUpdateAsync( const Ice::Current&) const { _database->waitForApplicationUpdate( - std::move(application), std::move(revision), std::move(response), std::move(exception)); + std::move(application), + std::move(revision), + std::move(response), + std::move(exception)); } void diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index c080f529f37..ea24914c734 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -35,46 +35,55 @@ using namespace IceGrid; namespace { const char* _commandsHelp[][3] = { - {"application", "add", + {"application", + "add", "application add [-n | --no-patch] DESC [TARGET ... ] [NAME=VALUE ... ]\n" " Add application described in DESC. If specified\n" " the optional targets TARGET will be deployed.\n"}, {"application", "remove", "application remove NAME Remove application NAME.\n"}, {"application", "describe", "application describe NAME Describe application NAME.\n"}, - {"application", "diff", + {"application", + "diff", "application diff [-s | --servers] DESC [TARGET ... ] [NAME=VALUE ... ]\n" " Print the differences betwen the application\n" " described in DESC and the current deployment.\n" " If -s or --servers is specified, print the\n" " the list of servers affected by the differences.\n"}, - {"application", "update", + {"application", + "update", "application update [-n | --no-restart] DESC [TARGET ... ] [NAME=VALUE ... ]\n" " Update the application described in DESC. If -n or\n" " --no-restart is specified, the update will fail if\n" " it is necessary to stop some servers.\n"}, - {"application", "patch", + {"application", + "patch", "application patch [-f | --force] NAME\n" " Patch the given application data. If -f or --force is\n" " specified, the servers depending on the data to patch\n" " will be stopped if necessary.\n"}, {"application", "list", "application list List all deployed applications.\n"}, - {"server template", "instantiate", + {"server template", + "instantiate", "server template instantiate APPLICATION NODE TEMPLATE [NAME=VALUE ...]\n" " Instantiate a server template.\n"}, - {"server template", "describe", + {"server template", + "describe", "server template describe APPLICATION TEMPLATE\n" " Describe application server template TEMPLATE.\n"}, - {"service template", "describe", + {"service template", + "describe", "service template describe APPLICATION TEMPLATE\n" " Describe application service template TEMPLATE.\n"}, {"node", "list", "node list List all registered nodes.\n"}, {"node", "describe", "node describe NAME Show information about node NAME.\n"}, {"node", "ping", "node ping NAME Ping node NAME.\n"}, {"node", "load", "node load NAME Print the load of the node NAME.\n"}, - {"node", "sockets", + {"node", + "sockets", "node sockets [NAME] Print the number of CPU sockets of the\n" " node NAME or all the nodes if NAME is omitted.\n"}, - {"node", "show", + {"node", + "show", "node show [OPTIONS] NAME [log | stderr | stdout]\n" " Show node NAME Ice log, stderr or stdout.\n" " Options:\n" @@ -85,7 +94,8 @@ namespace {"registry", "list", "registry list List all registered registries.\n"}, {"registry", "describe", "registry describe NAME Show information about registry NAME.\n"}, {"registry", "ping", "registry ping NAME Ping registry NAME.\n"}, - {"registry", "show", + {"registry", + "show", "registry show [OPTIONS] NAME [log | stderr | stdout ]\n" " Show registry NAME Ice log, stderr or stdout.\n" " Options:\n" @@ -106,7 +116,8 @@ namespace {"server", "signal", "server signal ID SIGNAL Send SIGNAL (e.g. SIGTERM or 15) to server ID.\n"}, {"server", "stdout", "server stdout ID MESSAGE Write MESSAGE on server ID's stdout.\n"}, {"server", "stderr", "server stderr ID MESSAGE Write MESSAGE on server ID's stderr.\n"}, - {"server", "show", + {"server", + "show", "server show [OPTIONS] ID [log | stderr | stdout | LOGFILE ]\n" " Show server ID Ice log, stderr, stdout or log file LOGFILE.\n" " Options:\n" @@ -114,18 +125,21 @@ namespace " -t N | --tail N: Print the last N log messages or lines\n" " -h N | --head N: Print the first N lines (not available for Ice log)\n"}, {"server", "enable", "server enable ID Enable server ID.\n"}, - {"server", "disable", + {"server", + "disable", "server disable ID Disable server ID (a disabled server can't be\n" " started on demand or administratively).\n"}, {"service", "start", "service start ID NAME Starts service NAME in IceBox server ID.\n"}, {"service", "stop", "service stop ID NAME Stops service NAME in IceBox server ID.\n"}, {"service", "describe", "service describe ID NAME Describes service NAME in IceBox server ID.\n"}, - {"service", "properties", + {"service", + "properties", "service properties ID NAME\n" " Get the run-time properties of service NAME in\n" " IceBox server ID.\n"}, - {"service", "property", + {"service", + "property", "service property ID NAME PROPERTY\n" " Get the run-time property PROPERTY of service NAME\n" " from IceBox server ID.\n"}, @@ -134,17 +148,20 @@ namespace {"adapter", "list", "adapter list List all registered adapters.\n"}, {"adapter", "endpoints", "adapter endpoints ID Show the endpoints of adapter or replica group ID.\n"}, {"adapter", "remove", "adapter remove ID Remove adapter or replica group ID.\n"}, - {"object", "add", + {"object", + "add", "object add PROXY [TYPE] Add an object to the object registry,\n" " optionally specifying its type.\n"}, {"object", "remove", "object remove IDENTITY Remove an object from the object registry.\n"}, {"object", "find", "object find TYPE Find all objects with the type TYPE.\n"}, - {"object", "describe", + {"object", + "describe", "object describe EXPR Describe all registered objects whose stringified\n" " identities match the expression EXPR. A trailing\n" " wildcard is supported in EXPR, for example\n" " \"object describe Ice*\".\n"}, - {"object", "list", + {"object", + "list", "object list EXPR List all registered objects whose stringified\n" " identities match the expression EXPR. A trailing\n" " wildcard is supported in EXPR, for example\n" @@ -1053,7 +1070,8 @@ Parser::printNodeProcessorSockets(const list& args) os << setw(20) << "Hostname" << setw(20) << "| # of sockets" << setw(39) << "| Nodes" << endl; os << setw(79) << "=====================================================================" << endl; for (map, int>>::const_iterator q = processorSocketCounts.begin(); - q != processorSocketCounts.end(); ++q) + q != processorSocketCounts.end(); + ++q) { os << setw(20) << setiosflags(ios::left) << q->first; os << "| " << setw(18) << setiosflags(ios::left) << q->second.second; diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp index 034924dbbfb..e22ca0d9fc3 100644 --- a/cpp/src/IceGrid/PlatformInfo.cpp +++ b/cpp/src/IceGrid/PlatformInfo.cpp @@ -382,8 +382,8 @@ PlatformInfo::getRegistryInfo() const shared_ptr PlatformInfo::getInternalNodeInfo() const { - return make_shared( - _name, _os, _hostname, _release, _version, _machine, _nProcessorThreads, _dataDir); + return make_shared< + InternalNodeInfo>(_name, _os, _hostname, _release, _version, _machine, _nProcessorThreads, _dataDir); } shared_ptr diff --git a/cpp/src/IceGrid/RegistryAdminRouter.cpp b/cpp/src/IceGrid/RegistryAdminRouter.cpp index 488b32c6dd4..9f2fc13462e 100644 --- a/cpp/src/IceGrid/RegistryAdminRouter.cpp +++ b/cpp/src/IceGrid/RegistryAdminRouter.cpp @@ -36,7 +36,9 @@ namespace // Retry to forward the call. // _adminRouter->ice_invokeAsync( - {&_inParams[0], &_inParams[0] + _inParams.size()}, std::move(_response), std::move(_exception), + {&_inParams[0], &_inParams[0] + _inParams.size()}, + std::move(_response), + std::move(_exception), _current); } @@ -79,7 +81,11 @@ RegistryServerAdminRouter::ice_invokeAsync( catch (const SynchronizationException&) { server->addSyncCallback(make_shared( - shared_from_this(), inParams, std::move(response), std::move(exception), current)); + shared_from_this(), + inParams, + std::move(response), + std::move(exception), + current)); return; // Wait for the server synchronization to complete and retry. } } diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index 1b06547ffef..b73a309e7e8 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -371,7 +371,12 @@ RegistryI::startImpl() registryTopicManagerId.category = _instanceName; registryTopicManagerId.name = "RegistryTopicManager"; _iceStorm = IceStormInternal::Service::create( - _communicator, _registryAdapter, _registryAdapter, "IceGrid.Registry", registryTopicManagerId, ""); + _communicator, + _registryAdapter, + _registryAdapter, + "IceGrid.Registry", + registryTopicManagerId, + ""); const auto topicManager = _iceStorm->getTopicManager(); try @@ -526,8 +531,16 @@ RegistryI::startImpl() auto adminCallbackRouter = make_shared(); _servantManager = make_shared( - _clientAdapter, _instanceName, true, getServerAdminCategory(), serverAdminRouter, getNodeAdminCategory(), - nodeAdminRouter, getReplicaAdminCategory(), replicaAdminRouter, adminCallbackRouter); + _clientAdapter, + _instanceName, + true, + getServerAdminCategory(), + serverAdminRouter, + getNodeAdminCategory(), + nodeAdminRouter, + getReplicaAdminCategory(), + replicaAdminRouter, + adminCallbackRouter); _clientAdapter->addServantLocator(_servantManager, ""); _serverAdapter->addDefaultServant(adminCallbackRouter, ""); @@ -758,8 +771,8 @@ RegistryI::setupClientSessionFactory(const IceGrid::LocatorPrxPtr& locator) if (!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) { adapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager"); - servantManager = make_shared( - adapter, _instanceName, false, "", nullptr, "", nullptr, "", nullptr, nullptr); + servantManager = make_shared< + SessionServantManager>(adapter, _instanceName, false, "", nullptr, "", nullptr, "", nullptr, nullptr); adapter->addServantLocator(servantManager, ""); } @@ -777,7 +790,8 @@ RegistryI::setupClientSessionFactory(const IceGrid::LocatorPrxPtr& locator) _wellKnownObjects->add(adapter->createProxy(sessionMgrId), string{Glacier2::SessionManager::ice_staticId()}); _wellKnownObjects->add( - adapter->createProxy(sslSessionMgrId), string{Glacier2::SSLSessionManager::ice_staticId()}); + adapter->createProxy(sslSessionMgrId), + string{Glacier2::SSLSessionManager::ice_staticId()}); } if (adapter) @@ -807,8 +821,16 @@ RegistryI::setupAdminSessionFactory( { adapter = _communicator->createObjectAdapter("IceGrid.Registry.AdminSessionManager"); servantManager = make_shared( - adapter, _instanceName, false, getServerAdminCategory(), serverAdminRouter, getNodeAdminCategory(), - nodeAdminRouter, getReplicaAdminCategory(), replicaAdminRouter, nullptr); + adapter, + _instanceName, + false, + getServerAdminCategory(), + serverAdminRouter, + getNodeAdminCategory(), + nodeAdminRouter, + getReplicaAdminCategory(), + replicaAdminRouter, + nullptr); adapter->addServantLocator(servantManager, ""); } @@ -830,7 +852,8 @@ RegistryI::setupAdminSessionFactory( _wellKnownObjects->add(adapter->createProxy(sessionMgrId), string{Glacier2::SessionManager::ice_staticId()}); _wellKnownObjects->add( - adapter->createProxy(sslSessionMgrId), string{Glacier2::SSLSessionManager::ice_staticId()}); + adapter->createProxy(sslSessionMgrId), + string{Glacier2::SSLSessionManager::ice_staticId()}); } if (adapter) @@ -947,7 +970,8 @@ RegistryI::createSession(string user, string password, const Current& current) auto session = _clientSessionFactory->createSessionServant(user, nullopt); auto proxy = session->_register(_servantManager, current.con); _reaper->add( - make_shared>(_traceLevels->logger, session), _sessionTimeout, + make_shared>(_traceLevels->logger, session), + _sessionTimeout, current.con); return uncheckedCast(proxy); } @@ -995,7 +1019,8 @@ RegistryI::createAdminSession(string user, string password, const Current& curre auto session = _adminSessionFactory->createSessionServant(user); auto proxy = session->_register(_servantManager, current.con); _reaper->add( - make_shared>(_traceLevels->logger, session), _sessionTimeout, + make_shared>(_traceLevels->logger, session), + _sessionTimeout, current.con); return uncheckedCast(proxy); } @@ -1050,7 +1075,8 @@ RegistryI::createSessionFromSecureConnection(const Current& current) auto session = _clientSessionFactory->createSessionServant(userDN, nullopt); auto proxy = session->_register(_servantManager, current.con); _reaper->add( - make_shared>(_traceLevels->logger, session), _sessionTimeout, + make_shared>(_traceLevels->logger, session), + _sessionTimeout, current.con); return uncheckedCast(proxy); } @@ -1098,7 +1124,8 @@ RegistryI::createAdminSessionFromSecureConnection(const Current& current) auto session = _adminSessionFactory->createSessionServant(userDN); auto proxy = session->_register(_servantManager, current.con); _reaper->add( - make_shared>(_traceLevels->logger, session), _sessionTimeout, + make_shared>(_traceLevels->logger, session), + _sessionTimeout, current.con); return uncheckedCast(proxy); } diff --git a/cpp/src/IceGrid/ReplicaSessionManager.cpp b/cpp/src/IceGrid/ReplicaSessionManager.cpp index 4cbd5a0cc42..920b6ac2581 100644 --- a/cpp/src/IceGrid/ReplicaSessionManager.cpp +++ b/cpp/src/IceGrid/ReplicaSessionManager.cpp @@ -103,8 +103,8 @@ namespace IceGrid string failure; try { - _database->setAdapterDirectProxy( - info.id, info.replicaGroupId, info.proxy, getSerials(current.ctx, serial)); + _database + ->setAdapterDirectProxy(info.id, info.replicaGroupId, info.proxy, getSerials(current.ctx, serial)); } catch (const AdapterExistsException&) { @@ -119,8 +119,8 @@ namespace IceGrid string failure; try { - _database->setAdapterDirectProxy( - info.id, info.replicaGroupId, info.proxy, getSerials(current.ctx, serial)); + _database + ->setAdapterDirectProxy(info.id, info.replicaGroupId, info.proxy, getSerials(current.ctx, serial)); } catch (const AdapterExistsException&) { diff --git a/cpp/src/IceGrid/Scanner.cpp b/cpp/src/IceGrid/Scanner.cpp index 43a1ce7b27a..7badb0f4063 100644 --- a/cpp/src/IceGrid/Scanner.cpp +++ b/cpp/src/IceGrid/Scanner.cpp @@ -121,7 +121,7 @@ typedef unsigned int flex_uint32_t; * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start)-1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) @@ -1008,8 +1008,8 @@ YY_DECL default: YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp index c26cd6aac2c..22e7f425bd5 100644 --- a/cpp/src/IceGrid/ServerCache.cpp +++ b/cpp/src/IceGrid/ServerCache.cpp @@ -102,7 +102,8 @@ ServerCache::add(const ServerInfo& info) _nodeCache.get(info.node, true)->addServer(entry); forEachCommunicator( - info.descriptor, [this, entry, application = info.application](const auto& descriptor) + info.descriptor, + [this, entry, application = info.application](const auto& descriptor) { addCommunicator(nullptr, descriptor, entry, application); }); if (_traceLevels && _traceLevels->server > 0) @@ -171,7 +172,8 @@ ServerCache::preUpdate(const ServerInfo& newInfo, bool noRestart) { ServerInfo info = entry->getInfo(); forEachCommunicator( - info.descriptor, newInfo.descriptor, + info.descriptor, + newInfo.descriptor, [this, entry](const auto& oldDesc, const auto& newDesc) { removeCommunicator(oldDesc, newDesc, entry); }); _nodeCache.get(info.node)->removeServer(entry); } @@ -203,7 +205,8 @@ ServerCache::postUpdate(const ServerInfo& info, bool noRestart) _nodeCache.get(info.node, true)->addServer(entry); forEachCommunicator( - oldInfo.descriptor, info.descriptor, + oldInfo.descriptor, + info.descriptor, [this, entry, application = info.application](const auto& oldDesc, const auto& newDesc) { addCommunicator(oldDesc, newDesc, entry, application); }); } @@ -698,8 +701,9 @@ ServerEntry::syncImpl() { try { - _cache.getNodeCache().get(load.node)->loadServer( - static_pointer_cast(shared_from_this()), load, session, timeout, noRestart); + _cache.getNodeCache() + .get(load.node) + ->loadServer(static_pointer_cast(shared_from_this()), load, session, timeout, noRestart); } catch (const NodeNotExistException&) { @@ -884,8 +888,9 @@ ServerEntry::loadCallback( { try { - _cache.getNodeCache().get(load.node)->loadServer( - static_pointer_cast(shared_from_this()), load, session, timeout, noRestart); + _cache.getNodeCache() + .get(load.node) + ->loadServer(static_pointer_cast(shared_from_this()), load, session, timeout, noRestart); } catch (const NodeNotExistException&) { @@ -928,8 +933,9 @@ ServerEntry::destroyCallback() { try { - _cache.getNodeCache().get(load.node)->loadServer( - static_pointer_cast(shared_from_this()), load, session, -1s, noRestart); + _cache.getNodeCache() + .get(load.node) + ->loadServer(static_pointer_cast(shared_from_this()), load, session, -1s, noRestart); } catch (const NodeNotExistException&) { @@ -981,8 +987,9 @@ ServerEntry::exception(exception_ptr ex) { try { - _cache.getNodeCache().get(load.node)->loadServer( - static_pointer_cast(shared_from_this()), load, session, timeout, noRestart); + _cache.getNodeCache() + .get(load.node) + ->loadServer(static_pointer_cast(shared_from_this()), load, session, timeout, noRestart); } catch (const NodeNotExistException&) { @@ -1078,7 +1085,11 @@ ServerEntry::checkUpdate(const ServerInfo& info, bool noRestart) } return make_shared( - _id, oldInfo.node, noRestart, desc != nullptr, server->checkUpdateAsync(desc, noRestart)); + _id, + oldInfo.node, + noRestart, + desc != nullptr, + server->checkUpdateAsync(desc, noRestart)); } bool diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index e1709912767..1eb1a547e92 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -313,7 +313,8 @@ namespace IceGrid auto p = Ice::uncheckedCast(_admin, facet); p->setPropertiesAsync( - props, [self = shared_from_this()] { self->next(); }, + props, + [self = shared_from_this()] { self->next(); }, [server = _server, desc = _desc](exception_ptr ex) { server->updateRuntimePropertiesCallback(ex, desc); }); } @@ -351,7 +352,9 @@ namespace IceGrid } string variable = v.substr(beg + 1, end - beg - 1); DWORD ret = GetEnvironmentVariableW( - Ice::stringToWstring(variable).c_str(), &buf[0], static_cast(buf.size())); + Ice::stringToWstring(variable).c_str(), + &buf[0], + static_cast(buf.size())); string valstr = (ret > 0 && ret < buf.size()) ? Ice::wstringToString(&buf[0]) : string(""); v.replace(beg, end - beg + 1, valstr); beg += valstr.size(); @@ -1623,7 +1626,8 @@ ServerI::activate() if (session) { _node->getMasterNodeSession()->waitForApplicationUpdateAsync( - desc->uuid, desc->revision, + desc->uuid, + desc->revision, [self = shared_from_this()] { self->waitForApplicationUpdateCompleted(); }, [self = shared_from_this()](exception_ptr) { self->waitForApplicationUpdateCompleted(); }); return; @@ -1662,8 +1666,8 @@ ServerI::activate() } #ifndef _WIN32 - int pid = _node->getActivator()->activate( - desc->id, desc->exe, desc->pwd, uid, gid, options, envs, shared_from_this()); + int pid = _node->getActivator() + ->activate(desc->id, desc->exe, desc->pwd, uid, gid, options, envs, shared_from_this()); #else int pid = _node->getActivator()->activate(desc->id, desc->exe, desc->pwd, options, envs, shared_from_this()); #endif @@ -2115,7 +2119,12 @@ ServerI::updateImpl(const shared_ptr& descriptor) { auto proxy = Ice::uncheckedCast(adapter->createProxy(id)); servant = make_shared( - _node, this, _id, proxy, adpt->id, _activation != Disabled || _failureTime != nullopt); + _node, + this, + _id, + proxy, + adpt->id, + _activation != Disabled || _failureTime != nullopt); adapter->add(servant, id); } _adapters.insert(make_pair(adpt->id, servant)); @@ -2643,10 +2652,11 @@ ServerI::checkActivation() // Mark the server as active if the server process proxy is registered (or it's not expecting // one to be registered) and if all the server lifetime adapters have been activated. // - if ((!_desc->processRegistered || _process) && - includes( - _activatedAdapters.begin(), _activatedAdapters.end(), _serverLifetimeAdapters.begin(), - _serverLifetimeAdapters.end())) + if ((!_desc->processRegistered || _process) && includes( + _activatedAdapters.begin(), + _activatedAdapters.end(), + _serverLifetimeAdapters.begin(), + _serverLifetimeAdapters.end())) { setStateNoSync(InternalServerState::Active); return true; diff --git a/cpp/src/IceGrid/SessionI.cpp b/cpp/src/IceGrid/SessionI.cpp index b057cbebaef..75f5603ae62 100644 --- a/cpp/src/IceGrid/SessionI.cpp +++ b/cpp/src/IceGrid/SessionI.cpp @@ -156,7 +156,9 @@ SessionI::allocateObjectByIdAsync( const Ice::Current&) { auto allocatedObject = make_shared( - static_pointer_cast(shared_from_this()), std::move(response), std::move(exception)); + static_pointer_cast(shared_from_this()), + std::move(response), + std::move(exception)); _database->getAllocatableObject(id)->allocate(std::move(allocatedObject)); } @@ -168,7 +170,9 @@ SessionI::allocateObjectByTypeAsync( const Ice::Current&) { auto allocatedObject = make_shared( - static_pointer_cast(shared_from_this()), std::move(response), std::move(exception)); + static_pointer_cast(shared_from_this()), + std::move(response), + std::move(exception)); _database->getAllocatableObjectCache().allocateByType(type, std::move(allocatedObject)); } diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp index 5437e37c1da..d15b1b9dec2 100644 --- a/cpp/src/IceGrid/Util.cpp +++ b/cpp/src/IceGrid/Util.cpp @@ -218,8 +218,7 @@ IceGrid::toObjectInfo( catch (const Ice::ProxyParseException&) { ostringstream fallbackProxyStr; - fallbackProxyStr << "\"" << communicator->identityToString(obj.id) << "\"" - << " @ \"" << adapterId << "\""; + fallbackProxyStr << "\"" << communicator->identityToString(obj.id) << "\"" << " @ \"" << adapterId << "\""; info.proxy = communicator->stringToProxy(fallbackProxyStr.str()); } return info; diff --git a/cpp/src/IceIAP/EndpointI.mm b/cpp/src/IceIAP/EndpointI.mm index efb693d9ff1..a3f2108b476 100644 --- a/cpp/src/IceIAP/EndpointI.mm +++ b/cpp/src/IceIAP/EndpointI.mm @@ -173,8 +173,8 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize) } else { - return make_shared( - _instance, _manufacturer, _modelNumber, _name, _protocol, t, _connectionId, _compress); + return make_shared< + iAPEndpointI>(_instance, _manufacturer, _modelNumber, _name, _protocol, t, _connectionId, _compress); } } @@ -193,8 +193,8 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize) } else { - return make_shared( - _instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, cId, _compress); + return make_shared< + iAPEndpointI>(_instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, cId, _compress); } } @@ -213,8 +213,8 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize) } else { - return make_shared( - _instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, _connectionId, c); + return make_shared< + iAPEndpointI>(_instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, _connectionId, c); } } diff --git a/cpp/src/IceLocatorDiscovery/PluginI.cpp b/cpp/src/IceLocatorDiscovery/PluginI.cpp index c1154622d16..0dda6954332 100644 --- a/cpp/src/IceLocatorDiscovery/PluginI.cpp +++ b/cpp/src/IceLocatorDiscovery/PluginI.cpp @@ -307,7 +307,9 @@ Request::invoke(const Ice::LocatorPrx& l) { auto self = shared_from_this(); l->ice_invokeAsync( - _operation, _mode, _inParams, + _operation, + _mode, + _inParams, [self](bool ok, vector outParams) { pair outPair; @@ -322,7 +324,9 @@ Request::invoke(const Ice::LocatorPrx& l) } self->response(ok, outPair); }, - [self](exception_ptr e) { self->exception(e); }, nullptr, _context); + [self](exception_ptr e) { self->exception(e); }, + nullptr, + _context); } catch (const Ice::LocalException&) { @@ -446,9 +450,15 @@ LocatorI::ice_invokeAsync( const Ice::Current& current) { invoke( - nullopt, make_shared( - this, current.operation, current.mode, inParams, current.ctx, std::move(responseCB), - std::move(exceptionCB))); + nullopt, + make_shared( + this, + current.operation, + current.mode, + inParams, + current.ctx, + std::move(responseCB), + std::move(exceptionCB))); } vector @@ -645,7 +655,9 @@ LocatorI::invoke(const optional& locator, const RequestPtr& req for (const auto& l : _lookups) { l.first->findLocatorAsync( - _instanceName, l.second, nullptr, + _instanceName, + l.second, + nullptr, [self = shared_from_this()](exception_ptr ex) { self->exception(ex); }); } _timer->schedule(shared_from_this(), _timeout); @@ -764,7 +776,9 @@ LocatorI::runTimerTask() for (const auto& l : _lookups) { l.first->findLocatorAsync( - _instanceName, l.second, nullptr, + _instanceName, + l.second, + nullptr, [self = shared_from_this()](exception_ptr ex) { self->exception(ex); }); } _timer->schedule(shared_from_this(), _timeout); diff --git a/cpp/src/IcePatch2/Calc.cpp b/cpp/src/IcePatch2/Calc.cpp index 78bdef37a68..f304928faaa 100644 --- a/cpp/src/IcePatch2/Calc.cpp +++ b/cpp/src/IcePatch2/Calc.cpp @@ -248,8 +248,12 @@ main(int argc, char* argv[]) newInfoSeq.reserve(infoSeq.size()); set_difference( - infoSeq.begin(), infoSeq.end(), partialInfoSeq.begin(), partialInfoSeq.end(), - back_inserter(newInfoSeq), FileInfoPathLess()); + infoSeq.begin(), + infoSeq.end(), + partialInfoSeq.begin(), + partialInfoSeq.end(), + back_inserter(newInfoSeq), + FileInfoPathLess()); infoSeq.swap(newInfoSeq); @@ -257,8 +261,12 @@ main(int argc, char* argv[]) newInfoSeq.reserve(infoSeq.size() + partialInfoSeq.size()); set_union( - infoSeq.begin(), infoSeq.end(), partialInfoSeq.begin(), partialInfoSeq.end(), - back_inserter(newInfoSeq), FileInfoPathLess()); + infoSeq.begin(), + infoSeq.end(), + partialInfoSeq.begin(), + partialInfoSeq.end(), + back_inserter(newInfoSeq), + FileInfoPathLess()); infoSeq.swap(newInfoSeq); } diff --git a/cpp/src/IcePatch2Lib/ClientUtil.cpp b/cpp/src/IcePatch2Lib/ClientUtil.cpp index fb0134bf441..1e7f9006511 100644 --- a/cpp/src/IcePatch2Lib/ClientUtil.cpp +++ b/cpp/src/IcePatch2Lib/ClientUtil.cpp @@ -374,7 +374,10 @@ namespace // Compute the set of files which were removed. // set_difference( - tree0.nodes[node0].files.begin(), tree0.nodes[node0].files.end(), files.begin(), files.end(), + tree0.nodes[node0].files.begin(), + tree0.nodes[node0].files.end(), + files.begin(), + files.end(), back_inserter(_removeFiles), FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags here. @@ -385,8 +388,12 @@ namespace updatedFiles.reserve(files.size()); set_difference( - files.begin(), files.end(), tree0.nodes[node0].files.begin(), tree0.nodes[node0].files.end(), - back_inserter(updatedFiles), FileInfoLess()); + files.begin(), + files.end(), + tree0.nodes[node0].files.begin(), + tree0.nodes[node0].files.end(), + back_inserter(updatedFiles), + FileInfoLess()); // // Compute the set of files whose contents was updated. @@ -395,7 +402,10 @@ namespace contentsUpdatedFiles.reserve(files.size()); set_difference( - files.begin(), files.end(), tree0.nodes[node0].files.begin(), tree0.nodes[node0].files.end(), + files.begin(), + files.end(), + tree0.nodes[node0].files.begin(), + tree0.nodes[node0].files.end(), back_inserter(contentsUpdatedFiles), FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags here. copy(contentsUpdatedFiles.begin(), contentsUpdatedFiles.end(), back_inserter(_updateFiles)); @@ -404,8 +414,12 @@ namespace // Compute the set of files whose flags were updated. // set_difference( - updatedFiles.begin(), updatedFiles.end(), contentsUpdatedFiles.begin(), - contentsUpdatedFiles.end(), back_inserter(_updateFlags), FileInfoLess()); + updatedFiles.begin(), + updatedFiles.end(), + contentsUpdatedFiles.begin(), + contentsUpdatedFiles.end(), + back_inserter(_updateFlags), + FileInfoLess()); } if (!_feedback->fileListProgress(static_cast(node0 + 1) * 100 / 256)) @@ -578,7 +592,11 @@ namespace newLocalFiles.reserve(_localFiles.size()); set_difference( - _localFiles.begin(), _localFiles.end(), files.begin(), files.end(), back_inserter(newLocalFiles), + _localFiles.begin(), + _localFiles.end(), + files.begin(), + files.end(), + back_inserter(newLocalFiles), FileInfoLess()); _localFiles.swap(newLocalFiles); @@ -586,7 +604,11 @@ namespace LargeFileInfoSeq newRemoveFiles; set_difference( - _removeFiles.begin(), _removeFiles.end(), files.begin(), files.end(), back_inserter(newRemoveFiles), + _removeFiles.begin(), + _removeFiles.end(), + files.begin(), + files.end(), + back_inserter(newRemoveFiles), FileInfoLess()); _removeFiles.swap(newRemoveFiles); @@ -650,7 +672,9 @@ namespace std::shared_ptr cb) { serverNoCompress->getLargeFileCompressedAsync( - path, pos, chunkSize, + path, + pos, + chunkSize, [cb](std::pair result) { cb->complete(ByteSeq(result.first, result.second)); }, [cb](exception_ptr exception) { cb->exception(exception); }); @@ -826,7 +850,11 @@ namespace newLocalFiles.reserve(_localFiles.size()); set_union( - _localFiles.begin(), _localFiles.end(), files.begin(), files.end(), back_inserter(newLocalFiles), + _localFiles.begin(), + _localFiles.end(), + files.begin(), + files.end(), + back_inserter(newLocalFiles), FileInfoLess()); _localFiles.swap(newLocalFiles); @@ -834,7 +862,11 @@ namespace LargeFileInfoSeq newUpdateFiles; set_difference( - _updateFiles.begin(), _updateFiles.end(), files.begin(), files.end(), back_inserter(newUpdateFiles), + _updateFiles.begin(), + _updateFiles.end(), + files.begin(), + files.end(), + back_inserter(newUpdateFiles), FileInfoLess()); _updateFiles.swap(newUpdateFiles); @@ -859,7 +891,11 @@ namespace LargeFileInfoSeq localFiles; localFiles.reserve(_localFiles.size()); set_difference( - _localFiles.begin(), _localFiles.end(), files.begin(), files.end(), back_inserter(localFiles), + _localFiles.begin(), + _localFiles.end(), + files.begin(), + files.end(), + back_inserter(localFiles), FileInfoWithoutFlagsLess()); // NOTE: We ignore the flags. // @@ -867,13 +903,21 @@ namespace // _localFiles.clear(); set_union( - localFiles.begin(), localFiles.end(), files.begin(), files.end(), back_inserter(_localFiles), + localFiles.begin(), + localFiles.end(), + files.begin(), + files.end(), + back_inserter(_localFiles), FileInfoLess()); LargeFileInfoSeq newUpdateFlags; set_difference( - _updateFlags.begin(), _updateFlags.end(), files.begin(), files.end(), back_inserter(newUpdateFlags), + _updateFlags.begin(), + _updateFlags.end(), + files.begin(), + files.end(), + back_inserter(newUpdateFlags), FileInfoLess()); _updateFlags.swap(newUpdateFlags); diff --git a/cpp/src/IcePatch2Lib/Util.cpp b/cpp/src/IcePatch2Lib/Util.cpp index e937b8ac743..89b99571320 100644 --- a/cpp/src/IcePatch2Lib/Util.cpp +++ b/cpp/src/IcePatch2Lib/Util.cpp @@ -75,9 +75,12 @@ bool IcePatch2Internal::writeFileInfo(FILE* fp, const LargeFileInfo& info) { int rc = fprintf( - fp, "%s\t%s\t%lld\t%d\n", + fp, + "%s\t%s\t%lld\t%d\n", IceUtilInternal::escapeString(info.path, "", IceUtilInternal::ToStringMode::Compat).c_str(), - bytesToString(info.checksum).c_str(), static_cast(info.size), static_cast(info.executable)); + bytesToString(info.checksum).c_str(), + static_cast(info.size), + static_cast(info.executable)); return rc > 0; } @@ -588,7 +591,10 @@ IcePatch2Internal::compressBytesToFile(const string& pa, const ByteSeq& bytes, i } BZ2_bzWrite( - &bzError, bzFile, const_cast(&bytes[static_cast(pos)]), static_cast(bytes.size()) - pos); + &bzError, + bzFile, + const_cast(&bytes[static_cast(pos)]), + static_cast(bytes.size()) - pos); if (bzError != BZ_OK) { string reason = "BZ2_bzWrite failed"; @@ -955,7 +961,10 @@ namespace if (doCompress) { BZ2_bzWrite( - &bzError, bzFile, const_cast(&bytes[0]), static_cast(bytes.size())); + &bzError, + bzFile, + const_cast(&bytes[0]), + static_cast(bytes.size())); if (bzError != BZ_OK) { string reason = "BZ2_bzWrite failed"; @@ -1163,7 +1172,11 @@ IcePatch2Internal::loadFileInfoSeq(const string& pa, LargeFileInfoSeq& infoSeq) newInfoSeq.reserve(infoSeq.size()); set_difference( - infoSeq.begin(), infoSeq.end(), remove.begin(), remove.end(), back_inserter(newInfoSeq), + infoSeq.begin(), + infoSeq.end(), + remove.begin(), + remove.end(), + back_inserter(newInfoSeq), FileInfoLess()); infoSeq.swap(newInfoSeq); @@ -1172,7 +1185,11 @@ IcePatch2Internal::loadFileInfoSeq(const string& pa, LargeFileInfoSeq& infoSeq) newInfoSeq.reserve(infoSeq.size()); set_union( - infoSeq.begin(), infoSeq.end(), update.begin(), update.end(), back_inserter(newInfoSeq), + infoSeq.begin(), + infoSeq.end(), + update.begin(), + update.end(), + back_inserter(newInfoSeq), FileInfoLess()); infoSeq.swap(newInfoSeq); @@ -1220,7 +1237,9 @@ IcePatch2Internal::getFileTree0(const LargeFileInfoSeq& infoSeq, FileTree0& tree if (!allChecksums1.empty()) { IceInternal::sha1( - reinterpret_cast(&allChecksums1[0]), allChecksums1.size(), tree1.checksum); + reinterpret_cast(&allChecksums1[0]), + allChecksums1.size(), + tree1.checksum); } else { diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index a11438c67f5..a001bf56e40 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -170,7 +170,10 @@ IceInternal::AcceptorPtr IceSSL::EndpointI::acceptor(const string& adapterName) const { return make_shared( - const_cast(this)->shared_from_this(), _instance, _delegate->acceptor(adapterName), adapterName); + const_cast(this)->shared_from_this(), + _instance, + _delegate->acceptor(adapterName), + adapterName); } EndpointIPtr @@ -329,7 +332,8 @@ IceSSL::EndpointFactoryI::cloneWithUnderlying(const IceInternal::ProtocolInstanc const { return make_shared( - make_shared(_sslInstance->engine(), instance->type(), instance->protocol()), underlying); + make_shared(_sslInstance->engine(), instance->type(), instance->protocol()), + underlying); } IceInternal::EndpointIPtr diff --git a/cpp/src/IceSSL/OpenSSLEngine.cpp b/cpp/src/IceSSL/OpenSSLEngine.cpp index 2e2a3126947..2235e55dc97 100644 --- a/cpp/src/IceSSL/OpenSSLEngine.cpp +++ b/cpp/src/IceSSL/OpenSSLEngine.cpp @@ -134,7 +134,9 @@ OpenSSL::SSLEngine::SSLEngine(const CommunicatorPtr& communicator) : IceSSL::SSL { cleanup(); throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for IceSSL.Random:\n" + randFiles); + __FILE__, + __LINE__, + "IceSSL: invalid value for IceSSL.Random:\n" + randFiles); } for (vector::iterator p = files.begin(); p != files.end(); ++p) { @@ -144,13 +146,17 @@ OpenSSL::SSLEngine::SSLEngine(const CommunicatorPtr& communicator) : IceSSL::SSL { cleanup(); throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: entropy data file not found:\n" + file); + __FILE__, + __LINE__, + "IceSSL: entropy data file not found:\n" + file); } if (!RAND_load_file(resolved.c_str(), 1024)) { cleanup(); throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to load entropy data from " + resolved); + __FILE__, + __LINE__, + "IceSSL: unable to load entropy data from " + resolved); } } } @@ -166,7 +172,9 @@ OpenSSL::SSLEngine::SSLEngine(const CommunicatorPtr& communicator) : IceSSL::SSL { cleanup(); throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: EGD failure using file " + entropyDaemon); + __FILE__, + __LINE__, + "IceSSL: EGD failure using file " + entropyDaemon); } } #endif @@ -256,7 +264,9 @@ OpenSSL::SSLEngine::initialize() if (!_ctx) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to create SSL context:\n" + sslErrors()); + __FILE__, + __LINE__, + "IceSSL: unable to create SSL context:\n" + sslErrors()); } int securityLevel = properties->getPropertyAsIntWithDefault(propPrefix + "SecurityLevel", -1); @@ -266,7 +276,9 @@ OpenSSL::SSLEngine::initialize() if (SSL_CTX_get_security_level(_ctx) != securityLevel) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to set SSL security level:\n" + sslErrors()); + __FILE__, + __LINE__, + "IceSSL: unable to set SSL security level:\n" + sslErrors()); } } @@ -322,7 +334,9 @@ OpenSSL::SSLEngine::initialize() if (!file && !dir) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: CA certificate path not found:\n" + path); + __FILE__, + __LINE__, + "IceSSL: CA certificate path not found:\n" + path); } } @@ -382,7 +396,9 @@ OpenSSL::SSLEngine::initialize() if (!IceUtilInternal::splitString(certFile, IceUtilInternal::pathsep, files) || files.size() > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for " + propPrefix + "CertFile:\n" + certFile); + __FILE__, + __LINE__, + "IceSSL: invalid value for " + propPrefix + "CertFile:\n" + certFile); } numCerts = files.size(); for (vector::iterator p = files.begin(); p != files.end(); ++p) @@ -392,7 +408,9 @@ OpenSSL::SSLEngine::initialize() if (!checkPath(file, defaultDir, false, resolved)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: certificate file not found:\n" + file); + __FILE__, + __LINE__, + "IceSSL: certificate file not found:\n" + file); } file = resolved; @@ -439,7 +457,8 @@ OpenSSL::SSLEngine::initialize() if (!cert || !SSL_CTX_use_certificate(_ctx, cert)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: unable to load SSL certificate:\n" + (cert ? sslErrors() : "certificate not found")); } @@ -447,7 +466,8 @@ OpenSSL::SSLEngine::initialize() if (!key || !SSL_CTX_use_PrivateKey(_ctx, key)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: unable to load SSL private key:\n" + (key ? sslErrors() : "key not found")); } @@ -463,7 +483,8 @@ OpenSSL::SSLEngine::initialize() if (!SSL_CTX_add_extra_chain_cert(_ctx, c)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: unable to add extra SSL certificate:\n" + sslErrors()); } } @@ -553,12 +574,15 @@ OpenSSL::SSLEngine::initialize() if (!IceUtilInternal::splitString(keyFile, IceUtilInternal::pathsep, files) || files.size() > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for " + propPrefix + "KeyFile:\n" + keyFile); + __FILE__, + __LINE__, + "IceSSL: invalid value for " + propPrefix + "KeyFile:\n" + keyFile); } if (files.size() != numCerts) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: " + propPrefix + "KeyFile does not agree with " + propPrefix + "CertFile"); } for (vector::iterator p = files.begin(); p != files.end(); ++p) @@ -609,7 +633,9 @@ OpenSSL::SSLEngine::initialize() if (keyLoaded && !SSL_CTX_check_private_key(_ctx)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to validate private key(s):\n" + sslErrors()); + __FILE__, + __LINE__, + "IceSSL: unable to validate private key(s):\n" + sslErrors()); } // @@ -644,13 +670,17 @@ OpenSSL::SSLEngine::initialize() if (!checkPath(file, defaultDir, false, resolved)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: DH parameter file not found:\n" + file); + __FILE__, + __LINE__, + "IceSSL: DH parameter file not found:\n" + file); } file = resolved; if (!_dhParams->add(keyLength, file)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to read DH parameter file " + file); + __FILE__, + __LINE__, + "IceSSL: unable to read DH parameter file " + file); } } } @@ -665,7 +695,8 @@ OpenSSL::SSLEngine::initialize() if (crlFiles.empty()) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: cannot enable revocation checks without setting certificate revocation list files"); } @@ -673,7 +704,9 @@ OpenSSL::SSLEngine::initialize() if (!store) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to obtain the certificate store"); + __FILE__, + __LINE__, + "IceSSL: unable to obtain the certificate store"); } X509_LOOKUP* lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); @@ -688,13 +721,17 @@ OpenSSL::SSLEngine::initialize() if (!checkPath(*it, defaultDir, false, file)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: CRL file not found `" + *it + "'"); + __FILE__, + __LINE__, + "IceSSL: CRL file not found `" + *it + "'"); } if (X509_LOOKUP_load_file(lookup, file.c_str(), X509_FILETYPE_PEM) == 0) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: CRL load failure `" + *it + "'"); + __FILE__, + __LINE__, + "IceSSL: CRL load failure `" + *it + "'"); } } @@ -728,7 +765,9 @@ OpenSSL::SSLEngine::initialize() // pointer to this SharedInstance object. // SSL_CTX_set_session_id_context( - _ctx, reinterpret_cast(this), static_cast(sizeof(this))); + _ctx, + reinterpret_cast(this), + static_cast(sizeof(this))); // // Select protocols. @@ -747,7 +786,9 @@ OpenSSL::SSLEngine::initialize() if (!SSL_CTX_set_cipher_list(_ctx, ciphersStr.c_str())) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to set ciphers using `" + ciphersStr + "':\n" + sslErrors()); + __FILE__, + __LINE__, + "IceSSL: unable to set ciphers using `" + ciphersStr + "':\n" + sslErrors()); } } @@ -855,7 +896,9 @@ OpenSSL::SSLEngine::parseProtocols(const StringSeq& protocols) const { #if defined(OPENSSL_NO_TLS1_METHOD) || !defined(TLS1_VERSION) throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: OpenSSL was build without TLS 1.0 support"); + __FILE__, + __LINE__, + "IceSSL: OpenSSL was build without TLS 1.0 support"); #else v |= TLSv1_0; #endif @@ -864,7 +907,9 @@ OpenSSL::SSLEngine::parseProtocols(const StringSeq& protocols) const { #if defined(OPENSSL_NO_TLS1_1_METHOD) || !defined(TLS1_1_VERSION) throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: OpenSSL was build without TLS 1.1 support"); + __FILE__, + __LINE__, + "IceSSL: OpenSSL was build without TLS 1.1 support"); #else v |= TLSv1_1; #endif @@ -873,7 +918,9 @@ OpenSSL::SSLEngine::parseProtocols(const StringSeq& protocols) const { #if defined(OPENSSL_NO_TLS1_2_METHOD) || !defined(TLS1_2_VERSION) throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: OpenSSL was build without TLS 1.2 support"); + __FILE__, + __LINE__, + "IceSSL: OpenSSL was build without TLS 1.2 support"); #else v |= TLSv1_2; #endif @@ -882,7 +929,9 @@ OpenSSL::SSLEngine::parseProtocols(const StringSeq& protocols) const { #if defined(OPENSSL_NO_TLS1_3_METHOD) || !defined(TLS1_3_VERSION) throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: OpenSSL was build without TLS 1.3 support"); + __FILE__, + __LINE__, + "IceSSL: OpenSSL was build without TLS 1.3 support"); #else v |= TLSv1_3; #endif diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp index 9194a31a756..e0d2931d9f1 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp @@ -236,7 +236,9 @@ OpenSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal:: if (!X509_VERIFY_PARAM_set1_ip_asc(param, _host.c_str())) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error setting the expected IP address `" + _host + "'"); + __FILE__, + __LINE__, + "IceSSL: error setting the expected IP address `" + _host + "'"); } } else @@ -244,7 +246,9 @@ OpenSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal:: if (!X509_VERIFY_PARAM_set1_host(param, _host.c_str(), 0)) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error setting the expected host name `" + _host + "'"); + __FILE__, + __LINE__, + "IceSSL: error setting the expected host name `" + _host + "'"); } } } @@ -567,7 +571,9 @@ OpenSSL::TransceiverI::write(IceInternal::Buffer& buf) case SSL_ERROR_SSL: { throw ProtocolException( - __FILE__, __LINE__, "SSL protocol error during write:\n" + _engine->sslErrors()); + __FILE__, + __LINE__, + "SSL protocol error during write:\n" + _engine->sslErrors()); } } } @@ -688,7 +694,9 @@ OpenSSL::TransceiverI::read(IceInternal::Buffer& buf) { #endif throw ProtocolException( - __FILE__, __LINE__, "SSL protocol error during read:\n" + _engine->sslErrors()); + __FILE__, + __LINE__, + "SSL protocol error during read:\n" + _engine->sslErrors()); #if defined(SSL_R_UNEXPECTED_EOF_WHILE_READING) } #endif @@ -836,7 +844,9 @@ OpenSSL::TransceiverI::finishRead(IceInternal::Buffer& buffer) case SSL_ERROR_SSL: { throw ProtocolException( - __FILE__, __LINE__, "SSL protocol error during read:\n" + _engine->sslErrors()); + __FILE__, + __LINE__, + "SSL protocol error during read:\n" + _engine->sslErrors()); } } } diff --git a/cpp/src/IceSSL/SChannelCertificateI.cpp b/cpp/src/IceSSL/SChannelCertificateI.cpp index 0e3ed0de708..aef0ca685bd 100644 --- a/cpp/src/IceSSL/SChannelCertificateI.cpp +++ b/cpp/src/IceSSL/SChannelCertificateI.cpp @@ -104,7 +104,14 @@ namespace DWORD decodedLeng = 0; if (!CryptDecodeObjectEx( - X509_ASN_ENCODING, X509_CERT, &outBuffer[0], outLength, CRYPT_DECODE_ALLOC_FLAG, 0, cert, &decodedLeng)) + X509_ASN_ENCODING, + X509_CERT, + &outBuffer[0], + outLength, + CRYPT_DECODE_ALLOC_FLAG, + 0, + cert, + &decodedLeng)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } @@ -143,7 +150,11 @@ namespace vector buffer(length); if (!CertNameToStr( - X509_ASN_ENCODING, certName, CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG, &buffer[0], length)) + X509_ASN_ENCODING, + certName, + CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG, + &buffer[0], + length)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } @@ -174,8 +185,14 @@ namespace CERT_ALT_NAME_INFO* altName; DWORD length = 0; if (!CryptDecodeObjectEx( - X509_ASN_ENCODING, X509_ALTERNATE_NAME, extension->Value.pbData, extension->Value.cbData, - CRYPT_DECODE_ALLOC_FLAG, 0, &altName, &length)) + X509_ASN_ENCODING, + X509_ALTERNATE_NAME, + extension->Value.pbData, + extension->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &altName, + &length)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } @@ -289,8 +306,14 @@ SChannelCertificateI::SChannelCertificateI(CERT_SIGNED_CONTENT_INFO* cert) : _ce // DWORD length = 0; if (!CryptDecodeObjectEx( - X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED, _cert->ToBeSigned.pbData, _cert->ToBeSigned.cbData, - CRYPT_DECODE_ALLOC_FLAG, 0, &_certInfo, &length)) + X509_ASN_ENCODING, + X509_CERT_TO_BE_SIGNED, + _cert->ToBeSigned.pbData, + _cert->ToBeSigned.cbData, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &_certInfo, + &length)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } @@ -335,8 +358,14 @@ SChannelCertificateI::getAuthorityKeyIdentifier() const CERT_AUTHORITY_KEY_ID2_INFO* decoded; DWORD length = 0; if (!CryptDecodeObjectEx( - X509_ASN_ENCODING, X509_AUTHORITY_KEY_ID2, extension->Value.pbData, extension->Value.cbData, - CRYPT_DECODE_ALLOC_FLAG, 0, &decoded, &length)) + X509_ASN_ENCODING, + X509_AUTHORITY_KEY_ID2, + extension->Value.pbData, + extension->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &decoded, + &length)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } @@ -362,8 +391,14 @@ SChannelCertificateI::getSubjectKeyIdentifier() const CRYPT_DATA_BLOB* decoded; DWORD length = 0; if (!CryptDecodeObjectEx( - X509_ASN_ENCODING, szOID_SUBJECT_KEY_IDENTIFIER, extension->Value.pbData, extension->Value.cbData, - CRYPT_DECODE_ALLOC_FLAG, 0, &decoded, &length)) + X509_ASN_ENCODING, + szOID_SUBJECT_KEY_IDENTIFIER, + extension->Value.pbData, + extension->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &decoded, + &length)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } @@ -392,7 +427,11 @@ SChannelCertificateI::verify(const CertificatePtr& cert) const throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } result = CryptVerifyCertificateSignature( - 0, X509_ASN_ENCODING, buffer, length, &c->_certInfo->SubjectPublicKeyInfo) != 0; + 0, + X509_ASN_ENCODING, + buffer, + length, + &c->_certInfo->SubjectPublicKeyInfo) != 0; LocalFree(buffer); } return result; @@ -420,7 +459,11 @@ SChannelCertificateI::encode() const std::vector encoded; encoded.resize(encodedLength); if (!CryptBinaryToString( - buffer, length, CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, &encoded[0], &encodedLength)) + buffer, + length, + CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, + &encoded[0], + &encodedLength)) { throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString()); } diff --git a/cpp/src/IceSSL/SChannelEngine.cpp b/cpp/src/IceSSL/SChannelEngine.cpp index 38a46b0ef5c..38f7fa25bd0 100644 --- a/cpp/src/IceSSL/SChannelEngine.cpp +++ b/cpp/src/IceSSL/SChannelEngine.cpp @@ -53,12 +53,18 @@ namespace do { if ((next = CertFindCertificateInStore( - source, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, findType, findParam, next)) != 0) + source, + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + 0, + findType, + findParam, + next)) != 0) { if (!CertAddCertificateContextToStore(target, next, CERT_STORE_ADD_ALWAYS, 0)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error adding certificate to store:\n" + IceUtilInternal::lastErrorToString()); } } @@ -83,7 +89,8 @@ namespace if (!store) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: failed to open certificate store `" + storeName + "':\n" + IceUtilInternal::lastErrorToString()); } @@ -122,7 +129,9 @@ namespace field != "THUMBPRINT" && field != "SUBJECTKEYID" && field != "SERIAL") { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unknown key in `" + value + "'"); + __FILE__, + __LINE__, + "IceSSL: unknown key in `" + value + "'"); } start = pos + 1; @@ -134,7 +143,9 @@ namespace if (start == value.size()) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: missing argument in `" + value + "'"); + __FILE__, + __LINE__, + "IceSSL: missing argument in `" + value + "'"); } string arg; @@ -153,7 +164,9 @@ namespace if (end == value.size() || value[end] != value[start]) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unmatched quote in `" + value + "'"); + __FILE__, + __LINE__, + "IceSSL: unmatched quote in `" + value + "'"); } ++start; arg = value.substr(start, end - start); @@ -178,7 +191,8 @@ namespace if (!tmpStore) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error adding certificate to store:\n" + IceUtilInternal::lastErrorToString()); } @@ -192,7 +206,8 @@ namespace { const wstring argW = Ice::stringToWstring(arg); DWORD flags[] = { - CERT_OID_NAME_STR, CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG, + CERT_OID_NAME_STR, + CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG, CERT_OID_NAME_STR | CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG, CERT_OID_NAME_STR | CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG | CERT_NAME_STR_REVERSE_FLAG}; for (size_t i = 0; i < sizeof(flags) / sizeof(DWORD); ++i) @@ -201,7 +216,8 @@ namespace if (!CertStrToNameW(X509_ASN_ENCODING, argW.c_str(), flags[i], 0, 0, &length, 0)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: invalid value `" + value + "' for `IceSSL.FindCert' property:\n" + IceUtilInternal::lastErrorToString()); } @@ -210,7 +226,8 @@ namespace if (!CertStrToNameW(X509_ASN_ENCODING, argW.c_str(), flags[i], 0, &buffer[0], &length, 0)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: invalid value `" + value + "' for `IceSSL.FindCert' property:\n" + IceUtilInternal::lastErrorToString()); } @@ -227,7 +244,8 @@ namespace if (!parseBytes(arg, buffer)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: invalid `IceSSL.FindCert' property: can't decode the value"); } @@ -241,7 +259,8 @@ namespace if (!parseBytes(arg, buffer)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: invalid value `" + value + "' for `IceSSL.FindCert' property"); } @@ -250,14 +269,20 @@ namespace do { if ((next = CertFindCertificateInStore( - store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_ANY, 0, next)) != 0) + store, + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + 0, + CERT_FIND_ANY, + 0, + next)) != 0) { if (CertCompareIntegerBlob(&serial, &next->pCertInfo->SerialNumber)) { if (!CertAddCertificateContextToStore(tmpStore, next, CERT_STORE_ADD_ALWAYS, 0)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error adding certificate to store:\n" + IceUtilInternal::lastErrorToString()); } @@ -292,7 +317,12 @@ namespace do { if ((next = CertFindCertificateInStore( - store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_ANY, 0, next)) != 0) + store, + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + 0, + CERT_FIND_ANY, + 0, + next)) != 0) { certs.push_back(next); } @@ -337,21 +367,35 @@ namespace outBuffer.resize(size); DWORD outLength = static_cast(outBuffer.size()); if (!CryptStringToBinary( - &buffer[startpos], static_cast(size), CRYPT_STRING_ANY, &outBuffer[0], &outLength, 0, 0)) + &buffer[startpos], + static_cast(size), + CRYPT_STRING_ANY, + &outBuffer[0], + &outLength, + 0, + 0)) { assert(GetLastError() != ERROR_MORE_DATA); // Base64 data should always be bigger than binary throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error decoding certificate:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error decoding certificate:\n" + lastErrorToString()); } if (!CertAddEncodedCertificateToStore( - store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, &outBuffer[0], outLength, CERT_STORE_ADD_NEW, + store, + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + &outBuffer[0], + outLength, + CERT_STORE_ADD_NEW, first ? cert : 0)) { if (GetLastError() != static_cast(CRYPT_E_EXISTS)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error decoding certificate:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error decoding certificate:\n" + lastErrorToString()); } } @@ -644,7 +688,9 @@ SChannel::SSLEngine::initialize() if (!_rootStore) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error creating in memory certificate store:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error creating in memory certificate store:\n" + lastErrorToString()); } } if (!caFile.empty()) @@ -653,7 +699,9 @@ SChannel::SSLEngine::initialize() if (!checkPath(caFile, defaultDir, false, resolved)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: CA certificate file not found:\n" + caFile); + __FILE__, + __LINE__, + "IceSSL: CA certificate file not found:\n" + caFile); } addCertificatesToStore(resolved, _rootStore); @@ -681,7 +729,9 @@ SChannel::SSLEngine::initialize() if (!CertCreateCertificateChainEngine(&config, &_chainEngine)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error creating certificate chain engine:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error creating certificate chain engine:\n" + lastErrorToString()); } } else @@ -699,7 +749,9 @@ SChannel::SSLEngine::initialize() if (!splitString(certFile, IceUtilInternal::pathsep, certFiles) || certFiles.size() > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for " + prefix + "CertFile:\n" + certFile); + __FILE__, + __LINE__, + "IceSSL: invalid value for " + prefix + "CertFile:\n" + certFile); } vector keyFiles; @@ -708,13 +760,17 @@ SChannel::SSLEngine::initialize() if (!splitString(keyFile, IceUtilInternal::pathsep, keyFiles) || keyFiles.size() > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for " + prefix + "KeyFile:\n" + keyFile); + __FILE__, + __LINE__, + "IceSSL: invalid value for " + prefix + "KeyFile:\n" + keyFile); } if (certFiles.size() != keyFiles.size()) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: " + prefix + "KeyFile does not agree with " + prefix + "CertFile"); + __FILE__, + __LINE__, + "IceSSL: " + prefix + "KeyFile does not agree with " + prefix + "CertFile"); } } @@ -725,7 +781,9 @@ SChannel::SSLEngine::initialize() if (!checkPath(cFile, defaultDir, false, resolved)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: certificate file not found:\n" + cFile); + __FILE__, + __LINE__, + "IceSSL: certificate file not found:\n" + cFile); } cFile = resolved; @@ -788,7 +846,9 @@ SChannel::SSLEngine::initialize() if (!cert) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: certificate error:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: certificate error:\n" + lastErrorToString()); } _allCerts.push_back(cert); _stores.push_back(store); @@ -799,7 +859,9 @@ SChannel::SSLEngine::initialize() if (err != CRYPT_E_BAD_ENCODE) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error decoding certificate:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error decoding certificate:\n" + lastErrorToString()); } // @@ -832,11 +894,18 @@ SChannel::SSLEngine::initialize() // Convert the PEM encoded buffer to DER binary format. // if (!CryptStringToBinary( - &buffer[0], static_cast(buffer.size()), CRYPT_STRING_BASE64HEADER, &outBuffer[0], &outLength, - 0, 0)) + &buffer[0], + static_cast(buffer.size()), + CRYPT_STRING_BASE64HEADER, + &outBuffer[0], + &outLength, + 0, + 0)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error decoding key `" + keyFile + "':\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error decoding key `" + keyFile + "':\n" + lastErrorToString()); } PCRYPT_PRIVATE_KEY_INFO keyInfo = 0; @@ -849,8 +918,14 @@ SChannel::SSLEngine::initialize() // DWORD decodedLength = 0; if (CryptDecodeObjectEx( - X509_ASN_ENCODING, PKCS_PRIVATE_KEY_INFO, &outBuffer[0], outLength, CRYPT_DECODE_ALLOC_FLAG, 0, - &keyInfo, &decodedLength)) + X509_ASN_ENCODING, + PKCS_PRIVATE_KEY_INFO, + &outBuffer[0], + outLength, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &keyInfo, + &decodedLength)) { // // Check that we are using a RSA Key @@ -858,7 +933,8 @@ SChannel::SSLEngine::initialize() if (strcmp(keyInfo->Algorithm.pszObjId, szOID_RSA_RSA)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, string("IceSSL: error unknow key algorithm: `") + keyInfo->Algorithm.pszObjId + "'"); } @@ -866,11 +942,18 @@ SChannel::SSLEngine::initialize() // Decode the private key BLOB // if (!CryptDecodeObjectEx( - X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, PKCS_RSA_PRIVATE_KEY, keyInfo->PrivateKey.pbData, - keyInfo->PrivateKey.cbData, CRYPT_DECODE_ALLOC_FLAG, 0, &key, &outLength)) + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + PKCS_RSA_PRIVATE_KEY, + keyInfo->PrivateKey.pbData, + keyInfo->PrivateKey.cbData, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &key, + &outLength)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error decoding key `" + keyFile + "':\n" + lastErrorToString()); } LocalFree(keyInfo); @@ -882,11 +965,18 @@ SChannel::SSLEngine::initialize() // Decode the private key BLOB // if (!CryptDecodeObjectEx( - X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, PKCS_RSA_PRIVATE_KEY, &outBuffer[0], outLength, - CRYPT_DECODE_ALLOC_FLAG, 0, &key, &outLength)) + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + PKCS_RSA_PRIVATE_KEY, + &outBuffer[0], + outLength, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &key, + &outLength)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error decoding key `" + keyFile + "':\n" + lastErrorToString()); } } @@ -904,10 +994,15 @@ SChannel::SSLEngine::initialize() }; if (!CryptAcquireContextW( - &cryptProv, keySetName.c_str(), MS_ENHANCED_PROV_W, PROV_RSA_FULL, contextFlags)) + &cryptProv, + keySetName.c_str(), + MS_ENHANCED_PROV_W, + PROV_RSA_FULL, + contextFlags)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error acquiring cryptographic " "context:\n" + lastErrorToString()); @@ -919,7 +1014,9 @@ SChannel::SSLEngine::initialize() if (!CryptImportKey(cryptProv, key, outLength, 0, 0, &hKey)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error importing key `" + keyFile + "':\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: error importing key `" + keyFile + "':\n" + lastErrorToString()); } LocalFree(key); key = 0; @@ -934,7 +1031,8 @@ SChannel::SSLEngine::initialize() if (!store) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error creating certificate " "store:\n" + lastErrorToString()); @@ -954,7 +1052,8 @@ SChannel::SSLEngine::initialize() if (!CertSetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo)) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error seting certificate " "property:\n" + lastErrorToString()); @@ -1140,13 +1239,22 @@ SChannel::SSLEngine::newCredentialsHandle(bool incoming) memset(&credHandle, 0, sizeof(credHandle)); SECURITY_STATUS err = AcquireCredentialsHandle( - 0, const_cast(UNISP_NAME), (incoming ? SECPKG_CRED_INBOUND : SECPKG_CRED_OUTBOUND), 0, &cred, 0, 0, - &credHandle, 0); + 0, + const_cast(UNISP_NAME), + (incoming ? SECPKG_CRED_INBOUND : SECPKG_CRED_OUTBOUND), + 0, + &cred, + 0, + 0, + &credHandle, + 0); if (err != SEC_E_OK) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: failed to acquire credentials handle:\n" + lastErrorToString()); + __FILE__, + __LINE__, + "IceSSL: failed to acquire credentials handle:\n" + lastErrorToString()); } return credHandle; } diff --git a/cpp/src/IceSSL/SChannelTransceiverI.cpp b/cpp/src/IceSSL/SChannelTransceiverI.cpp index 6520a34b5c0..f9359ecb2af 100644 --- a/cpp/src/IceSSL/SChannelTransceiverI.cpp +++ b/cpp/src/IceSSL/SChannelTransceiverI.cpp @@ -322,8 +322,18 @@ SChannel::TransceiverI::sslHandshake() SecBufferDesc outBufferDesc = {SECBUFFER_VERSION, 1, &outBuffer}; err = InitializeSecurityContext( - &_credentials, 0, const_cast(_host.c_str()), flags, 0, 0, 0, 0, &_ssl, &outBufferDesc, - &_ctxFlags, 0); + &_credentials, + 0, + const_cast(_host.c_str()), + flags, + 0, + 0, + 0, + 0, + &_ssl, + &outBufferDesc, + &_ctxFlags, + 0); if (err != SEC_E_OK && err != SEC_I_CONTINUE_NEEDED) { throw SecurityException(__FILE__, __LINE__, "IceSSL: handshake failure:\n" + secStatusToString(err)); @@ -367,8 +377,15 @@ SChannel::TransceiverI::sslHandshake() if (_incoming) { err = AcceptSecurityContext( - &_credentials, (_sslInitialized ? &_ssl : 0), &inBufferDesc, flags, 0, &_ssl, &outBufferDesc, - &_ctxFlags, 0); + &_credentials, + (_sslInitialized ? &_ssl : 0), + &inBufferDesc, + flags, + 0, + &_ssl, + &outBufferDesc, + &_ctxFlags, + 0); if (err == SEC_I_CONTINUE_NEEDED || err == SEC_E_OK) { _sslInitialized = true; @@ -377,8 +394,18 @@ SChannel::TransceiverI::sslHandshake() else { err = InitializeSecurityContext( - &_credentials, &_ssl, const_cast(_host.c_str()), flags, 0, 0, &inBufferDesc, 0, 0, - &outBufferDesc, &_ctxFlags, 0); + &_credentials, + &_ssl, + const_cast(_host.c_str()), + flags, + 0, + 0, + &inBufferDesc, + 0, + 0, + &outBufferDesc, + &_ctxFlags, + 0); } // @@ -540,7 +567,9 @@ SChannel::TransceiverI::sslHandshake() if (err != SEC_E_OK) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: failure to query stream sizes attributes:\n" + secStatusToString(err)); + __FILE__, + __LINE__, + "IceSSL: failure to query stream sizes attributes:\n" + secStatusToString(err)); } size_t pos = _readBuffer.i - _readBuffer.b.begin(); @@ -622,7 +651,9 @@ SChannel::TransceiverI::decryptMessage(IceInternal::Buffer& buffer) else if (err != SEC_E_OK) { throw ProtocolException( - __FILE__, __LINE__, "IceSSL: protocol error during read:\n" + secStatusToString(err)); + __FILE__, + __LINE__, + "IceSSL: protocol error during read:\n" + secStatusToString(err)); } SecBuffer* dataBuffer = getSecBufferWithType(inBufferDesc, SECBUFFER_DATA); @@ -640,7 +671,8 @@ SChannel::TransceiverI::decryptMessage(IceInternal::Buffer& buffer) { _readUnprocessed.b.resize(dataBuffer->cbBuffer - remaining); memcpy( - _readUnprocessed.b.begin(), reinterpret_cast(dataBuffer->pvBuffer) + remaining, + _readUnprocessed.b.begin(), + reinterpret_cast(dataBuffer->pvBuffer) + remaining, dataBuffer->cbBuffer - remaining); } } @@ -695,7 +727,9 @@ SChannel::TransceiverI::encryptMessage(IceInternal::Buffer& buffer) if (err != SEC_E_OK) { throw ProtocolException( - __FILE__, __LINE__, "IceSSL: protocol error encrypting message:\n" + secStatusToString(err)); + __FILE__, + __LINE__, + "IceSSL: protocol error encrypting message:\n" + secStatusToString(err)); } // EncryptMessage resizes the buffers, so resize the write buffer as well to reflect this. @@ -732,7 +766,9 @@ SChannel::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal: if (err && err != SEC_E_NO_CREDENTIALS) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: certificate verification failure:\n" + secStatusToString(err)); + __FILE__, + __LINE__, + "IceSSL: certificate verification failure:\n" + secStatusToString(err)); } if (!cert && ((!_incoming && _engine->getVerifyPeer() > 0) || (_incoming && _engine->getVerifyPeer() == 2))) @@ -767,7 +803,14 @@ SChannel::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal: } if (!CertGetCertificateChain( - _engine->chainEngine(), cert, 0, cert->hCertStore, &chainP, dwFlags, 0, &certChain)) + _engine->chainEngine(), + cert, + 0, + cert->hCertStore, + &chainP, + dwFlags, + 0, + &certChain)) { CertFreeCertificateContext(cert); trustError = IceUtilInternal::lastErrorToString(); @@ -794,13 +837,20 @@ SChannel::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal: DWORD length = 0; if (!CryptDecodeObjectEx( - X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, X509_CERT, c->pbCertEncoded, c->cbCertEncoded, - CRYPT_DECODE_ALLOC_FLAG, 0, &cc, &length)) + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + X509_CERT, + c->pbCertEncoded, + c->cbCertEncoded, + CRYPT_DECODE_ALLOC_FLAG, + 0, + &cc, + &length)) { CertFreeCertificateChain(certChain); CertFreeCertificateContext(cert); throw SecurityException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: error decoding peer certificate chain:\n" + IceUtilInternal::lastErrorToString()); } _certs.push_back(SChannel::Certificate::create(cc)); @@ -890,7 +940,8 @@ SChannel::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal: out << toString(); } _delegate->getNativeInfo()->ready( - IceInternal::SocketOperationRead, !_readUnprocessed.b.empty() || _readBuffer.i != _readBuffer.b.begin()); + IceInternal::SocketOperationRead, + !_readUnprocessed.b.empty() || _readBuffer.i != _readBuffer.b.begin()); return IceInternal::SocketOperationNone; } @@ -997,7 +1048,8 @@ SChannel::TransceiverI::read(IceInternal::Buffer& buf) buf.i += decrypted; } _delegate->getNativeInfo()->ready( - IceInternal::SocketOperationRead, !_readUnprocessed.b.empty() || _readBuffer.i != _readBuffer.b.begin()); + IceInternal::SocketOperationRead, + !_readUnprocessed.b.empty() || _readBuffer.i != _readBuffer.b.begin()); return IceInternal::SocketOperationNone; } diff --git a/cpp/src/IceSSL/SSLEngine.cpp b/cpp/src/IceSSL/SSLEngine.cpp index 9c0a878851c..9f3875871a1 100644 --- a/cpp/src/IceSSL/SSLEngine.cpp +++ b/cpp/src/IceSSL/SSLEngine.cpp @@ -130,7 +130,9 @@ IceSSL::SSLEngine::initialize() if (_verifyPeer < 0 || _verifyPeer > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for " + propPrefix + "VerifyPeer"); + __FILE__, + __LINE__, + "IceSSL: invalid value for " + propPrefix + "VerifyPeer"); } _securityTraceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security"); diff --git a/cpp/src/IceSSL/SecureTransportCertificateI.cpp b/cpp/src/IceSSL/SecureTransportCertificateI.cpp index e9d5082f082..ec76a033ba8 100644 --- a/cpp/src/IceSSL/SecureTransportCertificateI.cpp +++ b/cpp/src/IceSSL/SecureTransportCertificateI.cpp @@ -283,8 +283,8 @@ namespace // // Map alternative name alias to its types. // - const char* certificateAlternativeNameTypes[] = {"", "Email Address", "DNS Name", "", "Directory Name", - "", "URI", "IP Address"}; + const char* certificateAlternativeNameTypes[] = + {"", "Email Address", "DNS Name", "", "Directory Name", "", "URI", "IP Address"}; const int certificateAlternativeNameTypesSize = sizeof(certificateAlternativeNameTypes) / sizeof(char*); int certificateAlternativeNameType(const string& alias) @@ -527,13 +527,17 @@ SecureTransportCertificateI::verify(const IceSSL::CertificatePtr& cert) const if (error) { throw CertificateEncodingException( - __FILE__, __LINE__, "certificate error:\n" + sslErrorToString(error.get())); + __FILE__, + __LINE__, + "certificate error:\n" + sslErrorToString(error.get())); } UniqueRef subject(SecCertificateCopyNormalizedSubjectContent(c->getCert(), &error.get())); if (error) { throw CertificateEncodingException( - __FILE__, __LINE__, "certificate error:\n" + sslErrorToString(error.get())); + __FILE__, + __LINE__, + "certificate error:\n" + sslErrorToString(error.get())); } // @@ -921,7 +925,9 @@ IceSSL::SecureTransport::Certificate::decode(const std::string& encoding) return make_shared(cert); #else // macOS UniqueRef data(CFDataCreateWithBytesNoCopy( - kCFAllocatorDefault, reinterpret_cast(encoding.c_str()), static_cast(encoding.size()), + kCFAllocatorDefault, + reinterpret_cast(encoding.c_str()), + static_cast(encoding.size()), kCFAllocatorNull)); SecExternalFormat format = kSecFormatUnknown; diff --git a/cpp/src/IceSSL/SecureTransportEngine.cpp b/cpp/src/IceSSL/SecureTransportEngine.cpp index 8795ef1e4a7..f16d4a3b5ba 100644 --- a/cpp/src/IceSSL/SecureTransportEngine.cpp +++ b/cpp/src/IceSSL/SecureTransportEngine.cpp @@ -817,7 +817,9 @@ IceSSL::SecureTransport::SSLEngine::initialize() if (!checkPath(caFile, defaultDir, false, resolved)) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: CA certificate file not found:\n" + caFile); + __FILE__, + __LINE__, + "IceSSL: CA certificate file not found:\n" + caFile); } _certificateAuthorities.reset(loadCACertificates(resolved)); } @@ -847,7 +849,9 @@ IceSSL::SecureTransport::SSLEngine::initialize() if (!IceUtilInternal::splitString(certFile, IceUtilInternal::pathsep, files) || files.size() > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for IceSSL.CertFile:\n" + certFile); + __FILE__, + __LINE__, + "IceSSL: invalid value for IceSSL.CertFile:\n" + certFile); } vector keyFiles; { @@ -857,12 +861,16 @@ IceSSL::SecureTransport::SSLEngine::initialize() if (!IceUtilInternal::splitString(keyFile, IceUtilInternal::pathsep, keyFiles) || keyFiles.size() > 2) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid value for IceSSL.KeyFile:\n" + keyFile); + __FILE__, + __LINE__, + "IceSSL: invalid value for IceSSL.KeyFile:\n" + keyFile); } if (files.size() != keyFiles.size()) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: IceSSL.KeyFile does not agree with IceSSL.CertFile"); + __FILE__, + __LINE__, + "IceSSL: IceSSL.KeyFile does not agree with IceSSL.CertFile"); } } } @@ -891,7 +899,13 @@ IceSSL::SecureTransport::SSLEngine::initialize() try { _chain.reset(loadCertificateChain( - file, keyFile, keychain, keychainPassword, password, passwordPrompt, passwordRetryMax)); + file, + keyFile, + keychain, + keychainPassword, + password, + passwordPrompt, + passwordRetryMax)); break; } catch (const CertificateReadException& ce) @@ -1044,7 +1058,9 @@ IceSSL::SecureTransport::SSLEngine::newContext(bool incoming) if ((err = SSLSetDiffieHellmanParams(ssl, &_dhParams[0], _dhParams.size()))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: unable to create the trust object:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: unable to create the trust object:\n" + sslErrorToString(err)); } } #endif @@ -1053,7 +1069,9 @@ IceSSL::SecureTransport::SSLEngine::newContext(bool incoming) if (_chain && (err = SSLSetCertificate(ssl, _chain.get()))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error while setting the SSL context certificate:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error while setting the SSL context certificate:\n" + sslErrorToString(err)); } if (!_ciphers.empty()) @@ -1061,15 +1079,21 @@ IceSSL::SecureTransport::SSLEngine::newContext(bool incoming) if ((err = SSLSetEnabledCiphers(ssl, &_ciphers[0], _ciphers.size()))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error while setting ciphers:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error while setting ciphers:\n" + sslErrorToString(err)); } } if ((err = SSLSetSessionOption( - ssl, incoming ? kSSLSessionOptionBreakOnClientAuth : kSSLSessionOptionBreakOnServerAuth, true))) + ssl, + incoming ? kSSLSessionOptionBreakOnClientAuth : kSSLSessionOptionBreakOnServerAuth, + true))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error while setting SSL option:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error while setting SSL option:\n" + sslErrorToString(err)); } if (_protocolVersionMax != kSSLProtocolUnknown) @@ -1077,7 +1101,9 @@ IceSSL::SecureTransport::SSLEngine::newContext(bool incoming) if ((err = SSLSetProtocolVersionMax(ssl, _protocolVersionMax))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error while setting SSL protocol version max:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error while setting SSL protocol version max:\n" + sslErrorToString(err)); } } @@ -1086,7 +1112,9 @@ IceSSL::SecureTransport::SSLEngine::newContext(bool incoming) if ((err = SSLSetProtocolVersionMin(ssl, _protocolVersionMin))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: error while setting SSL protocol version min:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error while setting SSL protocol version min:\n" + sslErrorToString(err)); } } @@ -1121,7 +1149,9 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) if (i != tokens.begin()) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: `ALL' must be first in cipher list `" + ciphers + "'"); + __FILE__, + __LINE__, + "IceSSL: `ALL' must be first in cipher list `" + ciphers + "'"); } allCiphers = true; } @@ -1130,7 +1160,9 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) if (i != tokens.begin()) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: `NONE' must be first in cipher list `" + ciphers + "'"); + __FILE__, + __LINE__, + "IceSSL: `NONE' must be first in cipher list `" + ciphers + "'"); } } else @@ -1146,7 +1178,9 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) else { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid cipher expression `" + token + "'"); + __FILE__, + __LINE__, + "IceSSL: invalid cipher expression `" + token + "'"); } } else @@ -1159,7 +1193,9 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) if (token.rfind(')') != token.size() - 1) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid cipher expression `" + token + "'"); + __FILE__, + __LINE__, + "IceSSL: invalid cipher expression `" + token + "'"); } try @@ -1169,7 +1205,9 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) catch (const Ice::SyscallException&) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid cipher expression `" + token + "'"); + __FILE__, + __LINE__, + "IceSSL: invalid cipher expression `" + token + "'"); } } else @@ -1195,7 +1233,9 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) if (err) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to get supported ciphers list:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: unable to get supported ciphers list:\n" + sslErrorToString(err)); } vector enabled; @@ -1256,7 +1296,8 @@ IceSSL::SecureTransport::SSLEngine::parseCiphers(const string& ciphers) if (_ciphers.empty()) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: invalid value for IceSSL.Ciphers:\n" + ciphers + "\nThe result cipher list does not contain any entries"); } diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp index 8ead9e48b93..df43f578017 100644 --- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp @@ -188,7 +188,9 @@ namespace if (!revocationPolicy) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: handshake failure: error creating revocation policy"); + __FILE__, + __LINE__, + "IceSSL: handshake failure: error creating revocation policy"); } CFArrayAppendValue(policies.get(), revocationPolicy.get()); } @@ -292,13 +294,17 @@ IceSSL::SecureTransport::TransceiverI::initialize(IceInternal::Buffer& readBuffe if ((err = SSLSetIOFuncs(_ssl.get(), socketRead, socketWrite))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: setting IO functions failed\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: setting IO functions failed\n" + sslErrorToString(err)); } if ((err = SSLSetConnection(_ssl.get(), reinterpret_cast(this)))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: setting SSL connection failed\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: setting SSL connection failed\n" + sslErrorToString(err)); } // @@ -309,7 +315,9 @@ IceSSL::SecureTransport::TransceiverI::initialize(IceInternal::Buffer& readBuffe if ((err = SSLSetPeerDomainName(_ssl.get(), _host.data(), _host.length()))) { throw SecurityException( - __FILE__, __LINE__, "IceSSL: setting SNI host failed `" + _host + "'\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: setting SNI host failed `" + _host + "'\n" + sslErrorToString(err)); } } } @@ -655,7 +663,8 @@ IceSSL::SecureTransport::TransceiverI::writeRaw(const char* data, size_t* length try { IceInternal::Buffer buf( - reinterpret_cast(data), reinterpret_cast(data) + *length); + reinterpret_cast(data), + reinterpret_cast(data) + *length); IceInternal::SocketOperation op = _delegate->write(buf); if (op == IceInternal::SocketOperationWrite) { diff --git a/cpp/src/IceSSL/SecureTransportUtil.cpp b/cpp/src/IceSSL/SecureTransportUtil.cpp index 02565188f8a..67e16a664f5 100644 --- a/cpp/src/IceSSL/SecureTransportUtil.cpp +++ b/cpp/src/IceSSL/SecureTransportUtil.cpp @@ -119,7 +119,8 @@ namespace if (CFEqual(label, CFSTR("Certificate Authority"))) { return CFEqual( - static_cast(CFDictionaryGetValue(dict, kSecPropertyKeyValue)), CFSTR("Yes")); + static_cast(CFDictionaryGetValue(dict, kSecPropertyKeyValue)), + CFSTR("Yes")); } } } @@ -218,7 +219,9 @@ namespace if ((err = SecKeychainCopyDefault(&keychain.get()))) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to retrieve default keychain:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: unable to retrieve default keychain:\n" + sslErrorToString(err)); } } else @@ -238,7 +241,8 @@ namespace if ((err = SecKeychainOpen(keychainPath.c_str(), &keychain.get()))) { throw PluginInitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: unable to open keychain: `" + keychainPath + "'\n" + sslErrorToString(err)); } } @@ -252,7 +256,9 @@ namespace SecKeychainUnlock(keychain.get(), static_cast(keychainPassword.size()), pass, pass != 0))) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to unlock keychain:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: unable to unlock keychain:\n" + sslErrorToString(err)); } } else if (err == errSecNoSuchKeychain) @@ -260,17 +266,25 @@ namespace const char* pass = keychainPassword.empty() ? 0 : keychainPassword.c_str(); keychain.reset(0); if ((err = SecKeychainCreate( - keychainPath.c_str(), static_cast(keychainPassword.size()), pass, pass == 0, 0, + keychainPath.c_str(), + static_cast(keychainPassword.size()), + pass, + pass == 0, + 0, &keychain.get()))) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to create keychain:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: unable to create keychain:\n" + sslErrorToString(err)); } } else { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: unable to open keychain:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: unable to open keychain:\n" + sslErrorToString(err)); } // @@ -284,7 +298,9 @@ namespace if ((err = SecKeychainSetSettings(keychain.get(), &settings))) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error setting keychain settings:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error setting keychain settings:\n" + sslErrorToString(err)); } return keychain.release(); @@ -386,7 +402,10 @@ namespace // Add the certificate to the keychain // query.reset(CFDictionaryCreateMutable( - kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + kCFAllocatorDefault, + 0, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks)); CFDictionarySetValue(query.get(), kSecUseKeychain, keychain); CFDictionarySetValue(query.get(), kSecClass, kSecClassCertificate); @@ -476,7 +495,8 @@ namespace if (endpos == string::npos) { throw InitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "IceSSL: certificate " + file + " is not a valid PEM-encoded certificate"); } size = endpos - startpos; @@ -494,12 +514,16 @@ namespace vector data(IceInternal::Base64::decode(string(&buffer[startpos], size))); UniqueRef certdata(CFDataCreate( - kCFAllocatorDefault, reinterpret_cast(&data[0]), static_cast(data.size()))); + kCFAllocatorDefault, + reinterpret_cast(&data[0]), + static_cast(data.size()))); UniqueRef cert(SecCertificateCreateWithData(0, certdata.get())); if (!cert) { throw InitializationException( - __FILE__, __LINE__, "IceSSL: certificate " + file + " is not a valid PEM-encoded certificate"); + __FILE__, + __LINE__, + "IceSSL: certificate " + file + " is not a valid PEM-encoded certificate"); } CFArrayAppendValue(const_cast(certs.get()), cert.get()); first = false; @@ -512,7 +536,9 @@ namespace if (!cert) { throw InitializationException( - __FILE__, __LINE__, "IceSSL: certificate " + file + " is not a valid DER-encoded certificate"); + __FILE__, + __LINE__, + "IceSSL: certificate " + file + " is not a valid DER-encoded certificate"); } CFArrayAppendValue(const_cast(certs.get()), cert.get()); } @@ -765,7 +791,9 @@ IceSSL::SecureTransport::findCertificateChain( } UniqueRef v(CFDataCreate(kCFAllocatorDefault, &buffer[0], static_cast(buffer.size()))); CFDictionarySetValue( - query.get(), field == "SUBJECTKEYID" ? kSecAttrSubjectKeyID : kSecAttrSerialNumber, v.get()); + query.get(), + field == "SUBJECTKEYID" ? kSecAttrSubjectKeyID : kSecAttrSerialNumber, + v.get()); valid = true; } } @@ -780,7 +808,9 @@ IceSSL::SecureTransport::findCertificateChain( if (err != noErr) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: find certificate `" + value + "' failed:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: find certificate `" + value + "' failed:\n" + sslErrorToString(err)); } // @@ -792,14 +822,18 @@ IceSSL::SecureTransport::findCertificateChain( if (err || !trust) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error creating trust object" + (err ? ":\n" + sslErrorToString(err) : "")); + __FILE__, + __LINE__, + "IceSSL: error creating trust object" + (err ? ":\n" + sslErrorToString(err) : "")); } SecTrustResultType trustResult; if ((err = SecTrustEvaluate(trust.get(), &trustResult))) { throw PluginInitializationException( - __FILE__, __LINE__, "IceSSL: error evaluating trust:\n" + sslErrorToString(err)); + __FILE__, + __LINE__, + "IceSSL: error evaluating trust:\n" + sslErrorToString(err)); } CFIndex chainLength = SecTrustGetCertificateCount(trust.get()); diff --git a/cpp/src/IceSSL/TrustManager.cpp b/cpp/src/IceSSL/TrustManager.cpp index 9afa56a6a96..153a3833df1 100644 --- a/cpp/src/IceSSL/TrustManager.cpp +++ b/cpp/src/IceSSL/TrustManager.cpp @@ -49,7 +49,9 @@ TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) : _communic catch (const ParseException& ex) { throw Ice::PluginInitializationException( - __FILE__, __LINE__, "IceSSL: invalid property " + key + ":\n" + ex.reason); + __FILE__, + __LINE__, + "IceSSL: invalid property " + key + ":\n" + ex.reason); } } diff --git a/cpp/src/IceStorm/Grammar.cpp b/cpp/src/IceStorm/Grammar.cpp index 76203016a0f..16c6adb8f4f 100644 --- a/cpp/src/IceStorm/Grammar.cpp +++ b/cpp/src/IceStorm/Grammar.cpp @@ -230,7 +230,7 @@ typedef short int yytype_int16; # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T)-1) +#define YYSIZE_MAXIMUM ((YYSIZE_T) - 1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS @@ -1154,7 +1154,11 @@ yyparse() conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow( - YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1, yysize * sizeof(*yyvsp), + YY_("memory exhausted"), + &yyss1, + yysize * sizeof(*yyssp), + &yyvs1, + yysize * sizeof(*yyvsp), &yystacksize); yyss = yyss1; diff --git a/cpp/src/IceStorm/IceStormDB.cpp b/cpp/src/IceStorm/IceStormDB.cpp index c39eaeb1ff0..47ec6048b41 100644 --- a/cpp/src/IceStorm/IceStormDB.cpp +++ b/cpp/src/IceStorm/IceStormDB.cpp @@ -201,7 +201,10 @@ run(const shared_ptr& communicator, const Ice::StringSeq& arg } IceDB::Dbi lluMap( - txn, "llu", dbContext, MDB_CREATE); + txn, + "llu", + dbContext, + MDB_CREATE); for (IceStormElection::StringLogUpdateDict::const_iterator p = data.llus.begin(); p != data.llus.end(); ++p) @@ -218,9 +221,9 @@ run(const shared_ptr& communicator, const Ice::StringSeq& arg consoleOut << "Writing Subscriber Map:" << endl; } - IceDB::Dbi< - IceStorm::SubscriberRecordKey, IceStorm::SubscriberRecord, IceDB::IceContext, Ice::OutputStream> - subscriberMap(txn, "subscribers", dbContext, MDB_CREATE); + IceDB:: + Dbi + subscriberMap(txn, "subscribers", dbContext, MDB_CREATE); for (const auto& subscriber : data.subscribers) { @@ -250,7 +253,10 @@ run(const shared_ptr& communicator, const Ice::StringSeq& arg } IceDB::Dbi lluMap( - txn, "llu", dbContext, 0); + txn, + "llu", + dbContext, + 0); string s; IceStormElection::LogUpdate llu; @@ -271,14 +277,17 @@ run(const shared_ptr& communicator, const Ice::StringSeq& arg consoleOut << "Reading Subscriber Map:" << endl; } - IceDB::Dbi< - IceStorm::SubscriberRecordKey, IceStorm::SubscriberRecord, IceDB::IceContext, Ice::OutputStream> - subscriberMap(txn, "subscribers", dbContext, 0); + IceDB:: + Dbi + subscriberMap(txn, "subscribers", dbContext, 0); IceStorm::SubscriberRecordKey key; IceStorm::SubscriberRecord record; IceDB::ReadOnlyCursor< - IceStorm::SubscriberRecordKey, IceStorm::SubscriberRecord, IceDB::IceContext, Ice::OutputStream> + IceStorm::SubscriberRecordKey, + IceStorm::SubscriberRecord, + IceDB::IceContext, + Ice::OutputStream> subCursor(subscriberMap, txn); while (subCursor.get(key, record, MDB_NEXT)) { diff --git a/cpp/src/IceStorm/NodeI.cpp b/cpp/src/IceStorm/NodeI.cpp index 023d87ca660..0469b8cbd4e 100644 --- a/cpp/src/IceStorm/NodeI.cpp +++ b/cpp/src/IceStorm/NodeI.cpp @@ -162,7 +162,8 @@ NodeI::start() _checkTask = make_shared(shared_from_this()); _timer->schedule( - _checkTask, chrono::seconds(static_cast(_nodes.size() - static_cast(_id)) * 2)); + _checkTask, + chrono::seconds(static_cast(_nodes.size() - static_cast(_id)) * 2)); recovery(); } diff --git a/cpp/src/IceStorm/Scanner.cpp b/cpp/src/IceStorm/Scanner.cpp index d2546278a1c..1ad31e7e5de 100644 --- a/cpp/src/IceStorm/Scanner.cpp +++ b/cpp/src/IceStorm/Scanner.cpp @@ -121,7 +121,7 @@ typedef unsigned int flex_uint32_t; * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start)-1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) @@ -1032,8 +1032,8 @@ YY_DECL default: YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/cpp/src/IceStorm/Service.cpp b/cpp/src/IceStorm/Service.cpp index 4b01e1ffe44..e6be8155e78 100644 --- a/cpp/src/IceStorm/Service.cpp +++ b/cpp/src/IceStorm/Service.cpp @@ -291,7 +291,13 @@ ServiceI::start(const string& name, const shared_ptr& communicator auto nodeAdapter = communicator->createObjectAdapter(name + ".Node"); auto instance = make_shared( - instanceName, name, communicator, publishAdapter, topicAdapter, nodeAdapter, nodes.at(id)); + instanceName, + name, + communicator, + publishAdapter, + topicAdapter, + nodeAdapter, + nodes.at(id)); _instance = instance; _instance->observers()->setMajority(static_cast(nodes.size()) / 2); diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp index ab05aa82d7f..4b848087925 100644 --- a/cpp/src/IceStorm/Subscriber.cpp +++ b/cpp/src/IceStorm/Subscriber.cpp @@ -168,7 +168,11 @@ SubscriberOneway::flush() auto future = isSent->get_future(); _obj->ice_invokeAsync( - e.op, e.mode, e.data, nullptr, [self](exception_ptr ex) { self->error(true, ex); }, + e.op, + e.mode, + e.data, + nullptr, + [self](exception_ptr ex) { self->error(true, ex); }, [self, isSent](bool sentSynchronously) { isSent->set_value(sentSynchronously); @@ -279,8 +283,13 @@ SubscriberTwoway::flush() { auto self = static_pointer_cast(shared_from_this()); _obj->ice_invokeAsync( - e.op, e.mode, e.data, [self](bool, vector) { self->completed(); }, - [self](exception_ptr ex) { self->error(true, ex); }, nullptr, e.context); + e.op, + e.mode, + e.data, + [self](bool, vector) { self->completed(); }, + [self](exception_ptr ex) { self->error(true, ex); }, + nullptr, + e.context); } catch (const std::exception&) { @@ -351,7 +360,9 @@ namespace auto self = shared_from_this(); _obj->forwardAsync( - v, [self]() { self->completed(); }, [self](exception_ptr ex) { self->error(true, ex); }); + v, + [self]() { self->completed(); }, + [self](exception_ptr ex) { self->error(true, ex); }); } catch (const std::exception&) { @@ -803,7 +814,12 @@ Subscriber::updateObserver() { assert(_rec.obj); _observer.attach(_instance->observer()->getSubscriberObserver( - _instance->serviceName(), _rec.topicName, *_rec.obj, _rec.theQoS, _rec.theTopic, toSubscriberState(_state), + _instance->serviceName(), + _rec.topicName, + *_rec.obj, + _rec.theQoS, + _rec.theTopic, + toSubscriberState(_state), _observer.get())); } } @@ -836,7 +852,12 @@ Subscriber::Subscriber( { assert(_rec.obj); _observer.attach(_instance->observer()->getSubscriberObserver( - _instance->serviceName(), _rec.topicName, *_rec.obj, _rec.theQoS, _rec.theTopic, toSubscriberState(_state), + _instance->serviceName(), + _rec.topicName, + *_rec.obj, + _rec.theQoS, + _rec.theTopic, + toSubscriberState(_state), 0)); } } @@ -879,8 +900,13 @@ Subscriber::setState(Subscriber::SubscriberState state) { assert(_rec.obj); _observer.attach(_instance->observer()->getSubscriberObserver( - _instance->serviceName(), _rec.topicName, *_rec.obj, _rec.theQoS, _rec.theTopic, - toSubscriberState(_state), _observer.get())); + _instance->serviceName(), + _rec.topicName, + *_rec.obj, + _rec.theQoS, + _rec.theTopic, + toSubscriberState(_state), + _observer.get())); } } } diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index e0ecbca35e0..975415f63a7 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -966,7 +966,8 @@ TopicImpl::publish(bool forwarded, const EventDataSeq& events) // node is locked. masterInternal->reapAsync( - reap, nullptr, + reap, + nullptr, [instance = _instance, generation](exception_ptr ex) { auto traceLevels = instance->traceLevels(); diff --git a/cpp/src/IceUtil/ConsoleUtil.cpp b/cpp/src/IceUtil/ConsoleUtil.cpp index 6ea19180299..6e01deba01e 100644 --- a/cpp/src/IceUtil/ConsoleUtil.cpp +++ b/cpp/src/IceUtil/ConsoleUtil.cpp @@ -48,7 +48,8 @@ ConsoleUtil::toConsoleEncoding(const string& message) const // Then from UTF-8 to console CP string consoleString; _consoleConverter->fromUTF8( - reinterpret_cast(u8s.data()), reinterpret_cast(u8s.data() + u8s.size()), + reinterpret_cast(u8s.data()), + reinterpret_cast(u8s.data() + u8s.size()), consoleString); return consoleString; diff --git a/cpp/src/IceUtil/FileUtil.cpp b/cpp/src/IceUtil/FileUtil.cpp index 74cc456966f..8ba377cce8e 100644 --- a/cpp/src/IceUtil/FileUtil.cpp +++ b/cpp/src/IceUtil/FileUtil.cpp @@ -225,7 +225,9 @@ IceUtilInternal::open(const string& path, int flags) if (flags & _O_CREAT) { return ::_wopen( - stringToWstring(path, IceUtil::getProcessStringConverter()).c_str(), flags, _S_IREAD | _S_IWRITE); + stringToWstring(path, IceUtil::getProcessStringConverter()).c_str(), + flags, + _S_IREAD | _S_IWRITE); } else { @@ -276,8 +278,13 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) : _fd(INVALID_HANDL // to Windows API. // _fd = ::CreateFileW( - stringToWstring(path, IceUtil::getProcessStringConverter()).c_str(), GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, nullptr); + stringToWstring(path, IceUtil::getProcessStringConverter()).c_str(), + GENERIC_WRITE, + 0, + nullptr, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + nullptr); _path = path; if (_fd == INVALID_HANDLE_VALUE) diff --git a/cpp/src/IceUtil/Options.cpp b/cpp/src/IceUtil/Options.cpp index e019f569605..8c4f44f823a 100644 --- a/cpp/src/IceUtil/Options.cpp +++ b/cpp/src/IceUtil/Options.cpp @@ -124,7 +124,9 @@ IceUtilInternal::Options::checkArgs(const string& shortOpt, const string& longOp if (!needArg && !dflt.empty()) { throw IllegalArgumentException( - __FILE__, __LINE__, "a default value can be specified only for options requiring an argument"); + __FILE__, + __LINE__, + "a default value can be specified only for options requiring an argument"); } } @@ -428,7 +430,8 @@ IceUtilInternal::Options::split(const string& line) Int64 ull = 0; string::size_type j; for (j = i + 1; - j < i + 3 && j < l.size() && isxdigit(static_cast(c = l[j])); ++j) + j < i + 3 && j < l.size() && isxdigit(static_cast(c = l[j])); + ++j) { ull *= 16; if (isdigit(static_cast(c))) diff --git a/cpp/src/IceUtil/StringConverter.cpp b/cpp/src/IceUtil/StringConverter.cpp index d7a84b7e611..1617dffaba9 100644 --- a/cpp/src/IceUtil/StringConverter.cpp +++ b/cpp/src/IceUtil/StringConverter.cpp @@ -146,8 +146,13 @@ namespace mbstate_t state = mbstate_t(); codecvt_base::result result = _codecvt.in( - state, reinterpret_cast(sourceStart), reinterpret_cast(sourceEnd), - sourceNext, targetStart, targetEnd, targetNext); + state, + reinterpret_cast(sourceStart), + reinterpret_cast(sourceEnd), + sourceNext, + targetStart, + targetEnd, + targetNext); if (result != codecvt_base::ok) { @@ -273,7 +278,8 @@ IceUtil::wstringToString(const wstring& v, const StringConverterPtr& converter, string tmp; converter->fromUTF8( reinterpret_cast(target.data()), - reinterpret_cast(target.data() + target.size()), tmp); + reinterpret_cast(target.data() + target.size()), + tmp); tmp.swap(target); } } @@ -308,7 +314,8 @@ IceUtil::stringToWstring(const string& v, const StringConverterPtr& converter, c // Convert from UTF-8 to the wide string encoding // wConverterWithDefault->fromUTF8( - reinterpret_cast(tmp.data()), reinterpret_cast(tmp.data() + tmp.size()), + reinterpret_cast(tmp.data()), + reinterpret_cast(tmp.data() + tmp.size()), target); } return target; @@ -337,7 +344,9 @@ IceUtil::UTF8ToNative(const string& str, const IceUtil::StringConverterPtr& conv } string tmp; converter->fromUTF8( - reinterpret_cast(str.data()), reinterpret_cast(str.data() + str.size()), tmp); + reinterpret_cast(str.data()), + reinterpret_cast(str.data() + str.size()), + tmp); return tmp; } @@ -421,7 +430,8 @@ IceUtilInternal::fromUTF32(const vector& source) reinterpret_cast(&source.front() + source.size())); result = vector( - reinterpret_cast(bs.data()), reinterpret_cast(bs.data()) + bs.length()); + reinterpret_cast(bs.data()), + reinterpret_cast(bs.data()) + bs.length()); } catch (const std::range_error& ex) { @@ -480,7 +490,11 @@ namespace { wbuffer.resize(wbuffer.size() == 0 ? sourceSize + 2 : 2 * wbuffer.size()); writtenWchar = MultiByteToWideChar( - _cp, flags, sourceStart, sourceSize, const_cast(wbuffer.data()), + _cp, + flags, + sourceStart, + sourceSize, + const_cast(wbuffer.data()), static_cast(wbuffer.size())); } while (writtenWchar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER); @@ -534,8 +548,14 @@ namespace writtenChar == -1 ? std::max(sourceEnd - sourceStart + 2, target.size()) : 2 * target.size()); writtenChar = WideCharToMultiByte( - _cp, flags, wtarget.data(), static_cast(wtarget.size()), const_cast(target.data()), - static_cast(target.size()), 0, 0); + _cp, + flags, + wtarget.data(), + static_cast(wtarget.size()), + const_cast(target.data()), + static_cast(target.size()), + 0, + 0); } while (writtenChar == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER); if (writtenChar == 0) diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index d6815d28f82..17a75a1b1de 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -293,7 +293,9 @@ namespace if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { throw IllegalArgumentException( - __FILE__, __LINE__, "A universal character name cannot designate a surrogate"); + __FILE__, + __LINE__, + "A universal character name cannot designate a surrogate"); } if (codePoint <= 0x7F) @@ -447,7 +449,9 @@ namespace if (size > 0) { throw IllegalArgumentException( - __FILE__, __LINE__, "Invalid universal character name: too few hex digits"); + __FILE__, + __LINE__, + "Invalid universal character name: too few hex digits"); } appendUTF8(codePoint, result); @@ -811,8 +815,12 @@ IceUtilInternal::errorToString(int error, LPCVOID source) DWORD stored = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | (source != nullptr ? FORMAT_MESSAGE_FROM_HMODULE : 0), - source, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - reinterpret_cast(&msg), 0, nullptr); + source, + error, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + reinterpret_cast(&msg), + 0, + nullptr); if (stored > 0) { diff --git a/cpp/src/IceXML/Parser.cpp b/cpp/src/IceXML/Parser.cpp index 6e3dbeddd35..b0d968b331d 100644 --- a/cpp/src/IceXML/Parser.cpp +++ b/cpp/src/IceXML/Parser.cpp @@ -391,7 +391,8 @@ IceXML::Parser::parse(istream& in, Handler& handler) if (XML_Parse(parser, buff, static_cast(in.gcount()), isFinal) != 1) { handler.error( - XML_ErrorString(XML_GetErrorCode(parser)), static_cast(XML_GetCurrentLineNumber(parser)), + XML_ErrorString(XML_GetErrorCode(parser)), + static_cast(XML_GetCurrentLineNumber(parser)), static_cast(XML_GetCurrentColumnNumber(parser))); return; } diff --git a/cpp/src/Slice/Grammar.cpp b/cpp/src/Slice/Grammar.cpp index 9692698c8e0..66bf115f245 100644 --- a/cpp/src/Slice/Grammar.cpp +++ b/cpp/src/Slice/Grammar.cpp @@ -1244,7 +1244,9 @@ yy_reduce_print(yy_state_t* yyssp, YYSTYPE* yyvsp, YYLTYPE* yylsp, int yyrule) { YYFPRINTF(stderr, " $%d = ", yyi + 1); yy_symbol_print( - stderr, YY_ACCESSING_SYMBOL(+yyssp[yyi + 1 - yynrhs]), &yyvsp[(yyi + 1) - (yynrhs)], + stderr, + YY_ACCESSING_SYMBOL(+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)], &(yylsp[(yyi + 1) - (yynrhs)])); YYFPRINTF(stderr, "\n"); } @@ -1420,8 +1422,14 @@ yyparse(void) conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow( - YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF(*yyssp), &yyvs1, yysize * YYSIZEOF(*yyvsp), &yyls1, - yysize * YYSIZEOF(*yylsp), &yystacksize); + YY_("memory exhausted"), + &yyss1, + yysize * YYSIZEOF(*yyssp), + &yyvs1, + yysize * YYSIZEOF(*yyvsp), + &yyls1, + yysize * YYSIZEOF(*yylsp), + &yystacksize); yyss = yyss1; yyvs = yyvs1; yyls = yyls1; @@ -1991,8 +1999,9 @@ yyparse(void) cl.push_back(enumerators.front()); scoped->v = enumerators.front()->scoped(); currentUnit->warning( - Deprecated, string("referencing enumerator `") + scoped->v + - "' without its enumeration's scope is deprecated"); + Deprecated, + string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); } else if (enumerators.size() > 1) { @@ -2116,8 +2125,9 @@ yyparse(void) cl.push_back(enumerators.front()); scoped->v = enumerators.front()->scoped(); currentUnit->warning( - Deprecated, string("referencing enumerator `") + scoped->v + - "' without its enumeration's scope is deprecated"); + Deprecated, + string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); } else if (enumerators.size() > 1) { @@ -2374,8 +2384,9 @@ yyparse(void) cl.push_back(enumerators.front()); scoped->v = enumerators.front()->scoped(); currentUnit->warning( - Deprecated, string("referencing enumerator `") + scoped->v + - "' without its enumeration's scope is deprecated"); + Deprecated, + string("referencing enumerator `") + scoped->v + + "' without its enumeration's scope is deprecated"); } else if (enumerators.size() > 1) { @@ -2649,7 +2660,12 @@ yyparse(void) if (cl) { dm = cl->createDataMember( - def->name, def->type, def->isTagged, def->tag, value->v, value->valueAsString, + def->name, + def->type, + def->isTagged, + def->tag, + value->v, + value->valueAsString, value->valueAsLiteral); } auto st = dynamic_pointer_cast(currentUnit->currentContainer()); @@ -2663,14 +2679,25 @@ yyparse(void) else { dm = st->createDataMember( - def->name, def->type, false, -1, value->v, value->valueAsString, value->valueAsLiteral); + def->name, + def->type, + false, + -1, + value->v, + value->valueAsString, + value->valueAsLiteral); } } auto ex = dynamic_pointer_cast(currentUnit->currentContainer()); if (ex) { dm = ex->createDataMember( - def->name, def->type, def->isTagged, def->tag, value->v, value->valueAsString, + def->name, + def->type, + def->isTagged, + def->tag, + value->v, + value->valueAsString, value->valueAsLiteral); } currentUnit->currentContainer()->checkIntroduced(def->name, dm); @@ -2807,7 +2834,11 @@ yyparse(void) if (interface) { OperationPtr op = interface->createOperation( - name, returnType->type, returnType->isTagged, returnType->tag, Operation::Idempotent); + name, + returnType->type, + returnType->isTagged, + returnType->tag, + Operation::Idempotent); if (op) { @@ -2866,7 +2897,11 @@ yyparse(void) if (interface) { OperationPtr op = interface->createOperation( - name, returnType->type, returnType->isTagged, returnType->tag, Operation::Idempotent); + name, + returnType->type, + returnType->isTagged, + returnType->tag, + Operation::Idempotent); if (op) { currentUnit->pushContainer(op); @@ -3918,7 +3953,12 @@ yyparse(void) auto ident = dynamic_pointer_cast(yyvsp[-2]); auto value = dynamic_pointer_cast(yyvsp[0]); yyval = currentUnit->currentContainer()->createConst( - ident->v, const_type, metaData->v, value->v, value->valueAsString, value->valueAsLiteral); + ident->v, + const_type, + metaData->v, + value->v, + value->valueAsString, + value->valueAsLiteral); } #line 4074 "src/Slice/Grammar.cpp" break; @@ -3931,7 +3971,12 @@ yyparse(void) auto value = dynamic_pointer_cast(yyvsp[0]); currentUnit->error("missing constant name"); yyval = currentUnit->currentContainer()->createConst( - IceUtil::generateUUID(), const_type, metaData->v, value->v, value->valueAsString, value->valueAsLiteral, + IceUtil::generateUUID(), + const_type, + metaData->v, + value->v, + value->valueAsString, + value->valueAsLiteral, Dummy); // Dummy } #line 4087 "src/Slice/Grammar.cpp" diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 49acdf532d4..b8249b7b520 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1567,7 +1567,12 @@ Slice::Container::createDictionary( } DictionaryPtr p = make_shared( - dynamic_pointer_cast(shared_from_this()), name, keyType, keyMetaData, valueType, valueMetaData); + dynamic_pointer_cast(shared_from_this()), + name, + keyType, + keyMetaData, + valueType, + valueMetaData); p->init(); _contents.push_back(p); return p; @@ -1679,7 +1684,12 @@ Slice::Container::createConst( } ConstPtr p = make_shared( - dynamic_pointer_cast(shared_from_this()), name, constType, metaData, resolvedValueType, value, + dynamic_pointer_cast(shared_from_this()), + name, + constType, + metaData, + resolvedValueType, + value, literal); p->init(); _contents.push_back(p); @@ -3060,8 +3070,8 @@ Slice::ClassDef::createDataMember( } _hasDataMembers = true; - DataMemberPtr member = make_shared( - dynamic_pointer_cast(shared_from_this()), name, type, optional, tag, dlt, dv, dl); + DataMemberPtr member = make_shared< + DataMember>(dynamic_pointer_cast(shared_from_this()), name, type, optional, tag, dlt, dv, dl); member->init(); _contents.push_back(member); return member; @@ -3373,8 +3383,9 @@ Slice::InterfaceDecl::isInList(const GraphPartitionList& gpl, const InterfaceDef for (const auto& i : gpl) { if (find_if( - i.begin(), i.end(), [scope = cdp->scoped()](const auto& other) { return other->scoped() == scope; }) != - i.end()) + i.begin(), + i.end(), + [scope = cdp->scoped()](const auto& other) { return other->scoped() == scope; }) != i.end()) { return true; } @@ -3562,8 +3573,8 @@ Slice::InterfaceDef::createOperation( if (baseName == newName2) { ostringstream os; - os << "operation `" << name << "' differs only in capitalization from operation" - << " `" << op->name() << "', which is defined in a base interface"; + os << "operation `" << name << "' differs only in capitalization from operation" << " `" << op->name() + << "', which is defined in a base interface"; _unit->error(os.str()); return nullptr; } @@ -3572,7 +3583,12 @@ Slice::InterfaceDef::createOperation( _hasOperations = true; OperationPtr op = make_shared( - dynamic_pointer_cast(shared_from_this()), name, returnType, tagged, tag, mode); + dynamic_pointer_cast(shared_from_this()), + name, + returnType, + tagged, + tag, + mode); op->init(); _contents.push_back(op); return op; @@ -3628,7 +3644,8 @@ Slice::InterfaceDef::allOperations() const for (const auto& q : p->allOperations()) { if (find_if( - result.begin(), result.end(), + result.begin(), + result.end(), [scoped = q->scoped()](const auto& other) { return other->scoped() == scoped; }) == result.end()) { result.push_back(q); @@ -3639,7 +3656,8 @@ Slice::InterfaceDef::allOperations() const for (const auto& q : operations()) { if (find_if( - result.begin(), result.end(), + result.begin(), + result.end(), [scoped = q->scoped()](const auto& other) { return other->scoped() == scoped; }) == result.end()) { result.push_back(q); @@ -3833,8 +3851,8 @@ Slice::Exception::createDataMember( } } - DataMemberPtr p = make_shared( - dynamic_pointer_cast(shared_from_this()), name, type, optional, tag, dlt, dv, dl); + DataMemberPtr p = make_shared< + DataMember>(dynamic_pointer_cast(shared_from_this()), name, type, optional, tag, dlt, dv, dl); p->init(); _contents.push_back(p); return p; @@ -4093,8 +4111,8 @@ Slice::Struct::createDataMember( } } - DataMemberPtr p = make_shared( - dynamic_pointer_cast(shared_from_this()), name, type, optional, tag, dlt, dv, dl); + DataMemberPtr p = make_shared< + DataMember>(dynamic_pointer_cast(shared_from_this()), name, type, optional, tag, dlt, dv, dl); p->init(); _contents.push_back(p); return p; @@ -4864,7 +4882,12 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool } ParamDeclPtr p = make_shared( - dynamic_pointer_cast(shared_from_this()), name, type, isOutParam, optional, tag); + dynamic_pointer_cast(shared_from_this()), + name, + type, + isOutParam, + optional, + tag); p->init(); _contents.push_back(p); return p; @@ -4972,7 +4995,11 @@ Slice::Operation::setExceptionList(const ExceptionList& el) tmp.sort(containedCompare); ExceptionList duplicates; set_difference( - tmp.begin(), tmp.end(), uniqueExceptions.begin(), uniqueExceptions.end(), back_inserter(duplicates), + tmp.begin(), + tmp.end(), + uniqueExceptions.begin(), + uniqueExceptions.end(), + back_inserter(duplicates), containedCompare); ostringstream os; os << "operation `" << name() << "' has a throws clause with "; diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index ac478f9569a..c1683d0ab4e 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -387,8 +387,8 @@ namespace Slice std::string kindAsString() const; static std::optional kindFromString(std::string_view); - inline static const std::array builtinTable = { - "byte", "bool", "short", "int", "long", "float", "double", "string", "Object", "Object*", "Value"}; + inline static const std::array builtinTable = + {"byte", "bool", "short", "int", "long", "float", "double", "string", "Object", "Object*", "Value"}; protected: friend class Unit; diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index 59ce49ea09f..68acc248f9d 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -445,7 +445,7 @@ typedef unsigned int flex_uint32_t; * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start)-1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) @@ -1566,7 +1566,8 @@ YY_DECL #line 248 "src/Slice/Scanner.l" { currentUnit->warning( - All, "unknown escape sequence in string literal: `" + string(yytext) + "'"); + All, + "unknown escape sequence in string literal: `" + string(yytext) + "'"); StringTokPtr str = dynamic_pointer_cast(*yylval); // Escape the entire sequence. @@ -2119,8 +2120,8 @@ YY_DECL default: YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* %ok-for-header */ diff --git a/cpp/src/Slice/SliceUtil.cpp b/cpp/src/Slice/SliceUtil.cpp index 8d6d20dba59..530c9ceec4d 100644 --- a/cpp/src/Slice/SliceUtil.cpp +++ b/cpp/src/Slice/SliceUtil.cpp @@ -362,11 +362,9 @@ Slice::printGeneratedHeader(IceUtilInternal::Output& out, const string& path, co out << comment << " \n"; out << comment << "\n"; - out << comment << " Generated from file `" << file << "'" - << "\n"; + out << comment << " Generated from file `" << file << "'" << "\n"; out << comment << "\n"; - out << comment << " Warning: do not edit this file." - << "\n"; + out << comment << " Warning: do not edit this file." << "\n"; out << comment << "\n"; out << comment << " \n"; out << comment << "\n"; diff --git a/cpp/src/ice2slice/Main.cpp b/cpp/src/ice2slice/Main.cpp index df78cc9c495..02a89ac737c 100644 --- a/cpp/src/ice2slice/Main.cpp +++ b/cpp/src/ice2slice/Main.cpp @@ -247,8 +247,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/icegriddb/IceGridDB.cpp b/cpp/src/icegriddb/IceGridDB.cpp index 3b1a0846f42..b5f5d14f6fa 100644 --- a/cpp/src/icegriddb/IceGridDB.cpp +++ b/cpp/src/icegriddb/IceGridDB.cpp @@ -292,10 +292,14 @@ run(const Ice::StringSeq& args) } IceDB::Dbi apps( - txn, "applications", dbContext, MDB_CREATE); + txn, + "applications", + dbContext, + MDB_CREATE); for (IceGrid::ApplicationInfoSeq::const_iterator p = data.applications.begin(); - p != data.applications.end(); ++p) + p != data.applications.end(); + ++p) { if (debug) { @@ -310,7 +314,10 @@ run(const Ice::StringSeq& args) } IceDB::Dbi adpts( - txn, "adapters", dbContext, MDB_CREATE); + txn, + "adapters", + dbContext, + MDB_CREATE); for (IceGrid::AdapterInfoSeq::const_iterator p = data.adapters.begin(); p != data.adapters.end(); ++p) { @@ -327,7 +334,10 @@ run(const Ice::StringSeq& args) } IceDB::Dbi objs( - txn, "objects", dbContext, MDB_CREATE); + txn, + "objects", + dbContext, + MDB_CREATE); for (IceGrid::ObjectInfoSeq::const_iterator p = data.objects.begin(); p != data.objects.end(); ++p) { @@ -345,10 +355,14 @@ run(const Ice::StringSeq& args) } IceDB::Dbi internalObjs( - txn, "internal-objects", dbContext, MDB_CREATE); + txn, + "internal-objects", + dbContext, + MDB_CREATE); for (IceGrid::ObjectInfoSeq::const_iterator p = data.internalObjects.begin(); - p != data.internalObjects.end(); ++p) + p != data.internalObjects.end(); + ++p) { if (debug) { @@ -364,7 +378,10 @@ run(const Ice::StringSeq& args) } IceDB::Dbi srls( - txn, "serials", dbContext, MDB_CREATE); + txn, + "serials", + dbContext, + MDB_CREATE); for (IceGrid::StringLongDict::const_iterator p = data.serials.begin(); p != data.serials.end(); ++p) { @@ -393,12 +410,16 @@ run(const Ice::StringSeq& args) } IceDB::Dbi applications( - txn, "applications", dbContext, 0); + txn, + "applications", + dbContext, + 0); string name; IceGrid::ApplicationInfo application; IceDB::ReadOnlyCursor appCursor( - applications, txn); + applications, + txn); while (appCursor.get(name, application, MDB_NEXT)) { if (debug) @@ -415,11 +436,15 @@ run(const Ice::StringSeq& args) } IceDB::Dbi adapters( - txn, "adapters", dbContext, 0); + txn, + "adapters", + dbContext, + 0); IceGrid::AdapterInfo adapter; IceDB::ReadOnlyCursor adapterCursor( - adapters, txn); + adapters, + txn); while (adapterCursor.get(name, adapter, MDB_NEXT)) { if (debug) @@ -436,7 +461,10 @@ run(const Ice::StringSeq& args) } IceDB::Dbi objects( - txn, "objects", dbContext, 0); + txn, + "objects", + dbContext, + 0); Ice::Identity id; IceGrid::ObjectInfo object; @@ -458,7 +486,10 @@ run(const Ice::StringSeq& args) } IceDB::Dbi internalObjects( - txn, "internal-objects", dbContext, 0); + txn, + "internal-objects", + dbContext, + 0); IceDB::ReadOnlyCursor iobjCursor(internalObjects, txn); diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp index ddff9875790..5bb84678602 100644 --- a/cpp/src/iceserviceinstall/ServiceInstaller.cpp +++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp @@ -98,13 +98,15 @@ IceServiceInstaller::install(const PropertiesPtr& properties) "Glacier2 router (" + _glacier2InstanceName + ")"}; const string defaultDescription[] = { - "Location and deployment service for Ice applications", "Starts and monitors Ice servers", + "Location and deployment service for Ice applications", + "Starts and monitors Ice servers", "Ice Firewall traversal service"}; string displayName = properties->getPropertyWithDefault("DisplayName", defaultDisplayName[_serviceType]); string description = properties->getPropertyWithDefault("Description", defaultDescription[_serviceType]); string imagePath = fixDirSeparator(properties->getPropertyWithDefault( - "ImagePath", getServiceInstallerPath() + '\\' + serviceTypeToLowerString(_serviceType) + ".exe")); + "ImagePath", + getServiceInstallerPath() + '\\' + serviceTypeToLowerString(_serviceType) + ".exe")); if (!IceUtilInternal::fileExists(imagePath)) { throw runtime_error(imagePath + ": not found"); @@ -257,9 +259,18 @@ IceServiceInstaller::install(const PropertiesPtr& properties) // use string converters in calls to stringToWstring. // SC_HANDLE service = CreateServiceW( - scm, stringToWstring(_serviceName).c_str(), stringToWstring(displayName).c_str(), SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS, autoStart ? SERVICE_AUTO_START : SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, - stringToWstring(command).c_str(), 0, 0, stringToWstring(deps).c_str(), stringToWstring(_sidName).c_str(), + scm, + stringToWstring(_serviceName).c_str(), + stringToWstring(displayName).c_str(), + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + autoStart ? SERVICE_AUTO_START : SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + stringToWstring(command).c_str(), + 0, + 0, + stringToWstring(deps).c_str(), + stringToWstring(_sidName).c_str(), stringToWstring(password).c_str()); if (service == 0) @@ -366,8 +377,16 @@ IceServiceInstaller::uninstall() vector IceServiceInstaller::getPropertyNames() { - static const string propertyNames[] = {"ImagePath", "DisplayName", "ObjectName", "Password", "Description", - "DependOnRegistry", "Debug", "AutoStart", "EventLog"}; + static const string propertyNames[] = { + "ImagePath", + "DisplayName", + "ObjectName", + "Password", + "Description", + "DependOnRegistry", + "Debug", + "AutoStart", + "EventLog"}; vector result(propertyNames, propertyNames + 9); @@ -434,8 +453,13 @@ IceServiceInstaller::initializeSid(const string& name) // SID_NAME_USE nameUse; while (LookupAccountNameW( - 0, stringToWstring(name).c_str(), _sidBuffer.data(), &sidSize, - const_cast(domainName.data()), &domainNameSize, &nameUse) == false) + 0, + stringToWstring(name).c_str(), + _sidBuffer.data(), + &sidSize, + const_cast(domainName.data()), + &domainNameSize, + &nameUse) == false) { DWORD res = GetLastError(); @@ -616,7 +640,13 @@ IceServiceInstaller::grantPermissions(const string& path, SE_OBJECT_TYPE type, b } res = SetNamedSecurityInfoW( - const_cast(stringToWstring(path).c_str()), type, DACL_SECURITY_INFORMATION, 0, 0, newAcl, 0); + const_cast(stringToWstring(path).c_str()), + type, + DACL_SECURITY_INFORMATION, + 0, + 0, + newAcl, + 0); if (res != ERROR_SUCCESS) { throw runtime_error( @@ -693,8 +723,15 @@ IceServiceInstaller::addLog(const string& log) const // use string converters in calls to stringToWstring. // LONG res = RegCreateKeyExW( - HKEY_LOCAL_MACHINE, stringToWstring(createLog(log)).c_str(), 0, const_cast(L"REG_SZ"), - REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &key, &disposition); + HKEY_LOCAL_MACHINE, + stringToWstring(createLog(log)).c_str(), + 0, + const_cast(L"REG_SZ"), + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + 0, + &key, + &disposition); if (res != ERROR_SUCCESS) { @@ -737,8 +774,15 @@ IceServiceInstaller::addSource(const string& source, const string& log, const st HKEY key = 0; DWORD disposition = 0; LONG res = RegCreateKeyExW( - HKEY_LOCAL_MACHINE, stringToWstring(createSource(source, log)).c_str(), 0, const_cast(L"REG_SZ"), - REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &key, &disposition); + HKEY_LOCAL_MACHINE, + stringToWstring(createSource(source, log)).c_str(), + 0, + const_cast(L"REG_SZ"), + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + 0, + &key, + &disposition); if (res != ERROR_SUCCESS) { throw runtime_error("Could not create Event Log source in registry: " + IceUtilInternal::errorToString(res)); @@ -750,7 +794,10 @@ IceServiceInstaller::addSource(const string& source, const string& log, const st // DLL. // res = RegSetValueExW( - key, L"EventMessageFile", 0, REG_EXPAND_SZ, + key, + L"EventMessageFile", + 0, + REG_EXPAND_SZ, reinterpret_cast(stringToWstring(resourceFile).c_str()), static_cast(resourceFile.length() + 1) * sizeof(wchar_t)); @@ -762,7 +809,12 @@ IceServiceInstaller::addSource(const string& source, const string& log, const st // DWORD typesSupported = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; res = RegSetValueExW( - key, L"TypesSupported", 0, REG_DWORD, reinterpret_cast(&typesSupported), sizeof(typesSupported)); + key, + L"TypesSupported", + 0, + REG_DWORD, + reinterpret_cast(&typesSupported), + sizeof(typesSupported)); } if (res != ERROR_SUCCESS) @@ -788,7 +840,11 @@ IceServiceInstaller::removeSource(const string& source) const HKEY key = 0; LONG res = RegOpenKeyExW( - HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog", 0, KEY_ENUMERATE_SUB_KEYS, &key); + HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Services\\EventLog", + 0, + KEY_ENUMERATE_SUB_KEYS, + &key); if (res != ERROR_SUCCESS) { @@ -812,7 +868,8 @@ IceServiceInstaller::removeSource(const string& source) const // use string converters in calls to stringToWstring. // LONG delRes = RegDeleteKeyW( - HKEY_LOCAL_MACHINE, stringToWstring(createSource(source, wstringToString(subkey))).c_str()); + HKEY_LOCAL_MACHINE, + stringToWstring(createSource(source, wstringToString(subkey))).c_str()); if (delRes == ERROR_SUCCESS) { res = RegCloseKey(key); diff --git a/cpp/src/slice2cpp/CPlusPlusUtil.cpp b/cpp/src/slice2cpp/CPlusPlusUtil.cpp index 40d14d76e57..1ce9731888c 100644 --- a/cpp/src/slice2cpp/CPlusPlusUtil.cpp +++ b/cpp/src/slice2cpp/CPlusPlusUtil.cpp @@ -50,7 +50,10 @@ namespace { BuiltinPtr builtin = dynamic_pointer_cast(seq->type()); string s = typeToString( - seq->type(), false, scope, seq->typeMetaData(), + seq->type(), + false, + scope, + seq->typeMetaData(), typeCtx | (inWstringModule(seq) ? TypeContext::UseWstring : TypeContext::None)); return "::std::pair"; } @@ -657,14 +660,25 @@ Slice::writeAllocateCode( for (ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p) { writeParamAllocateCode( - out, (*p)->type(), (*p)->optional(), clScope, fixKwd(paramPrefix + (*p)->name()), (*p)->getMetaData(), + out, + (*p)->type(), + (*p)->optional(), + clScope, + fixKwd(paramPrefix + (*p)->name()), + (*p)->getMetaData(), typeCtx); } if (op && op->returnType()) { writeParamAllocateCode( - out, op->returnType(), op->returnIsOptional(), clScope, "ret", op->getMetaData(), typeCtx); + out, + op->returnType(), + op->returnIsOptional(), + clScope, + "ret", + op->getMetaData(), + typeCtx); } } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 48a84d4930c..30fcbb24268 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1065,7 +1065,9 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p) if (s.find("cpp:type:") == 0 || s.find("cpp:view-type:") == 0 || s == "cpp:array") { dc->warning( - InvalidMetaData, p->file(), p->line(), + InvalidMetaData, + p->file(), + p->line(), "ignoring invalid metadata `" + s + "' for operation with void return type"); metaData.remove(s); } @@ -1435,8 +1437,7 @@ Slice::Gen::DefaultFactoryVisitor::visitClassDefStart(const ClassDefPtr& p) C << sp; C << nl << "const ::IceInternal::DefaultValueFactoryInit<" << fixKwd(p->scoped()) << "> "; - C << "iceC" + p->flattenedScope() + p->name() + "_init" - << "(\"" << p->scoped() << "\");"; + C << "iceC" + p->flattenedScope() + p->name() + "_init" << "(\"" << p->scoped() << "\");"; if (p->compactId() >= 0) { @@ -1452,8 +1453,7 @@ Slice::Gen::DefaultFactoryVisitor::visitExceptionStart(const ExceptionPtr& p) { C << sp; C << nl << "const ::IceInternal::DefaultUserExceptionFactoryInit<" << fixKwd(p->scoped()) << "> "; - C << "iceC" + p->flattenedScope() + p->name() + "_init" - << "(\"" << p->scoped() << "\");"; + C << "iceC" + p->flattenedScope() + p->name() + "_init" << "(\"" << p->scoped() << "\");"; return false; } @@ -1733,8 +1733,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) // We call makePromiseOutgoing with the "sync" parameter set to true; the Promise/future implementation later on // calls makePromiseOutgoing with this parameter set to false. This parameter is useful for collocated calls. C << "::IceInternal::makePromiseOutgoing<" << futureT << ">"; - C << spar << "true, this" - << "&" + interface->name() + "Prx::_iceI_" + name; + C << spar << "true, this" << "&" + interface->name() + "Prx::_iceI_" + name; C << inParamsImpl; C << "context" << epar << ".get();"; if (futureOutParams.size() > 1) @@ -1836,10 +1835,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "return ::IceInternal::makeLambdaOutgoing<" << lambdaT << ">" << spar; - C << "std::move(" + (lambdaOutParams.size() > 1 ? string("responseCb") : "response") + ")" - << "std::move(ex)" - << "std::move(sent)" - << "this"; + C << "std::move(" + (lambdaOutParams.size() > 1 ? string("responseCb") : "response") + ")" << "std::move(ex)" + << "std::move(sent)" << "this"; C << string("&" + getUnqualified(scoped, interfaceScope.substr(2)) + lambdaImplPrefix + name); C << inParamsImpl; C << "context" << epar << ";"; @@ -2165,8 +2162,7 @@ Slice::Gen::DataDefVisitor::visitExceptionStart(const ExceptionPtr& p) H.inc(); if (base || !baseDataMembers.empty()) { - H << nl << helperClass << "<" << templateParameters << ">" - << "("; + H << nl << helperClass << "<" << templateParameters << ">" << "("; for (DataMemberList::const_iterator q = baseDataMembers.begin(); q != baseDataMembers.end(); ++q) { @@ -2747,7 +2743,10 @@ Slice::Gen::InterfaceVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) { StringList allOpNames; transform( - allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const ContainedPtr& it) { return it->name(); }); + allOps.begin(), + allOps.end(), + back_inserter(allOpNames), + [](const ContainedPtr& it) { return it->name(); }); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -2779,8 +2778,7 @@ Slice::Gen::InterfaceVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) C << sp; C << nl << "const ::Ice::Current& current = incoming.current();"; C << nl << "::std::pair r = " - << "::std::equal_range(allOperations, allOperations" - << " + " << allOpNames.size() << ", current.operation);"; + << "::std::equal_range(allOperations, allOperations" << " + " << allOpNames.size() << ", current.operation);"; C << nl << "if(r.first == r.second)"; C << sb; C << nl << "throw " << getUnqualified("::Ice::OperationNotExistException", scope) @@ -2881,7 +2879,10 @@ Slice::Gen::InterfaceVisitor::visitOperation(const OperationPtr& p) { params.push_back( typeToString( - type, (*q)->optional(), interfaceScope, (*q)->getMetaData(), + type, + (*q)->optional(), + interfaceScope, + (*q)->getMetaData(), _useWstring | TypeContext::UnmarshalParamZeroCopy) + " " + paramName); args.push_back(condMove(isMovable(type), paramPrefix + (*q)->name())); diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index dd1455c9fe0..47756131fca 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -226,8 +226,12 @@ compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::CPlusPlus : Preprocessor::SliceXML, includePaths, "-D__SLICE2CPP__", - sourceExtension, ext)) + os, + depend ? Preprocessor::CPlusPlus : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2CPP__", + sourceExtension, + ext)) { return EXIT_FAILURE; } @@ -282,8 +286,14 @@ compile(const vector& argv) try { Gen gen( - icecpp->getBaseName(), headerExtension, sourceExtension, extraHeaders, include, - includePaths, dllExport, output); + icecpp->getBaseName(), + headerExtension, + sourceExtension, + extraHeaders, + include, + includePaths, + dllExport, + output); gen.generate(u); } catch (const Slice::FileException& ex) @@ -344,8 +354,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index 345a3f6ac80..d03c7495edd 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -42,7 +42,10 @@ namespace "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while"}; bool found = binary_search( - &keywordList[0], &keywordList[sizeof(keywordList) / sizeof(*keywordList)], name, Slice::CICompare()); + &keywordList[0], + &keywordList[sizeof(keywordList) / sizeof(*keywordList)], + name, + Slice::CICompare()); if (found) { return "@" + name; @@ -334,8 +337,18 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& package, boo return getUnqualified("Ice.Optional", package) + "<" + typeToString(type, package, false) + ">"; } - static const char* builtinTable[] = {"byte", "bool", "short", "int", "long", "float", - "double", "string", "Ice.Object", "Ice.ObjectPrx", "Ice.Value"}; + static const char* builtinTable[] = { + "byte", + "bool", + "short", + "int", + "long", + "float", + "double", + "string", + "Ice.Object", + "Ice.ObjectPrx", + "Ice.Value"}; BuiltinPtr builtin = dynamic_pointer_cast(type); if (builtin) @@ -1385,8 +1398,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode( else if (isCustom) { out << sb; - out << nl << param << " = new " - << "global::" << genericType << "<" << typeToString(type, scope) << ">();"; + out << nl << param << " = new " << "global::" << genericType << "<" << typeToString(type, scope) + << ">();"; out << nl << "int szx = " << stream << ".readSize();"; out << nl << "for(int ix = 0; ix < szx; ++ix)"; out << sb; diff --git a/cpp/src/slice2cs/DotNetNames.cpp b/cpp/src/slice2cs/DotNetNames.cpp index 1c29ce15b0e..4e0d7c04200 100644 --- a/cpp/src/slice2cs/DotNetNames.cpp +++ b/cpp/src/slice2cs/DotNetNames.cpp @@ -18,8 +18,8 @@ namespace Slice const Node** parents; }; - static const char* ObjectNames[] = {"Equals", "Finalize", "GetHashCode", "GetType", - "MemberwiseClone", "ReferenceEquals", "ToString", 0}; + static const char* ObjectNames[] = + {"Equals", "Finalize", "GetHashCode", "GetType", "MemberwiseClone", "ReferenceEquals", "ToString", 0}; static const Node* ObjectParents[] = {0}; static const Node ObjectNode = {ObjectNames, &ObjectParents[0]}; @@ -28,8 +28,17 @@ namespace Slice static const Node ICloneableNode = {ICloneableNames, &ICloneableParents[0]}; static const char* ExceptionNames[] = { - "Data", "GetBaseException", "GetObjectData", "HelpLink", "HResult", "InnerException", - "Message", "Source", "StackTrace", "TargetSite", 0}; + "Data", + "GetBaseException", + "GetObjectData", + "HelpLink", + "HResult", + "InnerException", + "Message", + "Source", + "StackTrace", + "TargetSite", + 0}; static const Node* ExceptionParents[] = {&ObjectNode, 0}; static const Node ExceptionNode = {ExceptionNames, &ExceptionParents[0]}; diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 8427421f3e6..f654eb7f873 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -445,8 +445,8 @@ Slice::CsVisitor::writeDispatch(const InterfaceDefPtr& p) _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]"; _out << nl << "public static global::System.Threading.Tasks.Task<" << getUnqualified("Ice.OutputStream", ns) << ">"; - _out << nl << "iceD_" << opName << "(" << name << " obj, " - << "global::IceInternal.Incoming inS, " << getUnqualified("Ice.Current", ns) << " current)"; + _out << nl << "iceD_" << opName << "(" << name << " obj, " << "global::IceInternal.Incoming inS, " + << getUnqualified("Ice.Current", ns) << " current)"; _out << sb; TypePtr ret = op->returnType(); @@ -531,8 +531,7 @@ Slice::CsVisitor::writeDispatch(const InterfaceDefPtr& p) _out.inc(); if (!ret && outParams.size() == 1) { - _out << nl << "(ostr, " - << "iceP_" << outParams.front()->name() << ") =>"; + _out << nl << "(ostr, " << "iceP_" << outParams.front()->name() << ") =>"; } else { @@ -600,7 +599,10 @@ Slice::CsVisitor::writeDispatch(const InterfaceDefPtr& p) { StringList allOpNames; transform( - allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const ContainedPtr& it) { return it->name(); }); + allOps.begin(), + allOps.end(), + back_inserter(allOpNames), + [](const ContainedPtr& it) { return it->name(); }); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -1251,7 +1253,8 @@ Slice::CsVisitor::editMarkup(const string& s) string ident = result.substr(startIdent, endIdent - startIdent); string::size_type endComment = result.find_first_of("@<", endIdent); string comment = result.substr( - endIdent + 1, endComment == string::npos ? endComment : endComment - endIdent - 1); + endIdent + 1, + endComment == string::npos ? endComment : endComment - endIdent - 1); result.erase(startIdent, endComment == string::npos ? string::npos : endComment - startIdent); string newComment = "" + comment + "\n"; result.insert(startIdent, newComment); @@ -1296,7 +1299,8 @@ Slice::CsVisitor::editMarkup(const string& s) string ident = result.substr(startIdent, endIdent - startIdent); string::size_type endComment = result.find_first_of("@<", endIdent); string comment = result.substr( - endIdent + 1, endComment == string::npos ? endComment : endComment - endIdent - 1); + endIdent + 1, + endComment == string::npos ? endComment : endComment - endIdent - 1); result.erase(startIdent, endComment == string::npos ? string::npos : endComment - startIdent); string newComment = "" + comment + "\n"; result.insert(startIdent, newComment); @@ -3343,7 +3347,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) string context = getEscapedParamName(p, "context"); _out << sp; writeDocComment( - p, deprecateReason, "The Context map to send with the invocation."); + p, + deprecateReason, + "The Context map to send with the invocation."); if (!deprecateReason.empty()) { _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; @@ -3364,7 +3370,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) _out << sp; writeDocCommentTaskAsyncAMI( - p, deprecateReason, "Context map to send with the invocation.", + p, + deprecateReason, + "Context map to send with the invocation.", "Sent progress provider.", "A cancellation token that receives the cancellation requests."); if (!deprecateReason.empty()) @@ -3502,12 +3510,14 @@ Slice::Gen::OpsVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) if (amd) { writeDocCommentAMD( - op, "The Current object for the invocation."); + op, + "The Current object for the invocation."); } else { writeDocComment( - op, getDeprecateReason(op, p, "operation"), + op, + getDeprecateReason(op, p, "operation"), "The Current object for the invocation."); } emitAttributes(op); @@ -3627,8 +3637,7 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) } } _out << "_iceI_" << op->name() << "Async" << spar << argsAMI << context << "null" - << "global::System.Threading.CancellationToken.None" - << "true" << epar; + << "global::System.Threading.CancellationToken.None" << "true" << epar; if (ret || outParams.size() > 0) { @@ -3736,10 +3745,8 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) _out << "<" << returnTypeS << ">"; } _out << " _iceI_" << opName << "Async" << spar << getInParams(op, ns, true) - << getUnqualified("Ice.OptionalContext", ns) + " context" - << "global::System.IProgress progress" - << "global::System.Threading.CancellationToken cancel" - << "bool synchronous" << epar; + << getUnqualified("Ice.OptionalContext", ns) + " context" << "global::System.IProgress progress" + << "global::System.Threading.CancellationToken cancel" << "bool synchronous" << epar; _out << sb; string flatName = "_" + opName + "_name"; @@ -3754,13 +3761,12 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) } else { - _out << nl << "var completed = " - << "new global::IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress, cancel);"; + _out << nl << "var completed = " << "new global::IceInternal.OperationTaskCompletionCallback<" + << returnTypeS << ">(progress, cancel);"; } - _out << nl << "_iceI_" << opName << spar << getInArgs(op, true) << "context" - << "synchronous" - << "completed" << epar << ";"; + _out << nl << "_iceI_" << opName << spar << getInArgs(op, true) << "context" << "synchronous" << "completed" + << epar << ";"; _out << nl << "return completed.Task;"; _out << eb; @@ -3772,8 +3778,7 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) // _out << sp << nl; _out << "private void _iceI_" << op->name() << spar << getInParams(op, ns, true) - << "global::System.Collections.Generic.Dictionary context" - << "bool synchronous" + << "global::System.Collections.Generic.Dictionary context" << "bool synchronous" << "global::IceInternal.OutgoingAsyncCompletionCallback completed" << epar; _out << sb; @@ -3847,8 +3852,7 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) StructPtr st = dynamic_pointer_cast(ret); if (st && isValueType(st)) { - _out << " = " - << "new " + returnTypeS + "()"; + _out << " = " << "new " + returnTypeS + "()"; } else if (isClassType(ret) || st) { @@ -3875,8 +3879,7 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) StructPtr st = dynamic_pointer_cast(t); if (st && isValueType(st)) { - _out << " = " - << "new " << typeToString(t, ns) << "()"; + _out << " = " << "new " << typeToString(t, ns) << "()"; } else if (isClassType(t) || st) { @@ -3972,8 +3975,7 @@ Slice::Gen::HelperVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) _out << eb; _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", ns) - << " b, string f, " - << "global::System.Collections.Generic.Dictionary ctx)"; + << " b, string f, " << "global::System.Collections.Generic.Dictionary ctx)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp index d8edd068403..71b633175ec 100644 --- a/cpp/src/slice2cs/Main.cpp +++ b/cpp/src/slice2cs/Main.cpp @@ -197,7 +197,10 @@ compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::CSharp : Preprocessor::SliceXML, includePaths, "-D__SLICE2CS__")) + os, + depend ? Preprocessor::CSharp : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2CS__")) { return EXIT_FAILURE; } @@ -311,8 +314,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index c648b15f9bb..40a0b842b0e 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -283,7 +283,11 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s { out << (typeToString( - ret, TypeModeIn, package, op->getMetaData(), true, + ret, + TypeModeIn, + package, + op->getMetaData(), + true, !generateMandatoryOnly && op->returnIsOptional()) + " " + retval); needMandatoryOnly = !generateMandatoryOnly && op->returnIsOptional(); @@ -292,7 +296,11 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s { out << (typeToString( - (*p)->type(), TypeModeIn, package, (*p)->getMetaData(), true, + (*p)->type(), + TypeModeIn, + package, + (*p)->getMetaData(), + true, !generateMandatoryOnly && (*p)->optional()) + " " + fixKwd((*p)->name())); if (!generateMandatoryOnly) @@ -379,7 +387,16 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s { const string paramName = fixKwd((*pli)->name()); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalNone, false, 0, "this." + paramName, true, iter, "", + out, + package, + (*pli)->type(), + OptionalNone, + false, + 0, + "this." + paramName, + true, + iter, + "", (*pli)->getMetaData()); } @@ -398,21 +415,49 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s if (checkReturnType && op->returnTag() < (*pli)->tag()) { writeMarshalUnmarshalCode( - out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter, "", + out, + package, + ret, + OptionalReturnParam, + true, + op->returnTag(), + retval, + true, + iter, + "", op->getMetaData()); checkReturnType = false; } const string paramName = fixKwd((*pli)->name()); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), "this." + paramName, true, iter, "", + out, + package, + (*pli)->type(), + OptionalOutParam, + true, + (*pli)->tag(), + "this." + paramName, + true, + iter, + "", (*pli)->getMetaData()); } if (checkReturnType) { writeMarshalUnmarshalCode( - out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter, "", op->getMetaData()); + out, + package, + ret, + OptionalReturnParam, + true, + op->returnTag(), + retval, + true, + iter, + "", + op->getMetaData()); } out << eb; @@ -426,15 +471,36 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s const string paramName = fixKwd((*pli)->name()); const string patchParams = getPatcher((*pli)->type(), package, "this." + paramName); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalNone, false, 0, "this." + paramName, false, iter, "", - (*pli)->getMetaData(), patchParams); + out, + package, + (*pli)->type(), + OptionalNone, + false, + 0, + "this." + paramName, + false, + iter, + "", + (*pli)->getMetaData(), + patchParams); } if (ret && !op->returnIsOptional()) { const string patchParams = getPatcher(ret, package, retval); writeMarshalUnmarshalCode( - out, package, ret, OptionalNone, false, 0, retval, false, iter, "", op->getMetaData(), patchParams); + out, + package, + ret, + OptionalNone, + false, + 0, + retval, + false, + iter, + "", + op->getMetaData(), + patchParams); } // @@ -448,23 +514,53 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s { const string patchParams = getPatcher(ret, package, retval); writeMarshalUnmarshalCode( - out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, false, iter, "", - op->getMetaData(), patchParams); + out, + package, + ret, + OptionalReturnParam, + true, + op->returnTag(), + retval, + false, + iter, + "", + op->getMetaData(), + patchParams); checkReturnType = false; } const string paramName = fixKwd((*pli)->name()); const string patchParams = getPatcher((*pli)->type(), package, paramName); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), "this." + paramName, false, iter, "", - (*pli)->getMetaData(), patchParams); + out, + package, + (*pli)->type(), + OptionalOutParam, + true, + (*pli)->tag(), + "this." + paramName, + false, + iter, + "", + (*pli)->getMetaData(), + patchParams); } if (checkReturnType) { const string patchParams = getPatcher(ret, package, retval); writeMarshalUnmarshalCode( - out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, false, iter, "", op->getMetaData(), + out, + package, + ret, + OptionalReturnParam, + true, + op->returnTag(), + retval, + false, + iter, + "", + op->getMetaData(), patchParams); } @@ -552,14 +648,33 @@ Slice::JavaVisitor::writeMarshaledResultType( { const string paramName = fixKwd((*pli)->name()); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter, "_ostr", + out, + package, + (*pli)->type(), + OptionalNone, + false, + 0, + paramName, + true, + iter, + "_ostr", (*pli)->getMetaData()); } if (ret && !op->returnIsOptional()) { writeMarshalUnmarshalCode( - out, package, ret, OptionalNone, false, 0, retval, true, iter, "_ostr", op->getMetaData()); + out, + package, + ret, + OptionalNone, + false, + 0, + retval, + true, + iter, + "_ostr", + op->getMetaData()); } // @@ -572,21 +687,48 @@ Slice::JavaVisitor::writeMarshaledResultType( if (checkReturnType && op->returnTag() < (*pli)->tag()) { writeMarshalUnmarshalCode( - out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter, "_ostr", + out, + package, + ret, + OptionalReturnParam, + true, + op->returnTag(), + retval, + true, + iter, + "_ostr", op->getMetaData()); checkReturnType = false; } const string paramName = fixKwd((*pli)->name()); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName, true, iter, "_ostr", + out, + package, + (*pli)->type(), + OptionalOutParam, + true, + (*pli)->tag(), + paramName, + true, + iter, + "_ostr", (*pli)->getMetaData()); } if (checkReturnType) { writeMarshalUnmarshalCode( - out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter, "_ostr", + out, + package, + ret, + OptionalReturnParam, + true, + op->returnTag(), + retval, + true, + iter, + "_ostr", op->getMetaData()); } @@ -785,7 +927,12 @@ Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package for (ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q) { const string typeString = typeToString( - (*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true, optionalMapping && (*q)->optional()); + (*q)->type(), + TypeModeIn, + package, + (*q)->getMetaData(), + true, + optionalMapping && (*q)->optional()); params.push_back(typeString + ' ' + (internal ? "iceP_" + (*q)->name() : fixKwd((*q)->name()))); } @@ -835,7 +982,17 @@ Slice::JavaVisitor::writeMarshalProxyParams( { string paramName = "iceP_" + (*pli)->name(); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter, "", (*pli)->getMetaData()); + out, + package, + (*pli)->type(), + OptionalNone, + false, + 0, + paramName, + true, + iter, + "", + (*pli)->getMetaData()); } // @@ -844,8 +1001,17 @@ Slice::JavaVisitor::writeMarshalProxyParams( for (ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli) { writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalInParam, optionalMapping, (*pli)->tag(), "iceP_" + (*pli)->name(), - true, iter, "", (*pli)->getMetaData()); + out, + package, + (*pli)->type(), + OptionalInParam, + optionalMapping, + (*pli)->tag(), + "iceP_" + (*pli)->name(), + true, + iter, + "", + (*pli)->getMetaData()); } if (op->sendsClasses(false)) @@ -912,13 +1078,34 @@ Slice::JavaVisitor::writeUnmarshalProxyResults(Output& out, const string& packag if (optional) { writeMarshalUnmarshalCode( - out, package, type, ret ? OptionalReturnParam : OptionalOutParam, true, tag, name, false, iter, "", - metaData, patchParams); + out, + package, + type, + ret ? OptionalReturnParam : OptionalOutParam, + true, + tag, + name, + false, + iter, + "", + metaData, + patchParams); } else { writeMarshalUnmarshalCode( - out, package, type, OptionalNone, false, 0, name, false, iter, "", metaData, patchParams); + out, + package, + type, + OptionalNone, + false, + 0, + name, + false, + iter, + "", + metaData, + patchParams); } if (op->returnsClasses(false)) @@ -1029,8 +1216,17 @@ Slice::JavaVisitor::writeMarshalDataMember( out << nl << "if(_" << member->name() << ")"; out << sb; writeMarshalUnmarshalCode( - out, package, member->type(), OptionalInParam, false, member->tag(), fixKwd(member->name()), true, iter, - "ostr_", member->getMetaData()); + out, + package, + member->type(), + OptionalInParam, + false, + member->tag(), + fixKwd(member->name()), + true, + iter, + "ostr_", + member->getMetaData()); out << eb; } else @@ -1043,7 +1239,16 @@ Slice::JavaVisitor::writeMarshalDataMember( } writeMarshalUnmarshalCode( - out, package, member->type(), OptionalNone, false, 0, memberName, true, iter, stream, + out, + package, + member->type(), + OptionalNone, + false, + 0, + memberName, + true, + iter, + stream, member->getMetaData()); } } @@ -1065,8 +1270,18 @@ Slice::JavaVisitor::writeUnmarshalDataMember( << getOptionalFormat(member->type()) << "))"; out << sb; writeMarshalUnmarshalCode( - out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), false, iter, "istr_", - member->getMetaData(), patchParams); + out, + package, + member->type(), + OptionalMember, + false, + 0, + fixKwd(member->name()), + false, + iter, + "istr_", + member->getMetaData(), + patchParams); out << eb; } else @@ -1079,8 +1294,18 @@ Slice::JavaVisitor::writeUnmarshalDataMember( } writeMarshalUnmarshalCode( - out, package, member->type(), OptionalNone, false, 0, memberName, false, iter, stream, - member->getMetaData(), patchParams); + out, + package, + member->type(), + OptionalNone, + false, + 0, + memberName, + false, + iter, + stream, + member->getMetaData(), + patchParams); } } @@ -1255,8 +1480,18 @@ Slice::JavaVisitor::writeDispatch(Output& out, const InterfaceDefPtr& p) isValue((*pli)->type()) ? ("icePP_" + (*pli)->name()) : "iceP_" + (*pli)->name(); const string patchParams = getPatcher((*pli)->type(), package, paramName + ".value"); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalNone, false, 0, paramName, false, iter, "", - (*pli)->getMetaData(), patchParams); + out, + package, + (*pli)->type(), + OptionalNone, + false, + 0, + paramName, + false, + iter, + "", + (*pli)->getMetaData(), + patchParams); } for (ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli) { @@ -1264,8 +1499,18 @@ Slice::JavaVisitor::writeDispatch(Output& out, const InterfaceDefPtr& p) isValue((*pli)->type()) ? ("icePP_" + (*pli)->name()) : "iceP_" + (*pli)->name(); const string patchParams = getPatcher((*pli)->type(), package, paramName + ".value"); writeMarshalUnmarshalCode( - out, package, (*pli)->type(), OptionalInParam, true, (*pli)->tag(), paramName, false, iter, "", - (*pli)->getMetaData(), patchParams); + out, + package, + (*pli)->type(), + OptionalInParam, + true, + (*pli)->tag(), + paramName, + false, + iter, + "", + (*pli)->getMetaData(), + patchParams); } if (op->sendsClasses(false)) { @@ -1353,7 +1598,10 @@ Slice::JavaVisitor::writeDispatch(Output& out, const InterfaceDefPtr& p) { StringList allOpNames; transform( - allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const ContainedPtr& it) { return it->name(); }); + allOps.begin(), + allOps.end(), + back_inserter(allOpNames), + [](const ContainedPtr& it) { return it->name(); }); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -1962,8 +2210,7 @@ Slice::JavaVisitor::writeHiddenProxyDocComment(Output& out, const OperationPtr& for (ParamDeclList::const_iterator i = paramList.begin(); i != paramList.end(); ++i) { const string name = (*i)->name(); - out << nl << " * @param " - << "iceP_" << name << " -"; + out << nl << " * @param " << "iceP_" << name << " -"; } out << nl << " * @param context -"; out << nl << " * @param sync -"; @@ -4251,10 +4498,11 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Contacts the remote server to verify that the object implements this type.\n" - "Raises a local exception if a communication error occurs.\n" - "@param obj The untyped proxy.\n" - "@return A proxy for this type, or null if the object does not support this type."); + out, + "Contacts the remote server to verify that the object implements this type.\n" + "Raises a local exception if a communication error occurs.\n" + "@param obj The untyped proxy.\n" + "@return A proxy for this type, or null if the object does not support this type."); out << nl << "static " << p->name() << "Prx checkedCast(" << getUnqualified("com.zeroc.Ice.ObjectPrx", package) << " obj)"; out << sb; @@ -4264,11 +4512,12 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Contacts the remote server to verify that the object implements this type.\n" - "Raises a local exception if a communication error occurs.\n" - "@param obj The untyped proxy.\n" - "@param context The Context map to send with the invocation.\n" - "@return A proxy for this type, or null if the object does not support this type."); + out, + "Contacts the remote server to verify that the object implements this type.\n" + "Raises a local exception if a communication error occurs.\n" + "@param obj The untyped proxy.\n" + "@param context The Context map to send with the invocation.\n" + "@return A proxy for this type, or null if the object does not support this type."); out << nl << "static " << p->name() << "Prx checkedCast(" << getUnqualified("com.zeroc.Ice.ObjectPrx", package) << " obj, " << contextParam << ')'; out << sb; @@ -4278,11 +4527,12 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Contacts the remote server to verify that a facet of the object implements this type.\n" - "Raises a local exception if a communication error occurs.\n" - "@param obj The untyped proxy.\n" - "@param facet The name of the desired facet.\n" - "@return A proxy for this type, or null if the object does not support this type."); + out, + "Contacts the remote server to verify that a facet of the object implements this type.\n" + "Raises a local exception if a communication error occurs.\n" + "@param obj The untyped proxy.\n" + "@param facet The name of the desired facet.\n" + "@return A proxy for this type, or null if the object does not support this type."); out << nl << "static " << p->name() << "Prx checkedCast(" << getUnqualified("com.zeroc.Ice.ObjectPrx", package) << " obj, String facet)"; out << sb; @@ -4292,12 +4542,13 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Contacts the remote server to verify that a facet of the object implements this type.\n" - "Raises a local exception if a communication error occurs.\n" - "@param obj The untyped proxy.\n" - "@param facet The name of the desired facet.\n" - "@param context The Context map to send with the invocation.\n" - "@return A proxy for this type, or null if the object does not support this type."); + out, + "Contacts the remote server to verify that a facet of the object implements this type.\n" + "Raises a local exception if a communication error occurs.\n" + "@param obj The untyped proxy.\n" + "@param facet The name of the desired facet.\n" + "@param context The Context map to send with the invocation.\n" + "@return A proxy for this type, or null if the object does not support this type."); out << nl << "static " << p->name() << "Prx checkedCast(" << getUnqualified("com.zeroc.Ice.ObjectPrx", package) << " obj, String facet, " << contextParam << ')'; out << sb; @@ -4308,9 +4559,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Downcasts the given proxy to this type without contacting the remote server.\n" - "@param obj The untyped proxy.\n" - "@return A proxy for this type."); + out, + "Downcasts the given proxy to this type without contacting the remote server.\n" + "@param obj The untyped proxy.\n" + "@return A proxy for this type."); out << nl << "static " << p->name() << "Prx uncheckedCast(" << getUnqualified("com.zeroc.Ice.ObjectPrx", package) << " obj)"; out << sb; @@ -4320,10 +4572,11 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Downcasts the given proxy to this type without contacting the remote server.\n" - "@param obj The untyped proxy.\n" - "@param facet The name of the desired facet.\n" - "@return A proxy for this type."); + out, + "Downcasts the given proxy to this type without contacting the remote server.\n" + "@param obj The untyped proxy.\n" + "@param facet The name of the desired facet.\n" + "@return A proxy for this type."); out << nl << "static " << p->name() << "Prx uncheckedCast(" << getUnqualified("com.zeroc.Ice.ObjectPrx", package) << " obj, String facet)"; out << sb; @@ -4333,9 +4586,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the per-proxy context.\n" - "@param newContext The context for the new proxy.\n" - "@return A proxy with the specified per-proxy context."); + out, + "Returns a proxy that is identical to this proxy, except for the per-proxy context.\n" + "@param newContext The context for the new proxy.\n" + "@return A proxy with the specified per-proxy context."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_context(java.util.Map newContext)"; out << sb; @@ -4344,9 +4598,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the adapter ID.\n" - "@param newAdapterId The adapter ID for the new proxy.\n" - "@return A proxy with the specified adapter ID."); + out, + "Returns a proxy that is identical to this proxy, except for the adapter ID.\n" + "@param newAdapterId The adapter ID for the new proxy.\n" + "@return A proxy with the specified adapter ID."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_adapterId(String newAdapterId)"; out << sb; @@ -4355,9 +4610,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the endpoints.\n" - "@param newEndpoints The endpoints for the new proxy.\n" - "@return A proxy with the specified endpoints."); + out, + "Returns a proxy that is identical to this proxy, except for the endpoints.\n" + "@param newEndpoints The endpoints for the new proxy.\n" + "@return A proxy with the specified endpoints."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_endpoints(" << getUnqualified("com.zeroc.Ice.Endpoint", package) << "[] newEndpoints)"; @@ -4367,9 +4623,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the locator cache timeout.\n" - "@param newTimeout The new locator cache timeout (in seconds).\n" - "@return A proxy with the specified locator cache timeout."); + out, + "Returns a proxy that is identical to this proxy, except for the locator cache timeout.\n" + "@param newTimeout The new locator cache timeout (in seconds).\n" + "@return A proxy with the specified locator cache timeout."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_locatorCacheTimeout(int newTimeout)"; out << sb; @@ -4378,9 +4635,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the invocation timeout.\n" - "@param newTimeout The new invocation timeout (in seconds).\n" - "@return A proxy with the specified invocation timeout."); + out, + "Returns a proxy that is identical to this proxy, except for the invocation timeout.\n" + "@param newTimeout The new invocation timeout (in seconds).\n" + "@return A proxy with the specified invocation timeout."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_invocationTimeout(int newTimeout)"; out << sb; @@ -4401,9 +4659,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the endpoint selection policy.\n" - "@param newType The new endpoint selection policy.\n" - "@return A proxy with the specified endpoint selection policy."); + out, + "Returns a proxy that is identical to this proxy, except for the endpoint selection policy.\n" + "@param newType The new endpoint selection policy.\n" + "@return A proxy with the specified endpoint selection policy."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_endpointSelection(" << getUnqualified("com.zeroc.Ice.EndpointSelectionType", package) << " newType)"; @@ -4413,11 +4672,12 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for how it selects endpoints.\n" - "@param b If b is true, only endpoints that use a secure transport are\n" - "used by the new proxy. If b is false, the returned proxy uses both secure and\n" - "insecure endpoints.\n" - "@return A proxy with the specified selection policy."); + out, + "Returns a proxy that is identical to this proxy, except for how it selects endpoints.\n" + "@param b If b is true, only endpoints that use a secure transport are\n" + "used by the new proxy. If b is false, the returned proxy uses both secure and\n" + "insecure endpoints.\n" + "@return A proxy with the specified selection policy."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_secure(boolean b)"; out << sb; @@ -4426,9 +4686,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the encoding used to marshal parameters.\n" - "@param e The encoding version to use to marshal request parameters.\n" - "@return A proxy with the specified encoding version."); + out, + "Returns a proxy that is identical to this proxy, except for the encoding used to marshal parameters.\n" + "@param e The encoding version to use to marshal request parameters.\n" + "@return A proxy with the specified encoding version."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_encodingVersion(" << getUnqualified("com.zeroc.Ice.EncodingVersion", package) << " e)"; @@ -4452,9 +4713,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the router.\n" - "@param router The router for the new proxy.\n" - "@return A proxy with the specified router."); + out, + "Returns a proxy that is identical to this proxy, except for the router.\n" + "@param router The router for the new proxy.\n" + "@return A proxy with the specified router."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_router(" << getUnqualified("com.zeroc.Ice.RouterPrx", package) << " router)"; @@ -4464,9 +4726,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for the locator.\n" - "@param locator The locator for the new proxy.\n" - "@return A proxy with the specified locator."); + out, + "Returns a proxy that is identical to this proxy, except for the locator.\n" + "@param locator The locator for the new proxy.\n" + "@return A proxy with the specified locator."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_locator(" << getUnqualified("com.zeroc.Ice.LocatorPrx", package) << " locator)"; @@ -4488,8 +4751,9 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, but uses twoway invocations.\n" - "@return A proxy that uses twoway invocations."); + out, + "Returns a proxy that is identical to this proxy, but uses twoway invocations.\n" + "@return A proxy that uses twoway invocations."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_twoway()"; out << sb; @@ -4498,8 +4762,9 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, but uses oneway invocations.\n" - "@return A proxy that uses oneway invocations."); + out, + "Returns a proxy that is identical to this proxy, but uses oneway invocations.\n" + "@return A proxy that uses oneway invocations."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_oneway()"; out << sb; @@ -4508,8 +4773,9 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, but uses batch oneway invocations.\n" - "@return A proxy that uses batch oneway invocations."); + out, + "Returns a proxy that is identical to this proxy, but uses batch oneway invocations.\n" + "@return A proxy that uses batch oneway invocations."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_batchOneway()"; out << sb; @@ -4518,8 +4784,9 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, but uses datagram invocations.\n" - "@return A proxy that uses datagram invocations."); + out, + "Returns a proxy that is identical to this proxy, but uses datagram invocations.\n" + "@return A proxy that uses datagram invocations."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_datagram()"; out << sb; @@ -4528,8 +4795,9 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, but uses batch datagram invocations.\n" - "@return A proxy that uses batch datagram invocations."); + out, + "Returns a proxy that is identical to this proxy, but uses batch datagram invocations.\n" + "@return A proxy that uses batch datagram invocations."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_batchDatagram()"; out << sb; @@ -4550,9 +4818,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for its connection timeout setting.\n" - "@param t The connection timeout for the proxy in milliseconds.\n" - "@return A proxy with the specified timeout."); + out, + "Returns a proxy that is identical to this proxy, except for its connection timeout setting.\n" + "@param t The connection timeout for the proxy in milliseconds.\n" + "@return A proxy with the specified timeout."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_timeout(int t)"; out << sb; @@ -4561,9 +4830,10 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except for its connection ID.\n" - "@param connectionId The connection ID for the new proxy. An empty string removes the connection ID.\n" - "@return A proxy with the specified connection ID."); + out, + "Returns a proxy that is identical to this proxy, except for its connection ID.\n" + "@param connectionId The connection ID for the new proxy. An empty string removes the connection ID.\n" + "@return A proxy with the specified connection ID."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_connectionId(String connectionId)"; out << sb; @@ -4572,10 +4842,11 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) out << sp; writeDocComment( - out, "Returns a proxy that is identical to this proxy, except it's a fixed proxy bound\n" - "the given connection." - "@param connection The fixed proxy connection.\n" - "@return A fixed proxy bound to the given connection."); + out, + "Returns a proxy that is identical to this proxy, except it's a fixed proxy bound\n" + "the given connection." + "@param connection The fixed proxy connection.\n" + "@return A fixed proxy bound to the given connection."); out << nl << "@Override"; out << nl << "default " << p->name() << "Prx ice_fixed(com.zeroc.Ice.Connection connection)"; out << sb; @@ -4824,8 +5095,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) out << sp; writeHiddenProxyDocComment(out, p); out << nl << "default " << futureImpl << " _iceI_" << p->name() << "Async" << spar - << getParamsProxy(p, package, false, true) << "java.util.Map context" - << "boolean sync" << epar; + << getParamsProxy(p, package, false, true) << "java.util.Map context" << "boolean sync" << epar; out << sb; out << nl << futureImpl << " f = new " << getUnqualified("com.zeroc.IceInternal.OutgoingAsync", package) << "<>(this, \"" << p->name() << "\", " << sliceModeToIceMode(p->sendMode()) << ", sync, " @@ -4914,8 +5184,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) out << sp; writeHiddenProxyDocComment(out, p); out << nl << "default " << futureImpl << " _iceI_" << p->name() << "Async" << spar - << getParamsProxy(p, package, true, true) << "java.util.Map context" - << "boolean sync" << epar; + << getParamsProxy(p, package, true, true) << "java.util.Map context" << "boolean sync" + << epar; out << sb; out << nl << futureImpl << " f = new " << getUnqualified("com.zeroc.IceInternal.OutgoingAsync", package) << "<>(this, \"" << p->name() << "\", " << sliceModeToIceMode(p->sendMode()) << ", sync, " diff --git a/cpp/src/slice2java/JavaUtil.cpp b/cpp/src/slice2java/JavaUtil.cpp index 92b2b20f29f..9a658f32994 100644 --- a/cpp/src/slice2java/JavaUtil.cpp +++ b/cpp/src/slice2java/JavaUtil.cpp @@ -185,7 +185,9 @@ namespace if (s.find("java:type:", 0) == 0) { dc->warning( - InvalidMetaData, p->file(), p->line(), + InvalidMetaData, + p->file(), + p->line(), "ignoring invalid metadata `" + s + "' for operation with void return type"); metaData.remove(s); continue; @@ -244,7 +246,9 @@ namespace if (!builtin || builtin->kind() != Builtin::KindByte) { dc->warning( - InvalidMetaData, file, line, + InvalidMetaData, + file, + line, "ignoring invalid metadata `" + s + "': " + "this metadata can only be used with a byte sequence"); continue; @@ -261,7 +265,9 @@ namespace builtin->kind() != Builtin::KindFloat && builtin->kind() != Builtin::KindDouble)) { dc->warning( - InvalidMetaData, file, line, + InvalidMetaData, + file, + line, "ignoring invalid metadata `" + s + "': " + "this metadata can not be used with this type"); continue; } @@ -1240,10 +1246,18 @@ Slice::JavaGenerator::typeToObjectString( const StringList& metaData, bool formal) const { - static const char* builtinTable[] = {"java.lang.Byte", "java.lang.Boolean", "java.lang.Short", - "java.lang.Integer", "java.lang.Long", "java.lang.Float", - "java.lang.Double", "java.lang.String", "com.zeroc.Ice.Value", - "com.zeroc.Ice.ObjectPrx", "com.zeroc.Ice.Value"}; + static const char* builtinTable[] = { + "java.lang.Byte", + "java.lang.Boolean", + "java.lang.Short", + "java.lang.Integer", + "java.lang.Long", + "java.lang.Float", + "java.lang.Double", + "java.lang.String", + "com.zeroc.Ice.Value", + "com.zeroc.Ice.ObjectPrx", + "com.zeroc.Ice.Value"}; BuiltinPtr builtin = dynamic_pointer_cast(type); if (builtin && mode != TypeModeOut) @@ -1280,8 +1294,8 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode( assert(!marshal || mode != OptionalMember); // Only support OptionalMember for un-marshaling - static const char* builtinTable[] = {"Byte", "Bool", "Short", "Int", "Long", "Float", - "Double", "String", "???", "???", "???"}; + static const char* builtinTable[] = + {"Byte", "Bool", "Short", "Int", "Long", "Float", "Double", "String", "???", "???", "???"}; const BuiltinPtr builtin = dynamic_pointer_cast(type); if (builtin) @@ -1497,7 +1511,15 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode( string d = optionalParam && optionalMapping ? param + ".get()" : param; out << nl << "int pos = " << stream << ".startSize();"; writeDictionaryMarshalUnmarshalCode( - out, package, dict, d, marshal, iter, true, customStream, metaData); + out, + package, + dict, + d, + marshal, + iter, + true, + customStream, + metaData); out << nl << stream << ".endSize(pos);"; } else @@ -1508,7 +1530,15 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode( out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << sz << " + 5 : optSize * " << sz << " + 1);"; writeDictionaryMarshalUnmarshalCode( - out, package, dict, d, marshal, iter, true, customStream, metaData); + out, + package, + dict, + d, + marshal, + iter, + true, + customStream, + metaData); } if (optionalParam) @@ -1851,7 +1881,17 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode( ostringstream patchParams; patchParams << "value -> " << v << ".put(key, value), " << valueS << ".class"; writeMarshalUnmarshalCode( - out, package, value, OptionalNone, false, 0, "value", false, iter, customStream, StringList(), + out, + package, + value, + OptionalNone, + false, + 0, + "value", + false, + iter, + customStream, + StringList(), patchParams.str()); } else @@ -2088,14 +2128,33 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode( patchParams << "value -> " << v << ".set(fi" << iter << ", value), " << origContentS << ".class"; writeMarshalUnmarshalCode( - out, package, type, OptionalNone, false, 0, "elem", false, iter, customStream, StringList(), + out, + package, + type, + OptionalNone, + false, + 0, + "elem", + false, + iter, + customStream, + StringList(), patchParams.str()); } else { out << nl << cont << " elem;"; writeMarshalUnmarshalCode( - out, package, type, OptionalNone, false, 0, "elem", false, iter, customStream); + out, + package, + type, + OptionalNone, + false, + 0, + "elem", + false, + iter, + customStream); out << nl << v << ".add(elem);"; } out << eb; @@ -2232,7 +2291,16 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode( o << v << "[i" << iter << "]"; iter++; writeMarshalUnmarshalCode( - out, package, type, OptionalNone, false, 0, o.str(), true, iter, customStream); + out, + package, + type, + OptionalNone, + false, + 0, + o.str(), + true, + iter, + customStream); out << eb; out << eb; } @@ -2297,13 +2365,32 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode( out << nl << "final int fi" << iter << " = i" << iter << ";"; patchParams << "value -> " << v << "[fi" << iter << "] = value, " << origContentS << ".class"; writeMarshalUnmarshalCode( - out, package, type, OptionalNone, false, 0, o.str(), false, iter, customStream, StringList(), + out, + package, + type, + OptionalNone, + false, + 0, + o.str(), + false, + iter, + customStream, + StringList(), patchParams.str()); } else { writeMarshalUnmarshalCode( - out, package, type, OptionalNone, false, 0, o.str(), false, iter, customStream); + out, + package, + type, + OptionalNone, + false, + 0, + o.str(), + false, + iter, + customStream); } out << eb; iter++; diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index 86442f7e1f4..4ff04a7f0b6 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -205,7 +205,10 @@ compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::Java : Preprocessor::SliceXML, includePaths, cppOpts)) + os, + depend ? Preprocessor::Java : Preprocessor::SliceXML, + includePaths, + cppOpts)) { return EXIT_FAILURE; } @@ -333,8 +336,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index 220b1a588b4..54226a24887 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -1707,9 +1707,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) const bool fixed = !type->isVariableLength(); _out << sp; - _out << nl << "Slice.defineSequence(" << scope << ", \"" << propertyName << "\", " - << "\"" << getHelper(type) << "\"" - << ", " << (fixed ? "true" : "false"); + _out << nl << "Slice.defineSequence(" << scope << ", \"" << propertyName << "\", " << "\"" << getHelper(type) + << "\"" << ", " << (fixed ? "true" : "false"); if (isClassType(type)) { _out << ", \"" << typeToString(type) << "\""; @@ -1964,9 +1963,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) bool fixed = !keyType->isVariableLength() && !valueType->isVariableLength(); _out << sp; - _out << nl << "Slice.defineDictionary(" << scope << ", \"" << name << "\", \"" << propertyName << "\", " - << "\"" << getHelper(keyType) << "\", " - << "\"" << getHelper(valueType) << "\", " << (fixed ? "true" : "false") << ", " + _out << nl << "Slice.defineDictionary(" << scope << ", \"" << name << "\", \"" << propertyName << "\", " << "\"" + << getHelper(keyType) << "\", " << "\"" << getHelper(valueType) << "\", " << (fixed ? "true" : "false") << ", " << (keyUseEquals ? "Ice.HashMap.compareEquals" : "undefined"); if (isClassType(valueType)) @@ -2765,8 +2763,7 @@ Slice::Gen::TypeScriptVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) _out << nl << " * @return A proxy with the requested type."; _out << nl << " */"; _out << nl << "static uncheckedCast(prx:" << icePrefix << getUnqualified("Ice.ObjectPrx", p->scope(), icePrefix) - << ", " - << "facet?:string):" << fixId(p->name() + "Prx") << ";"; + << ", " << "facet?:string):" << fixId(p->name() + "Prx") << ";"; _out << nl << "/**"; _out << nl << " * Downcasts a proxy after confirming the target object's type via a remote invocation."; _out << nl << " * @param prx The target proxy."; @@ -2777,8 +2774,7 @@ Slice::Gen::TypeScriptVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) _out << nl << " * object does not support the requested type."; _out << nl << " */"; _out << nl << "static checkedCast(prx:" << icePrefix << getUnqualified("Ice.ObjectPrx", p->scope(), icePrefix) - << ", " - << "facet?:string, contex?:Map):" << icePrefix + << ", " << "facet?:string, contex?:Map):" << icePrefix << getUnqualified("Ice.AsyncResult", p->scope(), icePrefix) << "<" << fixId(p->name() + "Prx") << ">;"; _out << eb; diff --git a/cpp/src/slice2js/JsUtil.cpp b/cpp/src/slice2js/JsUtil.cpp index d2a97323a7a..02259f5d87e 100644 --- a/cpp/src/slice2js/JsUtil.cpp +++ b/cpp/src/slice2js/JsUtil.cpp @@ -105,7 +105,10 @@ lookupKwd(const string& name) "return", "static", "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with", "yield"}; bool found = binary_search( - &keywordList[0], &keywordList[sizeof(keywordList) / sizeof(*keywordList)], name, Slice::CICompare()); + &keywordList[0], + &keywordList[sizeof(keywordList) / sizeof(*keywordList)], + name, + Slice::CICompare()); if (found) { return "_" + name; @@ -366,23 +369,31 @@ Slice::JsGenerator::typeToString( return "void"; } - static const char* typeScriptBuiltinTable[] = {"number", // byte - "boolean", // bool - "number", // short - "number", // int - "Ice.Long", // long - "number", // float - "number", // double - "string", "Ice.Object", "Ice.ObjectPrx", "Ice.Value"}; - - static const char* javaScriptBuiltinTable[] = {"Number", // byte - "Boolean", // bool - "Number", // short - "Number", // int - "Ice.Long", // long - "Number", // float - "Number", // double - "String", "Ice.Value", "Ice.ObjectPrx", "Ice.Value"}; + static const char* typeScriptBuiltinTable[] = { + "number", // byte + "boolean", // bool + "number", // short + "number", // int + "Ice.Long", // long + "number", // float + "number", // double + "string", + "Ice.Object", + "Ice.ObjectPrx", + "Ice.Value"}; + + static const char* javaScriptBuiltinTable[] = { + "Number", // byte + "Boolean", // bool + "Number", // short + "Number", // int + "Ice.Long", // long + "Number", // float + "Number", // double + "String", + "Ice.Value", + "Ice.ObjectPrx", + "Ice.Value"}; BuiltinPtr builtin = dynamic_pointer_cast(type); if (builtin) diff --git a/cpp/src/slice2js/Main.cpp b/cpp/src/slice2js/Main.cpp index 9cb586d4a6d..25ea2357fa0 100644 --- a/cpp/src/slice2js/Main.cpp +++ b/cpp/src/slice2js/Main.cpp @@ -241,7 +241,8 @@ compile(const vector& argv) os, depend ? Preprocessor::JavaScript : (dependJSON ? Preprocessor::JavaScriptJSON : Preprocessor::SliceXML), - includePaths, "-D__SLICE2JS__")) + includePaths, + "-D__SLICE2JS__")) { return EXIT_FAILURE; } @@ -391,8 +392,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2matlab/Main.cpp b/cpp/src/slice2matlab/Main.cpp index dae3709b1ca..46a668c6324 100644 --- a/cpp/src/slice2matlab/Main.cpp +++ b/cpp/src/slice2matlab/Main.cpp @@ -238,9 +238,21 @@ namespace // // *Must* be kept in alphabetical order. // - static const string idList[] = {"addlistener", "checkedCast", "delete", "eq", "findobj", - "findprop", "ge", "gt", "isvalid", "le", - "lt", "ne", "notify", "uncheckedCast"}; + static const string idList[] = { + "addlistener", + "checkedCast", + "delete", + "eq", + "findobj", + "findprop", + "ge", + "gt", + "isvalid", + "le", + "lt", + "ne", + "notify", + "uncheckedCast"}; bool found = binary_search(&idList[0], &idList[sizeof(idList) / sizeof(*idList)], name); return found ? name + "_" : fixIdent(name); } @@ -374,7 +386,14 @@ namespace string typeToString(const TypePtr& type) { static const char* builtinTable[] = { - "uint8", "logical", "int16", "int32", "int64", "single", "double", "char", + "uint8", + "logical", + "int16", + "int32", + "int64", + "single", + "double", + "char", "Ice.Object", // Object "Ice.ObjectPrx", // ObjectPrx "Ice.Value" // Value @@ -2660,8 +2679,7 @@ CodeVisitor::visitExceptionStart(const ExceptionPtr& p) // // Constructor // - out << nl << "function " << self << " = " << name << spar << "ice_exid" - << "ice_exmsg" << allNames << epar; + out << nl << "function " << self << " = " << name << spar << "ice_exid" << "ice_exmsg" << allNames << epar; out.inc(); string exid = abs; const string exmsg = abs; @@ -2702,14 +2720,12 @@ CodeVisitor::visitExceptionStart(const ExceptionPtr& p) if (!base) { - out << nl << self << " = " << self << "@" - << "Ice.UserException" << spar << "ice_exid" - << "ice_exmsg" << epar << ';'; + out << nl << self << " = " << self << "@" << "Ice.UserException" << spar << "ice_exid" << "ice_exmsg" << epar + << ';'; } else { - out << nl << self << " = " << self << "@" << getAbsolute(base) << spar << "ice_exid" - << "ice_exmsg"; + out << nl << self << " = " << self << "@" << getAbsolute(base) << spar << "ice_exid" << "ice_exmsg"; for (MemberInfoList::const_iterator q = allMembers.begin(); q != allMembers.end(); ++q) { if (q->inherited) @@ -4185,8 +4201,8 @@ CodeVisitor::marshal( if (b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy && b->kind() != Builtin::KindValue) { - static const char* builtinTable[] = {"Byte", "Bool", "Short", "Int", "Long", "Float", - "Double", "String", "???", "???", "???", "???"}; + static const char* builtinTable[] = + {"Byte", "Bool", "Short", "Int", "Long", "Float", "Double", "String", "???", "???", "???", "???"}; string bs = builtinTable[b->kind()]; out << nl << stream << ".write" << builtinTable[b->kind()] << "Seq"; if (optional) @@ -4443,8 +4459,8 @@ CodeVisitor::unmarshal( if (b && b->kind() != Builtin::KindObject && b->kind() != Builtin::KindObjectProxy && b->kind() != Builtin::KindValue) { - static const char* builtinTable[] = {"Byte", "Bool", "Short", "Int", "Long", "Float", - "Double", "String", "???", "???", "???", "???"}; + static const char* builtinTable[] = + {"Byte", "Bool", "Short", "Int", "Long", "Float", "Double", "String", "???", "???", "???", "???"}; string bs = builtinTable[b->kind()]; out << nl << v << " = " << stream << ".read" << builtinTable[b->kind()] << "Seq"; if (optional) @@ -4720,7 +4736,10 @@ compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::MATLAB : Preprocessor::SliceXML, includePaths, "-D__SLICE2MATLAB__")) + os, + depend ? Preprocessor::MATLAB : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2MATLAB__")) { return EXIT_FAILURE; } @@ -4852,8 +4871,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 0588cecbd80..64aca0ff6c1 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -1502,7 +1502,10 @@ compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::PHP : Preprocessor::SliceXML, includePaths, "-D__SLICE2PHP__")) + os, + depend ? Preprocessor::PHP : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2PHP__")) { return EXIT_FAILURE; } @@ -1652,8 +1655,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2php/PHPUtil.cpp b/cpp/src/slice2php/PHPUtil.cpp index a1584ead1b2..a41bdc5d6e5 100644 --- a/cpp/src/slice2php/PHPUtil.cpp +++ b/cpp/src/slice2php/PHPUtil.cpp @@ -16,7 +16,9 @@ lowerCase(const string& s) { string result(s); transform( - result.begin(), result.end(), result.begin(), + result.begin(), + result.end(), + result.begin(), [](char c) { return static_cast(::tolower(static_cast(c))); }); return result; } diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp index e91f592d74c..86bb98bc0a9 100644 --- a/cpp/src/slice2py/Main.cpp +++ b/cpp/src/slice2py/Main.cpp @@ -31,8 +31,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2py/Python.cpp b/cpp/src/slice2py/Python.cpp index 5fc4c64e00d..9cfa48bd970 100644 --- a/cpp/src/slice2py/Python.cpp +++ b/cpp/src/slice2py/Python.cpp @@ -576,7 +576,11 @@ Slice::Python::compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::Python : Preprocessor::SliceXML, includePaths, "-D__SLICE2PY__", "", + os, + depend ? Preprocessor::Python : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2PY__", + "", prefix)) { return EXIT_FAILURE; diff --git a/cpp/src/slice2py/PythonUtil.cpp b/cpp/src/slice2py/PythonUtil.cpp index 57c6667987b..7af6e7c1d25 100644 --- a/cpp/src/slice2py/PythonUtil.cpp +++ b/cpp/src/slice2py/PythonUtil.cpp @@ -3062,7 +3062,9 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p) if (!builtin || builtin->kind() != Builtin::KindByte) { dc->warning( - InvalidMetaData, file, line, + InvalidMetaData, + file, + line, "ignoring invalid metadata `" + s + ": " + "`protobuf' encoding must be a byte sequence"); } else diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp index 74686360ef0..70c406beb1a 100644 --- a/cpp/src/slice2rb/Main.cpp +++ b/cpp/src/slice2rb/Main.cpp @@ -31,8 +31,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2rb/Ruby.cpp b/cpp/src/slice2rb/Ruby.cpp index f089dba0bc2..4e4cac23f43 100644 --- a/cpp/src/slice2rb/Ruby.cpp +++ b/cpp/src/slice2rb/Ruby.cpp @@ -182,7 +182,10 @@ Slice::Ruby::compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::Ruby : Preprocessor::SliceXML, includePaths, "-D__SLICE2RB__")) + os, + depend ? Preprocessor::Ruby : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2RB__")) { return EXIT_FAILURE; } diff --git a/cpp/src/slice2rb/RubyUtil.cpp b/cpp/src/slice2rb/RubyUtil.cpp index 5376f3283bb..1d9c4890e04 100644 --- a/cpp/src/slice2rb/RubyUtil.cpp +++ b/cpp/src/slice2rb/RubyUtil.cpp @@ -386,8 +386,7 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "end"; _classHistory.insert(scoped); // Avoid redundant declarations. - _out << sp << nl << "T_" << name << ".defineClass(" << name << ", " << p->compactId() << ", " - << "false, "; + _out << sp << nl << "T_" << name << ".defineClass(" << name << ", " << p->compactId() << ", " << "false, "; if (!base) { _out << "nil"; diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index 825f87af68b..9b127b809c4 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -325,7 +325,10 @@ Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList allIds; transform( - allBases.begin(), allBases.end(), back_inserter(allIds), [](const ContainedPtr& it) { return it->scoped(); }); + allBases.begin(), + allBases.end(), + back_inserter(allIds), + [](const ContainedPtr& it) { return it->scoped(); }); allIds.push_back(p->scoped()); allIds.push_back("::Ice::Object"); allIds.sort(); @@ -859,8 +862,7 @@ Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) out << nl << "v[key] = nil as " << valueType; out << nl << "Swift.withUnsafeMutablePointer(to: &v[key, default:nil])"; out << sb; - out << nl << "e.values[i] = Ice.DictEntry<" << keyType << ", " << valueType << ">(" - << "key: key, " + out << nl << "e.values[i] = Ice.DictEntry<" << keyType << ", " << valueType << ">(" << "key: key, " << "value: $0)"; out << eb; writeMarshalUnmarshalCode(out, p->valueType(), p, "e.values[i].value.pointee", false); @@ -1475,7 +1477,10 @@ Gen::ObjectVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) StringList allOpNames; transform( - allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const ContainedPtr& it) { return it->name(); }); + allOps.begin(), + allOps.end(), + back_inserter(allOpNames), + [](const ContainedPtr& it) { return it->name(); }); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); diff --git a/cpp/src/slice2swift/Main.cpp b/cpp/src/slice2swift/Main.cpp index d8a7bb8eee1..27b20365933 100644 --- a/cpp/src/slice2swift/Main.cpp +++ b/cpp/src/slice2swift/Main.cpp @@ -196,7 +196,10 @@ compile(const vector& argv) } if (!icecpp->printMakefileDependencies( - os, depend ? Preprocessor::Swift : Preprocessor::SliceXML, includePaths, "-D__SLICE2SWIFT__")) + os, + depend ? Preprocessor::Swift : Preprocessor::SliceXML, + includePaths, + "-D__SLICE2SWIFT__")) { return EXIT_FAILURE; } @@ -327,8 +330,7 @@ main(int argc, char* argv[]) } catch (...) { - consoleErr << args[0] << ": error:" - << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp index 5e4dfcab699..ddcb368c53d 100644 --- a/cpp/src/slice2swift/SwiftUtil.cpp +++ b/cpp/src/slice2swift/SwiftUtil.cpp @@ -102,7 +102,10 @@ namespace "while", "willSet"}; bool found = binary_search( - &keywordList[0], &keywordList[sizeof(keywordList) / sizeof(*keywordList)], name, Slice::CICompare()); + &keywordList[0], + &keywordList[sizeof(keywordList) / sizeof(*keywordList)], + name, + Slice::CICompare()); if (found) { return "`" + name + "`"; @@ -1106,8 +1109,14 @@ SwiftGenerator::typeToString( int typeCtx) { static const char* builtinTable[] = { - "Swift.UInt8", "Swift.Bool", "Swift.Int16", "Swift.Int32", - "Swift.Int64", "Swift.Float", "Swift.Double", "Swift.String", + "Swift.UInt8", + "Swift.Bool", + "Swift.Int16", + "Swift.Int32", + "Swift.Int64", + "Swift.Float", + "Swift.Double", + "Swift.String", "Ice.Disp", // Object "Ice.ObjectPrx", // ObjectPrx "Ice.Value" // Value @@ -1166,8 +1175,14 @@ string SwiftGenerator::getAbsolute(const TypePtr& type) { static const char* builtinTable[] = { - "Swift.UInt8", "Swift.Bool", "Swift.Int16", "Swift.Int32", - "Swift.Int64", "Swift.Float", "Swift.Double", "Swift.String", + "Swift.UInt8", + "Swift.Bool", + "Swift.Int16", + "Swift.Int32", + "Swift.Int64", + "Swift.Float", + "Swift.Double", + "Swift.String", "Ice.Disp", // Object "Ice.ObjectPrx", // ObjectPrx "Ice.Value" // Value @@ -1580,7 +1595,12 @@ SwiftGenerator::writeMembers( if (alias.empty()) { writeConstantValue( - out, type, member->defaultValueType(), defaultValue, p->getMetaData(), swiftModule, + out, + type, + member->defaultValueType(), + defaultValue, + p->getMetaData(), + swiftModule, member->optional()); } else @@ -1733,8 +1753,7 @@ SwiftGenerator::writeMarshalUnmarshalCode( out << nl << "typealias " << alias << " = " << memberType; } args += (alias.empty() ? memberType : alias) + ".self"; - out << nl << "try " << stream << ".read(" << args << ") { " << param << " = $0 " - << "}"; + out << nl << "try " << stream << ".read(" << args << ") { " << param << " = $0 " << "}"; } return; } @@ -2927,14 +2946,18 @@ SwiftGenerator::MetaDataVisitor::validate( if (!returnType) { dc->warning( - InvalidMetaData, file, line, + InvalidMetaData, + file, + line, "ignoring invalid metadata `" + s + "' for operation with void return type"); newMetaData.remove(s); } else if (!isNullableType(returnType)) { dc->warning( - InvalidMetaData, file, line, + InvalidMetaData, + file, + line, "ignoring invalid metadata `" + s + "' for operation with non nullable return type"); newMetaData.remove(s); } @@ -2947,7 +2970,10 @@ SwiftGenerator::MetaDataVisitor::validate( if (!isNullableType(dynamic_pointer_cast(cont))) { dc->warning( - InvalidMetaData, file, line, "ignoring invalid metadata `swift:nonnull' for non nullable type"); + InvalidMetaData, + file, + line, + "ignoring invalid metadata `swift:nonnull' for non nullable type"); newMetaData.remove(s); } continue; @@ -2964,7 +2990,9 @@ SwiftGenerator::MetaDataVisitor::validate( if (!isNullableType(seq->type())) { dc->warning( - InvalidMetaData, file, line, + InvalidMetaData, + file, + line, "ignoring invalid metadata `" + s + "' for sequence of non nullable type"); newMetaData.remove(s); } diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp index 956a685310d..52294ac3225 100644 --- a/cpp/test/Glacier2/router/Client.cpp +++ b/cpp/test/Glacier2/router/Client.cpp @@ -71,7 +71,8 @@ class MisbehavedClient final { auto communicator = initialize(initData); Glacier2::RouterPrx router( - communicator, "Glacier2/router:" + TestHelper::getTestEndpoint(communicator->getProperties(), 50)); + communicator, + "Glacier2/router:" + TestHelper::getTestEndpoint(communicator->getProperties(), 50)); communicator->setDefaultRouter(router); ostringstream os; @@ -160,7 +161,8 @@ class StressClient { auto communicator = initialize(initData); _router = Glacier2::RouterPrx( - communicator, "Glacier2/router:" + TestHelper::getTestEndpoint(communicator->getProperties(), 50)); + communicator, + "Glacier2/router:" + TestHelper::getTestEndpoint(communicator->getProperties(), 50)); communicator->setDefaultRouter(_router); ostringstream os; @@ -579,17 +581,29 @@ CallbackClient::run(int argc, char** argv) context["_fwd"] = "t"; AsyncCallback cb0; twoway->initiateConcurrentCallbackAsync( - 0, twowayR, [&cb0](int val) { cb0.response(val); }, [&cb0](exception_ptr e) { cb0.error(e); }, nullptr, + 0, + twowayR, + [&cb0](int val) { cb0.response(val); }, + [&cb0](exception_ptr e) { cb0.error(e); }, + nullptr, context); AsyncCallback cb1; twoway->initiateConcurrentCallbackAsync( - 1, twowayR, [&cb1](int val) { cb1.response(val); }, [&cb1](exception_ptr e) { cb1.error(e); }, nullptr, + 1, + twowayR, + [&cb1](int val) { cb1.response(val); }, + [&cb1](exception_ptr e) { cb1.error(e); }, + nullptr, context); AsyncCallback cb2; twoway->initiateConcurrentCallbackAsync( - 2, twowayR, [&cb2](int val) { cb2.response(val); }, [&cb2](exception_ptr e) { cb2.error(e); }, nullptr, + 2, + twowayR, + [&cb2](int val) { cb2.response(val); }, + [&cb2](exception_ptr e) { cb2.error(e); }, + nullptr, context); callbackReceiver->answerConcurrentCallbacks(3); diff --git a/cpp/test/Glacier2/router/Server.cpp b/cpp/test/Glacier2/router/Server.cpp index 300581b25b3..8734b2d2ff3 100644 --- a/cpp/test/Glacier2/router/Server.cpp +++ b/cpp/test/Glacier2/router/Server.cpp @@ -29,7 +29,8 @@ CallbackServer::run(int argc, char** argv) adapter->add(make_shared(), Ice::stringToIdentity("c2/callback")); // The test allows "c2" as category. adapter->add(make_shared(), Ice::stringToIdentity("c3/callback")); // The test rejects "c3" as category. adapter->add( - make_shared(), Ice::stringToIdentity("_userid/callback")); // The test allows the prefixed userid. + make_shared(), + Ice::stringToIdentity("_userid/callback")); // The test allows the prefixed userid. adapter->activate(); communicator->waitForShutdown(); } diff --git a/cpp/test/Ice/adapterDeactivation/TestI.cpp b/cpp/test/Ice/adapterDeactivation/TestI.cpp index 879466d881e..cf3a121831e 100644 --- a/cpp/test/Ice/adapterDeactivation/TestI.cpp +++ b/cpp/test/Ice/adapterDeactivation/TestI.cpp @@ -19,7 +19,8 @@ TestI::transient(const Current& current) { CommunicatorPtr communicator = current.adapter->getCommunicator(); ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints( - "TransientTestAdapter", TestHelper::getTestEndpoint(communicator->getProperties(), 1)); + "TransientTestAdapter", + TestHelper::getTestEndpoint(communicator->getProperties(), 1)); adapter->activate(); adapter->destroy(); } diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index b326220f2e2..3249a2ab291 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -95,7 +95,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->ice_isAAsync( - TestIntf::ice_staticId(), [&](bool value) { promise.set_value(value); }, + TestIntf::ice_staticId(), + [&](bool value) { promise.set_value(value); }, [&](exception_ptr ex) { promise.set_exception(ex); }); test(promise.get_future().get()); } @@ -103,7 +104,11 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->ice_isAAsync( - TestIntf::ice_staticId(), [&](bool value) { promise.set_value(value); }, nullptr, nullptr, ctx); + TestIntf::ice_staticId(), + [&](bool value) { promise.set_value(value); }, + nullptr, + nullptr, + ctx); test(promise.get_future().get()); } @@ -137,7 +142,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->ice_idAsync( - [&](const string& id) { promise.set_value(id); }, [&](exception_ptr ex) { promise.set_exception(ex); }); + [&](const string& id) { promise.set_value(id); }, + [&](exception_ptr ex) { promise.set_exception(ex); }); test(promise.get_future().get() == TestIntf::ice_staticId()); } { @@ -285,8 +291,7 @@ allTests(TestHelper* helper, bool collocated) } { promise promise; - p->opWithUEAsync( - nullptr, [&](exception_ptr ex) { promise.set_exception(ex); }, nullptr, ctx); + p->opWithUEAsync(nullptr, [&](exception_ptr ex) { promise.set_exception(ex); }, nullptr, ctx); try { @@ -320,7 +325,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->opWithResultAndUEAsync( - [&](int) { promise.set_value(); }, [&](exception_ptr ex) { promise.set_exception(ex); }); + [&](int) { promise.set_value(); }, + [&](exception_ptr ex) { promise.set_exception(ex); }); try { @@ -336,8 +342,7 @@ allTests(TestHelper* helper, bool collocated) } { promise promise; - p->opWithResultAndUEAsync( - nullptr, [&](exception_ptr ex) { promise.set_exception(ex); }, nullptr, ctx); + p->opWithResultAndUEAsync(nullptr, [&](exception_ptr ex) { promise.set_exception(ex); }, nullptr, ctx); try { @@ -442,7 +447,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->ice_oneway()->opWithResultAsync( - [&](int value) { promise.set_value(value); }, [&](exception_ptr ex) { promise.set_exception(ex); }); + [&](int value) { promise.set_value(value); }, + [&](exception_ptr ex) { promise.set_exception(ex); }); test(false); } catch (const TwowayOnlyException&) @@ -528,7 +534,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; i->ice_isAAsync( - TestIntf::ice_staticId(), [&](bool value) { promise.set_value(value); }, + TestIntf::ice_staticId(), + [&](bool value) { promise.set_value(value); }, [&](exception_ptr ex) { promise.set_exception(ex); }); try { @@ -572,7 +579,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->ice_isAAsync( - TestIntf::ice_staticId(), [&](bool value) { promise.set_value(value); }, + TestIntf::ice_staticId(), + [&](bool value) { promise.set_value(value); }, [&](exception_ptr ex) { promise.set_exception(ex); }); try { @@ -621,7 +629,8 @@ allTests(TestHelper* helper, bool collocated) promise sent; p->ice_isAAsync( - "", [&](bool value) { response.set_value(value); }, + "", + [&](bool value) { response.set_value(value); }, [&](exception_ptr ex) { response.set_exception(ex); }, [&](bool sentAsync) { sent.set_value(sentAsync); }); @@ -634,7 +643,8 @@ allTests(TestHelper* helper, bool collocated) promise sent; p->ice_pingAsync( - [&]() { response.set_value(); }, [&](exception_ptr ex) { response.set_exception(ex); }, + [&]() { response.set_value(); }, + [&](exception_ptr ex) { response.set_exception(ex); }, [&](bool sentAsync) { sent.set_value(sentAsync); }); sent.get_future().get(); @@ -646,7 +656,8 @@ allTests(TestHelper* helper, bool collocated) promise sent; p->ice_idAsync( - [&](string value) { response.set_value(value); }, [&](exception_ptr ex) { response.set_exception(ex); }, + [&](string value) { response.set_value(value); }, + [&](exception_ptr ex) { response.set_exception(ex); }, [&](bool sentAsync) { sent.set_value(sentAsync); }); sent.get_future().get(); @@ -671,7 +682,8 @@ allTests(TestHelper* helper, bool collocated) promise sent; p->opAsync( - [&]() { response.set_value(); }, [&](exception_ptr ex) { response.set_exception(ex); }, + [&]() { response.set_value(); }, + [&](exception_ptr ex) { response.set_exception(ex); }, [&](bool sentAsync) { sent.set_value(sentAsync); }); sent.get_future().get(); @@ -689,7 +701,9 @@ allTests(TestHelper* helper, bool collocated) auto s = make_shared>(); auto f = s->get_future(); p->opWithPayloadAsync( - seq, []() {}, [s](exception_ptr ex) { s->set_exception(ex); }, + seq, + []() {}, + [s](exception_ptr ex) { s->set_exception(ex); }, [s](bool value) { s->set_value(value); }); if (f.wait_for(chrono::seconds(0)) != future_status::ready || !f.get()) @@ -738,7 +752,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; p->opAsync( - nullptr, nullptr, + nullptr, + nullptr, [&, i](bool) { promise.set_value(); @@ -818,7 +833,8 @@ allTests(TestHelper* helper, bool collocated) promise promise; b1->ice_getConnection()->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(ex); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(ex); }, [&](bool sentSynchronously) { test( @@ -835,7 +851,8 @@ allTests(TestHelper* helper, bool collocated) auto id = this_thread::get_id(); promise promise; p->ice_getConnection()->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(ex); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(ex); }, [&](bool sentSynchronously) { test( @@ -855,7 +872,8 @@ allTests(TestHelper* helper, bool collocated) promise promise; b1->ice_getConnection()->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, [&](bool) { promise.set_value(); }); try @@ -898,7 +916,8 @@ allTests(TestHelper* helper, bool collocated) promise promise; auto id = this_thread::get_id(); communicator->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, [&](bool sentSynchronously) { test( @@ -923,7 +942,8 @@ allTests(TestHelper* helper, bool collocated) promise promise; auto id = this_thread::get_id(); communicator->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, [&](bool sentSynchronously) { test( @@ -952,7 +972,8 @@ allTests(TestHelper* helper, bool collocated) promise promise; auto id = this_thread::get_id(); communicator->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, [&](bool sentSynchronously) { test( @@ -984,7 +1005,8 @@ allTests(TestHelper* helper, bool collocated) promise promise; auto id = this_thread::get_id(); communicator->flushBatchRequestsAsync( - CompressBatch::BasedOnProxy, [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, + CompressBatch::BasedOnProxy, + [&](exception_ptr ex) { promise.set_exception(std::move(ex)); }, [&](bool sentSynchronously) { test( @@ -1006,7 +1028,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; auto cancel = p->ice_pingAsync( - [&]() { promise.set_value(); }, [&](exception_ptr ex) { promise.set_exception(ex); }); + [&]() { promise.set_value(); }, + [&](exception_ptr ex) { promise.set_exception(ex); }); cancel(); try @@ -1027,7 +1050,8 @@ allTests(TestHelper* helper, bool collocated) { promise promise; auto cancel = p->ice_idAsync( - [&](string) { promise.set_value(); }, [&](exception_ptr ex) { promise.set_exception(ex); }); + [&](string) { promise.set_value(); }, + [&](exception_ptr ex) { promise.set_exception(ex); }); cancel(); try @@ -1062,8 +1086,7 @@ allTests(TestHelper* helper, bool collocated) con->setCloseCallback([sc](ConnectionPtr) { sc->set_value(); }); auto fc = sc->get_future(); auto s = make_shared>(); - p->sleepAsync( - 100, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }); + p->sleepAsync(100, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }); auto f = s->get_future(); // Blocks until the request completes. con->close(ConnectionClose::GracefullyWithWait); @@ -1098,12 +1121,17 @@ allTests(TestHelper* helper, bool collocated) { auto s = make_shared>(); p->opWithPayloadAsync( - seq, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }); + seq, + [s]() { s->set_value(); }, + [s](exception_ptr ex) { s->set_exception(ex); }); results.push_back(s->get_future()); } atomic_flag sent = ATOMIC_FLAG_INIT; p->closeAsync( - CloseMode::GracefullyWithWait, nullptr, nullptr, [&sent](bool) { sent.test_and_set(); }); + CloseMode::GracefullyWithWait, + nullptr, + nullptr, + [&sent](bool) { sent.test_and_set(); }); if (!sent.test_and_set()) { for (int i = 0; i < maxQueue; i++) @@ -1111,7 +1139,9 @@ allTests(TestHelper* helper, bool collocated) auto s = make_shared>(); atomic_flag sent2 = ATOMIC_FLAG_INIT; p->opWithPayloadAsync( - seq, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }, + seq, + [s]() { s->set_value(); }, + [s](exception_ptr ex) { s->set_exception(ex); }, [&sent2](bool) { sent2.test_and_set(); }); results.push_back(s->get_future()); if (sent2.test_and_set()) @@ -1156,7 +1186,8 @@ allTests(TestHelper* helper, bool collocated) auto s = make_shared>(); auto sent = make_shared>(); p->startDispatchAsync( - [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }, + [s]() { s->set_value(); }, + [s](exception_ptr ex) { s->set_exception(ex); }, [sent](bool) { sent->set_value(); }); auto f = s->get_future(); sent->get_future().get(); // Ensure the request was sent before we close the connection. @@ -1181,8 +1212,7 @@ allTests(TestHelper* helper, bool collocated) con->setCloseCallback([sc](ConnectionPtr) { sc->set_value(); }); auto fc = sc->get_future(); s = make_shared>(); - p->sleepAsync( - 100, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }); + p->sleepAsync(100, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }); f = s->get_future(); p->close(CloseMode::Gracefully); // Close is delayed until sleep completes. fc.get(); // Ensure connection was closed. @@ -1208,7 +1238,8 @@ allTests(TestHelper* helper, bool collocated) auto s = make_shared>(); auto sent = make_shared>(); p->startDispatchAsync( - [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }, + [s]() { s->set_value(); }, + [s](exception_ptr ex) { s->set_exception(ex); }, [sent](bool) { sent->set_value(); }); auto f = s->get_future(); sent->get_future().get(); // Ensure the request was sent before we close the connection. diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 5d53956dcd0..658dc40c70f 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -77,7 +77,8 @@ allTests(TestHelper* helper) BackgroundPrx background(communicator, "background:" + endp); BackgroundControllerPrx backgroundController( - communicator, "backgroundController:" + helper->getTestEndpoint(1, "tcp")); + communicator, + "backgroundController:" + helper->getTestEndpoint(1, "tcp")); auto plugin = dynamic_pointer_cast(communicator->getPluginManager()->getPlugin("Test")); assert(plugin); @@ -267,7 +268,8 @@ connectTests(const ConfigurationPtr& configuration, const BackgroundPrx& backgro promise completed; promise sent; prx->opAsync( - []() { test(false); }, [&completed](exception_ptr) { completed.set_value(); }, + []() { test(false); }, + [&completed](exception_ptr) { completed.set_value(); }, [&sent](bool value) { sent.set_value(value); }); test(sent.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); completed.get_future().get(); @@ -278,7 +280,8 @@ connectTests(const ConfigurationPtr& configuration, const BackgroundPrx& backgro promise sent; prx->opAsync( - []() { test(false); }, [&completed](exception_ptr) { completed.set_value(); }, + []() { test(false); }, + [&completed](exception_ptr) { completed.set_value(); }, [&sent](bool value) { sent.set_value(value); }); test(sent.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); completed.get_future().get(); @@ -379,7 +382,8 @@ initializeTests( promise completed; prx->opAsync( - []() { test(false); }, [&completed](exception_ptr) { completed.set_value(); }, + []() { test(false); }, + [&completed](exception_ptr) { completed.set_value(); }, [&sent](bool value) { sent.set_value(value); }); test(sent.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); completed.get_future().get(); @@ -614,7 +618,8 @@ validationTests( promise completed; prx->opAsync( - []() { test(false); }, [&completed](exception_ptr) { completed.set_value(); }, + []() { test(false); }, + [&completed](exception_ptr) { completed.set_value(); }, [&sent](bool value) { sent.set_value(value); }); test(sent.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); completed.get_future().get(); @@ -695,11 +700,13 @@ validationTests( promise s2; background->opAsync( - [&p1]() { p1.set_value(); }, [&p1](exception_ptr e) { p1.set_exception(e); }, + [&p1]() { p1.set_value(); }, + [&p1](exception_ptr e) { p1.set_exception(e); }, [&s1](bool value) { s1.set_value(value); }); background->opAsync( - [&p2]() { p2.set_value(); }, [&p2](exception_ptr e) { p2.set_exception(e); }, + [&p2]() { p2.set_value(); }, + [&p2](exception_ptr e) { p2.set_exception(e); }, [&s2](bool value) { s2.set_value(value); }); test(s1.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); @@ -1112,34 +1119,43 @@ readWriteTests( // Fill up the receive and send buffers for (int i = 0; i < 200; ++i) // 2MB { - backgroundOneway->opWithPayloadAsync( - seq, []() { test(false); }, [](exception_ptr) { test(false); }); + backgroundOneway->opWithPayloadAsync(seq, []() { test(false); }, [](exception_ptr) { test(false); }); } promise c1; promise s1; background->opAsync( - [&c1]() { c1.set_value(); }, [](exception_ptr) { test(false); }, [&s1](bool value) { s1.set_value(value); }); + [&c1]() { c1.set_value(); }, + [](exception_ptr) { test(false); }, + [&s1](bool value) { s1.set_value(value); }); auto fs1 = s1.get_future(); test(fs1.wait_for(chrono::milliseconds(0)) != future_status::ready); promise c2; promise s2; background->opAsync( - [&c2]() { c2.set_value(); }, [](exception_ptr) { test(false); }, [&s2](bool value) { s2.set_value(value); }); + [&c2]() { c2.set_value(); }, + [](exception_ptr) { test(false); }, + [&s2](bool value) { s2.set_value(value); }); auto fs2 = s2.get_future(); test(fs2.wait_for(chrono::milliseconds(0)) != future_status::ready); promise s3; backgroundOneway->opWithPayloadAsync( - seq, []() { test(false); }, [](exception_ptr) { test(false); }, [&s3](bool value) { s3.set_value(value); }); + seq, + []() { test(false); }, + [](exception_ptr) { test(false); }, + [&s3](bool value) { s3.set_value(value); }); auto fs3 = s3.get_future(); test(fs3.wait_for(chrono::milliseconds(0)) != future_status::ready); promise s4; backgroundOneway->opWithPayloadAsync( - seq, []() { test(false); }, [](exception_ptr) { test(false); }, [&s4](bool value) { s4.set_value(value); }); + seq, + []() { test(false); }, + [](exception_ptr) { test(false); }, + [&s4](bool value) { s4.set_value(value); }); auto fs4 = s4.get_future(); test(fs4.wait_for(chrono::milliseconds(0)) != future_status::ready); diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp index 3656374fe36..ddb00d3e1bd 100644 --- a/cpp/test/Ice/custom/AllTests.cpp +++ b/cpp/test/Ice/custom/AllTests.cpp @@ -1708,7 +1708,8 @@ allTests(TestHelper* helper) promise done; wsc1->throwExceptAsync( - wstr, [&]() { done.set_value(false); }, + wstr, + [&]() { done.set_value(false); }, [&](std::exception_ptr eptr) { try @@ -1755,7 +1756,8 @@ allTests(TestHelper* helper) promise done; wsc2->throwExceptAsync( - wstr, [&]() { done.set_value(false); }, + wstr, + [&]() { done.set_value(false); }, [&](std::exception_ptr eptr) { try diff --git a/cpp/test/Ice/echo/BlobjectI.cpp b/cpp/test/Ice/echo/BlobjectI.cpp index b2e4f1c6fdd..c2c38925bc0 100644 --- a/cpp/test/Ice/echo/BlobjectI.cpp +++ b/cpp/test/Ice/echo/BlobjectI.cpp @@ -68,8 +68,13 @@ BlobjectI::ice_invokeAsync( else { obj->ice_oneway()->ice_invokeAsync( - current.operation, current.mode, inEncaps, [](bool, const std::vector&) { assert(0); }, ex, - [&](bool) { response(true, vector()); }, current.ctx); + current.operation, + current.mode, + inEncaps, + [](bool, const std::vector&) { assert(0); }, + ex, + [&](bool) { response(true, vector()); }, + current.ctx); } } else diff --git a/cpp/test/Ice/enums/AllTests.cpp b/cpp/test/Ice/enums/AllTests.cpp index eb53396fcea..97d252e0f8a 100644 --- a/cpp/test/Ice/enums/AllTests.cpp +++ b/cpp/test/Ice/enums/AllTests.cpp @@ -91,9 +91,18 @@ allTests(Test::TestHelper* helper) cout << "testing enum sequences operations... " << flush; { - ByteEnum values[] = {ByteEnum::benum1, ByteEnum::benum2, ByteEnum::benum3, ByteEnum::benum4, - ByteEnum::benum5, ByteEnum::benum6, ByteEnum::benum7, ByteEnum::benum8, - ByteEnum::benum9, ByteEnum::benum10, ByteEnum::benum11}; + ByteEnum values[] = { + ByteEnum::benum1, + ByteEnum::benum2, + ByteEnum::benum3, + ByteEnum::benum4, + ByteEnum::benum5, + ByteEnum::benum6, + ByteEnum::benum7, + ByteEnum::benum8, + ByteEnum::benum9, + ByteEnum::benum10, + ByteEnum::benum11}; ByteEnumSeq b1(&values[0], &values[0] + sizeof(values) / sizeof(ByteEnum)); ByteEnumSeq b2; @@ -107,9 +116,18 @@ allTests(Test::TestHelper* helper) } { - ShortEnum values[] = {ShortEnum::senum1, ShortEnum::senum2, ShortEnum::senum3, ShortEnum::senum4, - ShortEnum::senum5, ShortEnum::senum6, ShortEnum::senum7, ShortEnum::senum8, - ShortEnum::senum9, ShortEnum::senum10, ShortEnum::senum11}; + ShortEnum values[] = { + ShortEnum::senum1, + ShortEnum::senum2, + ShortEnum::senum3, + ShortEnum::senum4, + ShortEnum::senum5, + ShortEnum::senum6, + ShortEnum::senum7, + ShortEnum::senum8, + ShortEnum::senum9, + ShortEnum::senum10, + ShortEnum::senum11}; ShortEnumSeq s1(&values[0], &values[0] + sizeof(values) / sizeof(ShortEnum)); ShortEnumSeq s2; @@ -123,9 +141,18 @@ allTests(Test::TestHelper* helper) } { - IntEnum values[] = {IntEnum::ienum1, IntEnum::ienum2, IntEnum::ienum3, IntEnum::ienum4, - IntEnum::ienum5, IntEnum::ienum6, IntEnum::ienum7, IntEnum::ienum8, - IntEnum::ienum9, IntEnum::ienum10, IntEnum::ienum11}; + IntEnum values[] = { + IntEnum::ienum1, + IntEnum::ienum2, + IntEnum::ienum3, + IntEnum::ienum4, + IntEnum::ienum5, + IntEnum::ienum6, + IntEnum::ienum7, + IntEnum::ienum8, + IntEnum::ienum9, + IntEnum::ienum10, + IntEnum::ienum11}; IntEnumSeq i1(&values[0], &values[0] + sizeof(values) / sizeof(IntEnum)); IntEnumSeq i2; diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index e485796ece7..eaa20e85294 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -858,43 +858,37 @@ allTests(Test::TestHelper* helper) // { promise sent; - thrower->throwAasAAsync( - 1, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); + thrower->throwAasAAsync(1, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); sent.get_future().get(); // Wait for sent } { promise sent; - thrower->throwAorDasAorDAsync( - 1, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); + thrower->throwAorDasAorDAsync(1, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); sent.get_future().get(); // Wait for sent } { promise sent; - thrower->throwAorDasAorDAsync( - -1, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); + thrower->throwAorDasAorDAsync(-1, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); sent.get_future().get(); // Wait for sent } { promise sent; - thrower->throwBasBAsync( - 1, 2, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); + thrower->throwBasBAsync(1, 2, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); sent.get_future().get(); // Wait for sent } { promise sent; - thrower->throwCasCAsync( - 1, 2, 3, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); + thrower->throwCasCAsync(1, 2, 3, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); sent.get_future().get(); // Wait for sent } { promise sent; - thrower->throwModAAsync( - 1, 2, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); + thrower->throwModAAsync(1, 2, []() { test(false); }, nullptr, [&](bool value) { sent.set_value(value); }); sent.get_future().get(); // Wait for sent } cout << "ok" << endl; diff --git a/cpp/test/Ice/executor/AllTests.cpp b/cpp/test/Ice/executor/AllTests.cpp index 3dbd29c481b..4ae3a49cafa 100644 --- a/cpp/test/Ice/executor/AllTests.cpp +++ b/cpp/test/Ice/executor/AllTests.cpp @@ -130,7 +130,8 @@ allTests(TestHelper* helper) // auto to = p->ice_invocationTimeout(10); to->sleepAsync( - 500, [cb]() { cb->responseEx(); }, + 500, + [cb]() { cb->responseEx(); }, [cb](exception_ptr err) { try @@ -161,7 +162,9 @@ allTests(TestHelper* helper) auto c = make_shared>(); p->opWithPayloadAsync( - seq, [=]() { c->set_value(); }, [=](exception_ptr) { c->set_value(); }, + seq, + [=]() { c->set_value(); }, + [=](exception_ptr) { c->set_value(); }, [=](bool sent) { s->set_value(sent); }); completed.push_back(c); diff --git a/cpp/test/Ice/hold/AllTests.cpp b/cpp/test/Ice/hold/AllTests.cpp index 95a14b3d6dd..c858834b723 100644 --- a/cpp/test/Ice/hold/AllTests.cpp +++ b/cpp/test/Ice/hold/AllTests.cpp @@ -74,7 +74,8 @@ allTests(Test::TestHelper* helper) auto sent = make_shared>(); auto expected = value; hold->setAsync( - value + 1, static_cast(IceUtilInternal::random(5)), + value + 1, + static_cast(IceUtilInternal::random(5)), [cond, expected, completed](int val) { if (val != expected) @@ -116,7 +117,8 @@ allTests(Test::TestHelper* helper) auto sent = make_shared>(); auto expected = value; holdSerialized->setAsync( - value + 1, static_cast(IceUtilInternal::random(1)), + value + 1, + static_cast(IceUtilInternal::random(1)), [cond, expected, completed](int val) { if (val != expected) @@ -158,7 +160,10 @@ allTests(Test::TestHelper* helper) { completed = make_shared>(); holdSerializedOneway->setOnewayAsync( - value + 1, value, nullptr, [](exception_ptr) {}, + value + 1, + value, + nullptr, + [](exception_ptr) {}, [completed](bool /*sentSynchronously*/) { completed->set_value(); }); ++value; if ((i % 100) == 0) diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp index d216dc998fe..0aa050a1679 100644 --- a/cpp/test/Ice/info/AllTests.cpp +++ b/cpp/test/Ice/info/AllTests.cpp @@ -46,9 +46,10 @@ allTests(Test::TestHelper* helper) cout << "testing proxy endpoint information... " << flush; { Ice::ObjectPrx p1( - communicator, "test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" - "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" - "opaque -e 1.8 -t 100 -v ABCD"); + communicator, + "test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" + "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" + "opaque -e 1.8 -t 100 -v ABCD"); Ice::EndpointSeq endps = p1->ice_getEndpoints(); @@ -102,7 +103,8 @@ allTests(Test::TestHelper* helper) cout << "test object adapter endpoint information... " << flush; { communicator->getProperties()->setProperty( - "TestAdapter.Endpoints", "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1"); + "TestAdapter.Endpoints", + "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::EndpointSeq endpoints = adapter->getEndpoints(); @@ -162,7 +164,8 @@ allTests(Test::TestHelper* helper) int port = helper->getTestPort(); TestIntfPrx testIntf( - communicator, "test:" + helper->getTestEndpoint() + ":" + helper->getTestEndpoint("udp") + " -c"); + communicator, + "test:" + helper->getTestEndpoint() + ":" + helper->getTestEndpoint("udp") + " -c"); cout << "test connection endpoint information... " << flush; { diff --git a/cpp/test/Ice/info/Server.cpp b/cpp/test/Ice/info/Server.cpp index b2e03a39587..3d17cccd90a 100644 --- a/cpp/test/Ice/info/Server.cpp +++ b/cpp/test/Ice/info/Server.cpp @@ -19,7 +19,8 @@ Server::run(int argc, char** argv) { Ice::CommunicatorHolder communicator = initialize(argc, argv); communicator->getProperties()->setProperty( - "TestAdapter.Endpoints", getTestEndpoint() + ":" + getTestEndpoint("udp")); + "TestAdapter.Endpoints", + getTestEndpoint() + ":" + getTestEndpoint("udp")); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(std::make_shared(), Ice::stringToIdentity("test")); adapter->activate(); diff --git a/cpp/test/Ice/invoke/AllTests.cpp b/cpp/test/Ice/invoke/AllTests.cpp index dbd7c8d9461..510e20f9260 100644 --- a/cpp/test/Ice/invoke/AllTests.cpp +++ b/cpp/test/Ice/invoke/AllTests.cpp @@ -114,8 +114,12 @@ allTests(Test::TestHelper* helper) { ByteSeq inEncaps; batchOneway->ice_invokeAsync( - "opOneway", OperationMode::Normal, inEncaps, [](bool, const vector) { test(false); }, - [](exception_ptr) { test(false); }, [](bool) { test(false); }); + "opOneway", + OperationMode::Normal, + inEncaps, + [](bool, const vector) { test(false); }, + [](exception_ptr) { test(false); }, + [](bool) { test(false); }); batchOneway->ice_flushBatchRequests(); } // @@ -147,8 +151,12 @@ allTests(Test::TestHelper* helper) promise completed; ByteSeq inEncaps, outEncaps; oneway->ice_invokeAsync( - "opOneway", OperationMode::Normal, inEncaps, nullptr, - [&](exception_ptr ex) { completed.set_exception(ex); }, [&](bool) { completed.set_value(true); }); + "opOneway", + OperationMode::Normal, + inEncaps, + nullptr, + [&](exception_ptr ex) { completed.set_exception(ex); }, + [&](bool) { completed.set_value(true); }); test(completed.get_future().get()); } @@ -174,7 +182,9 @@ allTests(Test::TestHelper* helper) out.finished(inEncaps); cl->ice_invokeAsync( - "opString", OperationMode::Normal, inEncaps, + "opString", + OperationMode::Normal, + inEncaps, [&](bool ok, vector outParams) { outEncaps = std::move(outParams); @@ -229,13 +239,16 @@ allTests(Test::TestHelper* helper) auto inPair = make_pair(inEncaps.data(), inEncaps.data() + inEncaps.size()); cl->ice_invokeAsync( - "opString", OperationMode::Normal, inPair, + "opString", + OperationMode::Normal, + inPair, [&](bool ok, pair outParams) { vector(outParams.first, outParams.second).swap(outEncaps); completed.set_value(ok); }, - [&](exception_ptr ex) { completed.set_exception(ex); }, [&](bool) { sent.set_value(); }); + [&](exception_ptr ex) { completed.set_exception(ex); }, + [&](bool) { sent.set_value(); }); sent.get_future().get(); // Ensure sent callback was called test(completed.get_future().get()); @@ -281,13 +294,16 @@ allTests(Test::TestHelper* helper) ByteSeq inEncaps, outEncaps; cl->ice_invokeAsync( - "opException", OperationMode::Normal, inEncaps, + "opException", + OperationMode::Normal, + inEncaps, [&](bool ok, vector outParams) { outEncaps = std::move(outParams); completed.set_value(ok); }, - [&](exception_ptr ex) { completed.set_exception(ex); }, [&](bool) { sent.set_value(); }); + [&](exception_ptr ex) { completed.set_exception(ex); }, + [&](bool) { sent.set_value(); }); sent.get_future().get(); // Ensure sent callback was called test(!completed.get_future().get()); diff --git a/cpp/test/Ice/invoke/BlobjectI.cpp b/cpp/test/Ice/invoke/BlobjectI.cpp index 21bca119929..aca68d747b2 100644 --- a/cpp/test/Ice/invoke/BlobjectI.cpp +++ b/cpp/test/Ice/invoke/BlobjectI.cpp @@ -121,7 +121,8 @@ BlobjectArrayAsyncI::ice_invokeAsync( vector outEncaps; bool ok = invokeInternal(in, outEncaps, current); pair outPair( - static_cast(nullptr), static_cast(nullptr)); + static_cast(nullptr), + static_cast(nullptr)); if (outEncaps.size() != 0) { outPair.first = &outEncaps[0]; diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index 4d401cf9f6d..e0e2b53bc25 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -362,7 +362,8 @@ allTests(Test::TestHelper* helper, const string& ref) { ObjectPrx(communicator, "test@TestAdapter3")->ice_ping(); registry->setAdapterDirectProxy( - "TestAdapter3", ObjectPrx(communicator, "dummy:" + helper->getTestEndpoint(99))); + "TestAdapter3", + ObjectPrx(communicator, "dummy:" + helper->getTestEndpoint(99))); ObjectPrx(communicator, "test@TestAdapter3")->ice_ping(); } catch (const Ice::LocalException&) diff --git a/cpp/test/Ice/location/TestI.cpp b/cpp/test/Ice/location/TestI.cpp index 0adde5d03bb..3007a3f115f 100644 --- a/cpp/test/Ice/location/TestI.cpp +++ b/cpp/test/Ice/location/TestI.cpp @@ -56,9 +56,11 @@ ServerManagerI::startServer(const Current&) { PropertiesPtr props = _initData.properties; serverCommunicator->getProperties()->setProperty( - "TestAdapter.Endpoints", TestHelper::getTestEndpoint(props, _nextPort++)); + "TestAdapter.Endpoints", + TestHelper::getTestEndpoint(props, _nextPort++)); serverCommunicator->getProperties()->setProperty( - "TestAdapter2.Endpoints", TestHelper::getTestEndpoint(props, _nextPort++)); + "TestAdapter2.Endpoints", + TestHelper::getTestEndpoint(props, _nextPort++)); adapter = serverCommunicator->createObjectAdapter("TestAdapter"); adapter2 = serverCommunicator->createObjectAdapter("TestAdapter2"); diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index 142257a7fbc..a02a9a0a9c6 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -699,17 +699,47 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "parent", "Communicator", c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "id", hostAndPort, c); testAttribute( - clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c); + clientMetrics, + clientProps, + update.get(), + "ConnectionEstablishment", + "endpoint", + endpoint + " -t 60000", + c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointType", type, c); testAttribute( - clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointIsDatagram", "false", c); + clientMetrics, + clientProps, + update.get(), + "ConnectionEstablishment", + "endpointIsDatagram", + "false", + c); testAttribute( - clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointIsSecure", isSecure, c); + clientMetrics, + clientProps, + update.get(), + "ConnectionEstablishment", + "endpointIsSecure", + isSecure, + c); testAttribute( - clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointTimeout", "60000", c); + clientMetrics, + clientProps, + update.get(), + "ConnectionEstablishment", + "endpointTimeout", + "60000", + c); testAttribute( - clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointCompress", "false", c); + clientMetrics, + clientProps, + update.get(), + "ConnectionEstablishment", + "endpointCompress", + "false", + c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointHost", host, c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointPort", port, c); @@ -767,11 +797,21 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "parent", "Communicator", c); testAttribute( - clientMetrics, clientProps, update.get(), "EndpointLookup", "id", - prx->ice_getConnection()->getEndpoint()->toString(), c); + clientMetrics, + clientProps, + update.get(), + "EndpointLookup", + "id", + prx->ice_getConnection()->getEndpoint()->toString(), + c); testAttribute( - clientMetrics, clientProps, update.get(), "EndpointLookup", "endpoint", - prx->ice_getConnection()->getEndpoint()->toString(), c); + clientMetrics, + clientProps, + update.get(), + "EndpointLookup", + "endpoint", + prx->ice_getConnection()->getEndpoint()->toString(), + c); testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointType", type, c); testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointIsDatagram", "false", c); @@ -1209,7 +1249,12 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) testAttribute(clientMetrics, clientProps, update.get(), "Invocation", "encoding", "1.1", op); testAttribute(clientMetrics, clientProps, update.get(), "Invocation", "mode", "twoway", op); testAttribute( - clientMetrics, clientProps, update.get(), "Invocation", "proxy", "metrics -t -e 1.1:" + endpoint + " -t 60000", + clientMetrics, + clientProps, + update.get(), + "Invocation", + "proxy", + "metrics -t -e 1.1:" + endpoint + " -t 60000", op); testAttribute(clientMetrics, clientProps, update.get(), "Invocation", "context.entry1", "test", op); testAttribute(clientMetrics, clientProps, update.get(), "Invocation", "context.entry2", "", op); @@ -1259,7 +1304,13 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) test(im1->remotes.size() == 0); testAttribute( - clientMetrics, clientProps, update.get(), "Invocation", "mode", "batch-oneway", InvokeOp(metricsBatchOneway)); + clientMetrics, + clientProps, + update.get(), + "Invocation", + "mode", + "batch-oneway", + InvokeOp(metricsBatchOneway)); // // Tests flushBatchRequests diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp index 4a606ea659c..309e554e716 100644 --- a/cpp/test/Ice/objects/AllTests.cpp +++ b/cpp/test/Ice/objects/AllTests.cpp @@ -14,7 +14,8 @@ namespace void testUOE(const Ice::CommunicatorPtr& communicator) { UnexpectedObjectExceptionTestPrx uoet( - communicator, "uoet:" + TestHelper::getTestEndpoint(communicator->getProperties())); + communicator, + "uoet:" + TestHelper::getTestEndpoint(communicator->getProperties())); try { diff --git a/cpp/test/Ice/operations/OnewaysAMI.cpp b/cpp/test/Ice/operations/OnewaysAMI.cpp index a16736f9adf..3d859cec920 100644 --- a/cpp/test/Ice/operations/OnewaysAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysAMI.cpp @@ -58,8 +58,7 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrx& proxy) { CallbackPtr cb = std::make_shared(); - p->ice_pingAsync( - nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); + p->ice_pingAsync(nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); cb->check(); } @@ -98,22 +97,19 @@ onewaysAMI(const Ice::CommunicatorPtr&, const Test::MyClassPrx& proxy) { CallbackPtr cb = std::make_shared(); - p->opVoidAsync( - nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); + p->opVoidAsync(nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); cb->check(); } { CallbackPtr cb = std::make_shared(); - p->opIdempotentAsync( - nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); + p->opIdempotentAsync(nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); cb->check(); } { CallbackPtr cb = std::make_shared(); - p->opNonmutatingAsync( - nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); + p->opNonmutatingAsync(nullptr, [](exception_ptr) { test(false); }, [&](bool sent) { cb->sent(sent); }); cb->check(); } diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 62186201688..e2581ab0dc8 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -209,14 +209,24 @@ twoways(const Ice::CommunicatorPtr& communicator, Test::TestHelper*, const Test: test(r == 12); r = p->opShortIntLong( - numeric_limits::min(), numeric_limits::min(), numeric_limits::min(), s, i, l); + numeric_limits::min(), + numeric_limits::min(), + numeric_limits::min(), + s, + i, + l); test(s == numeric_limits::min()); test(i == numeric_limits::min()); test(l == numeric_limits::min()); test(r == numeric_limits::min()); r = p->opShortIntLong( - numeric_limits::max(), numeric_limits::max(), numeric_limits::max(), s, i, l); + numeric_limits::max(), + numeric_limits::max(), + numeric_limits::max(), + s, + i, + l); test(s == numeric_limits::max()); test(i == numeric_limits::max()); test(l == numeric_limits::max()); diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index a419de497d6..adb33c046d7 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -1015,8 +1015,7 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) { CallbackPtr cb = make_shared(); - p->ice_isAAsync( - MyClass::ice_staticId(), [&](bool v) { cb->isA(v); }, makeExceptionClosure(cb)); + p->ice_isAAsync(MyClass::ice_staticId(), [&](bool v) { cb->isA(v); }, makeExceptionClosure(cb)); cb->check(); } @@ -1041,22 +1040,26 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) { CallbackPtr cb = make_shared(); p->opByteAsync( - uint8_t(0xff), uint8_t(0x0f), [&](uint8_t b1, uint8_t b2) { cb->opByte(b1, b2); }, + uint8_t(0xff), + uint8_t(0x0f), + [&](uint8_t b1, uint8_t b2) { cb->opByte(b1, b2); }, makeExceptionClosure(cb)); cb->check(); } { CallbackPtr cb = make_shared(); - p->opBoolAsync( - true, false, [&](bool b1, bool b2) { cb->opBool(b1, b2); }, makeExceptionClosure(cb)); + p->opBoolAsync(true, false, [&](bool b1, bool b2) { cb->opBool(b1, b2); }, makeExceptionClosure(cb)); cb->check(); } { CallbackPtr cb = make_shared(); p->opShortIntLongAsync( - 10, 11, 12, [&](int64_t l1, short s1P, int i1, int64_t l2) { cb->opShortIntLong(l1, s1P, i1, l2); }, + 10, + 11, + 12, + [&](int64_t l1, short s1P, int i1, int64_t l2) { cb->opShortIntLong(l1, s1P, i1, l2); }, makeExceptionClosure(cb)); cb->check(); } @@ -1064,7 +1067,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) { CallbackPtr cb = make_shared(); p->opFloatDoubleAsync( - 3.14f, 1.1E10, [&](double d1, float f1, double d2) { cb->opFloatDouble(d1, f1, d2); }, + 3.14f, + 1.1E10, + [&](double d1, float f1, double d2) { cb->opFloatDouble(d1, f1, d2); }, makeExceptionClosure(cb)); cb->check(); } @@ -1072,15 +1077,16 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) { CallbackPtr cb = make_shared(); p->opStringAsync( - "hello", "world", [&](string s1P, string s2P) { cb->opString(std::move(s1P), std::move(s2P)); }, + "hello", + "world", + [&](string s1P, string s2P) { cb->opString(std::move(s1P), std::move(s2P)); }, makeExceptionClosure(cb)); cb->check(); } { CallbackPtr cb = make_shared(); - p->opMyEnumAsync( - MyEnum::enum2, [&](MyEnum e1, MyEnum e2) { cb->opMyEnum(e1, e2); }, makeExceptionClosure(cb)); + p->opMyEnumAsync(MyEnum::enum2, [&](MyEnum e1, MyEnum e2) { cb->opMyEnum(e1, e2); }, makeExceptionClosure(cb)); cb->check(); } @@ -1106,7 +1112,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(communicator); p->opStructAsync( - si1, si2, [&](Structure si3, Structure si4) { cb->opStruct(std::move(si3), std::move(si4)); }, + si1, + si2, + [&](Structure si3, Structure si4) { cb->opStruct(std::move(si3), std::move(si4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1127,7 +1135,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opByteSAsync( - bsi1, bsi2, [&](ByteS bsi3, ByteS bsi4) { cb->opByteS(std::move(bsi3), std::move(bsi4)); }, + bsi1, + bsi2, + [&](ByteS bsi3, ByteS bsi4) { cb->opByteS(std::move(bsi3), std::move(bsi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1144,7 +1154,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opBoolSAsync( - bsi1, bsi2, [&](BoolS bsi3, BoolS bsi4) { cb->opBoolS(std::move(bsi3), std::move(bsi4)); }, + bsi1, + bsi2, + [&](BoolS bsi3, BoolS bsi4) { cb->opBoolS(std::move(bsi3), std::move(bsi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1169,7 +1181,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opShortIntLongSAsync( - ssi, isi, lsi, + ssi, + isi, + lsi, [&](LongS lsi1, ShortS ssi1, IntS isi1, LongS lsi2) { cb->opShortIntLongS(std::move(lsi1), std::move(ssi1), std::move(isi1), std::move(lsi2)); }, makeExceptionClosure(cb)); @@ -1189,7 +1203,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opFloatDoubleSAsync( - fsi, dsi, + fsi, + dsi, [&](DoubleS dsi1, FloatS fsi1, DoubleS dsi2) { cb->opFloatDoubleS(std::move(dsi1), std::move(fsi1), std::move(dsi2)); }, makeExceptionClosure(cb)); @@ -1208,7 +1223,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringSAsync( - ssi1, ssi2, [&](StringS ssi3, StringS ssi4) { cb->opStringS(std::move(ssi3), std::move(ssi4)); }, + ssi1, + ssi2, + [&](StringS ssi3, StringS ssi4) { cb->opStringS(std::move(ssi3), std::move(ssi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1230,7 +1247,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opByteSSAsync( - bsi1, bsi2, [&](ByteSS bsi3, ByteSS bsi4) { cb->opByteSS(std::move(bsi3), std::move(bsi4)); }, + bsi1, + bsi2, + [&](ByteSS bsi3, ByteSS bsi4) { cb->opByteSS(std::move(bsi3), std::move(bsi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1252,7 +1271,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opBoolSSAsync( - bsi1, bsi2, [&](BoolSS bsi3, BoolSS bsi4) { cb->opBoolSS(std::move(bsi3), std::move(bsi4)); }, + bsi1, + bsi2, + [&](BoolSS bsi3, BoolSS bsi4) { cb->opBoolSS(std::move(bsi3), std::move(bsi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1276,7 +1297,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opShortIntLongSSAsync( - ssi, isi, lsi, + ssi, + isi, + lsi, [&](LongSS lsi1, ShortSS ssi1, IntSS isi1, LongSS lsi2) { cb->opShortIntLongSS(std::move(lsi1), std::move(ssi1), std::move(isi1), std::move(lsi2)); }, makeExceptionClosure(cb)); @@ -1298,7 +1321,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opFloatDoubleSSAsync( - fsi, dsi, + fsi, + dsi, [&](DoubleSS dsi1, FloatSS fsi1, DoubleSS dsi2) { cb->opFloatDoubleSS(std::move(dsi1), std::move(fsi1), std::move(dsi2)); }, makeExceptionClosure(cb)); @@ -1319,7 +1343,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringSSAsync( - ssi1, ssi2, [&](StringSS ssi3, StringSS ssi4) { cb->opStringSS(std::move(ssi3), std::move(ssi4)); }, + ssi1, + ssi2, + [&](StringSS ssi3, StringSS ssi4) { cb->opStringSS(std::move(ssi3), std::move(ssi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1335,7 +1361,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opByteBoolDAsync( - di1, di2, [&](ByteBoolD di3, ByteBoolD di4) { cb->opByteBoolD(std::move(di3), std::move(di4)); }, + di1, + di2, + [&](ByteBoolD di3, ByteBoolD di4) { cb->opByteBoolD(std::move(di3), std::move(di4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1351,7 +1379,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opShortIntDAsync( - di1, di2, [&](ShortIntD di3, ShortIntD di4) { cb->opShortIntD(std::move(di3), std::move(di4)); }, + di1, + di2, + [&](ShortIntD di3, ShortIntD di4) { cb->opShortIntD(std::move(di3), std::move(di4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1367,7 +1397,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opLongFloatDAsync( - di1, di2, [&](LongFloatD di3, LongFloatD di4) { cb->opLongFloatD(std::move(di3), std::move(di4)); }, + di1, + di2, + [&](LongFloatD di3, LongFloatD di4) { cb->opLongFloatD(std::move(di3), std::move(di4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1383,7 +1415,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringStringDAsync( - di1, di2, + di1, + di2, [&](StringStringD di3, StringStringD di4) { cb->opStringStringD(std::move(di3), std::move(di4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1400,7 +1433,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringMyEnumDAsync( - di1, di2, + di1, + di2, [&](StringMyEnumD di3, StringMyEnumD di4) { cb->opStringMyEnumD(std::move(di3), std::move(di4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1422,7 +1456,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opMyStructMyEnumDAsync( - di1, di2, + di1, + di2, [&](MyStructMyEnumD di3, MyStructMyEnumD di4) { cb->opMyStructMyEnumD(std::move(di3), std::move(di4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1451,7 +1486,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opByteBoolDSAsync( - dsi1, dsi2, [&](ByteBoolDS dsi3, ByteBoolDS dsi4) { cb->opByteBoolDS(std::move(dsi3), std::move(dsi4)); }, + dsi1, + dsi2, + [&](ByteBoolDS dsi3, ByteBoolDS dsi4) { cb->opByteBoolDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1478,7 +1515,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opShortIntDSAsync( - dsi1, dsi2, [&](ShortIntDS dsi3, ShortIntDS dsi4) { cb->opShortIntDS(std::move(dsi3), std::move(dsi4)); }, + dsi1, + dsi2, + [&](ShortIntDS dsi3, ShortIntDS dsi4) { cb->opShortIntDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1505,7 +1544,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opLongFloatDSAsync( - dsi1, dsi2, + dsi1, + dsi2, [&](LongFloatDS dsi3, LongFloatDS dsi4) { cb->opLongFloatDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1533,7 +1573,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringStringDSAsync( - dsi1, dsi2, + dsi1, + dsi2, [&](StringStringDS dsi3, StringStringDS dsi4) { cb->opStringStringDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1561,7 +1602,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringMyEnumDSAsync( - dsi1, dsi2, + dsi1, + dsi2, [&](StringMyEnumDS dsi3, StringMyEnumDS dsi4) { cb->opStringMyEnumDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1587,7 +1629,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opMyEnumStringDSAsync( - dsi1, dsi2, + dsi1, + dsi2, [&](MyEnumStringDS dsi3, MyEnumStringDS dsi4) { cb->opMyEnumStringDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1621,7 +1664,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opMyStructMyEnumDSAsync( - dsi1, dsi2, + dsi1, + dsi2, [&](MyStructMyEnumDS dsi3, MyStructMyEnumDS dsi4) { cb->opMyStructMyEnumDS(std::move(dsi3), std::move(dsi4)); }, makeExceptionClosure(cb)); @@ -1648,7 +1692,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opByteByteSDAsync( - sdi1, sdi2, [&](ByteByteSD sdi3, ByteByteSD sdi4) { cb->opByteByteSD(std::move(sdi3), std::move(sdi4)); }, + sdi1, + sdi2, + [&](ByteByteSD sdi3, ByteByteSD sdi4) { cb->opByteByteSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1672,7 +1718,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opBoolBoolSDAsync( - sdi1, sdi2, [&](BoolBoolSD sdi3, BoolBoolSD sdi4) { cb->opBoolBoolSD(std::move(sdi3), std::move(sdi4)); }, + sdi1, + sdi2, + [&](BoolBoolSD sdi3, BoolBoolSD sdi4) { cb->opBoolBoolSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1699,7 +1747,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opShortShortSDAsync( - sdi1, sdi2, + sdi1, + sdi2, [&](ShortShortSD sdi3, ShortShortSD sdi4) { cb->opShortShortSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1727,7 +1776,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opIntIntSDAsync( - sdi1, sdi2, [&](IntIntSD sdi3, IntIntSD sdi4) { cb->opIntIntSD(std::move(sdi3), std::move(sdi4)); }, + sdi1, + sdi2, + [&](IntIntSD sdi3, IntIntSD sdi4) { cb->opIntIntSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1754,7 +1805,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opLongLongSDAsync( - sdi1, sdi2, [&](LongLongSD sdi3, LongLongSD sdi4) { cb->opLongLongSD(std::move(sdi3), std::move(sdi4)); }, + sdi1, + sdi2, + [&](LongLongSD sdi3, LongLongSD sdi4) { cb->opLongLongSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); } @@ -1781,7 +1834,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringFloatSDAsync( - sdi1, sdi2, + sdi1, + sdi2, [&](StringFloatSD sdi3, StringFloatSD sdi4) { cb->opStringFloatSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1809,7 +1863,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringDoubleSDAsync( - sdi1, sdi2, + sdi1, + sdi2, [&](StringDoubleSD sdi3, StringDoubleSD sdi4) { cb->opStringDoubleSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1839,7 +1894,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opStringStringSDAsync( - sdi1, sdi2, + sdi1, + sdi2, [&](StringStringSD sdi3, StringStringSD sdi4) { cb->opStringStringSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1867,7 +1923,8 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) CallbackPtr cb = make_shared(); p->opMyEnumMyEnumSDAsync( - sdi1, sdi2, + sdi1, + sdi2, [&](MyEnumMyEnumSD sdi3, MyEnumMyEnumSD sdi4) { cb->opMyEnumMyEnumSD(std::move(sdi3), std::move(sdi4)); }, makeExceptionClosure(cb)); cb->check(); @@ -1884,8 +1941,7 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) s.push_back(i); } CallbackPtr cb = make_shared(); - p->opIntSAsync( - s, [&](IntS s1P) { cb->opIntS(s1P); }, makeExceptionClosure(cb)); + p->opIntSAsync(s, [&](IntS s1P) { cb->opIntS(s1P); }, makeExceptionClosure(cb)); cb->check(); } } @@ -1917,7 +1973,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) test(c == ctx); prom.set_value(); }, - [](exception_ptr) { test(false); }, nullptr, ctx); + [](exception_ptr) { test(false); }, + nullptr, + ctx); prom.get_future().get(); } { @@ -1942,7 +2000,9 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) test(c == ctx); prom.set_value(); }, - [](exception_ptr) { test(false); }, nullptr, ctx); + [](exception_ptr) { test(false); }, + nullptr, + ctx); prom.get_future().get(); } } @@ -2055,8 +2115,7 @@ twowaysAMI(const CommunicatorPtr& communicator, const MyClassPrx& p) double d = 1278312346.0 / 13.0; DoubleS ds(5, d); CallbackPtr cb = make_shared(); - p->opDoubleMarshalingAsync( - d, ds, [&]() { cb->opDoubleMarshaling(); }, makeExceptionClosure(cb)); + p->opDoubleMarshalingAsync(d, ds, [&]() { cb->opDoubleMarshaling(); }, makeExceptionClosure(cb)); cb->check(); } diff --git a/cpp/test/Ice/plugin/Client.cpp b/cpp/test/Ice/plugin/Client.cpp index bd0c520a395..b7b73ec389d 100644 --- a/cpp/test/Ice/plugin/Client.cpp +++ b/cpp/test/Ice/plugin/Client.cpp @@ -171,8 +171,9 @@ Client::run(int argc, char** argv) { Ice::PropertiesPtr properties = createTestProperties(argc, argv); properties->setProperty( - "Ice.Plugin.Test", pluginDir + "TestPlugin:createPluginWithArgs 'C:\\Program Files\\' --DatabasePath " - "'C:\\Program Files\\Application\\db'"); + "Ice.Plugin.Test", + pluginDir + "TestPlugin:createPluginWithArgs 'C:\\Program Files\\' --DatabasePath " + "'C:\\Program Files\\Application\\db'"); Ice::CommunicatorHolder communicator = initialize(argc, argv, properties); } catch (const Ice::Exception& ex) diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 20958865ef3..71f744142b4 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -860,19 +860,29 @@ allTests(TestHelper* helper) test( endpts1.size() != endpts2.size() || !equal( - endpts1.begin(), endpts1.end(), endpts2.begin(), + endpts1.begin(), + endpts1.end(), + endpts2.begin(), Ice::TargetCompare, std::equal_to>())); test(lexicographical_compare( - endpts1.begin(), endpts1.end(), endpts2.begin(), endpts2.end(), + endpts1.begin(), + endpts1.end(), + endpts2.begin(), + endpts2.end(), Ice::TargetCompare, std::less>())); test(!lexicographical_compare( - endpts2.begin(), endpts2.end(), endpts1.begin(), endpts1.end(), + endpts2.begin(), + endpts2.end(), + endpts1.begin(), + endpts1.end(), Ice::TargetCompare, std::less>())); Ice::EndpointSeq endpts3 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000")->ice_getEndpoints(); test( endpts1.size() == endpts3.size() && equal( - endpts1.begin(), endpts1.end(), endpts3.begin(), + endpts1.begin(), + endpts1.end(), + endpts3.begin(), Ice::TargetCompare, std::equal_to>())); test(compObj1->ice_encodingVersion(Ice::Encoding_1_0) == compObj1->ice_encodingVersion(Ice::Encoding_1_0)); diff --git a/cpp/test/Ice/retry/AllTests.cpp b/cpp/test/Ice/retry/AllTests.cpp index 14a50f7e849..b9bbf9ba4ce 100644 --- a/cpp/test/Ice/retry/AllTests.cpp +++ b/cpp/test/Ice/retry/AllTests.cpp @@ -105,7 +105,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::CommunicatorPtr& c cout << "calling regular AMI operation with first proxy... " << flush; retry1->opAsync( - false, [cb1]() { cb1->response(); }, + false, + [cb1]() { cb1->response(); }, [cb1](exception_ptr err) { try @@ -125,7 +126,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::CommunicatorPtr& c cout << "calling AMI operation to kill connection with second proxy... " << flush; retry2->opAsync( - true, [cb2]() { cb2->response(); }, + true, + [cb2]() { cb2->response(); }, [cb2](exception_ptr err) { try @@ -145,7 +147,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::CommunicatorPtr& c cout << "calling regular AMI operation with first proxy again... " << flush; retry1->opAsync( - false, [cb1]() { cb1->response(); }, + false, + [cb1]() { cb1->response(); }, [cb1](exception_ptr err) { try diff --git a/cpp/test/Ice/retry/Client.cpp b/cpp/test/Ice/retry/Client.cpp index ced6388b899..ca7f045d614 100644 --- a/cpp/test/Ice/retry/Client.cpp +++ b/cpp/test/Ice/retry/Client.cpp @@ -47,7 +47,9 @@ Client::run(int argc, char** argv) RetryPrx allTests(const Ice::CommunicatorPtr&, const Ice::CommunicatorPtr&, const string&); RetryPrx retry = allTests( - ich1.communicator(), ich2.communicator(), "retry:" + TestHelper::getTestEndpoint(ich1->getProperties())); + ich1.communicator(), + ich2.communicator(), + "retry:" + TestHelper::getTestEndpoint(ich1->getProperties())); retry->shutdown(); } diff --git a/cpp/test/IceBridge/simple/Server.cpp b/cpp/test/IceBridge/simple/Server.cpp index a0d7e567380..1f73e304ee1 100644 --- a/cpp/test/IceBridge/simple/Server.cpp +++ b/cpp/test/IceBridge/simple/Server.cpp @@ -25,7 +25,8 @@ Server::run(int argc, char** argv) Ice::CommunicatorHolder communicatorHolder = initialize(argc, argv, properties); communicatorHolder->getProperties()->setProperty( - "TestAdapter.Endpoints", getTestEndpoint() + ":" + getTestEndpoint("udp")); + "TestAdapter.Endpoints", + getTestEndpoint() + ":" + getTestEndpoint("udp")); auto adapter = communicatorHolder->createObjectAdapter("TestAdapter"); adapter->add(make_shared(), Ice::stringToIdentity("test")); adapter->activate(); diff --git a/cpp/test/IceBridge/simple/TestI.cpp b/cpp/test/IceBridge/simple/TestI.cpp index 45172a47c04..0009c1a914a 100644 --- a/cpp/test/IceBridge/simple/TestI.cpp +++ b/cpp/test/IceBridge/simple/TestI.cpp @@ -21,7 +21,8 @@ MyClassI::callCallbackAsync(function response, functioncreateProxy(callbackId)); prx->pingAsync( - [response = std::move(response)]() { response(); }, [error = std::move(error)](exception_ptr e) { error(e); }); + [response = std::move(response)]() { response(); }, + [error = std::move(error)](exception_ptr e) { error(e); }); } void diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp index d2eec8b085f..427cf2002d6 100644 --- a/cpp/test/IceGrid/activation/AllTests.cpp +++ b/cpp/test/IceGrid/activation/AllTests.cpp @@ -89,7 +89,8 @@ allTests(Test::TestHelper* helper) { Ice::CommunicatorPtr communicator = helper->communicator(); IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); IceGrid::QueryPrx query(communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Query"); diff --git a/cpp/test/IceGrid/allocation/AllTests.cpp b/cpp/test/IceGrid/allocation/AllTests.cpp index 8f435b8e9aa..1e33f202e60 100644 --- a/cpp/test/IceGrid/allocation/AllTests.cpp +++ b/cpp/test/IceGrid/allocation/AllTests.cpp @@ -206,7 +206,8 @@ class StressClient auto cb = make_shared(); session->allocateObjectByIdAsync( - Ice::stringToIdentity(os.str()), [cb](optional o) { cb->response(std::move(o)); }, + Ice::stringToIdentity(os.str()), + [cb](optional o) { cb->response(std::move(o)); }, [cb](exception_ptr) { cb->exception(); }); session->destroy(); } @@ -215,7 +216,8 @@ class StressClient { auto cb = make_shared(); session->allocateObjectByTypeAsync( - "::StressTest", [cb](optional o) { cb->response(std::move(o)); }, + "::StressTest", + [cb](optional o) { cb->response(std::move(o)); }, [cb](exception_ptr) { cb->exception(); }); session->destroy(); } @@ -413,7 +415,8 @@ allTests(Test::TestHelper* helper) auto cb1 = make_shared(); session2->allocateObjectByIdAsync( - allocatable, [&cb1](optional o) { cb1->response(o); }, + allocatable, + [&cb1](optional o) { cb1->response(o); }, [&cb1](exception_ptr) { cb1->exception(); }); this_thread::sleep_for(500ms); test(!cb1->hasResponse(dummy)); @@ -441,7 +444,8 @@ allTests(Test::TestHelper* helper) session1->setAllocationTimeout(allocationTimeout); cb1 = make_shared(); session1->allocateObjectByIdAsync( - allocatable, [&cb1](optional o) { cb1->response(o); }, + allocatable, + [&cb1](optional o) { cb1->response(o); }, [&cb1](exception_ptr) { cb1->exception(); }); this_thread::sleep_for(500ms); test(!cb1->hasResponse(dummy)); @@ -561,7 +565,9 @@ allTests(Test::TestHelper* helper) session1->setAllocationTimeout(allocationTimeout); auto cb3 = make_shared(); session1->allocateObjectByTypeAsync( - "::Test", [&cb3](optional o) { cb3->response(o); }, [&cb3](exception_ptr) { cb3->exception(); }); + "::Test", + [&cb3](optional o) { cb3->response(o); }, + [&cb3](exception_ptr) { cb3->exception(); }); this_thread::sleep_for(500ms); test(!cb3->hasResponse(dummy)); session2->releaseObject(obj->ice_getIdentity()); @@ -736,7 +742,8 @@ allTests(Test::TestHelper* helper) session2->setAllocationTimeout(allocationTimeout); cb1 = make_shared(); session2->allocateObjectByIdAsync( - allocatable3, [&cb1](optional o) { cb1->response(o); }, + allocatable3, + [&cb1](optional o) { cb1->response(o); }, [&cb1](exception_ptr) { cb1->exception(); }); this_thread::sleep_for(500ms); test(!cb1->hasResponse(dummy)); @@ -751,7 +758,8 @@ allTests(Test::TestHelper* helper) test(session2->allocateObjectByType("::TestServer1")); cb3 = make_shared(); session1->allocateObjectByTypeAsync( - "::TestServer2", [&cb3](optional o) { cb3->response(o); }, + "::TestServer2", + [&cb3](optional o) { cb3->response(o); }, [&cb3](exception_ptr) { cb3->exception(); }); this_thread::sleep_for(500ms); test(!cb3->hasResponse(dummy)); @@ -841,10 +849,12 @@ allTests(Test::TestHelper* helper) auto cb11 = make_shared(); auto cb12 = make_shared(); session1->allocateObjectByIdAsync( - allocatable, [&cb11](optional o) { cb11->response(o); }, + allocatable, + [&cb11](optional o) { cb11->response(o); }, [&cb11](exception_ptr) { cb11->exception(); }); session1->allocateObjectByIdAsync( - allocatable, [&cb12](optional o) { cb12->response(o); }, + allocatable, + [&cb12](optional o) { cb12->response(o); }, [&cb12](exception_ptr) { cb12->exception(); }); this_thread::sleep_for(500ms); test(!cb11->hasResponse(dummy)); @@ -860,10 +870,12 @@ allTests(Test::TestHelper* helper) auto cb31 = make_shared(); auto cb32 = make_shared(); session1->allocateObjectByTypeAsync( - "::Test", [&cb31](optional o) { cb31->response(o); }, + "::Test", + [&cb31](optional o) { cb31->response(o); }, [&cb31](exception_ptr) { cb31->exception(); }); session1->allocateObjectByTypeAsync( - "::Test", [&cb32](optional o) { cb32->response(o); }, + "::Test", + [&cb32](optional o) { cb32->response(o); }, [&cb32](exception_ptr) { cb32->exception(); }); this_thread::sleep_for(500ms); test(!cb31->hasResponse(dummy)); @@ -888,10 +900,12 @@ allTests(Test::TestHelper* helper) cb11 = make_shared(); cb12 = make_shared(); session1->allocateObjectByIdAsync( - allocatable3, [&cb11](optional o) { cb11->response(o); }, + allocatable3, + [&cb11](optional o) { cb11->response(o); }, [&cb11](exception_ptr) { cb11->exception(); }); session1->allocateObjectByIdAsync( - allocatable3, [&cb12](optional o) { cb12->response(o); }, + allocatable3, + [&cb12](optional o) { cb12->response(o); }, [&cb12](exception_ptr) { cb12->exception(); }); this_thread::sleep_for(500ms); test(!cb11->hasResponse(dummy)); @@ -907,10 +921,12 @@ allTests(Test::TestHelper* helper) cb31 = make_shared(); cb32 = make_shared(); session1->allocateObjectByTypeAsync( - "::TestServer1", [&cb31](optional o) { cb31->response(o); }, + "::TestServer1", + [&cb31](optional o) { cb31->response(o); }, [&cb31](exception_ptr) { cb31->exception(); }); session1->allocateObjectByTypeAsync( - "::TestServer1", [&cb32](optional o) { cb32->response(o); }, + "::TestServer1", + [&cb32](optional o) { cb32->response(o); }, [&cb32](exception_ptr) { cb32->exception(); }); this_thread::sleep_for(500ms); test(!cb31->hasResponse(dummy)); @@ -935,10 +951,12 @@ allTests(Test::TestHelper* helper) cb31 = make_shared(); cb32 = make_shared(); session1->allocateObjectByTypeAsync( - "::TestServer1", [&cb31](optional o) { cb31->response(o); }, + "::TestServer1", + [&cb31](optional o) { cb31->response(o); }, [&cb31](exception_ptr) { cb31->exception(); }); session1->allocateObjectByTypeAsync( - "::TestServer1", [&cb32](optional o) { cb32->response(o); }, + "::TestServer1", + [&cb32](optional o) { cb32->response(o); }, [&cb32](exception_ptr) { cb32->exception(); }); this_thread::sleep_for(500ms); test(!cb31->hasResponse(dummy)); @@ -969,7 +987,9 @@ allTests(Test::TestHelper* helper) session1->setAllocationTimeout(allocationTimeout); cb3 = make_shared(); session1->allocateObjectByTypeAsync( - "::Test", [&cb3](optional o) { cb3->response(o); }, [&cb3](exception_ptr) { cb3->exception(); }); + "::Test", + [&cb3](optional o) { cb3->response(o); }, + [&cb3](exception_ptr) { cb3->exception(); }); this_thread::sleep_for(500ms); test(!cb3->hasResponse(dummy)); session2->destroy(); diff --git a/cpp/test/IceGrid/distribution/AllTests.cpp b/cpp/test/IceGrid/distribution/AllTests.cpp index 5bdfd2a6796..af10a6a446a 100644 --- a/cpp/test/IceGrid/distribution/AllTests.cpp +++ b/cpp/test/IceGrid/distribution/AllTests.cpp @@ -18,7 +18,8 @@ allTests(Test::TestHelper* helper) { Ice::CommunicatorPtr communicator = helper->communicator(); IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); optional session = registry->createAdminSession("foo", "bar"); diff --git a/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp b/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp index 35de6025090..2426c6d76c3 100644 --- a/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp +++ b/cpp/test/IceGrid/noRestartUpdate/AllTests.cpp @@ -140,7 +140,8 @@ allTests(Test::TestHelper* helper) { auto communicator = helper->communicator(); IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); auto session = registry->createAdminSession("foo", "bar"); diff --git a/cpp/test/IceGrid/noRestartUpdate/Service.cpp b/cpp/test/IceGrid/noRestartUpdate/Service.cpp index 70623fab100..da60962e376 100644 --- a/cpp/test/IceGrid/noRestartUpdate/Service.cpp +++ b/cpp/test/IceGrid/noRestartUpdate/Service.cpp @@ -31,7 +31,8 @@ ServiceI::start(const string& name, const shared_ptr& communicator auto properties = communicator->getProperties(); auto adapter = communicator->createObjectAdapter(name); adapter->add( - make_shared(adapter, properties), stringToIdentity(properties->getProperty(name + ".Identity"))); + make_shared(adapter, properties), + stringToIdentity(properties->getProperty(name + ".Identity"))); adapter->activate(); } diff --git a/cpp/test/IceGrid/replication/AllTests.cpp b/cpp/test/IceGrid/replication/AllTests.cpp index 6559e4d8a4a..2fc32c0ca2c 100644 --- a/cpp/test/IceGrid/replication/AllTests.cpp +++ b/cpp/test/IceGrid/replication/AllTests.cpp @@ -237,7 +237,8 @@ allTests(Test::TestHelper* helper) { auto communicator = helper->communicator(); IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); auto adminSession = registry->createAdminSession("foo", "bar"); diff --git a/cpp/test/IceGrid/replication/Server.cpp b/cpp/test/IceGrid/replication/Server.cpp index 871fa0165cd..e29aae53943 100644 --- a/cpp/test/IceGrid/replication/Server.cpp +++ b/cpp/test/IceGrid/replication/Server.cpp @@ -20,7 +20,8 @@ Server::run(int argc, char** argv) Ice::CommunicatorHolder communicatorHolder = initialize(argc, argv); auto adapter = communicatorHolder->createObjectAdapter("TestAdapter"); adapter->add( - make_shared(), Ice::stringToIdentity(communicatorHolder->getProperties()->getProperty("Identity"))); + make_shared(), + Ice::stringToIdentity(communicatorHolder->getProperties()->getProperty("Identity"))); try { adapter->activate(); diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index 3c066afd2a3..afdc1c70d53 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -1059,7 +1059,11 @@ allTests(TestHelper* helper) adpt1->activate(); registry->ice_getConnection()->setAdapter(adpt1); session1->setObserversByIdentity( - Ice::Identity(), no1->ice_getIdentity(), app1->ice_getIdentity(), Ice::Identity(), Ice::Identity()); + Ice::Identity(), + no1->ice_getIdentity(), + app1->ice_getIdentity(), + Ice::Identity(), + Ice::Identity()); auto adpt2 = communicator->createObjectAdapterWithEndpoints("Observer2", "tcp"); auto appObs2 = make_shared("appObs2"); @@ -1302,7 +1306,11 @@ allTests(TestHelper* helper) adpt1->activate(); registry->ice_getConnection()->setAdapter(adpt1); session1->setObserversByIdentity( - Ice::Identity(), Ice::Identity(), app1->ice_getIdentity(), Ice::Identity(), Ice::Identity()); + Ice::Identity(), + Ice::Identity(), + app1->ice_getIdentity(), + Ice::Identity(), + Ice::Identity()); appObs1->waitForUpdate(__LINE__); @@ -1395,7 +1403,11 @@ allTests(TestHelper* helper) adpt1->activate(); registry->ice_getConnection()->setAdapter(adpt1); session1->setObserversByIdentity( - Ice::Identity(), Ice::Identity(), Ice::Identity(), adapter1->ice_getIdentity(), Ice::Identity()); + Ice::Identity(), + Ice::Identity(), + Ice::Identity(), + adapter1->ice_getIdentity(), + Ice::Identity()); adptObs1->waitForUpdate(__LINE__); // init @@ -1476,7 +1488,11 @@ allTests(TestHelper* helper) adpt1->activate(); registry->ice_getConnection()->setAdapter(adpt1); session1->setObserversByIdentity( - Ice::Identity(), Ice::Identity(), Ice::Identity(), Ice::Identity(), object1->ice_getIdentity()); + Ice::Identity(), + Ice::Identity(), + Ice::Identity(), + Ice::Identity(), + object1->ice_getIdentity()); objectObs1->waitForUpdate(__LINE__); // init @@ -1527,7 +1543,11 @@ allTests(TestHelper* helper) adpt1->activate(); registry->ice_getConnection()->setAdapter(adpt1); session1->setObserversByIdentity( - Ice::Identity(), no1->ice_getIdentity(), app1->ice_getIdentity(), Ice::Identity(), Ice::Identity()); + Ice::Identity(), + no1->ice_getIdentity(), + app1->ice_getIdentity(), + Ice::Identity(), + Ice::Identity()); appObs1->waitForUpdate(__LINE__); nodeObs1->waitForUpdate(__LINE__); // init @@ -1673,7 +1693,11 @@ allTests(TestHelper* helper) adpt1->activate(); registry->ice_getConnection()->setAdapter(adpt1); session1->setObserversByIdentity( - ro1->ice_getIdentity(), Ice::Identity(), app1->ice_getIdentity(), Ice::Identity(), Ice::Identity()); + ro1->ice_getIdentity(), + Ice::Identity(), + app1->ice_getIdentity(), + Ice::Identity(), + Ice::Identity()); appObs1->waitForUpdate(__LINE__); registryObs1->waitForUpdate(__LINE__); // init diff --git a/cpp/test/IceGrid/simple/AllTests.cpp b/cpp/test/IceGrid/simple/AllTests.cpp index 4d31ef79680..46cf7e7dbd3 100644 --- a/cpp/test/IceGrid/simple/AllTests.cpp +++ b/cpp/test/IceGrid/simple/AllTests.cpp @@ -36,7 +36,8 @@ allTests(Test::TestHelper* helper) { // Add test well-known object IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); optional session = registry->createAdminSession("foo", "bar"); session->getAdmin()->addObjectWithType(locator, "::Test"); @@ -50,7 +51,8 @@ allTests(Test::TestHelper* helper) initData.properties = communicator->getProperties()->clone(); initData.properties->setProperty("Ice.Default.Locator", ""); initData.properties->setProperty( - "Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery"); + "Ice.Plugin.IceLocatorDiscovery", + "IceLocatorDiscovery:createIceLocatorDiscovery"); initData.properties->setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties->setProperty("AdapterForDiscoveryTest.Endpoints", "default"); @@ -131,9 +133,11 @@ allTests(Test::TestHelper* helper) initData.properties = communicator->getProperties()->clone(); initData.properties->setProperty("Ice.Default.Locator", ""); initData.properties->setProperty( - "Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery"); + "Ice.Plugin.IceLocatorDiscovery", + "IceLocatorDiscovery:createIceLocatorDiscovery"); initData.properties->setProperty( - "IceLocatorDiscovery.Lookup", "udp -h " + multicast + " --interface unknown"); + "IceLocatorDiscovery.Lookup", + "udp -h " + multicast + " --interface unknown"); com = Ice::initialize(initData); test(com->getDefaultLocator()); try @@ -150,9 +154,11 @@ allTests(Test::TestHelper* helper) initData.properties->setProperty("Ice.Default.Locator", ""); initData.properties->setProperty("IceLocatorDiscovery.RetryCount", "0"); initData.properties->setProperty( - "Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery"); + "Ice.Plugin.IceLocatorDiscovery", + "IceLocatorDiscovery:createIceLocatorDiscovery"); initData.properties->setProperty( - "IceLocatorDiscovery.Lookup", "udp -h " + multicast + " --interface unknown"); + "IceLocatorDiscovery.Lookup", + "udp -h " + multicast + " --interface unknown"); com = Ice::initialize(initData); test(com->getDefaultLocator()); try @@ -169,7 +175,8 @@ allTests(Test::TestHelper* helper) initData.properties->setProperty("Ice.Default.Locator", ""); initData.properties->setProperty("IceLocatorDiscovery.RetryCount", "1"); initData.properties->setProperty( - "Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery"); + "Ice.Plugin.IceLocatorDiscovery", + "IceLocatorDiscovery:createIceLocatorDiscovery"); { string intf = initData.properties->getProperty("IceLocatorDiscovery.Interface"); if (!intf.empty()) @@ -179,8 +186,9 @@ allTests(Test::TestHelper* helper) ostringstream port; port << TestHelper::getTestPort(initData.properties, 99); initData.properties->setProperty( - "IceLocatorDiscovery.Lookup", "udp -h " + multicast + " --interface unknown:" + "udp -h " + - multicast + " -p " + port.str() + intf); + "IceLocatorDiscovery.Lookup", + "udp -h " + multicast + " --interface unknown:" + "udp -h " + multicast + " -p " + port.str() + + intf); } com = Ice::initialize(initData); test(com->getDefaultLocator()); @@ -272,7 +280,8 @@ allTestsWithDeploy(Test::TestHelper* helper) cout << "ok" << endl; IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); optional session = registry->createAdminSession("foo", "bar"); diff --git a/cpp/test/IceGrid/update/AllTests.cpp b/cpp/test/IceGrid/update/AllTests.cpp index 2a41608e59a..79275e7e01e 100644 --- a/cpp/test/IceGrid/update/AllTests.cpp +++ b/cpp/test/IceGrid/update/AllTests.cpp @@ -49,7 +49,8 @@ bool hasProperty(const CommunicatorDescriptorPtr& desc, const string& name, const string& value) { for (PropertyDescriptorSeq::const_iterator p = desc->propertySet.properties.begin(); - p != desc->propertySet.properties.end(); ++p) + p != desc->propertySet.properties.end(); + ++p) { if (p->name == name) { @@ -64,7 +65,8 @@ allTests(Test::TestHelper* helper) { const Ice::CommunicatorPtr& communicator = helper->communicator(); IceGrid::RegistryPrx registry( - communicator, communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); + communicator, + communicator->getDefaultLocator()->ice_getIdentity().category + "/Registry"); optional session = registry->createAdminSession("foo", "bar"); diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index ad02aaeac99..b3601e77285 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -111,7 +111,12 @@ class ImportCerts do { if ((next = CertFindCertificateInStore( - p12, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_ANY, 0, next)) != 0) + p12, + X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + 0, + CERT_FIND_ANY, + 0, + next)) != 0) { if (CertAddCertificateContextToStore(_store, next, CERT_STORE_ADD_ALWAYS, &newCert)) { @@ -142,12 +147,18 @@ class ImportCerts CRYPT_KEY_PROV_INFO* keyProvInfo = reinterpret_cast(&buf[0]); HCRYPTPROV cryptProv = 0; if (CryptAcquireContextW( - &cryptProv, keyProvInfo->pwszContainerName, keyProvInfo->pwszProvName, - keyProvInfo->dwProvType, 0)) + &cryptProv, + keyProvInfo->pwszContainerName, + keyProvInfo->pwszProvName, + keyProvInfo->dwProvType, + 0)) { CryptAcquireContextW( - &cryptProv, keyProvInfo->pwszContainerName, keyProvInfo->pwszProvName, - keyProvInfo->dwProvType, CRYPT_DELETEKEYSET); + &cryptProv, + keyProvInfo->pwszContainerName, + keyProvInfo->pwszProvName, + keyProvInfo->dwProvType, + CRYPT_DELETEKEYSET); } } } @@ -1180,12 +1191,14 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) const char* authorities[] = { "", // Self signed CA cert has not X509v3 Authority Key Identifier extension "02:FD:1B:E9:6F:4E:96:8F:0C:0E:99:61:8F:45:48:6B:2B:14:3C:31", - "02:FD:1B:E9:6F:4E:96:8F:0C:0E:99:61:8F:45:48:6B:2B:14:3C:31", 0}; + "02:FD:1B:E9:6F:4E:96:8F:0C:0E:99:61:8F:45:48:6B:2B:14:3C:31", + 0}; const char* subjects[] = { "02:FD:1B:E9:6F:4E:96:8F:0C:0E:99:61:8F:45:48:6B:2B:14:3C:31", "7F:4D:BF:80:65:E0:EE:A4:18:D5:6A:87:33:63:B3:76:7D:42:82:06", - "EB:4A:7A:79:09:65:0F:45:40:E8:8C:E6:A8:27:74:34:AB:EA:AF:48", 0}; + "EB:4A:7A:79:09:65:0F:45:40:E8:8C:E6:A8:27:74:34:AB:EA:AF:48", + 0}; for (int i = 0; certificates[i] != 0; ++i) { @@ -2600,8 +2613,9 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) InitializationData initData; initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); initData.properties->setProperty( - "IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.," - "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); + "IceSSL.TrustOnly", + "C=US, ST=Florida, O=ZeroC\\, Inc.," + "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); CommunicatorPtr comm = initialize(initData); optional fact = Test::ServerFactoryPrx(comm, factoryRef); @@ -2625,8 +2639,9 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) InitializationData initData; initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); initData.properties->setProperty( - "IceSSL.TrustOnly", "!C=US, ST=Florida, O=ZeroC\\, Inc.," - "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); + "IceSSL.TrustOnly", + "!C=US, ST=Florida, O=ZeroC\\, Inc.," + "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); CommunicatorPtr comm = initialize(initData); optional fact = Test::ServerFactoryPrx(comm, factoryRef); @@ -2648,8 +2663,9 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) InitializationData initData; initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); initData.properties->setProperty( - "IceSSL.TrustOnly", "C=US, ST=Florida, O=\"ZeroC, Inc.\"," - "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); + "IceSSL.TrustOnly", + "C=US, ST=Florida, O=\"ZeroC, Inc.\"," + "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); CommunicatorPtr comm = initialize(initData); optional fact = Test::ServerFactoryPrx(comm, factoryRef); @@ -3081,8 +3097,9 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) InitializationData initData; initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); initData.properties->setProperty( - "IceSSL.TrustOnly.Client", "C=US, ST=Florida, O=ZeroC\\, Inc.," - "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); + "IceSSL.TrustOnly.Client", + "C=US, ST=Florida, O=ZeroC\\, Inc.," + "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); CommunicatorPtr comm = initialize(initData); optional fact = Test::ServerFactoryPrx(comm, factoryRef); @@ -3109,8 +3126,9 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) InitializationData initData; initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); initData.properties->setProperty( - "IceSSL.TrustOnly.Client", "!C=US, ST=Florida, O=ZeroC\\, Inc.," - "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); + "IceSSL.TrustOnly.Client", + "!C=US, ST=Florida, O=ZeroC\\, Inc.," + "OU=Ice, emailAddress=info@zeroc.com, CN=Server"); CommunicatorPtr comm = initialize(initData); optional fact = Test::ServerFactoryPrx(comm, factoryRef); @@ -3202,8 +3220,9 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); // Should have no effect. initData.properties->setProperty( - "IceSSL.TrustOnly.Server", "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice," - "emailAddress=info@zeroc.com,CN=Client"); + "IceSSL.TrustOnly.Server", + "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice," + "emailAddress=info@zeroc.com,CN=Client"); CommunicatorPtr comm = initialize(initData); optional fact = Test::ServerFactoryPrx(comm, factoryRef); @@ -3541,8 +3560,11 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) cout << "testing IceSSL.FindCert... " << flush; const char* clientFindCertProperties[] = { // "SUBJECT:Client", - "LABEL:'Client'", "SUBJECTKEYID:'7F 4D BF 80 65 E0 EE A4 18 D5 6A 87 33 63 B3 76 7D 42 82 06'", "SERIAL:02", - "SERIAL:02 LABEL:Client", 0}; + "LABEL:'Client'", + "SUBJECTKEYID:'7F 4D BF 80 65 E0 EE A4 18 D5 6A 87 33 63 B3 76 7D 42 82 06'", + "SERIAL:02", + "SERIAL:02 LABEL:Client", + 0}; const char* serverFindCertProperties[] = { # if !defined(__APPLE__) || TARGET_OS_IPHONE == 0 @@ -3553,8 +3575,7 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) "SUBJECTKEYID:'EB 4A 7A 79 09 65 0F 45 40 E8 8C E6 A8 27 74 34 AB EA AF 48'", "SERIAL:01", "SERIAL:01 LABEL:Server", - 0 - }; + 0}; const char* failFindCertProperties[] = { "nolabel", @@ -3568,8 +3589,7 @@ allTests(Test::TestHelper* helper, const string& /*testDir*/, bool p12) "SUBJECTKEYID:'a6 42 aa 17 04 41 86 56 67 e4 04 64 59 34 30 c7 4c 6b ef ff'", "SERIAL:04", "SERIAL:04 LABEL:Client", - 0 - }; + 0}; const char* certificates[] = {"/s_rsa_ca1.p12", "/c_rsa_ca1.p12", 0}; ImportCerts import(defaultDir, certificates); diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp index e75298c9abc..3a5dfebc687 100644 --- a/cpp/test/IceUtil/unicode/Client.cpp +++ b/cpp/test/IceUtil/unicode/Client.cpp @@ -214,7 +214,8 @@ main(int argc, char* argv[]) cout << "testing IceUtilInternal::toUTF16, toUTF32 and fromUTF32... "; vector u8 = vector( - reinterpret_cast(ns.data()), reinterpret_cast(ns.data() + ns.length())); + reinterpret_cast(ns.data()), + reinterpret_cast(ns.data() + ns.length())); vector u16 = IceUtilInternal::toUTF16(u8); test(u16.size() == 4); diff --git a/cpp/test/ios/controller/Classes/ControllerView.m b/cpp/test/ios/controller/Classes/ControllerView.m index 1435cad97b0..421f5c5575f 100644 --- a/cpp/test/ios/controller/Classes/ControllerView.m +++ b/cpp/test/ios/controller/Classes/ControllerView.m @@ -98,7 +98,8 @@ - (void)viewDidLoad [interfaceIPv4 selectRow:0 inComponent:0 animated:NO]; [interfaceIPv6 selectRow:0 inComponent:0 animated:NO]; (*startController)( - self, [interfacesIPv4 objectAtIndex:[interfaceIPv4 selectedRowInComponent:0]], + self, + [interfacesIPv4 objectAtIndex:[interfaceIPv4 selectedRowInComponent:0]], [interfacesIPv6 objectAtIndex:[interfaceIPv6 selectedRowInComponent:0]]); } @@ -143,7 +144,8 @@ - (void)pickerView:(UIPickerView*)pickerView didSelectRow:(NSInteger)row inCompo { (*stopController)(self); (*startController)( - self, [interfacesIPv4 objectAtIndex:[interfaceIPv4 selectedRowInComponent:0]], + self, + [interfacesIPv4 objectAtIndex:[interfaceIPv4 selectedRowInComponent:0]], [interfacesIPv6 objectAtIndex:[interfaceIPv6 selectedRowInComponent:0]]); } diff --git a/matlab/src/Communicator.cpp b/matlab/src/Communicator.cpp index 1bdcc5dfb95..1d8faf5a971 100644 --- a/matlab/src/Communicator.cpp +++ b/matlab/src/Communicator.cpp @@ -239,7 +239,9 @@ extern "C" { auto m = static_cast(getEnumerator(mode, "Ice.CompressBatch")); function token = deref(self)->flushBatchRequestsAsync( - m, [f](exception_ptr e) { f->exception(e); }, [f](bool /*sentSynchronously*/) { f->done(); }); + m, + [f](exception_ptr e) { f->exception(e); }, + [f](bool /*sentSynchronously*/) { f->done(); }); f->token(token); *future = new shared_ptr(move(f)); } diff --git a/matlab/src/Connection.cpp b/matlab/src/Connection.cpp index a4a4f72cea1..ed09d435902 100644 --- a/matlab/src/Connection.cpp +++ b/matlab/src/Connection.cpp @@ -35,10 +35,24 @@ namespace NumFields // Number of fields in structure, must be last }; - static const char* infoFields[] = {"type", "underlying", "incoming", "adapterName", "connectionId", - "localAddress", "localPort", "remoteAddress", "remotePort", "rcvSize", - "sndSize", "mcastAddress", "mcastPort", "headers", "cipher", - "certs", "verified"}; + static const char* infoFields[] = { + "type", + "underlying", + "incoming", + "adapterName", + "connectionId", + "localAddress", + "localPort", + "remoteAddress", + "remotePort", + "rcvSize", + "sndSize", + "mcastAddress", + "mcastPort", + "headers", + "cipher", + "certs", + "verified"}; mxArray* createInfo(const shared_ptr& info) { @@ -210,7 +224,9 @@ extern "C" { auto mode = static_cast(getEnumerator(c, "Ice.CompressBatch")); function token = deref(self)->flushBatchRequestsAsync( - mode, [f](exception_ptr e) { f->exception(e); }, [f](bool /*sentSynchronously*/) { f->done(); }); + mode, + [f](exception_ptr e) { f->exception(e); }, + [f](bool /*sentSynchronously*/) { f->done(); }); f->token(token); *future = new shared_ptr(move(f)); } @@ -255,7 +271,8 @@ extern "C" try { function token = deref(self)->heartbeatAsync( - [f](exception_ptr e) { f->exception(e); }, [f](bool /*sentSynchronously*/) { f->done(); }); + [f](exception_ptr e) { f->exception(e); }, + [f](bool /*sentSynchronously*/) { f->done(); }); f->token(token); *future = new shared_ptr(move(f)); } diff --git a/matlab/src/Endpoint.cpp b/matlab/src/Endpoint.cpp index 0f21a7636e0..336ef15f294 100644 --- a/matlab/src/Endpoint.cpp +++ b/matlab/src/Endpoint.cpp @@ -32,9 +32,22 @@ namespace NumFields // Number of fields in structure, must be last }; - static const char* infoFields[] = {"type", "infoType", "datagram", "secure", "underlying", - "timeout", "compress", "host", "port", "sourceAddress", - "mcastInterface", "mcastTtl", "resource", "rawEncoding", "rawBytes"}; + static const char* infoFields[] = { + "type", + "infoType", + "datagram", + "secure", + "underlying", + "timeout", + "compress", + "host", + "port", + "sourceAddress", + "mcastInterface", + "mcastTtl", + "resource", + "rawEncoding", + "rawBytes"}; mxArray* createInfo(const shared_ptr& info) { @@ -77,7 +90,9 @@ namespace mxSetFieldByNumber(r, 0, Field::RawEncoding, createEncodingVersion(opaqueInfo->rawEncoding)); byte* p = &opaqueInfo->rawBytes[0]; mxSetFieldByNumber( - r, 0, Field::RawBytes, + r, + 0, + Field::RawBytes, createByteArray( reinterpret_cast(p), reinterpret_cast(p) + opaqueInfo->rawBytes.size())); diff --git a/matlab/src/ObjectPrx.cpp b/matlab/src/ObjectPrx.cpp index 2402e3d0ea7..5f61a2f03db 100644 --- a/matlab/src/ObjectPrx.cpp +++ b/matlab/src/ObjectPrx.cpp @@ -302,17 +302,22 @@ extern "C" *future = 0; auto f = make_shared( - proxy->ice_isTwoway(), proxy->ice_isBatchOneway() || proxy->ice_isBatchDatagram()); + proxy->ice_isTwoway(), + proxy->ice_isBatchOneway() || proxy->ice_isBatchDatagram()); try { Ice::Context ctx; getStringMap(context, ctx); function token = proxy->ice_invokeAsync( - op, mode, params, + op, + mode, + params, [proxy, f](bool ok, pair outParams) { f->finished(proxy->ice_getCommunicator(), proxy->ice_getEncodingVersion(), ok, outParams); }, - [f](exception_ptr e) { f->exception(e); }, [f](bool /*sentSynchronously*/) { f->sent(); }, ctx); + [f](exception_ptr e) { f->exception(e); }, + [f](bool /*sentSynchronously*/) { f->sent(); }, + ctx); f->token(token); *future = new shared_ptr(move(f)); } @@ -342,15 +347,19 @@ extern "C" *future = 0; auto f = make_shared( - proxy->ice_isTwoway(), proxy->ice_isBatchOneway() || proxy->ice_isBatchDatagram()); + proxy->ice_isTwoway(), + proxy->ice_isBatchOneway() || proxy->ice_isBatchDatagram()); try { function token = proxy->ice_invokeAsync( - op, mode, params, + op, + mode, + params, [proxy, f](bool ok, pair outParams) { f->finished(proxy->ice_getCommunicator(), proxy->ice_getEncodingVersion(), ok, outParams); }, - [f](exception_ptr e) { f->exception(e); }, [f](bool /*sentSynchronously*/) { f->sent(); }); + [f](exception_ptr e) { f->exception(e); }, + [f](bool /*sentSynchronously*/) { f->sent(); }); f->token(token); *future = new shared_ptr(move(f)); } @@ -950,7 +959,8 @@ extern "C" try { function token = restoreProxy(self)->ice_getConnectionAsync( - [f](shared_ptr con) { f->finished(con); }, [f](exception_ptr e) { f->exception(e); }, + [f](shared_ptr con) { f->finished(con); }, + [f](exception_ptr e) { f->exception(e); }, nullptr); f->token(token); *future = new shared_ptr(move(f)); @@ -1001,7 +1011,8 @@ extern "C" try { function token = restoreProxy(self)->ice_flushBatchRequestsAsync( - [f](exception_ptr e) { f->exception(e); }, [f](bool /*sentSynchronously*/) { f->done(); }); + [f](exception_ptr e) { f->exception(e); }, + [f](bool /*sentSynchronously*/) { f->done(); }); f->token(token); *future = new shared_ptr(move(f)); } diff --git a/php/src/Communicator.cpp b/php/src/Communicator.cpp index dcb8e8f95eb..0170295dba2 100644 --- a/php/src/Communicator.cpp +++ b/php/src/Communicator.cpp @@ -1200,7 +1200,13 @@ ZEND_FUNCTION(Ice_register) size_t sLen; zend_long expires = 0; if (zend_parse_parameters( - ZEND_NUM_ARGS(), const_cast("Os|l"), &comm, communicatorClassEntry, &s, &sLen, &expires) != SUCCESS) + ZEND_NUM_ARGS(), + const_cast("Os|l"), + &comm, + communicatorClassEntry, + &s, + &sLen, + &expires) != SUCCESS) { RETURN_NULL(); } @@ -1520,7 +1526,11 @@ createProfile(const string& name, const string& config, const string& options) ostringstream ostr; ex.ice_print(ostr); php_error_docref( - 0, E_WARNING, "unable to load Ice configuration file %s:\n%s", config.c_str(), ostr.str().c_str()); + 0, + E_WARNING, + "unable to load Ice configuration file %s:\n%s", + config.c_str(), + ostr.str().c_str()); return false; } } @@ -1538,7 +1548,11 @@ createProfile(const string& name, const string& config, const string& options) ex.ice_print(ostr); string msg = ostr.str(); php_error_docref( - 0, E_WARNING, "error occurred while parsing the options `%s':\n%s", options.c_str(), msg.c_str()); + 0, + E_WARNING, + "error occurred while parsing the options `%s':\n%s", + options.c_str(), + msg.c_str()); return false; } properties->parseCommandLineOptions("", args); diff --git a/php/src/Connection.cpp b/php/src/Connection.cpp index 0bc9b334266..c03d1882c98 100644 --- a/php/src/Connection.cpp +++ b/php/src/Connection.cpp @@ -455,7 +455,9 @@ static zend_function_entry _connectionClassMethods[] = { Ice_Connection_setBufferSize_arginfo, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Connection, throwException, ice_void_arginfo, ZEND_ACC_PUBLIC){ - 0, 0, 0}}; + 0, + 0, + 0}}; ZEND_METHOD(Ice_ConnectionInfo, __construct) { runtimeError("ConnectionInfo cannot be instantiated"); } @@ -513,7 +515,11 @@ IcePHP::connectionInit(void) zend_declare_property_bool(connectionInfoClassEntry, "incoming", sizeof("incoming") - 1, 0, ZEND_ACC_PUBLIC); zend_declare_property_string( - connectionInfoClassEntry, "adapterName", sizeof("adapterName") - 1, "", ZEND_ACC_PUBLIC); + connectionInfoClassEntry, + "adapterName", + sizeof("adapterName") - 1, + "", + ZEND_ACC_PUBLIC); zend_declare_property_null(connectionInfoClassEntry, "underlying", sizeof("underlying") - 1, ZEND_ACC_PUBLIC); // Register the IPConnectionInfo class. @@ -521,10 +527,18 @@ IcePHP::connectionInit(void) ce.create_object = handleConnectionInfoAlloc; ipConnectionInfoClassEntry = zend_register_internal_class_ex(&ce, connectionInfoClassEntry); zend_declare_property_string( - ipConnectionInfoClassEntry, "localAddress", sizeof("localAddress") - 1, "", ZEND_ACC_PUBLIC); + ipConnectionInfoClassEntry, + "localAddress", + sizeof("localAddress") - 1, + "", + ZEND_ACC_PUBLIC); zend_declare_property_long(ipConnectionInfoClassEntry, "localPort", sizeof("localPort") - 1, 0, ZEND_ACC_PUBLIC); zend_declare_property_string( - ipConnectionInfoClassEntry, "remoteAddress", sizeof("remoteAddress") - 1, "", ZEND_ACC_PUBLIC); + ipConnectionInfoClassEntry, + "remoteAddress", + sizeof("remoteAddress") - 1, + "", + ZEND_ACC_PUBLIC); zend_declare_property_long(ipConnectionInfoClassEntry, "remotePort", sizeof("remotePort") - 1, 0, ZEND_ACC_PUBLIC); // Register the TCPConnectionInfo class. @@ -539,7 +553,11 @@ IcePHP::connectionInit(void) ce.create_object = handleConnectionInfoAlloc; udpConnectionInfoClassEntry = zend_register_internal_class_ex(&ce, ipConnectionInfoClassEntry); zend_declare_property_string( - udpConnectionInfoClassEntry, "mcastAddress", sizeof("mcastAddress") - 1, "", ZEND_ACC_PUBLIC); + udpConnectionInfoClassEntry, + "mcastAddress", + sizeof("mcastAddress") - 1, + "", + ZEND_ACC_PUBLIC); zend_declare_property_long(udpConnectionInfoClassEntry, "mcastPort", sizeof("mcastPort") - 1, 0, ZEND_ACC_PUBLIC); // Register the WSConnectionInfo class. @@ -677,7 +695,9 @@ IcePHP::createConnectionInfo(zval* zv, const Ice::ConnectionInfoPtr& p) Ice::StringSeq encoded; transform( - info->certs.cbegin(), info->certs.cend(), back_inserter(encoded), + info->certs.cbegin(), + info->certs.cend(), + back_inserter(encoded), [](const auto& cert) { return cert->encode(); }); if (createStringArray(&zarr, encoded)) diff --git a/php/src/Endpoint.cpp b/php/src/Endpoint.cpp index ed1a91443a8..de3e6d0d27d 100644 --- a/php/src/Endpoint.cpp +++ b/php/src/Endpoint.cpp @@ -239,7 +239,11 @@ IcePHP::endpointInit(void) zend_declare_property_string(ipEndpointInfoClassEntry, "host", sizeof("host") - 1, "", ZEND_ACC_PUBLIC); zend_declare_property_long(ipEndpointInfoClassEntry, "port", sizeof("port") - 1, 0, ZEND_ACC_PUBLIC); zend_declare_property_string( - ipEndpointInfoClassEntry, "sourceAddress", sizeof("sourceAddress") - 1, "", ZEND_ACC_PUBLIC); + ipEndpointInfoClassEntry, + "sourceAddress", + sizeof("sourceAddress") - 1, + "", + ZEND_ACC_PUBLIC); // Define the TCPEndpointInfo class. INIT_NS_CLASS_ENTRY(ce, "Ice", "TCPEndpointInfo", nullptr); @@ -251,7 +255,11 @@ IcePHP::endpointInit(void) ce.create_object = handleEndpointInfoAlloc; udpEndpointInfoClassEntry = zend_register_internal_class_ex(&ce, ipEndpointInfoClassEntry); zend_declare_property_string( - udpEndpointInfoClassEntry, "mcastInterface", sizeof("mcastInterface") - 1, "", ZEND_ACC_PUBLIC); + udpEndpointInfoClassEntry, + "mcastInterface", + sizeof("mcastInterface") - 1, + "", + ZEND_ACC_PUBLIC); zend_declare_property_long(udpEndpointInfoClassEntry, "mcastTtl", sizeof("mcastTtl") - 1, 0, ZEND_ACC_PUBLIC); // Define the WSEndpointInfo class. diff --git a/php/src/Init.cpp b/php/src/Init.cpp index e9265bce6e1..a3d123fe92a 100644 --- a/php/src/Init.cpp +++ b/php/src/Init.cpp @@ -180,13 +180,25 @@ ZEND_END_ARG_INFO() ZEND_NS_NAMED_FE("Ice", currentProtocolEncoding, ZEND_FN(Ice_currentProtocolEncoding), ice_void_arginfo) \ ZEND_NS_NAMED_FE("Ice", currentEncoding, ZEND_FN(Ice_currentEncoding), ice_void_arginfo) \ ZEND_NS_NAMED_FE( \ - "Ice", protocolVersionToString, ZEND_FN(Ice_protocolVersionToString), Ice_protocolVersionToString_arginfo) \ + "Ice", \ + protocolVersionToString, \ + ZEND_FN(Ice_protocolVersionToString), \ + Ice_protocolVersionToString_arginfo) \ ZEND_NS_NAMED_FE( \ - "Ice", stringToProtocolVersion, ZEND_FN(Ice_stringToProtocolVersion), Ice_stringToProtocolVersion_arginfo) \ + "Ice", \ + stringToProtocolVersion, \ + ZEND_FN(Ice_stringToProtocolVersion), \ + Ice_stringToProtocolVersion_arginfo) \ ZEND_NS_NAMED_FE( \ - "Ice", encodingVersionToString, ZEND_FN(Ice_encodingVersionToString), Ice_encodingVersionToString_arginfo) \ + "Ice", \ + encodingVersionToString, \ + ZEND_FN(Ice_encodingVersionToString), \ + Ice_encodingVersionToString_arginfo) \ ZEND_NS_NAMED_FE( \ - "Ice", stringToEncodingVersion, ZEND_FN(Ice_stringToEncodingVersion), Ice_stringToEncodingVersion_arginfo) + "Ice", \ + stringToEncodingVersion, \ + ZEND_FN(Ice_stringToEncodingVersion), \ + Ice_stringToEncodingVersion_arginfo) // // Entries for all global functions. @@ -195,11 +207,17 @@ zend_function_entry ice_functions[] = { ICEPHP_COMMUNICATOR_FUNCTIONS ICEPHP_OPERATION_FUNCTIONS ICEPHP_PROPERTIES_FUNCTIONS ICEPHP_TYPE_FUNCTIONS ICEPHP_UTIL_FUNCTIONS{0, 0, 0}}; -zend_module_entry ice_module_entry = {STANDARD_MODULE_HEADER, "ice", - ice_functions, ZEND_MINIT(ice), - ZEND_MSHUTDOWN(ice), ZEND_RINIT(ice), - ZEND_RSHUTDOWN(ice), ZEND_MINFO(ice), - NO_VERSION_YET, STANDARD_MODULE_PROPERTIES}; +zend_module_entry ice_module_entry = { + STANDARD_MODULE_HEADER, + "ice", + ice_functions, + ZEND_MINIT(ice), + ZEND_MSHUTDOWN(ice), + ZEND_RINIT(ice), + ZEND_RSHUTDOWN(ice), + ZEND_MINFO(ice), + NO_VERSION_YET, + STANDARD_MODULE_PROPERTIES}; ZEND_GET_MODULE(ice) diff --git a/php/src/Logger.cpp b/php/src/Logger.cpp index d2599840aaa..caa94e09993 100644 --- a/php/src/Logger.cpp +++ b/php/src/Logger.cpp @@ -221,14 +221,15 @@ handleClone(zend_object*) // Predefined methods for Logger. static zend_function_entry _interfaceMethods[] = {{0, 0, 0}}; static zend_function_entry _classMethods[] = { - ZEND_ME(Ice_Logger, __construct, ice_void_arginfo, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR) - ZEND_ME(Ice_Logger, __toString, ice_to_string_arginfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ice_Logger, print, Ice_Logger_print_arginfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ice_Logger, trace, Ice_Logger_trace_arginfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ice_Logger, warning, Ice_Logger_warning_arginfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ice_Logger, error, Ice_Logger_error_arginfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ice_Logger, cloneWithPrefix, Ice_Logger_cloneWithPrefix_arginfo, ZEND_ACC_PUBLIC){ - 0, 0, 0}}; + ZEND_ME(Ice_Logger, __construct, ice_void_arginfo, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR) ZEND_ME( + Ice_Logger, + __toString, + ice_to_string_arginfo, + ZEND_ACC_PUBLIC) ZEND_ME(Ice_Logger, print, Ice_Logger_print_arginfo, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_Logger, trace, Ice_Logger_trace_arginfo, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_Logger, warning, Ice_Logger_warning_arginfo, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_Logger, error, Ice_Logger_error_arginfo, ZEND_ACC_PUBLIC) + ZEND_ME(Ice_Logger, cloneWithPrefix, Ice_Logger_cloneWithPrefix_arginfo, ZEND_ACC_PUBLIC){0, 0, 0}}; bool IcePHP::loggerInit(void) diff --git a/php/src/Operation.cpp b/php/src/Operation.cpp index 7336aac8441..995e1d627af 100644 --- a/php/src/Operation.cpp +++ b/php/src/Operation.cpp @@ -391,7 +391,9 @@ IcePHP::TypedInvocation::prepareRequest( if ((!info->optional || !isUnset(arg)) && !info->type->validate(arg, false)) { invalidArgument( - "invalid value for argument %d in operation `%s'", info->pos + 1, _op->name.c_str()); + "invalid value for argument %d in operation `%s'", + info->pos + 1, + _op->name.c_str()); return false; } } @@ -717,8 +719,18 @@ ZEND_FUNCTION(IcePHP_defineOperation) zval* exceptions; if (zend_parse_parameters( - ZEND_NUM_ARGS(), const_cast("osllla!a!a!a!"), &cls, &name, &nameLen, &mode, &sendMode, &format, - &inParams, &outParams, &returnType, &exceptions) == FAILURE) + ZEND_NUM_ARGS(), + const_cast("osllla!a!a!a!"), + &cls, + &name, + &nameLen, + &mode, + &sendMode, + &format, + &inParams, + &outParams, + &returnType, + &exceptions) == FAILURE) { return; } @@ -728,8 +740,14 @@ ZEND_FUNCTION(IcePHP_defineOperation) assert(c); auto op = make_shared( - name, static_cast(mode), static_cast(sendMode), - static_cast(format), inParams, outParams, returnType, exceptions); + name, + static_cast(mode), + static_cast(sendMode), + static_cast(format), + inParams, + outParams, + returnType, + exceptions); c->addOperation(name, op); } diff --git a/php/src/Properties.cpp b/php/src/Properties.cpp index fe67598a14f..6a2233ddc03 100644 --- a/php/src/Properties.cpp +++ b/php/src/Properties.cpp @@ -558,7 +558,11 @@ ZEND_FUNCTION(Ice_createProperties) zval* defaultsObj = 0; if (zend_parse_parameters( - ZEND_NUM_ARGS(), const_cast("|a!O!"), &arglist, &defaultsObj, propertiesClassEntry) == FAILURE) + ZEND_NUM_ARGS(), + const_cast("|a!O!"), + &arglist, + &defaultsObj, + propertiesClassEntry) == FAILURE) { RETURN_NULL(); } @@ -656,7 +660,9 @@ static zend_function_entry _classMethods[] = { ZEND_ACC_PUBLIC) ZEND_ME(Ice_Properties, load, Ice_Properties_load_arginfo, ZEND_ACC_PUBLIC) ZEND_ME(Ice_Properties, clone, ice_void_arginfo, ZEND_ACC_PUBLIC){ - 0, 0, 0}}; + 0, + 0, + 0}}; bool IcePHP::propertiesInit(void) diff --git a/php/src/Proxy.cpp b/php/src/Proxy.cpp index 819edb4f3f6..8bbd9dcea1e 100644 --- a/php/src/Proxy.cpp +++ b/php/src/Proxy.cpp @@ -1500,15 +1500,27 @@ do_cast(INTERNAL_FUNCTION_PARAMETERS, bool check) zval* arr = 0; if (zend_parse_parameters_ex( - ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), const_cast("s|s!a!"), &id, &idLen, &facet, &facetLen, + ZEND_PARSE_PARAMS_QUIET, + ZEND_NUM_ARGS(), + const_cast("s|s!a!"), + &id, + &idLen, + &facet, + &facetLen, &arr) == FAILURE) { facet = 0; if (zend_parse_parameters_ex( - ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), const_cast("s|a!"), &id, &idLen, &arr) == FAILURE) + ZEND_PARSE_PARAMS_QUIET, + ZEND_NUM_ARGS(), + const_cast("s|a!"), + &id, + &idLen, + &arr) == FAILURE) { php_error( - E_ERROR, "%s() requires a type id followed by an optional facet and/or context", + E_ERROR, + "%s() requires a type id followed by an optional facet and/or context", get_active_function_name()); return; } diff --git a/php/src/Types.cpp b/php/src/Types.cpp index 45f1b6f1166..892071d1bf0 100644 --- a/php/src/Types.cpp +++ b/php/src/Types.cpp @@ -2862,7 +2862,9 @@ IcePHP::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& m for (const auto& member : members) { zval* val = zend_hash_str_find( - Z_OBJPROP_P(const_cast(&_object)), member->name.c_str(), static_cast(member->name.size())); + Z_OBJPROP_P(const_cast(&_object)), + member->name.c_str(), + static_cast(member->name.size())); if (!val) { @@ -3465,7 +3467,15 @@ ZEND_FUNCTION(IcePHP_defineClass) zval* members; if (zend_parse_parameters( - ZEND_NUM_ARGS(), const_cast("sslbo!a!"), &id, &idLen, &name, &nameLen, &compactId, &interface, &base, + ZEND_NUM_ARGS(), + const_cast("sslbo!a!"), + &id, + &idLen, + &name, + &nameLen, + &compactId, + &interface, + &base, &members) == FAILURE) { return; @@ -3547,7 +3557,14 @@ ZEND_FUNCTION(IcePHP_defineException) zval* members; if (zend_parse_parameters( - ZEND_NUM_ARGS(), const_cast("sso!a!"), &id, &idLen, &name, &nameLen, &base, &members) == FAILURE) + ZEND_NUM_ARGS(), + const_cast("sso!a!"), + &id, + &idLen, + &name, + &nameLen, + &base, + &members) == FAILURE) { return; } diff --git a/php/src/Util.cpp b/php/src/Util.cpp index 31a27fed4f6..3f9141771f5 100644 --- a/php/src/Util.cpp +++ b/php/src/Util.cpp @@ -37,7 +37,9 @@ namespace string expected = zendTypeToString(type); string actual = zendTypeToString(Z_TYPE_P(val)); invalidArgument( - "expected value of type %s for member `%s' but received %s", expected.c_str(), name.c_str(), + "expected value of type %s for member `%s' but received %s", + expected.c_str(), + name.c_str(), actual.c_str()); return false; } @@ -51,8 +53,12 @@ namespace zend_class_entry* cls = Z_OBJCE_P(obj); assert(cls); zend_update_property_stringl( - cls, Z_OBJ_P(obj), const_cast(name.c_str()), static_cast(name.size()), - const_cast(val.c_str()), static_cast(val.size())); + cls, + Z_OBJ_P(obj), + const_cast(name.c_str()), + static_cast(name.size()), + const_cast(val.c_str()), + static_cast(val.size())); } template bool getVersion(zval* zv, T& v, const char* type) @@ -281,8 +287,11 @@ IcePHP::createStringMap(zval* zv, const map& ctx) for (map::const_iterator p = ctx.begin(); p != ctx.end(); ++p) { add_assoc_stringl_ex( - zv, const_cast(p->first.c_str()), static_cast(p->first.length()), - const_cast(p->second.c_str()), static_cast(p->second.length())); + zv, + const_cast(p->first.c_str()), + static_cast(p->first.length()), + const_cast(p->second.c_str()), + static_cast(p->second.length())); } return true; diff --git a/python/modules/IcePy/BatchRequestInterceptor.cpp b/python/modules/IcePy/BatchRequestInterceptor.cpp index 83e9f97a7cf..55a94050037 100644 --- a/python/modules/IcePy/BatchRequestInterceptor.cpp +++ b/python/modules/IcePy/BatchRequestInterceptor.cpp @@ -144,13 +144,21 @@ extern "C" } static PyMethodDef BatchRequestMethods[] = { - {STRCAST("getSize"), reinterpret_cast(batchRequestGetSize), METH_NOARGS, + {STRCAST("getSize"), + reinterpret_cast(batchRequestGetSize), + METH_NOARGS, PyDoc_STR(STRCAST("getSize() -> int"))}, - {STRCAST("getOperation"), reinterpret_cast(batchRequestGetOperation), METH_NOARGS, + {STRCAST("getOperation"), + reinterpret_cast(batchRequestGetOperation), + METH_NOARGS, PyDoc_STR(STRCAST("getOperation() -> string"))}, - {STRCAST("getProxy"), reinterpret_cast(batchRequestGetProxy), METH_NOARGS, + {STRCAST("getProxy"), + reinterpret_cast(batchRequestGetProxy), + METH_NOARGS, PyDoc_STR(STRCAST("getProxy() -> Ice.ObjectPrx"))}, - {STRCAST("enqueue"), reinterpret_cast(batchRequestEnqueue), METH_NOARGS, + {STRCAST("enqueue"), + reinterpret_cast(batchRequestEnqueue), + METH_NOARGS, PyDoc_STR(STRCAST("enqueue() -> None"))}, {0, 0} /* sentinel */ }; @@ -224,7 +232,8 @@ IcePy::BatchRequestInterceptorWrapper::BatchRequestInterceptorWrapper(PyObject* if (!PyCallable_Check(interceptor) && !PyObject_HasAttrString(interceptor, STRCAST("enqueue"))) { throw Ice::InitializationException( - __FILE__, __LINE__, + __FILE__, + __LINE__, "batch request interceptor must either be a callable or an object with an 'enqueue' method"); } diff --git a/python/modules/IcePy/Communicator.cpp b/python/modules/IcePy/Communicator.cpp index 140af9d6706..9b421914425 100644 --- a/python/modules/IcePy/Communicator.cpp +++ b/python/modules/IcePy/Communicator.cpp @@ -179,7 +179,8 @@ extern "C" if (initData && configFile) { PyErr_Format( - PyExc_ValueError, STRCAST("initialize accepts either Ice.InitializationData or a configuration filename")); + PyExc_ValueError, + STRCAST("initialize accepts either Ice.InitializationData or a configuration filename")); return -1; } @@ -1497,66 +1498,125 @@ extern "C" } static PyMethodDef CommunicatorMethods[] = { - {STRCAST("destroy"), reinterpret_cast(communicatorDestroy), METH_NOARGS, + {STRCAST("destroy"), + reinterpret_cast(communicatorDestroy), + METH_NOARGS, PyDoc_STR(STRCAST("destroy() -> None"))}, - {STRCAST("shutdown"), reinterpret_cast(communicatorShutdown), METH_NOARGS, + {STRCAST("shutdown"), + reinterpret_cast(communicatorShutdown), + METH_NOARGS, PyDoc_STR(STRCAST("shutdown() -> None"))}, - {STRCAST("waitForShutdown"), reinterpret_cast(communicatorWaitForShutdown), METH_VARARGS, + {STRCAST("waitForShutdown"), + reinterpret_cast(communicatorWaitForShutdown), + METH_VARARGS, PyDoc_STR(STRCAST("waitForShutdown() -> None"))}, - {STRCAST("isShutdown"), reinterpret_cast(communicatorIsShutdown), METH_NOARGS, + {STRCAST("isShutdown"), + reinterpret_cast(communicatorIsShutdown), + METH_NOARGS, PyDoc_STR(STRCAST("isShutdown() -> bool"))}, - {STRCAST("stringToProxy"), reinterpret_cast(communicatorStringToProxy), METH_VARARGS, + {STRCAST("stringToProxy"), + reinterpret_cast(communicatorStringToProxy), + METH_VARARGS, PyDoc_STR(STRCAST("stringToProxy(str) -> Ice.ObjectPrx"))}, - {STRCAST("proxyToString"), reinterpret_cast(communicatorProxyToString), METH_VARARGS, + {STRCAST("proxyToString"), + reinterpret_cast(communicatorProxyToString), + METH_VARARGS, PyDoc_STR(STRCAST("proxyToString(Ice.ObjectPrx) -> string"))}, - {STRCAST("propertyToProxy"), reinterpret_cast(communicatorPropertyToProxy), METH_VARARGS, + {STRCAST("propertyToProxy"), + reinterpret_cast(communicatorPropertyToProxy), + METH_VARARGS, PyDoc_STR(STRCAST("propertyToProxy(str) -> Ice.ObjectPrx"))}, - {STRCAST("proxyToProperty"), reinterpret_cast(communicatorProxyToProperty), METH_VARARGS, + {STRCAST("proxyToProperty"), + reinterpret_cast(communicatorProxyToProperty), + METH_VARARGS, PyDoc_STR(STRCAST("proxyToProperty(Ice.ObjectPrx, str) -> dict"))}, - {STRCAST("identityToString"), reinterpret_cast(communicatorIdentityToString), METH_VARARGS, + {STRCAST("identityToString"), + reinterpret_cast(communicatorIdentityToString), + METH_VARARGS, PyDoc_STR(STRCAST("identityToString(Ice.Identity) -> string"))}, - {STRCAST("createObjectAdapter"), reinterpret_cast(communicatorCreateObjectAdapter), METH_VARARGS, + {STRCAST("createObjectAdapter"), + reinterpret_cast(communicatorCreateObjectAdapter), + METH_VARARGS, PyDoc_STR(STRCAST("createObjectAdapter(name) -> Ice.ObjectAdapter"))}, {STRCAST("createObjectAdapterWithEndpoints"), - reinterpret_cast(communicatorCreateObjectAdapterWithEndpoints), METH_VARARGS, + reinterpret_cast(communicatorCreateObjectAdapterWithEndpoints), + METH_VARARGS, PyDoc_STR(STRCAST("createObjectAdapterWithEndpoints(name, endpoints) -> Ice.ObjectAdapter"))}, - {STRCAST("createObjectAdapterWithRouter"), reinterpret_cast(communicatorCreateObjectAdapterWithRouter), - METH_VARARGS, PyDoc_STR(STRCAST("createObjectAdapterWithRouter(name, router) -> Ice.ObjectAdapter"))}, - {STRCAST("getValueFactoryManager"), reinterpret_cast(communicatorGetValueFactoryManager), METH_NOARGS, + {STRCAST("createObjectAdapterWithRouter"), + reinterpret_cast(communicatorCreateObjectAdapterWithRouter), + METH_VARARGS, + PyDoc_STR(STRCAST("createObjectAdapterWithRouter(name, router) -> Ice.ObjectAdapter"))}, + {STRCAST("getValueFactoryManager"), + reinterpret_cast(communicatorGetValueFactoryManager), + METH_NOARGS, PyDoc_STR(STRCAST("getValueFactoryManager() -> Ice.ValueFactoryManager"))}, - {STRCAST("getImplicitContext"), reinterpret_cast(communicatorGetImplicitContext), METH_NOARGS, + {STRCAST("getImplicitContext"), + reinterpret_cast(communicatorGetImplicitContext), + METH_NOARGS, PyDoc_STR(STRCAST("getImplicitContext() -> Ice.ImplicitContext"))}, - {STRCAST("getProperties"), reinterpret_cast(communicatorGetProperties), METH_NOARGS, + {STRCAST("getProperties"), + reinterpret_cast(communicatorGetProperties), + METH_NOARGS, PyDoc_STR(STRCAST("getProperties() -> Ice.Properties"))}, - {STRCAST("getLogger"), reinterpret_cast(communicatorGetLogger), METH_NOARGS, + {STRCAST("getLogger"), + reinterpret_cast(communicatorGetLogger), + METH_NOARGS, PyDoc_STR(STRCAST("getLogger() -> Ice.Logger"))}, - {STRCAST("getDefaultRouter"), reinterpret_cast(communicatorGetDefaultRouter), METH_NOARGS, + {STRCAST("getDefaultRouter"), + reinterpret_cast(communicatorGetDefaultRouter), + METH_NOARGS, PyDoc_STR(STRCAST("getDefaultRouter() -> proxy"))}, - {STRCAST("setDefaultRouter"), reinterpret_cast(communicatorSetDefaultRouter), METH_VARARGS, + {STRCAST("setDefaultRouter"), + reinterpret_cast(communicatorSetDefaultRouter), + METH_VARARGS, PyDoc_STR(STRCAST("setDefaultRouter(proxy) -> None"))}, - {STRCAST("getDefaultLocator"), reinterpret_cast(communicatorGetDefaultLocator), METH_NOARGS, + {STRCAST("getDefaultLocator"), + reinterpret_cast(communicatorGetDefaultLocator), + METH_NOARGS, PyDoc_STR(STRCAST("getDefaultLocator() -> proxy"))}, - {STRCAST("setDefaultLocator"), reinterpret_cast(communicatorSetDefaultLocator), METH_VARARGS, + {STRCAST("setDefaultLocator"), + reinterpret_cast(communicatorSetDefaultLocator), + METH_VARARGS, PyDoc_STR(STRCAST("setDefaultLocator(proxy) -> None"))}, - {STRCAST("flushBatchRequests"), reinterpret_cast(communicatorFlushBatchRequests), METH_VARARGS, + {STRCAST("flushBatchRequests"), + reinterpret_cast(communicatorFlushBatchRequests), + METH_VARARGS, PyDoc_STR(STRCAST("flushBatchRequests(compress) -> None"))}, - {STRCAST("flushBatchRequestsAsync"), reinterpret_cast(communicatorFlushBatchRequestsAsync), - METH_VARARGS, PyDoc_STR(STRCAST("flushBatchRequestsAsync(compress) -> Ice.Future"))}, - {STRCAST("createAdmin"), reinterpret_cast(communicatorCreateAdmin), METH_VARARGS, + {STRCAST("flushBatchRequestsAsync"), + reinterpret_cast(communicatorFlushBatchRequestsAsync), + METH_VARARGS, + PyDoc_STR(STRCAST("flushBatchRequestsAsync(compress) -> Ice.Future"))}, + {STRCAST("createAdmin"), + reinterpret_cast(communicatorCreateAdmin), + METH_VARARGS, PyDoc_STR(STRCAST("createAdmin(adminAdapter, adminIdentity) -> Ice.ObjectPrx"))}, - {STRCAST("getAdmin"), reinterpret_cast(communicatorGetAdmin), METH_NOARGS, + {STRCAST("getAdmin"), + reinterpret_cast(communicatorGetAdmin), + METH_NOARGS, PyDoc_STR(STRCAST("getAdmin() -> Ice.ObjectPrx"))}, - {STRCAST("addAdminFacet"), reinterpret_cast(communicatorAddAdminFacet), METH_VARARGS, + {STRCAST("addAdminFacet"), + reinterpret_cast(communicatorAddAdminFacet), + METH_VARARGS, PyDoc_STR(STRCAST("addAdminFacet(servant, facet) -> None"))}, - {STRCAST("findAdminFacet"), reinterpret_cast(communicatorFindAdminFacet), METH_VARARGS, + {STRCAST("findAdminFacet"), + reinterpret_cast(communicatorFindAdminFacet), + METH_VARARGS, PyDoc_STR(STRCAST("findAdminFacet(facet) -> Ice.Object"))}, - {STRCAST("findAllAdminFacets"), reinterpret_cast(communicatorFindAllAdminFacets), METH_NOARGS, + {STRCAST("findAllAdminFacets"), + reinterpret_cast(communicatorFindAllAdminFacets), + METH_NOARGS, PyDoc_STR(STRCAST("findAllAdminFacets() -> dictionary"))}, - {STRCAST("removeAdminFacet"), reinterpret_cast(communicatorRemoveAdminFacet), METH_VARARGS, + {STRCAST("removeAdminFacet"), + reinterpret_cast(communicatorRemoveAdminFacet), + METH_VARARGS, PyDoc_STR(STRCAST("removeAdminFacet(facet) -> Ice.Object"))}, - {STRCAST("_setWrapper"), reinterpret_cast(communicatorSetWrapper), METH_VARARGS, + {STRCAST("_setWrapper"), + reinterpret_cast(communicatorSetWrapper), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("_getWrapper"), reinterpret_cast(communicatorGetWrapper), METH_NOARGS, + {STRCAST("_getWrapper"), + reinterpret_cast(communicatorGetWrapper), + METH_NOARGS, PyDoc_STR(STRCAST("internal function"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/Connection.cpp b/python/modules/IcePy/Connection.cpp index e98b451af6c..113d5cb8dd9 100644 --- a/python/modules/IcePy/Connection.cpp +++ b/python/modules/IcePy/Connection.cpp @@ -652,7 +652,8 @@ extern "C" if (PyObject_IsInstance(h, acmHeartbeatType) == 0) { PyErr_Format( - PyExc_TypeError, "value for 'heartbeat' argument must be Unset or an enumerator of Ice.ACMHeartbeat"); + PyExc_TypeError, + "value for 'heartbeat' argument must be Unset or an enumerator of Ice.ACMHeartbeat"); return 0; } PyObjectHandle v = getAttr(h, "_value", true); @@ -903,41 +904,77 @@ extern "C" } static PyMethodDef ConnectionMethods[] = { - {STRCAST("close"), reinterpret_cast(connectionClose), METH_VARARGS, + {STRCAST("close"), + reinterpret_cast(connectionClose), + METH_VARARGS, PyDoc_STR(STRCAST("close(Ice.ConnectionClose) -> None"))}, - {STRCAST("createProxy"), reinterpret_cast(connectionCreateProxy), METH_VARARGS, + {STRCAST("createProxy"), + reinterpret_cast(connectionCreateProxy), + METH_VARARGS, PyDoc_STR(STRCAST("createProxy(Ice.Identity) -> Ice.ObjectPrx"))}, - {STRCAST("setAdapter"), reinterpret_cast(connectionSetAdapter), METH_VARARGS, + {STRCAST("setAdapter"), + reinterpret_cast(connectionSetAdapter), + METH_VARARGS, PyDoc_STR(STRCAST("setAdapter(Ice.ObjectAdapter) -> None"))}, - {STRCAST("getAdapter"), reinterpret_cast(connectionGetAdapter), METH_NOARGS, + {STRCAST("getAdapter"), + reinterpret_cast(connectionGetAdapter), + METH_NOARGS, PyDoc_STR(STRCAST("getAdapter() -> Ice.ObjectAdapter"))}, - {STRCAST("flushBatchRequests"), reinterpret_cast(connectionFlushBatchRequests), METH_VARARGS, + {STRCAST("flushBatchRequests"), + reinterpret_cast(connectionFlushBatchRequests), + METH_VARARGS, PyDoc_STR(STRCAST("flushBatchRequests(Ice.CompressBatch) -> None"))}, - {STRCAST("flushBatchRequestsAsync"), reinterpret_cast(connectionFlushBatchRequestsAsync), METH_VARARGS, + {STRCAST("flushBatchRequestsAsync"), + reinterpret_cast(connectionFlushBatchRequestsAsync), + METH_VARARGS, PyDoc_STR(STRCAST("flushBatchRequestsAsync(Ice.CompressBatch) -> Ice.Future"))}, - {STRCAST("setCloseCallback"), reinterpret_cast(connectionSetCloseCallback), METH_VARARGS, + {STRCAST("setCloseCallback"), + reinterpret_cast(connectionSetCloseCallback), + METH_VARARGS, PyDoc_STR(STRCAST("setCloseCallback(Ice.CloseCallback) -> None"))}, - {STRCAST("setHeartbeatCallback"), reinterpret_cast(connectionSetHeartbeatCallback), METH_VARARGS, + {STRCAST("setHeartbeatCallback"), + reinterpret_cast(connectionSetHeartbeatCallback), + METH_VARARGS, PyDoc_STR(STRCAST("setHeartbeatCallback(Ice.HeartbeatCallback) -> None"))}, - {STRCAST("heartbeat"), reinterpret_cast(connectionHeartbeat), METH_NOARGS, + {STRCAST("heartbeat"), + reinterpret_cast(connectionHeartbeat), + METH_NOARGS, PyDoc_STR(STRCAST("heartbeat() -> None"))}, - {STRCAST("setACM"), reinterpret_cast(connectionSetACM), METH_VARARGS, + {STRCAST("setACM"), + reinterpret_cast(connectionSetACM), + METH_VARARGS, PyDoc_STR(STRCAST("setACM(int, Ice.ACMClose, Ice.ACMHeartbeat) -> None"))}, - {STRCAST("getACM"), reinterpret_cast(connectionGetACM), METH_NOARGS, + {STRCAST("getACM"), + reinterpret_cast(connectionGetACM), + METH_NOARGS, PyDoc_STR(STRCAST("getACM() -> Ice.ACM"))}, - {STRCAST("type"), reinterpret_cast(connectionType), METH_NOARGS, + {STRCAST("type"), + reinterpret_cast(connectionType), + METH_NOARGS, PyDoc_STR(STRCAST("type() -> string"))}, - {STRCAST("timeout"), reinterpret_cast(connectionTimeout), METH_NOARGS, + {STRCAST("timeout"), + reinterpret_cast(connectionTimeout), + METH_NOARGS, PyDoc_STR(STRCAST("timeout() -> int"))}, - {STRCAST("toString"), reinterpret_cast(connectionToString), METH_NOARGS, + {STRCAST("toString"), + reinterpret_cast(connectionToString), + METH_NOARGS, PyDoc_STR(STRCAST("toString() -> string"))}, - {STRCAST("getInfo"), reinterpret_cast(connectionGetInfo), METH_NOARGS, + {STRCAST("getInfo"), + reinterpret_cast(connectionGetInfo), + METH_NOARGS, PyDoc_STR(STRCAST("getInfo() -> Ice.ConnectionInfo"))}, - {STRCAST("getEndpoint"), reinterpret_cast(connectionGetEndpoint), METH_NOARGS, + {STRCAST("getEndpoint"), + reinterpret_cast(connectionGetEndpoint), + METH_NOARGS, PyDoc_STR(STRCAST("getEndpoint() -> Ice.Endpoint"))}, - {STRCAST("setBufferSize"), reinterpret_cast(connectionSetBufferSize), METH_VARARGS, + {STRCAST("setBufferSize"), + reinterpret_cast(connectionSetBufferSize), + METH_VARARGS, PyDoc_STR(STRCAST("setBufferSize(int, int) -> None"))}, - {STRCAST("throwException"), reinterpret_cast(connectionThrowException), METH_NOARGS, + {STRCAST("throwException"), + reinterpret_cast(connectionThrowException), + METH_NOARGS, PyDoc_STR(STRCAST("throwException() -> None"))}, {0, 0} /* sentinel */ }; @@ -1036,7 +1073,9 @@ IcePy::getConnectionArg(PyObject* p, const string& func, const string& arg, Ice: else if (!checkConnection(p)) { PyErr_Format( - PyExc_ValueError, STRCAST("%s expects an Ice.Connection object or None for argument '%s'"), func.c_str(), + PyExc_ValueError, + STRCAST("%s expects an Ice.Connection object or None for argument '%s'"), + func.c_str(), arg.c_str()); return false; } diff --git a/python/modules/IcePy/ConnectionInfo.cpp b/python/modules/IcePy/ConnectionInfo.cpp index 1997d3fbb95..7df791feaba 100644 --- a/python/modules/IcePy/ConnectionInfo.cpp +++ b/python/modules/IcePy/ConnectionInfo.cpp @@ -243,60 +243,111 @@ extern "C" } static PyGetSetDef ConnectionInfoGetters[] = { - {STRCAST("underlying"), reinterpret_cast(connectionInfoGetUnderlying), 0, - PyDoc_STR(STRCAST("get underlying connection information")), 0}, - {STRCAST("incoming"), reinterpret_cast(connectionInfoGetIncoming), 0, - PyDoc_STR(STRCAST("whether connection is incoming")), 0}, - {STRCAST("adapterName"), reinterpret_cast(connectionInfoGetAdapterName), 0, - PyDoc_STR(STRCAST("adapter associated the connection")), 0}, + {STRCAST("underlying"), + reinterpret_cast(connectionInfoGetUnderlying), + 0, + PyDoc_STR(STRCAST("get underlying connection information")), + 0}, + {STRCAST("incoming"), + reinterpret_cast(connectionInfoGetIncoming), + 0, + PyDoc_STR(STRCAST("whether connection is incoming")), + 0}, + {STRCAST("adapterName"), + reinterpret_cast(connectionInfoGetAdapterName), + 0, + PyDoc_STR(STRCAST("adapter associated the connection")), + 0}, {0, 0} /* sentinel */ }; static PyGetSetDef IPConnectionInfoGetters[] = { - {STRCAST("localAddress"), reinterpret_cast(ipConnectionInfoGetLocalAddress), 0, - PyDoc_STR(STRCAST("local address")), 0}, - {STRCAST("localPort"), reinterpret_cast(ipConnectionInfoGetLocalPort), 0, PyDoc_STR(STRCAST("local port")), + {STRCAST("localAddress"), + reinterpret_cast(ipConnectionInfoGetLocalAddress), + 0, + PyDoc_STR(STRCAST("local address")), + 0}, + {STRCAST("localPort"), + reinterpret_cast(ipConnectionInfoGetLocalPort), + 0, + PyDoc_STR(STRCAST("local port")), + 0}, + {STRCAST("remoteAddress"), + reinterpret_cast(ipConnectionInfoGetRemoteAddress), + 0, + PyDoc_STR(STRCAST("remote address")), + 0}, + {STRCAST("remotePort"), + reinterpret_cast(ipConnectionInfoGetRemotePort), + 0, + PyDoc_STR(STRCAST("remote port")), 0}, - {STRCAST("remoteAddress"), reinterpret_cast(ipConnectionInfoGetRemoteAddress), 0, - PyDoc_STR(STRCAST("remote address")), 0}, - {STRCAST("remotePort"), reinterpret_cast(ipConnectionInfoGetRemotePort), 0, - PyDoc_STR(STRCAST("remote port")), 0}, {0, 0} /* sentinel */ }; static PyGetSetDef TCPConnectionInfoGetters[] = { - {STRCAST("rcvSize"), reinterpret_cast(tcpConnectionInfoGetRcvSize), 0, - PyDoc_STR(STRCAST("receive buffer size")), 0}, - {STRCAST("sndSize"), reinterpret_cast(tcpConnectionInfoGetSndSize), 0, - PyDoc_STR(STRCAST("send buffer size")), 0}, + {STRCAST("rcvSize"), + reinterpret_cast(tcpConnectionInfoGetRcvSize), + 0, + PyDoc_STR(STRCAST("receive buffer size")), + 0}, + {STRCAST("sndSize"), + reinterpret_cast(tcpConnectionInfoGetSndSize), + 0, + PyDoc_STR(STRCAST("send buffer size")), + 0}, {0, 0} /* sentinel */ }; static PyGetSetDef UDPConnectionInfoGetters[] = { - {STRCAST("mcastAddress"), reinterpret_cast(udpConnectionInfoGetMcastAddress), 0, - PyDoc_STR(STRCAST("multicast address")), 0}, - {STRCAST("mcastPort"), reinterpret_cast(udpConnectionInfoGetMcastPort), 0, - PyDoc_STR(STRCAST("multicast port")), 0}, - {STRCAST("rcvSize"), reinterpret_cast(udpConnectionInfoGetRcvSize), 0, - PyDoc_STR(STRCAST("receive buffer size")), 0}, - {STRCAST("sndSize"), reinterpret_cast(udpConnectionInfoGetSndSize), 0, - PyDoc_STR(STRCAST("send buffer size")), 0}, + {STRCAST("mcastAddress"), + reinterpret_cast(udpConnectionInfoGetMcastAddress), + 0, + PyDoc_STR(STRCAST("multicast address")), + 0}, + {STRCAST("mcastPort"), + reinterpret_cast(udpConnectionInfoGetMcastPort), + 0, + PyDoc_STR(STRCAST("multicast port")), + 0}, + {STRCAST("rcvSize"), + reinterpret_cast(udpConnectionInfoGetRcvSize), + 0, + PyDoc_STR(STRCAST("receive buffer size")), + 0}, + {STRCAST("sndSize"), + reinterpret_cast(udpConnectionInfoGetSndSize), + 0, + PyDoc_STR(STRCAST("send buffer size")), + 0}, {0, 0} /* sentinel */ }; static PyGetSetDef WSConnectionInfoGetters[] = { - {STRCAST("headers"), reinterpret_cast(wsConnectionInfoGetHeaders), 0, PyDoc_STR(STRCAST("request headers")), + {STRCAST("headers"), + reinterpret_cast(wsConnectionInfoGetHeaders), + 0, + PyDoc_STR(STRCAST("request headers")), 0}, {0, 0} /* sentinel */ }; static PyGetSetDef SSLConnectionInfoGetters[] = { - {STRCAST("cipher"), reinterpret_cast(sslConnectionInfoGetCipher), 0, - PyDoc_STR(STRCAST("negotiated cipher suite")), 0}, - {STRCAST("certs"), reinterpret_cast(sslConnectionInfoGetCerts), 0, PyDoc_STR(STRCAST("certificate chain")), + {STRCAST("cipher"), + reinterpret_cast(sslConnectionInfoGetCipher), + 0, + PyDoc_STR(STRCAST("negotiated cipher suite")), + 0}, + {STRCAST("certs"), + reinterpret_cast(sslConnectionInfoGetCerts), + 0, + PyDoc_STR(STRCAST("certificate chain")), + 0}, + {STRCAST("verified"), + reinterpret_cast(sslConnectionInfoGetVerified), + 0, + PyDoc_STR(STRCAST("certificate chain verification status")), 0}, - {STRCAST("verified"), reinterpret_cast(sslConnectionInfoGetVerified), 0, - PyDoc_STR(STRCAST("certificate chain verification status")), 0}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/Current.cpp b/python/modules/IcePy/Current.cpp index ea3eb1e547b..c118987f8d2 100644 --- a/python/modules/IcePy/Current.cpp +++ b/python/modules/IcePy/Current.cpp @@ -233,23 +233,50 @@ extern "C" } static PyGetSetDef CurrentGetSetters[] = { - {STRCAST("adapter"), reinterpret_cast(currentGetter), 0, STRCAST("object adapter"), + {STRCAST("adapter"), + reinterpret_cast(currentGetter), + 0, + STRCAST("object adapter"), reinterpret_cast(CURRENT_ADAPTER)}, - {STRCAST("con"), reinterpret_cast(currentGetter), 0, STRCAST("connection info"), + {STRCAST("con"), + reinterpret_cast(currentGetter), + 0, + STRCAST("connection info"), reinterpret_cast(CURRENT_CONNECTION)}, - {STRCAST("id"), reinterpret_cast(currentGetter), 0, STRCAST("identity"), + {STRCAST("id"), + reinterpret_cast(currentGetter), + 0, + STRCAST("identity"), reinterpret_cast(CURRENT_ID)}, - {STRCAST("facet"), reinterpret_cast(currentGetter), 0, STRCAST("facet name"), + {STRCAST("facet"), + reinterpret_cast(currentGetter), + 0, + STRCAST("facet name"), reinterpret_cast(CURRENT_FACET)}, - {STRCAST("operation"), reinterpret_cast(currentGetter), 0, STRCAST("operation name"), + {STRCAST("operation"), + reinterpret_cast(currentGetter), + 0, + STRCAST("operation name"), reinterpret_cast(CURRENT_OPERATION)}, - {STRCAST("mode"), reinterpret_cast(currentGetter), 0, STRCAST("operation mode"), + {STRCAST("mode"), + reinterpret_cast(currentGetter), + 0, + STRCAST("operation mode"), reinterpret_cast(CURRENT_MODE)}, - {STRCAST("ctx"), reinterpret_cast(currentGetter), 0, STRCAST("context"), + {STRCAST("ctx"), + reinterpret_cast(currentGetter), + 0, + STRCAST("context"), reinterpret_cast(CURRENT_CTX)}, - {STRCAST("requestId"), reinterpret_cast(currentGetter), 0, STRCAST("requestId"), + {STRCAST("requestId"), + reinterpret_cast(currentGetter), + 0, + STRCAST("requestId"), reinterpret_cast(CURRENT_REQUEST_ID)}, - {STRCAST("encoding"), reinterpret_cast(currentGetter), 0, STRCAST("encoding"), + {STRCAST("encoding"), + reinterpret_cast(currentGetter), + 0, + STRCAST("encoding"), reinterpret_cast(CURRENT_ENCODING)}, {0} /* Sentinel */ }; diff --git a/python/modules/IcePy/Endpoint.cpp b/python/modules/IcePy/Endpoint.cpp index 45c9516eb16..ae8ea12f4c2 100644 --- a/python/modules/IcePy/Endpoint.cpp +++ b/python/modules/IcePy/Endpoint.cpp @@ -139,9 +139,13 @@ extern "C" } static PyMethodDef EndpointMethods[] = { - {STRCAST("toString"), reinterpret_cast(endpointToString), METH_NOARGS, + {STRCAST("toString"), + reinterpret_cast(endpointToString), + METH_NOARGS, PyDoc_STR(STRCAST("toString() -> string"))}, - {STRCAST("getInfo"), reinterpret_cast(endpointGetInfo), METH_NOARGS, + {STRCAST("getInfo"), + reinterpret_cast(endpointGetInfo), + METH_NOARGS, PyDoc_STR(STRCAST("getInfo() -> Ice.EndpointInfo"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/EndpointInfo.cpp b/python/modules/IcePy/EndpointInfo.cpp index 8f3d76e8365..17814adc5a8 100644 --- a/python/modules/IcePy/EndpointInfo.cpp +++ b/python/modules/IcePy/EndpointInfo.cpp @@ -211,7 +211,8 @@ extern "C" auto info = dynamic_pointer_cast(*self->endpointInfo); assert(info); return PyBytes_FromStringAndSize( - reinterpret_cast(&info->rawBytes[0]), static_cast(info->rawBytes.size())); + reinterpret_cast(&info->rawBytes[0]), + static_cast(info->rawBytes.size())); } #ifdef WIN32 @@ -226,39 +227,66 @@ extern "C" } static PyMethodDef EndpointInfoMethods[] = { - {STRCAST("type"), reinterpret_cast(endpointInfoType), METH_NOARGS, + {STRCAST("type"), + reinterpret_cast(endpointInfoType), + METH_NOARGS, PyDoc_STR(STRCAST("type() -> int"))}, - {STRCAST("datagram"), reinterpret_cast(endpointInfoDatagram), METH_NOARGS, + {STRCAST("datagram"), + reinterpret_cast(endpointInfoDatagram), + METH_NOARGS, PyDoc_STR(STRCAST("datagram() -> bool"))}, - {STRCAST("secure"), reinterpret_cast(endpointInfoSecure), METH_NOARGS, + {STRCAST("secure"), + reinterpret_cast(endpointInfoSecure), + METH_NOARGS, PyDoc_STR(STRCAST("secure() -> bool"))}, {0, 0} /* sentinel */ }; static PyGetSetDef EndpointInfoGetters[] = { - {STRCAST("underlying"), reinterpret_cast(endpointInfoGetUnderlying), 0, - PyDoc_STR(STRCAST("underling endpoint information")), 0}, - {STRCAST("timeout"), reinterpret_cast(endpointInfoGetTimeout), 0, - PyDoc_STR(STRCAST("timeout in milliseconds")), 0}, - {STRCAST("compress"), reinterpret_cast(endpointInfoGetCompress), 0, - PyDoc_STR(STRCAST("compression status")), 0}, + {STRCAST("underlying"), + reinterpret_cast(endpointInfoGetUnderlying), + 0, + PyDoc_STR(STRCAST("underling endpoint information")), + 0}, + {STRCAST("timeout"), + reinterpret_cast(endpointInfoGetTimeout), + 0, + PyDoc_STR(STRCAST("timeout in milliseconds")), + 0}, + {STRCAST("compress"), + reinterpret_cast(endpointInfoGetCompress), + 0, + PyDoc_STR(STRCAST("compression status")), + 0}, {0, 0} /* sentinel */ }; static PyGetSetDef IPEndpointInfoGetters[] = { - {STRCAST("host"), reinterpret_cast(ipEndpointInfoGetHost), 0, PyDoc_STR(STRCAST("host name or IP address")), + {STRCAST("host"), + reinterpret_cast(ipEndpointInfoGetHost), + 0, + PyDoc_STR(STRCAST("host name or IP address")), 0}, {STRCAST("port"), reinterpret_cast(ipEndpointInfoGetPort), 0, PyDoc_STR(STRCAST("TCP port number")), 0}, - {STRCAST("sourceAddress"), reinterpret_cast(ipEndpointInfoGetSourceAddress), 0, - PyDoc_STR(STRCAST("source IP address")), 0}, + {STRCAST("sourceAddress"), + reinterpret_cast(ipEndpointInfoGetSourceAddress), + 0, + PyDoc_STR(STRCAST("source IP address")), + 0}, {0, 0} /* sentinel */ }; static PyGetSetDef UDPEndpointInfoGetters[] = { - {STRCAST("mcastInterface"), reinterpret_cast(udpEndpointInfoGetMcastInterface), 0, - PyDoc_STR(STRCAST("multicast interface")), 0}, - {STRCAST("mcastTtl"), reinterpret_cast(udpEndpointInfoGetMcastTtl), 0, - PyDoc_STR(STRCAST("multicast time-to-live")), 0}, + {STRCAST("mcastInterface"), + reinterpret_cast(udpEndpointInfoGetMcastInterface), + 0, + PyDoc_STR(STRCAST("multicast interface")), + 0}, + {STRCAST("mcastTtl"), + reinterpret_cast(udpEndpointInfoGetMcastTtl), + 0, + PyDoc_STR(STRCAST("multicast time-to-live")), + 0}, {0, 0} /* sentinel */ }; @@ -268,10 +296,16 @@ static PyGetSetDef WSEndpointInfoGetters[] = { }; static PyGetSetDef OpaqueEndpointInfoGetters[] = { - {STRCAST("rawBytes"), reinterpret_cast(opaqueEndpointInfoGetRawBytes), 0, - PyDoc_STR(STRCAST("raw encoding")), 0}, - {STRCAST("rawEncoding"), reinterpret_cast(opaqueEndpointInfoGetRawEncoding), 0, - PyDoc_STR(STRCAST("raw encoding version")), 0}, + {STRCAST("rawBytes"), + reinterpret_cast(opaqueEndpointInfoGetRawBytes), + 0, + PyDoc_STR(STRCAST("raw encoding")), + 0}, + {STRCAST("rawEncoding"), + reinterpret_cast(opaqueEndpointInfoGetRawEncoding), + 0, + PyDoc_STR(STRCAST("raw encoding version")), + 0}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/ImplicitContext.cpp b/python/modules/IcePy/ImplicitContext.cpp index e755959fc26..6bca86c6dda 100644 --- a/python/modules/IcePy/ImplicitContext.cpp +++ b/python/modules/IcePy/ImplicitContext.cpp @@ -278,17 +278,29 @@ extern "C" } static PyMethodDef ImplicitContextMethods[] = { - {STRCAST("getContext"), reinterpret_cast(implicitContextGetContext), METH_NOARGS, + {STRCAST("getContext"), + reinterpret_cast(implicitContextGetContext), + METH_NOARGS, PyDoc_STR(STRCAST("getContext() -> Ice.Context"))}, - {STRCAST("setContext"), reinterpret_cast(implicitContextSetContext), METH_VARARGS, + {STRCAST("setContext"), + reinterpret_cast(implicitContextSetContext), + METH_VARARGS, PyDoc_STR(STRCAST("setContext(ctx) -> string"))}, - {STRCAST("containsKey"), reinterpret_cast(implicitContextContainsKey), METH_VARARGS, + {STRCAST("containsKey"), + reinterpret_cast(implicitContextContainsKey), + METH_VARARGS, PyDoc_STR(STRCAST("containsKey(key) -> bool"))}, - {STRCAST("get"), reinterpret_cast(implicitContextGet), METH_VARARGS, + {STRCAST("get"), + reinterpret_cast(implicitContextGet), + METH_VARARGS, PyDoc_STR(STRCAST("get(key) -> string"))}, - {STRCAST("put"), reinterpret_cast(implicitContextPut), METH_VARARGS, + {STRCAST("put"), + reinterpret_cast(implicitContextPut), + METH_VARARGS, PyDoc_STR(STRCAST("put(key, value) -> string"))}, - {STRCAST("remove"), reinterpret_cast(implicitContextRemove), METH_VARARGS, + {STRCAST("remove"), + reinterpret_cast(implicitContextRemove), + METH_VARARGS, PyDoc_STR(STRCAST("remove(key) -> string"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/Init.cpp b/python/modules/IcePy/Init.cpp index 36f75578dc7..67be4a4c3df 100644 --- a/python/modules/IcePy/Init.cpp +++ b/python/modules/IcePy/Init.cpp @@ -29,84 +29,149 @@ using namespace IcePy; extern "C" PyObject* IcePy_cleanup(PyObject*, PyObject*); static PyMethodDef methods[] = { - {STRCAST("stringVersion"), reinterpret_cast(IcePy_stringVersion), METH_NOARGS, + {STRCAST("stringVersion"), + reinterpret_cast(IcePy_stringVersion), + METH_NOARGS, PyDoc_STR(STRCAST("stringVersion() -> string"))}, - {STRCAST("intVersion"), reinterpret_cast(IcePy_intVersion), METH_NOARGS, + {STRCAST("intVersion"), + reinterpret_cast(IcePy_intVersion), + METH_NOARGS, PyDoc_STR(STRCAST("intVersion() -> int"))}, - {STRCAST("currentProtocol"), reinterpret_cast(IcePy_currentProtocol), METH_NOARGS, + {STRCAST("currentProtocol"), + reinterpret_cast(IcePy_currentProtocol), + METH_NOARGS, PyDoc_STR(STRCAST("currentProtocol() -> Ice.ProtocolVersion"))}, - {STRCAST("currentProtocolEncoding"), reinterpret_cast(IcePy_currentProtocolEncoding), METH_NOARGS, + {STRCAST("currentProtocolEncoding"), + reinterpret_cast(IcePy_currentProtocolEncoding), + METH_NOARGS, PyDoc_STR(STRCAST("currentProtocolEncoding() -> Ice.EncodingVersion"))}, - {STRCAST("currentEncoding"), reinterpret_cast(IcePy_currentEncoding), METH_NOARGS, + {STRCAST("currentEncoding"), + reinterpret_cast(IcePy_currentEncoding), + METH_NOARGS, PyDoc_STR(STRCAST("currentEncoding() -> Ice.EncodingVersion"))}, - {STRCAST("stringToProtocolVersion"), reinterpret_cast(IcePy_stringToProtocolVersion), METH_VARARGS, + {STRCAST("stringToProtocolVersion"), + reinterpret_cast(IcePy_stringToProtocolVersion), + METH_VARARGS, PyDoc_STR(STRCAST("stringToProtocolVersion(str) -> Ice.ProtocolVersion"))}, - {STRCAST("protocolVersionToString"), reinterpret_cast(IcePy_protocolVersionToString), METH_VARARGS, + {STRCAST("protocolVersionToString"), + reinterpret_cast(IcePy_protocolVersionToString), + METH_VARARGS, PyDoc_STR(STRCAST("protocolVersionToString(Ice.ProtocolVersion) -> string"))}, - {STRCAST("stringToEncodingVersion"), reinterpret_cast(IcePy_stringToEncodingVersion), METH_VARARGS, + {STRCAST("stringToEncodingVersion"), + reinterpret_cast(IcePy_stringToEncodingVersion), + METH_VARARGS, PyDoc_STR(STRCAST("stringToEncodingVersion(str) -> Ice.EncodingVersion"))}, - {STRCAST("encodingVersionToString"), reinterpret_cast(IcePy_encodingVersionToString), METH_VARARGS, + {STRCAST("encodingVersionToString"), + reinterpret_cast(IcePy_encodingVersionToString), + METH_VARARGS, PyDoc_STR(STRCAST("encodingVersionToString(Ice.EncodingVersion) -> string"))}, - {STRCAST("generateUUID"), reinterpret_cast(IcePy_generateUUID), METH_NOARGS, + {STRCAST("generateUUID"), + reinterpret_cast(IcePy_generateUUID), + METH_NOARGS, PyDoc_STR(STRCAST("generateUUID() -> string"))}, - {STRCAST("createProperties"), reinterpret_cast(IcePy_createProperties), METH_VARARGS, + {STRCAST("createProperties"), + reinterpret_cast(IcePy_createProperties), + METH_VARARGS, PyDoc_STR(STRCAST("createProperties([args]) -> Ice.Properties"))}, - {STRCAST("stringToIdentity"), reinterpret_cast(IcePy_stringToIdentity), METH_O, + {STRCAST("stringToIdentity"), + reinterpret_cast(IcePy_stringToIdentity), + METH_O, PyDoc_STR(STRCAST("stringToIdentity(string) -> Ice.Identity"))}, - {STRCAST("identityToString"), reinterpret_cast(IcePy_identityToString), METH_VARARGS, + {STRCAST("identityToString"), + reinterpret_cast(IcePy_identityToString), + METH_VARARGS, PyDoc_STR(STRCAST("identityToString(Ice.Identity, Ice.ToStringMode) -> string"))}, - {STRCAST("getProcessLogger"), reinterpret_cast(IcePy_getProcessLogger), METH_NOARGS, + {STRCAST("getProcessLogger"), + reinterpret_cast(IcePy_getProcessLogger), + METH_NOARGS, PyDoc_STR(STRCAST("getProcessLogger() -> Ice.Logger"))}, - {STRCAST("setProcessLogger"), reinterpret_cast(IcePy_setProcessLogger), METH_VARARGS, + {STRCAST("setProcessLogger"), + reinterpret_cast(IcePy_setProcessLogger), + METH_VARARGS, PyDoc_STR(STRCAST("setProcessLogger(logger) -> None"))}, - {STRCAST("defineEnum"), reinterpret_cast(IcePy_defineEnum), METH_VARARGS, + {STRCAST("defineEnum"), + reinterpret_cast(IcePy_defineEnum), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineStruct"), reinterpret_cast(IcePy_defineStruct), METH_VARARGS, + {STRCAST("defineStruct"), + reinterpret_cast(IcePy_defineStruct), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineSequence"), reinterpret_cast(IcePy_defineSequence), METH_VARARGS, + {STRCAST("defineSequence"), + reinterpret_cast(IcePy_defineSequence), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineCustom"), reinterpret_cast(IcePy_defineCustom), METH_VARARGS, + {STRCAST("defineCustom"), + reinterpret_cast(IcePy_defineCustom), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineDictionary"), reinterpret_cast(IcePy_defineDictionary), METH_VARARGS, + {STRCAST("defineDictionary"), + reinterpret_cast(IcePy_defineDictionary), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("declareProxy"), reinterpret_cast(IcePy_declareProxy), METH_VARARGS, + {STRCAST("declareProxy"), + reinterpret_cast(IcePy_declareProxy), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineProxy"), reinterpret_cast(IcePy_defineProxy), METH_VARARGS, + {STRCAST("defineProxy"), + reinterpret_cast(IcePy_defineProxy), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("declareClass"), reinterpret_cast(IcePy_declareClass), METH_VARARGS, + {STRCAST("declareClass"), + reinterpret_cast(IcePy_declareClass), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineClass"), reinterpret_cast(IcePy_defineClass), METH_VARARGS, + {STRCAST("defineClass"), + reinterpret_cast(IcePy_defineClass), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("declareValue"), reinterpret_cast(IcePy_declareValue), METH_VARARGS, + {STRCAST("declareValue"), + reinterpret_cast(IcePy_declareValue), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineValue"), reinterpret_cast(IcePy_defineValue), METH_VARARGS, + {STRCAST("defineValue"), + reinterpret_cast(IcePy_defineValue), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("defineException"), reinterpret_cast(IcePy_defineException), METH_VARARGS, + {STRCAST("defineException"), + reinterpret_cast(IcePy_defineException), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("stringify"), reinterpret_cast(IcePy_stringify), METH_VARARGS, + {STRCAST("stringify"), + reinterpret_cast(IcePy_stringify), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("stringifyException"), reinterpret_cast(IcePy_stringifyException), METH_VARARGS, + {STRCAST("stringifyException"), + reinterpret_cast(IcePy_stringifyException), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("loadSlice"), reinterpret_cast(IcePy_loadSlice), METH_VARARGS, + {STRCAST("loadSlice"), + reinterpret_cast(IcePy_loadSlice), + METH_VARARGS, PyDoc_STR(STRCAST("loadSlice(cmd) -> None"))}, - {STRCAST("cleanup"), reinterpret_cast(IcePy_cleanup), METH_NOARGS, + {STRCAST("cleanup"), + reinterpret_cast(IcePy_cleanup), + METH_NOARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("compile"), reinterpret_cast(IcePy_compile), METH_VARARGS, + {STRCAST("compile"), + reinterpret_cast(IcePy_compile), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, {0, 0} /* sentinel */ }; #define INIT_RETURN return (0) -static struct PyModuleDef iceModule = {PyModuleDef_HEAD_INIT, - "IcePy", - "The Internet Communications Engine.", - -1, - methods, - nullptr, - nullptr, - nullptr, - nullptr}; +static struct PyModuleDef iceModule = { + PyModuleDef_HEAD_INIT, + "IcePy", + "The Internet Communications Engine.", + -1, + methods, + nullptr, + nullptr, + nullptr, + nullptr}; #if defined(__GNUC__) extern "C" __attribute__((visibility("default"))) PyObject* diff --git a/python/modules/IcePy/Logger.cpp b/python/modules/IcePy/Logger.cpp index b2986c69118..7bebcbffb42 100644 --- a/python/modules/IcePy/Logger.cpp +++ b/python/modules/IcePy/Logger.cpp @@ -341,17 +341,29 @@ extern "C" } static PyMethodDef LoggerMethods[] = { - {STRCAST("_print"), reinterpret_cast(loggerPrint), METH_VARARGS, + {STRCAST("_print"), + reinterpret_cast(loggerPrint), + METH_VARARGS, PyDoc_STR(STRCAST("_print(message) -> None"))}, - {STRCAST("trace"), reinterpret_cast(loggerTrace), METH_VARARGS, + {STRCAST("trace"), + reinterpret_cast(loggerTrace), + METH_VARARGS, PyDoc_STR(STRCAST("trace(category, message) -> None"))}, - {STRCAST("warning"), reinterpret_cast(loggerWarning), METH_VARARGS, + {STRCAST("warning"), + reinterpret_cast(loggerWarning), + METH_VARARGS, PyDoc_STR(STRCAST("warning(message) -> None"))}, - {STRCAST("error"), reinterpret_cast(loggerError), METH_VARARGS, + {STRCAST("error"), + reinterpret_cast(loggerError), + METH_VARARGS, PyDoc_STR(STRCAST("error(message) -> None"))}, - {STRCAST("getPrefix"), reinterpret_cast(loggerGetPrefix), METH_NOARGS, + {STRCAST("getPrefix"), + reinterpret_cast(loggerGetPrefix), + METH_NOARGS, PyDoc_STR(STRCAST("getPrefix() -> string"))}, - {STRCAST("cloneWithPrefix"), reinterpret_cast(loggerCloneWithPrefix), METH_VARARGS, + {STRCAST("cloneWithPrefix"), + reinterpret_cast(loggerCloneWithPrefix), + METH_VARARGS, PyDoc_STR(STRCAST("cloneWithPrefix(prefix) -> Ice.Logger"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/ObjectAdapter.cpp b/python/modules/IcePy/ObjectAdapter.cpp index 5822c363321..68ddeea8515 100644 --- a/python/modules/IcePy/ObjectAdapter.cpp +++ b/python/modules/IcePy/ObjectAdapter.cpp @@ -1677,74 +1677,142 @@ extern "C" } static PyMethodDef AdapterMethods[] = { - {STRCAST("getName"), reinterpret_cast(adapterGetName), METH_NOARGS, + {STRCAST("getName"), + reinterpret_cast(adapterGetName), + METH_NOARGS, PyDoc_STR(STRCAST("getName() -> string"))}, - {STRCAST("getCommunicator"), reinterpret_cast(adapterGetCommunicator), METH_NOARGS, + {STRCAST("getCommunicator"), + reinterpret_cast(adapterGetCommunicator), + METH_NOARGS, PyDoc_STR(STRCAST("getCommunicator() -> Ice.Communicator"))}, - {STRCAST("activate"), reinterpret_cast(adapterActivate), METH_NOARGS, + {STRCAST("activate"), + reinterpret_cast(adapterActivate), + METH_NOARGS, PyDoc_STR(STRCAST("activate() -> None"))}, {STRCAST("hold"), reinterpret_cast(adapterHold), METH_NOARGS, PyDoc_STR(STRCAST("hold() -> None"))}, - {STRCAST("waitForHold"), reinterpret_cast(adapterWaitForHold), METH_VARARGS, + {STRCAST("waitForHold"), + reinterpret_cast(adapterWaitForHold), + METH_VARARGS, PyDoc_STR(STRCAST("waitForHold() -> None"))}, - {STRCAST("deactivate"), reinterpret_cast(adapterDeactivate), METH_NOARGS, + {STRCAST("deactivate"), + reinterpret_cast(adapterDeactivate), + METH_NOARGS, PyDoc_STR(STRCAST("deactivate() -> None"))}, - {STRCAST("waitForDeactivate"), reinterpret_cast(adapterWaitForDeactivate), METH_VARARGS, + {STRCAST("waitForDeactivate"), + reinterpret_cast(adapterWaitForDeactivate), + METH_VARARGS, PyDoc_STR(STRCAST("waitForDeactivate() -> None"))}, - {STRCAST("isDeactivated"), reinterpret_cast(adapterIsDeactivated), METH_NOARGS, + {STRCAST("isDeactivated"), + reinterpret_cast(adapterIsDeactivated), + METH_NOARGS, PyDoc_STR(STRCAST("isDeactivated() -> None"))}, - {STRCAST("destroy"), reinterpret_cast(adapterDestroy), METH_NOARGS, + {STRCAST("destroy"), + reinterpret_cast(adapterDestroy), + METH_NOARGS, PyDoc_STR(STRCAST("destroy() -> None"))}, - {STRCAST("add"), reinterpret_cast(adapterAdd), METH_VARARGS, + {STRCAST("add"), + reinterpret_cast(adapterAdd), + METH_VARARGS, PyDoc_STR(STRCAST("add(servant, identity) -> Ice.ObjectPrx"))}, - {STRCAST("addFacet"), reinterpret_cast(adapterAddFacet), METH_VARARGS, + {STRCAST("addFacet"), + reinterpret_cast(adapterAddFacet), + METH_VARARGS, PyDoc_STR(STRCAST("addFacet(servant, identity, facet) -> Ice.ObjectPrx"))}, - {STRCAST("addWithUUID"), reinterpret_cast(adapterAddWithUUID), METH_VARARGS, + {STRCAST("addWithUUID"), + reinterpret_cast(adapterAddWithUUID), + METH_VARARGS, PyDoc_STR(STRCAST("addWithUUID(servant) -> Ice.ObjectPrx"))}, - {STRCAST("addFacetWithUUID"), reinterpret_cast(adapterAddFacetWithUUID), METH_VARARGS, + {STRCAST("addFacetWithUUID"), + reinterpret_cast(adapterAddFacetWithUUID), + METH_VARARGS, PyDoc_STR(STRCAST("addFacetWithUUID(servant, facet) -> Ice.ObjectPrx"))}, - {STRCAST("addDefaultServant"), reinterpret_cast(adapterAddDefaultServant), METH_VARARGS, + {STRCAST("addDefaultServant"), + reinterpret_cast(adapterAddDefaultServant), + METH_VARARGS, PyDoc_STR(STRCAST("addDefaultServant(servant, category) -> None"))}, - {STRCAST("remove"), reinterpret_cast(adapterRemove), METH_VARARGS, + {STRCAST("remove"), + reinterpret_cast(adapterRemove), + METH_VARARGS, PyDoc_STR(STRCAST("remove(identity) -> Ice.Object"))}, - {STRCAST("removeFacet"), reinterpret_cast(adapterRemoveFacet), METH_VARARGS, + {STRCAST("removeFacet"), + reinterpret_cast(adapterRemoveFacet), + METH_VARARGS, PyDoc_STR(STRCAST("removeFacet(identity, facet) -> Ice.Object"))}, - {STRCAST("removeAllFacets"), reinterpret_cast(adapterRemoveAllFacets), METH_VARARGS, + {STRCAST("removeAllFacets"), + reinterpret_cast(adapterRemoveAllFacets), + METH_VARARGS, PyDoc_STR(STRCAST("removeAllFacets(identity) -> dictionary"))}, - {STRCAST("removeDefaultServant"), reinterpret_cast(adapterRemoveDefaultServant), METH_VARARGS, + {STRCAST("removeDefaultServant"), + reinterpret_cast(adapterRemoveDefaultServant), + METH_VARARGS, PyDoc_STR(STRCAST("removeDefaultServant(category) -> Ice.Object"))}, - {STRCAST("find"), reinterpret_cast(adapterFind), METH_VARARGS, + {STRCAST("find"), + reinterpret_cast(adapterFind), + METH_VARARGS, PyDoc_STR(STRCAST("find(identity) -> Ice.Object"))}, - {STRCAST("findFacet"), reinterpret_cast(adapterFindFacet), METH_VARARGS, + {STRCAST("findFacet"), + reinterpret_cast(adapterFindFacet), + METH_VARARGS, PyDoc_STR(STRCAST("findFacet(identity, facet) -> Ice.Object"))}, - {STRCAST("findAllFacets"), reinterpret_cast(adapterFindAllFacets), METH_VARARGS, + {STRCAST("findAllFacets"), + reinterpret_cast(adapterFindAllFacets), + METH_VARARGS, PyDoc_STR(STRCAST("findAllFacets(identity) -> dictionary"))}, - {STRCAST("findByProxy"), reinterpret_cast(adapterFindByProxy), METH_VARARGS, + {STRCAST("findByProxy"), + reinterpret_cast(adapterFindByProxy), + METH_VARARGS, PyDoc_STR(STRCAST("findByProxy(Ice.ObjectPrx) -> Ice.Object"))}, - {STRCAST("findDefaultServant"), reinterpret_cast(adapterFindDefaultServant), METH_VARARGS, + {STRCAST("findDefaultServant"), + reinterpret_cast(adapterFindDefaultServant), + METH_VARARGS, PyDoc_STR(STRCAST("findDefaultServant(category) -> Ice.Object"))}, - {STRCAST("addServantLocator"), reinterpret_cast(adapterAddServantLocator), METH_VARARGS, + {STRCAST("addServantLocator"), + reinterpret_cast(adapterAddServantLocator), + METH_VARARGS, PyDoc_STR(STRCAST("addServantLocator(Ice.ServantLocator, category) -> None"))}, - {STRCAST("removeServantLocator"), reinterpret_cast(adapterRemoveServantLocator), METH_VARARGS, + {STRCAST("removeServantLocator"), + reinterpret_cast(adapterRemoveServantLocator), + METH_VARARGS, PyDoc_STR(STRCAST("removeServantLocator(category) -> Ice.ServantLocator"))}, - {STRCAST("findServantLocator"), reinterpret_cast(adapterFindServantLocator), METH_VARARGS, + {STRCAST("findServantLocator"), + reinterpret_cast(adapterFindServantLocator), + METH_VARARGS, PyDoc_STR(STRCAST("findServantLocator(category) -> Ice.ServantLocator"))}, - {STRCAST("createProxy"), reinterpret_cast(adapterCreateProxy), METH_VARARGS, + {STRCAST("createProxy"), + reinterpret_cast(adapterCreateProxy), + METH_VARARGS, PyDoc_STR(STRCAST("createProxy(identity) -> Ice.ObjectPrx"))}, - {STRCAST("createDirectProxy"), reinterpret_cast(adapterCreateDirectProxy), METH_VARARGS, + {STRCAST("createDirectProxy"), + reinterpret_cast(adapterCreateDirectProxy), + METH_VARARGS, PyDoc_STR(STRCAST("createDirectProxy(identity) -> Ice.ObjectPrx"))}, - {STRCAST("createIndirectProxy"), reinterpret_cast(adapterCreateIndirectProxy), METH_VARARGS, + {STRCAST("createIndirectProxy"), + reinterpret_cast(adapterCreateIndirectProxy), + METH_VARARGS, PyDoc_STR(STRCAST("createIndirectProxy(identity) -> Ice.ObjectPrx"))}, - {STRCAST("setLocator"), reinterpret_cast(adapterSetLocator), METH_VARARGS, + {STRCAST("setLocator"), + reinterpret_cast(adapterSetLocator), + METH_VARARGS, PyDoc_STR(STRCAST("setLocator(proxy) -> None"))}, - {STRCAST("getLocator"), reinterpret_cast(adapterGetLocator), METH_NOARGS, + {STRCAST("getLocator"), + reinterpret_cast(adapterGetLocator), + METH_NOARGS, PyDoc_STR(STRCAST("getLocator() -> Ice.LocatorPrx"))}, - {STRCAST("getEndpoints"), reinterpret_cast(adapterGetEndpoints), METH_NOARGS, + {STRCAST("getEndpoints"), + reinterpret_cast(adapterGetEndpoints), + METH_NOARGS, PyDoc_STR(STRCAST("getEndpoints() -> None"))}, - {STRCAST("refreshPublishedEndpoints"), reinterpret_cast(adapterRefreshPublishedEndpoints), METH_NOARGS, + {STRCAST("refreshPublishedEndpoints"), + reinterpret_cast(adapterRefreshPublishedEndpoints), + METH_NOARGS, PyDoc_STR(STRCAST("refreshPublishedEndpoints() -> None"))}, - {STRCAST("getPublishedEndpoints"), reinterpret_cast(adapterGetPublishedEndpoints), METH_NOARGS, + {STRCAST("getPublishedEndpoints"), + reinterpret_cast(adapterGetPublishedEndpoints), + METH_NOARGS, PyDoc_STR(STRCAST("getPublishedEndpoints() -> None"))}, - {STRCAST("setPublishedEndpoints"), reinterpret_cast(adapterSetPublishedEndpoints), METH_VARARGS, + {STRCAST("setPublishedEndpoints"), + reinterpret_cast(adapterSetPublishedEndpoints), + METH_VARARGS, PyDoc_STR(STRCAST("setPublishedEndpoints(endpoints) -> None"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/Operation.cpp b/python/modules/IcePy/Operation.cpp index f53ce189351..bd82057b517 100644 --- a/python/modules/IcePy/Operation.cpp +++ b/python/modules/IcePy/Operation.cpp @@ -374,15 +374,31 @@ extern "C" PyObject* returnType; PyObject* exceptions; if (!PyArg_ParseTuple( - args, STRCAST("sO!O!iOO!O!O!OO!"), &name, modeType, &mode, modeType, &sendMode, &amd, &format, - &PyTuple_Type, &metaData, &PyTuple_Type, &inParams, &PyTuple_Type, &outParams, &returnType, &PyTuple_Type, + args, + STRCAST("sO!O!iOO!O!O!OO!"), + &name, + modeType, + &mode, + modeType, + &sendMode, + &amd, + &format, + &PyTuple_Type, + &metaData, + &PyTuple_Type, + &inParams, + &PyTuple_Type, + &outParams, + &returnType, + &PyTuple_Type, &exceptions)) { return -1; } - self->op = new OperationPtr(make_shared( - name, mode, sendMode, amd, format, metaData, inParams, outParams, returnType, exceptions)); + self->op = new OperationPtr( + make_shared< + Operation>(name, mode, sendMode, amd, format, metaData, inParams, outParams, returnType, exceptions)); return 0; } @@ -1068,27 +1084,41 @@ IcePy::Operation::convertParam(PyObject* p, Py_ssize_t pos) } static PyMethodDef OperationMethods[] = { - {STRCAST("invoke"), reinterpret_cast(operationInvoke), METH_VARARGS, + {STRCAST("invoke"), + reinterpret_cast(operationInvoke), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("invokeAsync"), reinterpret_cast(operationInvokeAsync), METH_VARARGS, + {STRCAST("invokeAsync"), + reinterpret_cast(operationInvokeAsync), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("deprecate"), reinterpret_cast(operationDeprecate), METH_VARARGS, + {STRCAST("deprecate"), + reinterpret_cast(operationDeprecate), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, {0, 0} /* sentinel */ }; static PyMethodDef DispatchCallbackMethods[] = { - {STRCAST("response"), reinterpret_cast(dispatchCallbackResponse), METH_VARARGS, + {STRCAST("response"), + reinterpret_cast(dispatchCallbackResponse), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, - {STRCAST("exception"), reinterpret_cast(dispatchCallbackException), METH_VARARGS, + {STRCAST("exception"), + reinterpret_cast(dispatchCallbackException), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, {0, 0} /* sentinel */ }; static PyMethodDef AsyncInvocationContextMethods[] = { - {STRCAST("cancel"), reinterpret_cast(asyncInvocationContextCancel), METH_NOARGS, + {STRCAST("cancel"), + reinterpret_cast(asyncInvocationContextCancel), + METH_NOARGS, PyDoc_STR(STRCAST("cancels the invocation"))}, - {STRCAST("callLater"), reinterpret_cast(asyncInvocationContextCallLater), METH_VARARGS, + {STRCAST("callLater"), + reinterpret_cast(asyncInvocationContextCallLater), + METH_VARARGS, PyDoc_STR(STRCAST("internal function"))}, {0, 0} /* sentinel */ }; @@ -1355,7 +1385,10 @@ IcePy::Invocation::prepareRequest( opName = fixIdent(op->name); } PyErr_Format( - PyExc_RuntimeError, STRCAST("%s expects %d in parameters"), opName.c_str(), static_cast(paramCount)); + PyExc_RuntimeError, + STRCAST("%s expects %d in parameters"), + opName.c_str(), + static_cast(paramCount)); return false; } @@ -1391,7 +1424,8 @@ IcePy::Invocation::prepareRequest( } PyErr_Format( PyExc_ValueError, - STRCAST("invalid value for argument %" PY_FORMAT_SIZE_T "d in operation `%s'"), info->pos + 1, + STRCAST("invalid value for argument %" PY_FORMAT_SIZE_T "d in operation `%s'"), + info->pos + 1, const_cast(name.c_str())); return false; } @@ -1664,7 +1698,11 @@ IcePy::SyncTypedInvocation::invoke(PyObject* args, PyObject* /* kwds */) { AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations. status = _prx->ice_invoke( - _op->name, _op->sendMode, params, result, pyctx == Py_None ? Ice::noExplicitContext : ctx); + _op->name, + _op->sendMode, + params, + result, + pyctx == Py_None ? Ice::noExplicitContext : ctx); } // @@ -2051,7 +2089,9 @@ IcePy::AsyncTypedInvocation::handleInvoke(PyObject* args, PyObject* /* kwds */) auto self = shared_from_this(); return _prx->ice_invokeAsync( - _op->name, _op->sendMode, params, + _op->name, + _op->sendMode, + params, [self](bool ok, const pair& results) { self->response(ok, results); }, [self](exception_ptr exptr) { @@ -2145,7 +2185,14 @@ IcePy::SyncBlobjectInvocation::invoke(PyObject* args, PyObject* /* kwds */) PyObject* operationModeType = lookupType("Ice.OperationMode"); PyObject* ctx = 0; if (!PyArg_ParseTuple( - args, STRCAST("sO!O!|O"), &operation, operationModeType, &mode, &PyBytes_Type, &inParams, &ctx)) + args, + STRCAST("sO!O!|O"), + &operation, + operationModeType, + &mode, + &PyBytes_Type, + &inParams, + &ctx)) { return 0; } @@ -2179,7 +2226,11 @@ IcePy::SyncBlobjectInvocation::invoke(PyObject* args, PyObject* /* kwds */) { AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations. ok = _prx->ice_invoke( - operation, sendMode, in, out, ctx == 0 || ctx == Py_None ? Ice::noExplicitContext : context); + operation, + sendMode, + in, + out, + ctx == 0 || ctx == Py_None ? Ice::noExplicitContext : context); } // @@ -2232,7 +2283,14 @@ IcePy::AsyncBlobjectInvocation::handleInvoke(PyObject* args, PyObject* /* kwds * PyObject* operationModeType = lookupType("Ice.OperationMode"); PyObject* ctx = 0; if (!PyArg_ParseTuple( - args, STRCAST("sO!O!|O"), &operation, operationModeType, &mode, &PyBytes_Type, &inParams, &ctx)) + args, + STRCAST("sO!O!|O"), + &operation, + operationModeType, + &mode, + &PyBytes_Type, + &inParams, + &ctx)) { return 0; } @@ -2262,7 +2320,9 @@ IcePy::AsyncBlobjectInvocation::handleInvoke(PyObject* args, PyObject* /* kwds * auto self = shared_from_this(); return _prx->ice_invokeAsync( - operation, sendMode, params, + operation, + sendMode, + params, [self](bool ok, const pair& results) { self->response(ok, results); }, [self](exception_ptr exptr) { @@ -2491,7 +2551,8 @@ IcePy::TypedUpcall::dispatch( // PyObjectHandle curr = createCurrent(current); PyTuple_SET_ITEM( - args.get(), PyTuple_GET_SIZE(args.get()) - 1, + args.get(), + PyTuple_GET_SIZE(args.get()) - 1, curr.release()); // PyTuple_SET_ITEM steals a reference. dispatchImpl(servant, _op->dispatchName, args.get(), current); diff --git a/python/modules/IcePy/Properties.cpp b/python/modules/IcePy/Properties.cpp index f18f58b7acb..031f8165507 100644 --- a/python/modules/IcePy/Properties.cpp +++ b/python/modules/IcePy/Properties.cpp @@ -660,31 +660,57 @@ extern "C" } static PyMethodDef PropertyMethods[] = { - {STRCAST("getProperty"), reinterpret_cast(propertiesGetProperty), METH_VARARGS, + {STRCAST("getProperty"), + reinterpret_cast(propertiesGetProperty), + METH_VARARGS, PyDoc_STR(STRCAST("getProperty(key) -> string"))}, - {STRCAST("getPropertyWithDefault"), reinterpret_cast(propertiesGetPropertyWithDefault), METH_VARARGS, + {STRCAST("getPropertyWithDefault"), + reinterpret_cast(propertiesGetPropertyWithDefault), + METH_VARARGS, PyDoc_STR(STRCAST("getPropertyWithDefault(key, default) -> string"))}, - {STRCAST("getPropertyAsInt"), reinterpret_cast(propertiesGetPropertyAsInt), METH_VARARGS, + {STRCAST("getPropertyAsInt"), + reinterpret_cast(propertiesGetPropertyAsInt), + METH_VARARGS, PyDoc_STR(STRCAST("getPropertyAsInt(key) -> int"))}, - {STRCAST("getPropertyAsIntWithDefault"), reinterpret_cast(propertiesGetPropertyAsIntWithDefault), - METH_VARARGS, PyDoc_STR(STRCAST("getPropertyAsIntWithDefault(key, default) -> int"))}, - {STRCAST("getPropertyAsList"), reinterpret_cast(propertiesGetPropertyAsList), METH_VARARGS, + {STRCAST("getPropertyAsIntWithDefault"), + reinterpret_cast(propertiesGetPropertyAsIntWithDefault), + METH_VARARGS, + PyDoc_STR(STRCAST("getPropertyAsIntWithDefault(key, default) -> int"))}, + {STRCAST("getPropertyAsList"), + reinterpret_cast(propertiesGetPropertyAsList), + METH_VARARGS, PyDoc_STR(STRCAST("getPropertyAsList(key) -> list"))}, - {STRCAST("getPropertyAsListWithDefault"), reinterpret_cast(propertiesGetPropertyAsListWithDefault), - METH_VARARGS, PyDoc_STR(STRCAST("getPropertyAsListWithDefault(key, default) -> list"))}, - {STRCAST("getPropertiesForPrefix"), reinterpret_cast(propertiesGetPropertiesForPrefix), METH_VARARGS, + {STRCAST("getPropertyAsListWithDefault"), + reinterpret_cast(propertiesGetPropertyAsListWithDefault), + METH_VARARGS, + PyDoc_STR(STRCAST("getPropertyAsListWithDefault(key, default) -> list"))}, + {STRCAST("getPropertiesForPrefix"), + reinterpret_cast(propertiesGetPropertiesForPrefix), + METH_VARARGS, PyDoc_STR(STRCAST("getPropertiesForPrefix(prefix) -> dict"))}, - {STRCAST("setProperty"), reinterpret_cast(propertiesSetProperty), METH_VARARGS, + {STRCAST("setProperty"), + reinterpret_cast(propertiesSetProperty), + METH_VARARGS, PyDoc_STR(STRCAST("setProperty(key, value) -> None"))}, - {STRCAST("getCommandLineOptions"), reinterpret_cast(propertiesGetCommandLineOptions), METH_NOARGS, + {STRCAST("getCommandLineOptions"), + reinterpret_cast(propertiesGetCommandLineOptions), + METH_NOARGS, PyDoc_STR(STRCAST("getCommandLineOptions() -> list"))}, - {STRCAST("parseCommandLineOptions"), reinterpret_cast(propertiesParseCommandLineOptions), METH_VARARGS, + {STRCAST("parseCommandLineOptions"), + reinterpret_cast(propertiesParseCommandLineOptions), + METH_VARARGS, PyDoc_STR(STRCAST("parseCommandLineOptions(prefix, options) -> list"))}, - {STRCAST("parseIceCommandLineOptions"), reinterpret_cast(propertiesParseIceCommandLineOptions), - METH_VARARGS, PyDoc_STR(STRCAST("parseIceCommandLineOptions(prefix, options) -> list"))}, - {STRCAST("load"), reinterpret_cast(propertiesLoad), METH_VARARGS, + {STRCAST("parseIceCommandLineOptions"), + reinterpret_cast(propertiesParseIceCommandLineOptions), + METH_VARARGS, + PyDoc_STR(STRCAST("parseIceCommandLineOptions(prefix, options) -> list"))}, + {STRCAST("load"), + reinterpret_cast(propertiesLoad), + METH_VARARGS, PyDoc_STR(STRCAST("load(file) -> None"))}, - {STRCAST("clone"), reinterpret_cast(propertiesClone), METH_NOARGS, + {STRCAST("clone"), + reinterpret_cast(propertiesClone), + METH_NOARGS, PyDoc_STR(STRCAST("clone() -> Ice.Properties"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/PropertiesAdmin.cpp b/python/modules/IcePy/PropertiesAdmin.cpp index a6cadf256e9..a1223c1195e 100644 --- a/python/modules/IcePy/PropertiesAdmin.cpp +++ b/python/modules/IcePy/PropertiesAdmin.cpp @@ -119,9 +119,13 @@ extern "C" } static PyMethodDef NativePropertiesAdminMethods[] = { - {STRCAST("addUpdateCallback"), reinterpret_cast(nativePropertiesAdminAddUpdateCB), METH_VARARGS, + {STRCAST("addUpdateCallback"), + reinterpret_cast(nativePropertiesAdminAddUpdateCB), + METH_VARARGS, PyDoc_STR(STRCAST("addUpdateCallback(callback) -> None"))}, - {STRCAST("removeUpdateCallback"), reinterpret_cast(nativePropertiesAdminRemoveUpdateCB), METH_VARARGS, + {STRCAST("removeUpdateCallback"), + reinterpret_cast(nativePropertiesAdminRemoveUpdateCB), + METH_VARARGS, PyDoc_STR(STRCAST("removeUpdateCallback(callback) -> None"))}, {0, 0} /* sentinel */ }; diff --git a/python/modules/IcePy/Proxy.cpp b/python/modules/IcePy/Proxy.cpp index 9fc484a0c2b..5dea571f78d 100644 --- a/python/modules/IcePy/Proxy.cpp +++ b/python/modules/IcePy/Proxy.cpp @@ -2205,145 +2205,285 @@ extern "C" } static PyMethodDef ProxyMethods[] = { - {STRCAST("ice_getCommunicator"), reinterpret_cast(proxyIceGetCommunicator), METH_NOARGS, + {STRCAST("ice_getCommunicator"), + reinterpret_cast(proxyIceGetCommunicator), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getCommunicator() -> Ice.Communicator"))}, - {STRCAST("ice_toString"), reinterpret_cast(proxyRepr), METH_NOARGS, + {STRCAST("ice_toString"), + reinterpret_cast(proxyRepr), + METH_NOARGS, PyDoc_STR(STRCAST("ice_toString() -> string"))}, - {STRCAST("ice_isA"), reinterpret_cast(proxyIceIsA), METH_VARARGS, + {STRCAST("ice_isA"), + reinterpret_cast(proxyIceIsA), + METH_VARARGS, PyDoc_STR(STRCAST("ice_isA(type, [ctx]) -> bool"))}, - {STRCAST("ice_isAAsync"), reinterpret_cast(proxyIceIsAAsync), METH_VARARGS, + {STRCAST("ice_isAAsync"), + reinterpret_cast(proxyIceIsAAsync), + METH_VARARGS, PyDoc_STR(STRCAST("ice_isAAsync(type, [ctx]) -> Ice.Future"))}, - {STRCAST("ice_ping"), reinterpret_cast(proxyIcePing), METH_VARARGS, + {STRCAST("ice_ping"), + reinterpret_cast(proxyIcePing), + METH_VARARGS, PyDoc_STR(STRCAST("ice_ping([ctx]) -> None"))}, - {STRCAST("ice_pingAsync"), reinterpret_cast(proxyIcePingAsync), METH_VARARGS, + {STRCAST("ice_pingAsync"), + reinterpret_cast(proxyIcePingAsync), + METH_VARARGS, PyDoc_STR(STRCAST("ice_pingAsync([ctx]) -> Ice.Future"))}, - {STRCAST("ice_ids"), reinterpret_cast(proxyIceIds), METH_VARARGS, + {STRCAST("ice_ids"), + reinterpret_cast(proxyIceIds), + METH_VARARGS, PyDoc_STR(STRCAST("ice_ids([ctx]) -> list"))}, - {STRCAST("ice_idsAsync"), reinterpret_cast(proxyIceIdsAsync), METH_VARARGS, + {STRCAST("ice_idsAsync"), + reinterpret_cast(proxyIceIdsAsync), + METH_VARARGS, PyDoc_STR(STRCAST("ice_idsAsync([ctx]) -> Ice.Future"))}, - {STRCAST("ice_id"), reinterpret_cast(proxyIceId), METH_VARARGS, + {STRCAST("ice_id"), + reinterpret_cast(proxyIceId), + METH_VARARGS, PyDoc_STR(STRCAST("ice_id([ctx]) -> string"))}, - {STRCAST("ice_idAsync"), reinterpret_cast(proxyIceIdAsync), METH_VARARGS, + {STRCAST("ice_idAsync"), + reinterpret_cast(proxyIceIdAsync), + METH_VARARGS, PyDoc_STR(STRCAST("ice_idAsync([ctx]) -> Ice.Future"))}, - {STRCAST("ice_getIdentity"), reinterpret_cast(proxyIceGetIdentity), METH_NOARGS, + {STRCAST("ice_getIdentity"), + reinterpret_cast(proxyIceGetIdentity), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getIdentity() -> Ice.Identity"))}, - {STRCAST("ice_identity"), reinterpret_cast(proxyIceIdentity), METH_VARARGS, + {STRCAST("ice_identity"), + reinterpret_cast(proxyIceIdentity), + METH_VARARGS, PyDoc_STR(STRCAST("ice_identity(id) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getContext"), reinterpret_cast(proxyIceGetContext), METH_NOARGS, + {STRCAST("ice_getContext"), + reinterpret_cast(proxyIceGetContext), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getContext() -> dict"))}, - {STRCAST("ice_context"), reinterpret_cast(proxyIceContext), METH_VARARGS, + {STRCAST("ice_context"), + reinterpret_cast(proxyIceContext), + METH_VARARGS, PyDoc_STR(STRCAST("ice_context(dict) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getFacet"), reinterpret_cast(proxyIceGetFacet), METH_NOARGS, + {STRCAST("ice_getFacet"), + reinterpret_cast(proxyIceGetFacet), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getFacet() -> string"))}, - {STRCAST("ice_facet"), reinterpret_cast(proxyIceFacet), METH_VARARGS, + {STRCAST("ice_facet"), + reinterpret_cast(proxyIceFacet), + METH_VARARGS, PyDoc_STR(STRCAST("ice_facet(string) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getAdapterId"), reinterpret_cast(proxyIceGetAdapterId), METH_NOARGS, + {STRCAST("ice_getAdapterId"), + reinterpret_cast(proxyIceGetAdapterId), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getAdapterId() -> string"))}, - {STRCAST("ice_adapterId"), reinterpret_cast(proxyIceAdapterId), METH_VARARGS, + {STRCAST("ice_adapterId"), + reinterpret_cast(proxyIceAdapterId), + METH_VARARGS, PyDoc_STR(STRCAST("ice_adapterId(string) -> proxy"))}, - {STRCAST("ice_getEndpoints"), reinterpret_cast(proxyIceGetEndpoints), METH_NOARGS, + {STRCAST("ice_getEndpoints"), + reinterpret_cast(proxyIceGetEndpoints), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getEndpoints() -> tuple"))}, - {STRCAST("ice_endpoints"), reinterpret_cast(proxyIceEndpoints), METH_VARARGS, + {STRCAST("ice_endpoints"), + reinterpret_cast(proxyIceEndpoints), + METH_VARARGS, PyDoc_STR(STRCAST("ice_endpoints(tuple) -> proxy"))}, - {STRCAST("ice_getLocatorCacheTimeout"), reinterpret_cast(proxyIceGetLocatorCacheTimeout), METH_NOARGS, + {STRCAST("ice_getLocatorCacheTimeout"), + reinterpret_cast(proxyIceGetLocatorCacheTimeout), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getLocatorCacheTimeout() -> int"))}, - {STRCAST("ice_getInvocationTimeout"), reinterpret_cast(proxyIceGetInvocationTimeout), METH_NOARGS, + {STRCAST("ice_getInvocationTimeout"), + reinterpret_cast(proxyIceGetInvocationTimeout), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getInvocationTimeout() -> int"))}, - {STRCAST("ice_getConnectionId"), reinterpret_cast(proxyIceGetConnectionId), METH_NOARGS, + {STRCAST("ice_getConnectionId"), + reinterpret_cast(proxyIceGetConnectionId), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getConnectionId() -> string"))}, - {STRCAST("ice_isCollocationOptimized"), reinterpret_cast(proxyIceIsCollocationOptimized), METH_NOARGS, + {STRCAST("ice_isCollocationOptimized"), + reinterpret_cast(proxyIceIsCollocationOptimized), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isCollocationOptimized() -> bool"))}, - {STRCAST("ice_collocationOptimized"), reinterpret_cast(proxyIceCollocationOptimized), METH_VARARGS, + {STRCAST("ice_collocationOptimized"), + reinterpret_cast(proxyIceCollocationOptimized), + METH_VARARGS, PyDoc_STR(STRCAST("ice_collocationOptimized(bool) -> Ice.ObjectPrx"))}, - {STRCAST("ice_locatorCacheTimeout"), reinterpret_cast(proxyIceLocatorCacheTimeout), METH_VARARGS, + {STRCAST("ice_locatorCacheTimeout"), + reinterpret_cast(proxyIceLocatorCacheTimeout), + METH_VARARGS, PyDoc_STR(STRCAST("ice_locatorCacheTimeout(int) -> Ice.ObjectPrx"))}, - {STRCAST("ice_invocationTimeout"), reinterpret_cast(proxyIceInvocationTimeout), METH_VARARGS, + {STRCAST("ice_invocationTimeout"), + reinterpret_cast(proxyIceInvocationTimeout), + METH_VARARGS, PyDoc_STR(STRCAST("ice_invocationTimeout(int) -> Ice.ObjectPrx"))}, - {STRCAST("ice_isConnectionCached"), reinterpret_cast(proxyIceIsConnectionCached), METH_NOARGS, + {STRCAST("ice_isConnectionCached"), + reinterpret_cast(proxyIceIsConnectionCached), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isConnectionCached() -> bool"))}, - {STRCAST("ice_connectionCached"), reinterpret_cast(proxyIceConnectionCached), METH_VARARGS, + {STRCAST("ice_connectionCached"), + reinterpret_cast(proxyIceConnectionCached), + METH_VARARGS, PyDoc_STR(STRCAST("ice_connectionCached(bool) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getEndpointSelection"), reinterpret_cast(proxyIceGetEndpointSelection), METH_NOARGS, + {STRCAST("ice_getEndpointSelection"), + reinterpret_cast(proxyIceGetEndpointSelection), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getEndpointSelection() -> bool"))}, - {STRCAST("ice_endpointSelection"), reinterpret_cast(proxyIceEndpointSelection), METH_VARARGS, + {STRCAST("ice_endpointSelection"), + reinterpret_cast(proxyIceEndpointSelection), + METH_VARARGS, PyDoc_STR(STRCAST("ice_endpointSelection(Ice.EndpointSelectionType) -> Ice.ObjectPrx"))}, - {STRCAST("ice_isSecure"), reinterpret_cast(proxyIceIsSecure), METH_NOARGS, + {STRCAST("ice_isSecure"), + reinterpret_cast(proxyIceIsSecure), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isSecure() -> bool"))}, - {STRCAST("ice_secure"), reinterpret_cast(proxyIceSecure), METH_VARARGS, + {STRCAST("ice_secure"), + reinterpret_cast(proxyIceSecure), + METH_VARARGS, PyDoc_STR(STRCAST("ice_secure(bool) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getEncodingVersion"), reinterpret_cast(proxyIceGetEncodingVersion), METH_NOARGS, + {STRCAST("ice_getEncodingVersion"), + reinterpret_cast(proxyIceGetEncodingVersion), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getEncodingVersion() -> Ice.EncodingVersion"))}, - {STRCAST("ice_encodingVersion"), reinterpret_cast(proxyIceEncodingVersion), METH_VARARGS, + {STRCAST("ice_encodingVersion"), + reinterpret_cast(proxyIceEncodingVersion), + METH_VARARGS, PyDoc_STR(STRCAST("ice_endpointSelection(Ice.EncodingVersion) -> Ice.ObjectPrx"))}, - {STRCAST("ice_isPreferSecure"), reinterpret_cast(proxyIceIsPreferSecure), METH_NOARGS, + {STRCAST("ice_isPreferSecure"), + reinterpret_cast(proxyIceIsPreferSecure), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isPreferSecure() -> bool"))}, - {STRCAST("ice_preferSecure"), reinterpret_cast(proxyIcePreferSecure), METH_VARARGS, + {STRCAST("ice_preferSecure"), + reinterpret_cast(proxyIcePreferSecure), + METH_VARARGS, PyDoc_STR(STRCAST("ice_preferSecure(bool) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getRouter"), reinterpret_cast(proxyIceGetRouter), METH_NOARGS, + {STRCAST("ice_getRouter"), + reinterpret_cast(proxyIceGetRouter), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getRouter() -> Ice.RouterPrx"))}, - {STRCAST("ice_router"), reinterpret_cast(proxyIceRouter), METH_VARARGS, + {STRCAST("ice_router"), + reinterpret_cast(proxyIceRouter), + METH_VARARGS, PyDoc_STR(STRCAST("ice_router(Ice.RouterPrx) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getLocator"), reinterpret_cast(proxyIceGetLocator), METH_NOARGS, + {STRCAST("ice_getLocator"), + reinterpret_cast(proxyIceGetLocator), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getLocator() -> Ice.LocatorPrx"))}, - {STRCAST("ice_locator"), reinterpret_cast(proxyIceLocator), METH_VARARGS, + {STRCAST("ice_locator"), + reinterpret_cast(proxyIceLocator), + METH_VARARGS, PyDoc_STR(STRCAST("ice_locator(Ice.LocatorPrx) -> Ice.ObjectPrx"))}, - {STRCAST("ice_twoway"), reinterpret_cast(proxyIceTwoway), METH_NOARGS, + {STRCAST("ice_twoway"), + reinterpret_cast(proxyIceTwoway), + METH_NOARGS, PyDoc_STR(STRCAST("ice_twoway() -> Ice.ObjectPrx"))}, - {STRCAST("ice_isTwoway"), reinterpret_cast(proxyIceIsTwoway), METH_NOARGS, + {STRCAST("ice_isTwoway"), + reinterpret_cast(proxyIceIsTwoway), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isTwoway() -> bool"))}, - {STRCAST("ice_oneway"), reinterpret_cast(proxyIceOneway), METH_NOARGS, + {STRCAST("ice_oneway"), + reinterpret_cast(proxyIceOneway), + METH_NOARGS, PyDoc_STR(STRCAST("ice_oneway() -> Ice.ObjectPrx"))}, - {STRCAST("ice_isOneway"), reinterpret_cast(proxyIceIsOneway), METH_NOARGS, + {STRCAST("ice_isOneway"), + reinterpret_cast(proxyIceIsOneway), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isOneway() -> bool"))}, - {STRCAST("ice_batchOneway"), reinterpret_cast(proxyIceBatchOneway), METH_NOARGS, + {STRCAST("ice_batchOneway"), + reinterpret_cast(proxyIceBatchOneway), + METH_NOARGS, PyDoc_STR(STRCAST("ice_batchOneway() -> Ice.ObjectPrx"))}, - {STRCAST("ice_isBatchOneway"), reinterpret_cast(proxyIceIsBatchOneway), METH_NOARGS, + {STRCAST("ice_isBatchOneway"), + reinterpret_cast(proxyIceIsBatchOneway), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isBatchOneway() -> bool"))}, - {STRCAST("ice_datagram"), reinterpret_cast(proxyIceDatagram), METH_NOARGS, + {STRCAST("ice_datagram"), + reinterpret_cast(proxyIceDatagram), + METH_NOARGS, PyDoc_STR(STRCAST("ice_datagram() -> Ice.ObjectPrx"))}, - {STRCAST("ice_isDatagram"), reinterpret_cast(proxyIceIsDatagram), METH_NOARGS, + {STRCAST("ice_isDatagram"), + reinterpret_cast(proxyIceIsDatagram), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isDatagram() -> bool"))}, - {STRCAST("ice_batchDatagram"), reinterpret_cast(proxyIceBatchDatagram), METH_NOARGS, + {STRCAST("ice_batchDatagram"), + reinterpret_cast(proxyIceBatchDatagram), + METH_NOARGS, PyDoc_STR(STRCAST("ice_batchDatagram() -> Ice.ObjectPrx"))}, - {STRCAST("ice_isBatchDatagram"), reinterpret_cast(proxyIceIsBatchDatagram), METH_NOARGS, + {STRCAST("ice_isBatchDatagram"), + reinterpret_cast(proxyIceIsBatchDatagram), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isBatchDatagram() -> bool"))}, - {STRCAST("ice_compress"), reinterpret_cast(proxyIceCompress), METH_VARARGS, + {STRCAST("ice_compress"), + reinterpret_cast(proxyIceCompress), + METH_VARARGS, PyDoc_STR(STRCAST("ice_compress(bool) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getCompress"), reinterpret_cast(proxyIceGetCompress), METH_VARARGS, + {STRCAST("ice_getCompress"), + reinterpret_cast(proxyIceGetCompress), + METH_VARARGS, PyDoc_STR(STRCAST("ice_getCompress() -> bool"))}, - {STRCAST("ice_timeout"), reinterpret_cast(proxyIceTimeout), METH_VARARGS, + {STRCAST("ice_timeout"), + reinterpret_cast(proxyIceTimeout), + METH_VARARGS, PyDoc_STR(STRCAST("ice_timeout(int) -> Ice.ObjectPrx"))}, - {STRCAST("ice_getTimeout"), reinterpret_cast(proxyIceGetTimeout), METH_VARARGS, + {STRCAST("ice_getTimeout"), + reinterpret_cast(proxyIceGetTimeout), + METH_VARARGS, PyDoc_STR(STRCAST("ice_getTimeout() -> int"))}, - {STRCAST("ice_connectionId"), reinterpret_cast(proxyIceConnectionId), METH_VARARGS, + {STRCAST("ice_connectionId"), + reinterpret_cast(proxyIceConnectionId), + METH_VARARGS, PyDoc_STR(STRCAST("ice_connectionId(string) -> Ice.ObjectPrx"))}, - {STRCAST("ice_fixed"), reinterpret_cast(proxyIceFixed), METH_VARARGS, + {STRCAST("ice_fixed"), + reinterpret_cast(proxyIceFixed), + METH_VARARGS, PyDoc_STR(STRCAST("ice_fixed(Ice.Connection) -> Ice.ObjectPrx"))}, - {STRCAST("ice_isFixed"), reinterpret_cast(proxyIceIsFixed), METH_NOARGS, + {STRCAST("ice_isFixed"), + reinterpret_cast(proxyIceIsFixed), + METH_NOARGS, PyDoc_STR(STRCAST("ice_isFixed() -> bool"))}, - {STRCAST("ice_getConnection"), reinterpret_cast(proxyIceGetConnection), METH_NOARGS, + {STRCAST("ice_getConnection"), + reinterpret_cast(proxyIceGetConnection), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getConnection() -> Ice.Connection"))}, - {STRCAST("ice_getConnectionAsync"), reinterpret_cast(proxyIceGetConnectionAsync), METH_NOARGS, + {STRCAST("ice_getConnectionAsync"), + reinterpret_cast(proxyIceGetConnectionAsync), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getConnectionAsync() -> Ice.Future"))}, - {STRCAST("ice_getCachedConnection"), reinterpret_cast(proxyIceGetCachedConnection), METH_NOARGS, + {STRCAST("ice_getCachedConnection"), + reinterpret_cast(proxyIceGetCachedConnection), + METH_NOARGS, PyDoc_STR(STRCAST("ice_getCachedConnection() -> Ice.Connection"))}, - {STRCAST("ice_flushBatchRequests"), reinterpret_cast(proxyIceFlushBatchRequests), METH_NOARGS, + {STRCAST("ice_flushBatchRequests"), + reinterpret_cast(proxyIceFlushBatchRequests), + METH_NOARGS, PyDoc_STR(STRCAST("ice_flushBatchRequests() -> void"))}, - {STRCAST("ice_flushBatchRequestsAsync"), reinterpret_cast(proxyIceFlushBatchRequestsAsync), - METH_NOARGS, PyDoc_STR(STRCAST("ice_flushBatchRequestsAsync() -> Ice.Future"))}, - {STRCAST("ice_invoke"), reinterpret_cast(proxyIceInvoke), METH_VARARGS, + {STRCAST("ice_flushBatchRequestsAsync"), + reinterpret_cast(proxyIceFlushBatchRequestsAsync), + METH_NOARGS, + PyDoc_STR(STRCAST("ice_flushBatchRequestsAsync() -> Ice.Future"))}, + {STRCAST("ice_invoke"), + reinterpret_cast(proxyIceInvoke), + METH_VARARGS, PyDoc_STR(STRCAST("ice_invoke(operation, mode, inParams) -> bool, outParams"))}, - {STRCAST("ice_invokeAsync"), reinterpret_cast(proxyIceInvokeAsync), METH_VARARGS | METH_KEYWORDS, + {STRCAST("ice_invokeAsync"), + reinterpret_cast(proxyIceInvokeAsync), + METH_VARARGS | METH_KEYWORDS, PyDoc_STR(STRCAST("ice_invokeAsync(op, mode, inParams[, context]) -> Ice.Future"))}, - {STRCAST("ice_checkedCast"), reinterpret_cast(proxyIceCheckedCast), METH_VARARGS | METH_CLASS, + {STRCAST("ice_checkedCast"), + reinterpret_cast(proxyIceCheckedCast), + METH_VARARGS | METH_CLASS, PyDoc_STR(STRCAST("ice_checkedCast(proxy, id[, facetOrContext[, context]]) -> proxy"))}, - {STRCAST("ice_uncheckedCast"), reinterpret_cast(proxyIceUncheckedCast), METH_VARARGS | METH_CLASS, + {STRCAST("ice_uncheckedCast"), + reinterpret_cast(proxyIceUncheckedCast), + METH_VARARGS | METH_CLASS, PyDoc_STR(STRCAST("ice_uncheckedCast(proxy) -> proxy"))}, - {STRCAST("checkedCast"), reinterpret_cast(proxyCheckedCast), METH_VARARGS | METH_STATIC, + {STRCAST("checkedCast"), + reinterpret_cast(proxyCheckedCast), + METH_VARARGS | METH_STATIC, PyDoc_STR(STRCAST("checkedCast(proxy) -> proxy"))}, - {STRCAST("uncheckedCast"), reinterpret_cast(proxyUncheckedCast), METH_VARARGS | METH_STATIC, + {STRCAST("uncheckedCast"), + reinterpret_cast(proxyUncheckedCast), + METH_VARARGS | METH_STATIC, PyDoc_STR(STRCAST("uncheckedCast(proxy) -> proxy"))}, - {STRCAST("ice_staticId"), reinterpret_cast(proxyIceStaticId), METH_NOARGS | METH_STATIC, + {STRCAST("ice_staticId"), + reinterpret_cast(proxyIceStaticId), + METH_NOARGS | METH_STATIC, PyDoc_STR(STRCAST("ice_staticId() -> string"))}, {0, 0} /* sentinel */ }; @@ -2481,8 +2621,11 @@ IcePy::getProxyArg( { string typeName = type.empty() ? "Ice.ObjectPrx" : type; PyErr_Format( - PyExc_ValueError, STRCAST("%s expects a proxy of type %s or None for argument '%s'"), func.c_str(), - typeName.c_str(), arg.c_str()); + PyExc_ValueError, + STRCAST("%s expects a proxy of type %s or None for argument '%s'"), + func.c_str(), + typeName.c_str(), + arg.c_str()); } return result; diff --git a/python/modules/IcePy/Slice.cpp b/python/modules/IcePy/Slice.cpp index 5dbab159c74..fc68008bfd8 100644 --- a/python/modules/IcePy/Slice.cpp +++ b/python/modules/IcePy/Slice.cpp @@ -223,8 +223,7 @@ IcePy_compile(PyObject* /*self*/, PyObject* args) } catch (...) { - consoleErr << argSeq[0] << ": error:" - << "unknown exception" << endl; + consoleErr << argSeq[0] << ": error:" << "unknown exception" << endl; rc = EXIT_FAILURE; } diff --git a/python/modules/IcePy/Types.cpp b/python/modules/IcePy/Types.cpp index c59f877b4de..8ffabb0b638 100644 --- a/python/modules/IcePy/Types.cpp +++ b/python/modules/IcePy/Types.cpp @@ -1332,14 +1332,18 @@ IcePy::StructInfo::marshal( if (!attr.get()) { PyErr_Format( - PyExc_AttributeError, STRCAST("no member `%s' found in %s value"), memberName, + PyExc_AttributeError, + STRCAST("no member `%s' found in %s value"), + memberName, const_cast(id.c_str())); throw AbortMarshaling(); } if (!member->type->validate(attr.get())) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for %s member `%s'"), const_cast(id.c_str()), + PyExc_ValueError, + STRCAST("invalid value for %s member `%s'"), + const_cast(id.c_str()), memberName); throw AbortMarshaling(); } @@ -1583,7 +1587,9 @@ IcePy::SequenceInfo::marshal( if (!elementType->validate(item)) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of `%s'"), static_cast(i), + PyExc_ValueError, + STRCAST("invalid value for element %d of `%s'"), + static_cast(i), const_cast(id.c_str())); throw AbortMarshaling(); } @@ -1783,8 +1789,9 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (pybuf.format != 0 && pybuf.format[0] == '<') { PyErr_Format( - PyExc_ValueError, "sequence buffer byte order doesn't match the platform native byte-order " - "`big-endian'"); + PyExc_ValueError, + "sequence buffer byte order doesn't match the platform native byte-order " + "`big-endian'"); PyBuffer_Release(&pybuf); throw AbortMarshaling(); } @@ -1792,8 +1799,9 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (pybuf.format != 0 && (pybuf.format[0] == '>' || pybuf.format[0] == '!')) { PyErr_Format( - PyExc_ValueError, "sequence buffer byte order doesn't match the platform native byte-order " - "`little-endian'"); + PyExc_ValueError, + "sequence buffer byte order doesn't match the platform native byte-order " + "`little-endian'"); PyBuffer_Release(&pybuf); throw AbortMarshaling(); } @@ -1801,7 +1809,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (pybuf.itemsize != itemsize[pi->kind]) { PyErr_Format( - PyExc_ValueError, "sequence item size doesn't match the size of the sequence type `%s'", + PyExc_ValueError, + "sequence item size doesn't match the size of the sequence type `%s'", itemtype[pi->kind]); PyBuffer_Release(&pybuf); throw AbortMarshaling(); @@ -1887,7 +1896,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (isTrue < 0) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -1923,7 +1933,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (PyErr_Occurred() || val < 0 || val > 255) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -1951,7 +1962,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (PyErr_Occurred() || val < SHRT_MIN || val > SHRT_MAX) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -1978,7 +1990,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (PyErr_Occurred() || val < INT_MIN || val > INT_MAX) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -2005,7 +2018,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (PyErr_Occurred()) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -2031,7 +2045,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (PyErr_Occurred()) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -2058,7 +2073,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (PyErr_Occurred()) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -2084,7 +2100,8 @@ IcePy::SequenceInfo::marshalPrimitiveSequence(const PrimitiveInfoPtr& pi, PyObje if (item != Py_None && !checkString(item)) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for element %d of sequence"), + PyExc_ValueError, + STRCAST("invalid value for element %d of sequence"), static_cast(i)); throw AbortMarshaling(); } @@ -3607,7 +3624,9 @@ IcePy::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& me else { PyErr_Format( - PyExc_AttributeError, STRCAST("no member `%s' found in %s value"), memberName, + PyExc_AttributeError, + STRCAST("no member `%s' found in %s value"), + memberName, const_cast(_info->id.c_str())); throw AbortMarshaling(); } @@ -3621,7 +3640,9 @@ IcePy::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& me if (!member->type->validate(val.get())) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for %s member `%s'"), const_cast(_info->id.c_str()), + PyExc_ValueError, + STRCAST("invalid value for %s member `%s'"), + const_cast(_info->id.c_str()), memberName); throw AbortMarshaling(); } @@ -3852,7 +3873,9 @@ IcePy::ExceptionInfo::writeMembers( else { PyErr_Format( - PyExc_AttributeError, STRCAST("no member `%s' found in %s value"), memberName, + PyExc_AttributeError, + STRCAST("no member `%s' found in %s value"), + memberName, const_cast(id.c_str())); throw AbortMarshaling(); } @@ -3866,7 +3889,9 @@ IcePy::ExceptionInfo::writeMembers( if (!member->type->validate(val.get())) { PyErr_Format( - PyExc_ValueError, STRCAST("invalid value for %s member `%s'"), const_cast(id.c_str()), + PyExc_ValueError, + STRCAST("invalid value for %s member `%s'"), + const_cast(id.c_str()), memberName); throw AbortMarshaling(); } diff --git a/python/modules/IcePy/ValueFactoryManager.cpp b/python/modules/IcePy/ValueFactoryManager.cpp index 72f2e86b172..c77bfa78c95 100644 --- a/python/modules/IcePy/ValueFactoryManager.cpp +++ b/python/modules/IcePy/ValueFactoryManager.cpp @@ -412,9 +412,13 @@ extern "C" } static PyMethodDef ValueFactoryManagerMethods[] = { - {STRCAST("add"), reinterpret_cast(valueFactoryManagerAdd), METH_VARARGS, + {STRCAST("add"), + reinterpret_cast(valueFactoryManagerAdd), + METH_VARARGS, PyDoc_STR(STRCAST("add(factory, id) -> None"))}, - {STRCAST("find"), reinterpret_cast(valueFactoryManagerFind), METH_VARARGS, + {STRCAST("find"), + reinterpret_cast(valueFactoryManagerFind), + METH_VARARGS, PyDoc_STR(STRCAST("find(id) -> function"))}, {0, 0} /* sentinel */ }; diff --git a/ruby/src/IceRuby/Communicator.cpp b/ruby/src/IceRuby/Communicator.cpp index d5b507c1553..d70ec2c3398 100644 --- a/ruby/src/IceRuby/Communicator.cpp +++ b/ruby/src/IceRuby/Communicator.cpp @@ -146,7 +146,8 @@ IceRuby_initialize(int argc, VALUE* argv, VALUE /*self*/) if (!NIL_P(initData) && !NIL_P(configFile)) { throw RubyException( - rb_eTypeError, "initialize accepts either Ice.InitializationData or a configuration filename"); + rb_eTypeError, + "initialize accepts either Ice.InitializationData or a configuration filename"); } Ice::StringSeq seq; @@ -260,7 +261,9 @@ IceRuby_initialize(int argc, VALUE* argv, VALUE /*self*/) delete[] av; VALUE result = Data_Wrap_Struct( - _communicatorClass, IceRuby_Communicator_mark, IceRuby_Communicator_free, + _communicatorClass, + IceRuby_Communicator_mark, + IceRuby_Communicator_free, new Ice::CommunicatorPtr(communicator)); CommunicatorMap::iterator p = _communicatorMap.find(communicator); @@ -639,7 +642,8 @@ IceRuby_Communicator_flushBatchRequests(VALUE self, VALUE compress) if (callRuby(rb_obj_is_instance_of, compress, type) != Qtrue) { throw RubyException( - rb_eTypeError, "value for 'compress' argument must be an enumerator of Ice::CompressBatch"); + rb_eTypeError, + "value for 'compress' argument must be an enumerator of Ice::CompressBatch"); } volatile VALUE compressValue = callRuby(rb_funcall, compress, rb_intern("to_i"), 0); assert(TYPE(compressValue) == T_FIXNUM); @@ -669,7 +673,10 @@ IceRuby::initCommunicator(VALUE iceModule) rb_define_method(_communicatorClass, "proxyToProperty", CAST_METHOD(IceRuby_Communicator_proxyToProperty), 2); rb_define_method(_communicatorClass, "identityToString", CAST_METHOD(IceRuby_Communicator_identityToString), 1); rb_define_method( - _communicatorClass, "getValueFactoryManager", CAST_METHOD(IceRuby_Communicator_getValueFactoryManager), 0); + _communicatorClass, + "getValueFactoryManager", + CAST_METHOD(IceRuby_Communicator_getValueFactoryManager), + 0); rb_define_method(_communicatorClass, "getImplicitContext", CAST_METHOD(IceRuby_Communicator_getImplicitContext), 0); rb_define_method(_communicatorClass, "getProperties", CAST_METHOD(IceRuby_Communicator_getProperties), 0); rb_define_method(_communicatorClass, "getLogger", CAST_METHOD(IceRuby_Communicator_getLogger), 0); diff --git a/ruby/src/IceRuby/Connection.cpp b/ruby/src/IceRuby/Connection.cpp index 62fc62fe5e3..0a4d61eb2d6 100644 --- a/ruby/src/IceRuby/Connection.cpp +++ b/ruby/src/IceRuby/Connection.cpp @@ -48,7 +48,8 @@ IceRuby_Connection_close(VALUE self, VALUE mode) if (callRuby(rb_obj_is_instance_of, mode, type) != Qtrue) { throw RubyException( - rb_eTypeError, "value for 'mode' argument must be an enumerator of Ice::ConnectionClose"); + rb_eTypeError, + "value for 'mode' argument must be an enumerator of Ice::ConnectionClose"); } volatile VALUE modeValue = callRuby(rb_funcall, mode, rb_intern("to_i"), 0); assert(TYPE(modeValue) == T_FIXNUM); @@ -71,7 +72,8 @@ IceRuby_Connection_flushBatchRequests(VALUE self, VALUE compress) if (callRuby(rb_obj_is_instance_of, compress, type) != Qtrue) { throw RubyException( - rb_eTypeError, "value for 'compress' argument must be an enumerator of Ice::CompressBatch"); + rb_eTypeError, + "value for 'compress' argument must be an enumerator of Ice::CompressBatch"); } volatile VALUE compressValue = callRuby(rb_funcall, compress, rb_intern("to_i"), 0); assert(TYPE(compressValue) == T_FIXNUM); @@ -119,7 +121,8 @@ IceRuby_Connection_setACM(VALUE self, VALUE t, VALUE c, VALUE h) if (callRuby(rb_obj_is_instance_of, c, type) != Qtrue) { throw RubyException( - rb_eTypeError, "value for 'close' argument must be Unset or an enumerator of Ice.ACMClose"); + rb_eTypeError, + "value for 'close' argument must be Unset or an enumerator of Ice.ACMClose"); } volatile VALUE closeValue = callRuby(rb_funcall, c, rb_intern("to_i"), 0); assert(TYPE(closeValue) == T_FIXNUM); @@ -132,7 +135,8 @@ IceRuby_Connection_setACM(VALUE self, VALUE t, VALUE c, VALUE h) if (callRuby(rb_obj_is_instance_of, h, type) != Qtrue) { throw RubyException( - rb_eTypeError, "value for 'heartbeat' argument must be Unset or an enumerator of Ice.ACMHeartbeat"); + rb_eTypeError, + "value for 'heartbeat' argument must be Unset or an enumerator of Ice.ACMHeartbeat"); } volatile VALUE heartbeatValue = callRuby(rb_funcall, h, rb_intern("to_i"), 0); assert(TYPE(heartbeatValue) == T_FIXNUM); diff --git a/ruby/src/IceRuby/Operation.cpp b/ruby/src/IceRuby/Operation.cpp index 951fe0780dd..cd5a55601e4 100644 --- a/ruby/src/IceRuby/Operation.cpp +++ b/ruby/src/IceRuby/Operation.cpp @@ -424,7 +424,10 @@ IceRuby::OperationI::prepareRequest( { string opName = fixIdent(_name, IdentNormal); throw RubyException( - rb_eTypeError, "invalid value for argument %ld in operation `%s'", info->pos + 1, opName.c_str()); + rb_eTypeError, + "invalid value for argument %ld in operation `%s'", + info->pos + 1, + opName.c_str()); } } diff --git a/ruby/src/IceRuby/Properties.cpp b/ruby/src/IceRuby/Properties.cpp index c95fa3fc64c..b3b2911bf9b 100644 --- a/ruby/src/IceRuby/Properties.cpp +++ b/ruby/src/IceRuby/Properties.cpp @@ -313,24 +313,43 @@ IceRuby::initProperties(VALUE iceModule) rb_undef_alloc_func(_propertiesClass); rb_define_method(_propertiesClass, "getProperty", CAST_METHOD(IceRuby_Properties_getProperty), 1); rb_define_method( - _propertiesClass, "getPropertyWithDefault", CAST_METHOD(IceRuby_Properties_getPropertyWithDefault), 2); + _propertiesClass, + "getPropertyWithDefault", + CAST_METHOD(IceRuby_Properties_getPropertyWithDefault), + 2); rb_define_method(_propertiesClass, "getPropertyAsInt", CAST_METHOD(IceRuby_Properties_getPropertyAsInt), 1); rb_define_method( - _propertiesClass, "getPropertyAsIntWithDefault", CAST_METHOD(IceRuby_Properties_getPropertyAsIntWithDefault), + _propertiesClass, + "getPropertyAsIntWithDefault", + CAST_METHOD(IceRuby_Properties_getPropertyAsIntWithDefault), 2); rb_define_method(_propertiesClass, "getPropertyAsList", CAST_METHOD(IceRuby_Properties_getPropertyAsList), 1); rb_define_method( - _propertiesClass, "getPropertyAsListWithDefault", CAST_METHOD(IceRuby_Properties_getPropertyAsListWithDefault), + _propertiesClass, + "getPropertyAsListWithDefault", + CAST_METHOD(IceRuby_Properties_getPropertyAsListWithDefault), 2); rb_define_method( - _propertiesClass, "getPropertiesForPrefix", CAST_METHOD(IceRuby_Properties_getPropertiesForPrefix), 1); + _propertiesClass, + "getPropertiesForPrefix", + CAST_METHOD(IceRuby_Properties_getPropertiesForPrefix), + 1); rb_define_method(_propertiesClass, "setProperty", CAST_METHOD(IceRuby_Properties_setProperty), 2); rb_define_method( - _propertiesClass, "getCommandLineOptions", CAST_METHOD(IceRuby_Properties_getCommandLineOptions), 0); + _propertiesClass, + "getCommandLineOptions", + CAST_METHOD(IceRuby_Properties_getCommandLineOptions), + 0); rb_define_method( - _propertiesClass, "parseCommandLineOptions", CAST_METHOD(IceRuby_Properties_parseCommandLineOptions), 2); + _propertiesClass, + "parseCommandLineOptions", + CAST_METHOD(IceRuby_Properties_parseCommandLineOptions), + 2); rb_define_method( - _propertiesClass, "parseIceCommandLineOptions", CAST_METHOD(IceRuby_Properties_parseIceCommandLineOptions), 1); + _propertiesClass, + "parseIceCommandLineOptions", + CAST_METHOD(IceRuby_Properties_parseIceCommandLineOptions), + 1); rb_define_method(_propertiesClass, "load", CAST_METHOD(IceRuby_Properties_load), 1); rb_define_method(_propertiesClass, "clone", CAST_METHOD(IceRuby_Properties_clone), 0); rb_define_method(_propertiesClass, "to_s", CAST_METHOD(IceRuby_Properties_to_s), 0); diff --git a/ruby/src/IceRuby/Proxy.cpp b/ruby/src/IceRuby/Proxy.cpp index 03f0d303c2a..3b33cd97c33 100644 --- a/ruby/src/IceRuby/Proxy.cpp +++ b/ruby/src/IceRuby/Proxy.cpp @@ -45,7 +45,10 @@ checkArgs(const char* name, int numArgs, int argc, VALUE* argv, Ice::Context& ct if (argc < numArgs || argc > numArgs + 1) { throw RubyException( - rb_eArgError, "%s expects %d argument%s including an optional context hash", name, numArgs + 1, + rb_eArgError, + "%s expects %d argument%s including an optional context hash", + name, + numArgs + 1, numArgs + 1 == 1 ? "" : "s"); } if (argc == numArgs + 1) @@ -1223,16 +1226,25 @@ IceRuby::initProxy(VALUE iceModule) rb_define_method(_proxyClass, "ice_getEndpoints", CAST_METHOD(IceRuby_ObjectPrx_ice_getEndpoints), 0); rb_define_method(_proxyClass, "ice_endpoints", CAST_METHOD(IceRuby_ObjectPrx_ice_endpoints), 1); rb_define_method( - _proxyClass, "ice_getLocatorCacheTimeout", CAST_METHOD(IceRuby_ObjectPrx_ice_getLocatorCacheTimeout), 0); + _proxyClass, + "ice_getLocatorCacheTimeout", + CAST_METHOD(IceRuby_ObjectPrx_ice_getLocatorCacheTimeout), + 0); rb_define_method( - _proxyClass, "ice_getInvocationTimeout", CAST_METHOD(IceRuby_ObjectPrx_ice_getInvocationTimeout), 0); + _proxyClass, + "ice_getInvocationTimeout", + CAST_METHOD(IceRuby_ObjectPrx_ice_getInvocationTimeout), + 0); rb_define_method(_proxyClass, "ice_getConnectionId", CAST_METHOD(IceRuby_ObjectPrx_ice_getConnectionId), 0); rb_define_method(_proxyClass, "ice_locatorCacheTimeout", CAST_METHOD(IceRuby_ObjectPrx_ice_locatorCacheTimeout), 1); rb_define_method(_proxyClass, "ice_invocationTimeout", CAST_METHOD(IceRuby_ObjectPrx_ice_invocationTimeout), 1); rb_define_method(_proxyClass, "ice_isConnectionCached", CAST_METHOD(IceRuby_ObjectPrx_ice_isConnectionCached), 0); rb_define_method(_proxyClass, "ice_connectionCached", CAST_METHOD(IceRuby_ObjectPrx_ice_connectionCached), 1); rb_define_method( - _proxyClass, "ice_getEndpointSelection", CAST_METHOD(IceRuby_ObjectPrx_ice_getEndpointSelection), 0); + _proxyClass, + "ice_getEndpointSelection", + CAST_METHOD(IceRuby_ObjectPrx_ice_getEndpointSelection), + 0); rb_define_method(_proxyClass, "ice_endpointSelection", CAST_METHOD(IceRuby_ObjectPrx_ice_endpointSelection), 1); rb_define_method(_proxyClass, "ice_isSecure", CAST_METHOD(IceRuby_ObjectPrx_ice_isSecure), 0); rb_define_method(_proxyClass, "ice_secure", CAST_METHOD(IceRuby_ObjectPrx_ice_secure), 1); @@ -1288,7 +1300,9 @@ IceRuby::createProxy(Ice::ObjectPrx p, VALUE cls) { // If cls is nil then the proxy has the base type Ice::ObjectPrx. return Data_Wrap_Struct( - NIL_P(cls) ? _proxyClass : cls, IceRuby_ObjectPrx_mark, IceRuby_ObjectPrx_free, + NIL_P(cls) ? _proxyClass : cls, + IceRuby_ObjectPrx_mark, + IceRuby_ObjectPrx_free, new Ice::ObjectPrx(std::move(p))); } diff --git a/ruby/src/IceRuby/Slice.cpp b/ruby/src/IceRuby/Slice.cpp index bce106ac164..3cf48b0b364 100644 --- a/ruby/src/IceRuby/Slice.cpp +++ b/ruby/src/IceRuby/Slice.cpp @@ -176,8 +176,7 @@ IceRuby_compile(int argc, VALUE* argv, VALUE /*self*/) } catch (...) { - cerr << argSeq[0] << ": error:" - << "unknown exception" << endl; + cerr << argSeq[0] << ": error:" << "unknown exception" << endl; rc = EXIT_FAILURE; } return INT2FIX(rc); diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index 086476f1877..3efa1f8c056 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -271,7 +271,8 @@ IceRuby::StreamUtil::setSlicedDataMember(VALUE obj, const Ice::SlicedDataPtr& sl // bytes // volatile VALUE bytes = callRuby( - rb_str_new, (*p)->bytes.empty() ? 0 : reinterpret_cast(&(*p)->bytes[0]), + rb_str_new, + (*p)->bytes.empty() ? 0 : reinterpret_cast(&(*p)->bytes[0]), static_cast((*p)->bytes.size())); callRuby(rb_iv_set, slice, "@bytes", bytes); @@ -353,7 +354,8 @@ IceRuby::StreamUtil::getSlicedDataMember(VALUE obj, ValueMap* valueMap) if (str != 0 && len != 0) { vector vtmp( - reinterpret_cast(str), reinterpret_cast(str + len)); + reinterpret_cast(str), + reinterpret_cast(str + len)); info->bytes.swap(vtmp); } @@ -1014,7 +1016,10 @@ IceRuby::StructInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMap, if (!member->type->validate(val)) { throw RubyException( - rb_eTypeError, "invalid value for %s member `%s'", const_cast(id.c_str()), member->name.c_str()); + rb_eTypeError, + "invalid value for %s member `%s'", + const_cast(id.c_str()), + member->name.c_str()); } member->type->marshal(val, os, valueMap, false); } @@ -1232,7 +1237,10 @@ IceRuby::SequenceInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMa if (!elementType->validate(RARRAY_AREF(arr, i))) { throw RubyException( - rb_eTypeError, "invalid value for element %ld of `%s'", i, const_cast(id.c_str())); + rb_eTypeError, + "invalid value for element %ld of `%s'", + i, + const_cast(id.c_str())); } elementType->marshal(RARRAY_AREF(arr, i), os, valueMap, false); } @@ -2529,7 +2537,10 @@ IceRuby::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& if (!member->type->validate(val)) { throw RubyException( - rb_eTypeError, "invalid value for %s member `%s'", _info->id.c_str(), member->name.c_str()); + rb_eTypeError, + "invalid value for %s member `%s'", + _info->id.c_str(), + member->name.c_str()); } member->type->marshal(val, os, _map, member->optional); diff --git a/ruby/src/IceRuby/Util.cpp b/ruby/src/IceRuby/Util.cpp index 025ebffade2..78b6ec7c82f 100644 --- a/ruby/src/IceRuby/Util.cpp +++ b/ruby/src/IceRuby/Util.cpp @@ -434,7 +434,11 @@ IceRuby::hashIterate(VALUE h, HashIterator& iter) assert(TYPE(h) == T_HASH); callRuby( - ::rb_block_call, h, rb_intern("each"), 0, static_cast(0), + ::rb_block_call, + h, + rb_intern("each"), + 0, + static_cast(0), reinterpret_cast(IceRuby_Util_hash_foreach_callback), reinterpret_cast(&iter)); } diff --git a/ruby/src/IceRuby/ValueFactoryManager.cpp b/ruby/src/IceRuby/ValueFactoryManager.cpp index 91fefb71b73..c238cc4514f 100644 --- a/ruby/src/IceRuby/ValueFactoryManager.cpp +++ b/ruby/src/IceRuby/ValueFactoryManager.cpp @@ -58,7 +58,9 @@ IceRuby::ValueFactoryManager::ValueFactoryManager::create() // Create a Ruby wrapper around this object. Note that this is a cyclic reference. // vfm->_self = Data_Wrap_Struct( - _valueFactoryManagerClass, IceRuby_ValueFactoryManager_mark, IceRuby_ValueFactoryManager_free, + _valueFactoryManagerClass, + IceRuby_ValueFactoryManager_mark, + IceRuby_ValueFactoryManager_free, new ValueFactoryManagerPtr(vfm)); return vfm; diff --git a/swift/src/IceImpl/Communicator.mm b/swift/src/IceImpl/Communicator.mm index 40dea591b4a..002deaec3ad 100644 --- a/swift/src/IceImpl/Communicator.mm +++ b/swift/src/IceImpl/Communicator.mm @@ -128,7 +128,8 @@ - (ICEObjectAdapter*)createObjectAdapterWithRouter:(NSString*)name { assert(router); auto oa = self.communicator->createObjectAdapterWithRouter( - fromNSString(name), Ice::uncheckedCast([router prx]).value()); + fromNSString(name), + Ice::uncheckedCast([router prx]).value()); return [ICEObjectAdapter getHandle:oa]; } catch (const std::exception& ex) diff --git a/swift/src/IceImpl/Convert.mm b/swift/src/IceImpl/Convert.mm index 2e53220d218..925aad5cc2a 100644 --- a/swift/src/IceImpl/Convert.mm +++ b/swift/src/IceImpl/Convert.mm @@ -417,20 +417,29 @@ @catch (ICEObjectNotExistException* e) { return std::make_exception_ptr(Ice::ObjectNotExistException( - file.c_str(), line, Ice::Identity{fromNSString([e name]), fromNSString([e category])}, - fromNSString([e facet]), fromNSString([e operation]))); + file.c_str(), + line, + Ice::Identity{fromNSString([e name]), fromNSString([e category])}, + fromNSString([e facet]), + fromNSString([e operation]))); } @catch (ICEFacetNotExistException* e) { return std::make_exception_ptr(Ice::FacetNotExistException( - file.c_str(), line, Ice::Identity{fromNSString([e name]), fromNSString([e category])}, - fromNSString([e facet]), fromNSString([e operation]))); + file.c_str(), + line, + Ice::Identity{fromNSString([e name]), fromNSString([e category])}, + fromNSString([e facet]), + fromNSString([e operation]))); } @catch (ICEOperationNotExistException* e) { return std::make_exception_ptr(Ice::OperationNotExistException( - file.c_str(), line, Ice::Identity{fromNSString([e name]), fromNSString([e category])}, - fromNSString([e facet]), fromNSString([e operation]))); + file.c_str(), + line, + Ice::Identity{fromNSString([e name]), fromNSString([e category])}, + fromNSString([e facet]), + fromNSString([e operation]))); } @catch (ICEUnknownUserException* e) { diff --git a/swift/src/IceImpl/ObjectPrx.mm b/swift/src/IceImpl/ObjectPrx.mm index 85a4f47cde8..a2c48504562 100644 --- a/swift/src/IceImpl/ObjectPrx.mm +++ b/swift/src/IceImpl/ObjectPrx.mm @@ -636,7 +636,9 @@ - (BOOL)invoke:(NSString* _Nonnull)op std::promise p; _prx->ice_invokeAsync( - fromNSString(op), static_cast(mode), params, + fromNSString(op), + static_cast(mode), + params, [response, &p](bool ok, std::pair outParams) { // We need an autorelease pool as the unmarshaling (in the response) can @@ -644,12 +646,15 @@ - (BOOL)invoke:(NSString* _Nonnull)op @autoreleasepool { response( - ok, const_cast(outParams.first), + ok, + const_cast(outParams.first), static_cast(outParams.second - outParams.first)); } p.set_value(); }, - [&p](std::exception_ptr e) { p.set_exception(e); }, nullptr, context ? ctx : Ice::noExplicitContext); + [&p](std::exception_ptr e) { p.set_exception(e); }, + nullptr, + context ? ctx : Ice::noExplicitContext); p.get_future().get(); return YES; @@ -681,7 +686,10 @@ - (BOOL)onewayInvoke:(NSString*)op std::vector ignored; _prx->ice_invoke( - fromNSString(op), static_cast(mode), params, ignored, + fromNSString(op), + static_cast(mode), + params, + ignored, context ? ctx : Ice::noExplicitContext); return YES; } @@ -713,7 +721,9 @@ - (void)invokeAsync:(NSString* _Nonnull)op } _prx->ice_invokeAsync( - fromNSString(op), static_cast(mode), params, + fromNSString(op), + static_cast(mode), + params, [response](bool ok, std::pair outParams) { // We need an autorelease pool in case the unmarshaling creates auto @@ -723,7 +733,8 @@ - (void)invokeAsync:(NSString* _Nonnull)op @autoreleasepool { response( - ok, const_cast(outParams.first), + ok, + const_cast(outParams.first), static_cast(outParams.second - outParams.first)); } },