refactor: replace QString::toStdString().c_str with qPrintable(...)

This commit is contained in:
sithlord48 2025-08-21 16:55:09 -04:00 committed by Nick Bolton
parent 7e12c5b76d
commit 299ebea0e2
5 changed files with 8 additions and 12 deletions

View file

@ -79,7 +79,7 @@ int main(int argc, char **argv)
// useful for troubleshooting Windows services. // useful for troubleshooting Windows services.
// It's important to write the version number to the log file so we can be certain the old daemon // It's important to write the version number to the log file so we can be certain the old daemon
// was uninstalled, since sometimes Windows services can get stuck and fail to be removed. // was uninstalled, since sometimes Windows services can get stuck and fail to be removed.
LOG_PRINT("%s v%s", QCoreApplication::applicationName().toStdString().c_str(), kDisplayVersion); LOG_PRINT("%s v%s", qPrintable(QCoreApplication::applicationName()), kDisplayVersion);
// Default log level to system setting (found in Registry). // Default log level to system setting (found in Registry).
auto logLevel = Settings::value(Settings::Daemon::LogLevel).toString().toStdString(); auto logLevel = Settings::value(Settings::Daemon::LogLevel).toString().toStdString();
@ -105,8 +105,7 @@ int main(int argc, char **argv)
return s_exitSuccess; return s_exitSuccess;
} }
const auto ipcServer = const auto ipcServer = new ipc::DaemonIpcServer(&app, qPrintable(DaemonApp::logFilename())); // NOSONAR - Qt managed
new ipc::DaemonIpcServer(&app, DaemonApp::logFilename().toStdString().c_str()); // NOSONAR - Qt managed
ipcServer->listen(); ipcServer->listen();
daemon.connectIpcServer(ipcServer); daemon.connectIpcServer(ipcServer);

View file

@ -250,7 +250,7 @@ void DaemonApp::initLogging()
} }
#endif #endif
m_pFileLogOutputter = new FileLogOutputter(logFilename().toStdString().c_str()); // NOSONAR - Adopted by `Log` m_pFileLogOutputter = new FileLogOutputter(qPrintable(logFilename())); // NOSONAR - Adopted by `Log`
CLOG->insert(m_pFileLogOutputter); CLOG->insert(m_pFileLogOutputter);
} }

View file

@ -31,7 +31,7 @@ void VersionChecker::checkLatest() const
auto userAgent = QString("%1 %2 on %3").arg(kAppName, kVersion, QSysInfo::prettyProductName()); auto userAgent = QString("%1 %2 on %3").arg(kAppName, kVersion, QSysInfo::prettyProductName());
request.setHeader(QNetworkRequest::UserAgentHeader, userAgent); request.setHeader(QNetworkRequest::UserAgentHeader, userAgent);
request.setRawHeader("X-Deskflow-Version", kVersion); request.setRawHeader("X-Deskflow-Version", kVersion);
request.setRawHeader("X-Deskflow-Language", QLocale::system().name().toStdString().c_str()); request.setRawHeader("X-Deskflow-Language", qPrintable(QLocale::system().name()));
m_network->get(request); m_network->get(request);
} }

View file

@ -636,7 +636,7 @@ bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath)
return false; return false;
// Gui Must Parse this line, DO NOT CHANGE // Gui Must Parse this line, DO NOT CHANGE
LOG_NOTE("peer fingerprint: %s", deskflow::formatSSLFingerprint(sha256.data, false).toStdString().c_str()); LOG_NOTE("peer fingerprint: %s", qPrintable(deskflow::formatSSLFingerprint(sha256.data, false)));
QFile file(FingerprintDatabasePath); QFile file(FingerprintDatabasePath);
@ -646,12 +646,12 @@ bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath)
const auto &path = FingerprintDatabasePath; const auto &path = FingerprintDatabasePath;
if (file.exists() && emptyDB) { if (file.exists() && emptyDB) {
LOG_ERR("failed to open trusted fingerprints file: %s", path.toStdString().c_str()); LOG_ERR("failed to open trusted fingerprints file: %s", qPrintable(path));
return false; return false;
} }
if (!emptyDB) { if (!emptyDB) {
LOG_DEBUG("read %d fingerprint(s) from file: %s", db.fingerprints().size(), path.toStdString().c_str()); LOG_DEBUG("read %d fingerprint(s) from file: %s", db.fingerprints().size(), qPrintable(path));
} }
if (!db.isTrusted(sha256)) { if (!db.isTrusted(sha256)) {

View file

@ -242,10 +242,7 @@ bool XWindowsKeyState::setCurrentLanguageWithDBus(int32_t group) const
if (!reply.isValid()) { if (!reply.isValid()) {
auto qerror = reply.error(); auto qerror = reply.error();
LOG( LOG((CLOG_WARN "keyboard layout fail %s : %s", qPrintable(qerror.name()), qPrintable(qerror.message())));
(CLOG_WARN "keyboard layout fail %s : %s", qerror.name().toStdString().c_str(),
qerror.message().toStdString().c_str())
);
return true; return true;
} }