Skip to content

Commit

Permalink
Fix C++ build (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Dec 5, 2024
1 parent 2a3fde2 commit 2462e71
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions cpp/Chat/client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ createSession(const Glacier2::RouterPrx& router)

try
{
optional<Chat::ChatSessionPrx> session{router->createSession(id, pw)};
auto session = Ice::uncheckedCast<Chat::ChatSessionPrx>(router->createSession(id, pw));
if (!session)
{
throw runtime_error("Glaicer2::createSession return null. Is the SessionManager configured?");
throw runtime_error("Glacier2::createSession return null. Is the SessionManager configured?");
}
router->ice_getCachedConnection()->setCloseCallback(
[](const Ice::ConnectionPtr&)
Expand Down Expand Up @@ -112,7 +112,7 @@ createSession(const Glacier2::RouterPrx& router)
void
run(const shared_ptr<Ice::Communicator>& communicator)
{
optional<Glacier2::RouterPrx> router{communicator->getDefaultRouter()};
auto router = Ice::uncheckedCast<Glacier2::RouterPrx>(communicator->getDefaultRouter());
if (!router)
{
throw runtime_error("Ice.Default.Router property not set.");
Expand All @@ -128,7 +128,7 @@ run(const shared_ptr<Ice::Communicator>& communicator)
// provided by the router
Ice::Identity id{Ice::generateUUID(), router->getCategoryForClient()};

Chat::ChatRoomCallbackPrx callbackPrx{adapter->add(make_shared<ChatRoomCallbackI>(), id)};
auto callbackPrx = adapter->add<Chat::ChatRoomCallbackPrx>(make_shared<ChatRoomCallbackI>(), id);

// Set the callback proxy on the session
session->setCallback(callbackPrx);
Expand Down
2 changes: 1 addition & 1 deletion cpp/Glacier2/callback/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ run(const shared_ptr<Ice::Communicator>& communicator)
{
throw runtime_error("Ice.Default.Router property is not set.");
}
const Glacier2::RouterPrx router = Glacier2::RouterPrx(*defaultRouter);
auto router = Ice::uncheckedCast<Glacier2::RouterPrx>(*defaultRouter);

optional<Glacier2::SessionPrx> session;
//
Expand Down
4 changes: 2 additions & 2 deletions cpp/Glacier2/simpleChat/ChatSessionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ChatRoom::message(const string& data) const
const lock_guard<mutex> sync(const_cast<mutex&>(_mutex));
for (const auto& cb : _callbacks)
{
cb->messageAsync(data);
cb->messageAsync(data, nullptr); // don't wait
}
}

Expand Down Expand Up @@ -154,7 +154,7 @@ ChatSessionI::setCallback(optional<ChatCallbackPrx> callback, const Ice::Current
_callback = callback;
auto chatRoom = ChatRoom::instance();
chatRoom->message(_userId + " has entered the chat room.");
chatRoom->enter(ChatSessionPrx(current.adapter->createProxy(current.id)), std::move(*callback), current);
chatRoom->enter(current.adapter->createProxy<ChatSessionPrx>(current.id), std::move(*callback), current);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/Glacier2/simpleChat/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ run(const shared_ptr<Ice::Communicator>& communicator)
{
throw runtime_error("Ice.Default.Router property is not set.");
}
const Glacier2::RouterPrx router = Glacier2::RouterPrx(*defaultRouter);
auto router = Ice::uncheckedCast<Glacier2::RouterPrx>(*defaultRouter);
optional<ChatSessionPrx> session;
while (!session)
{
Expand Down
4 changes: 2 additions & 2 deletions cpp/Ice/mtalk/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ ChatApp::disconnect(const Ice::Identity& id, const shared_ptr<Ice::Connection>&
_peerAdapter->remove(id);
}

con->close(Ice::ConnectionClose::Gracefully);
con->close().get();
}

void
Expand Down Expand Up @@ -574,7 +574,7 @@ ChatApp::failed(const Ice::LocalException& ex)
auto con = peer->ice_getCachedConnection();
if (con)
{
con->close(Ice::ConnectionClose::Forcefully);
con->abort();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/plugin/LoggerPluginI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace

string getPrefix() final { return ""; }

shared_ptr<Ice::Logger> cloneWithPrefix(const std::string&) final { return make_shared<LoggerI>(); }
shared_ptr<Ice::Logger> cloneWithPrefix(std::string) final { return make_shared<LoggerI>(); }
};

}
Expand Down
2 changes: 1 addition & 1 deletion make/Make.rules.Darwin
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ endif
# If building objects for a shared library, enable fPIC
shared_cppflags = $(if $(filter-out program,$($1_target)),-fPIC) -fvisibility=hidden

cppflags = -Wall -Wextra -Wshadow -Wshadow-all -Wredundant-decls -Wno-shadow-field \
cppflags = -Wall -Wextra -Wshadow -Wshadow-all -Wredundant-decls -Wno-shadow-field -Wno-shadow-uncaptured-local \
-Wdeprecated -Wstrict-prototypes -Werror -Wconversion -Wdocumentation -pthread \
$(if $(filter yes,$(OPTIMIZE)),-O2 -DNDEBUG,-g)

Expand Down

0 comments on commit 2462e71

Please sign in to comment.