Skip to content

Commit

Permalink
KDSingleApplicationLocalSocket: Remove braces on single lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaski authored and nicolasfella committed Jan 15, 2025
1 parent 5cd5e5b commit 24ad34a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/kdsingleapplication_localsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,13 @@ KDSingleApplicationLocalSocket::KDSingleApplicationLocalSocket(const QString &na
struct passwd *pw = ::getpwuid(uid);
userName = pw ? QString::fromUtf8(pw->pw_name) : alternativeUserName;
}
if (options.testFlag(KDSingleApplication::Option::IncludeSessionInSocketName)) {
if (options.testFlag(KDSingleApplication::Option::IncludeSessionInSocketName))
sessionId = qEnvironmentVariable("XDG_SESSION_ID");
}
int socketNameLength = tempPathLength + m_socketName.length() + 1 + name.length() + 1 + userName.length();
if (options.testFlag(KDSingleApplication::Option::IncludeSessionInSocketName) && !sessionId.isEmpty()) {
if (options.testFlag(KDSingleApplication::Option::IncludeSessionInSocketName) && !sessionId.isEmpty())
socketNameLength += sessionId.length() + 1;
}
if (socketNameLength > maxSocketNameLength) {
if (socketNameLength > maxSocketNameLength)
userName = alternativeUserName;
}
#elif defined(Q_OS_WIN)

constexpr int maxSocketNameLength = MAX_PATH - 1;
Expand All @@ -95,16 +92,14 @@ KDSingleApplicationLocalSocket::KDSingleApplicationLocalSocket(const QString &na
if (options.testFlag(KDSingleApplication::Option::IncludeUsernameInSocketName)) {
DWORD usernameLen = UNLEN + 1;
wchar_t username[UNLEN + 1];
if (GetUserNameW(username, &usernameLen)) {
if (GetUserNameW(username, &usernameLen))
userName = QString::fromWCharArray(username);
}
}
if (options.testFlag(KDSingleApplication::Option::IncludeSessionInSocketName)) {
DWORD pSessionId;
BOOL haveSessionId = ProcessIdToSessionId(GetCurrentProcessId(), &pSessionId);
if (haveSessionId) {
if (haveSessionId)
sessionId = QString::number(pSessionId);
}
}
#else
#error "KDSingleApplication has not been ported to this platform"
Expand Down

0 comments on commit 24ad34a

Please sign in to comment.