chore: Client, Use auto where possible

This commit is contained in:
sithlord48 2025-04-27 12:29:43 -04:00 committed by Nick Bolton
parent b6f7497c44
commit af70ff98b7

View file

@ -338,7 +338,7 @@ void Client::resetOptions()
void Client::setOptions(const OptionsList &options) void Client::setOptions(const OptionsList &options)
{ {
for (OptionsList::const_iterator index = options.begin(); index != options.end(); ++index) { for (auto index = options.begin(); index != options.end(); ++index) {
const OptionID id = *index; const OptionID id = *index;
if (id == kOptionClipboardSharing) { if (id == kOptionClipboardSharing) {
index++; index++;
@ -417,7 +417,7 @@ void Client::sendEvent(Event::Type type, void *data)
void Client::sendConnectionFailedEvent(const char *msg) void Client::sendConnectionFailedEvent(const char *msg)
{ {
FailInfo *info = new FailInfo(msg); auto *info = new FailInfo(msg);
info->m_retry = true; info->m_retry = true;
Event event(m_events->forClient().connectionFailed(), getEventTarget(), info, Event::kDontFreeData); Event event(m_events->forClient().connectionFailed(), getEventTarget(), info, Event::kDontFreeData);
m_events->addEvent(event); m_events->addEvent(event);
@ -425,7 +425,7 @@ void Client::sendConnectionFailedEvent(const char *msg)
void Client::sendFileChunk(const void *data) void Client::sendFileChunk(const void *data)
{ {
FileChunk *chunk = static_cast<FileChunk *>(const_cast<void *>(data)); auto *chunk = static_cast<FileChunk *>(const_cast<void *>(data));
LOG((CLOG_DEBUG1 "send file chunk")); LOG((CLOG_DEBUG1 "send file chunk"));
assert(m_server != nullptr); assert(m_server != nullptr);
@ -584,7 +584,7 @@ void Client::handleConnected(const Event &, void *)
void Client::handleConnectionFailed(const Event &event, void *) void Client::handleConnectionFailed(const Event &event, void *)
{ {
IDataSocket::ConnectionFailedInfo *info = static_cast<IDataSocket::ConnectionFailedInfo *>(event.getData()); auto *info = static_cast<IDataSocket::ConnectionFailedInfo *>(event.getData());
cleanupTimer(); cleanupTimer();
cleanupConnecting(); cleanupConnecting();
@ -634,7 +634,7 @@ void Client::handleClipboardGrabbed(const Event &event, void *)
return; return;
} }
const IScreen::ClipboardInfo *info = static_cast<const IScreen::ClipboardInfo *>(event.getData()); const auto *info = static_cast<const IScreen::ClipboardInfo *>(event.getData());
// grab ownership // grab ownership
m_server->onGrabClipboard(info->m_id); m_server->onGrabClipboard(info->m_id);
@ -773,7 +773,7 @@ void Client::sendFileToServer(const char *filename)
void Client::sendFileThread(void *filename) void Client::sendFileThread(void *filename)
{ {
try { try {
char *name = static_cast<char *>(filename); auto *name = static_cast<char *>(filename);
StreamChunker::sendFile(name, m_events, this); StreamChunker::sendFile(name, m_events, this);
} catch (std::runtime_error &error) { } catch (std::runtime_error &error) {
LOG((CLOG_ERR "failed sending file chunks: %s", error.what())); LOG((CLOG_ERR "failed sending file chunks: %s", error.what()));