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.
// 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.
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).
auto logLevel = Settings::value(Settings::Daemon::LogLevel).toString().toStdString();
@ -105,8 +105,7 @@ int main(int argc, char **argv)
return s_exitSuccess;
}
const auto ipcServer =
new ipc::DaemonIpcServer(&app, DaemonApp::logFilename().toStdString().c_str()); // NOSONAR - Qt managed
const auto ipcServer = new ipc::DaemonIpcServer(&app, qPrintable(DaemonApp::logFilename())); // NOSONAR - Qt managed
ipcServer->listen();
daemon.connectIpcServer(ipcServer);

View File

@ -250,7 +250,7 @@ void DaemonApp::initLogging()
}
#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);
}

View File

@ -31,7 +31,7 @@ void VersionChecker::checkLatest() const
auto userAgent = QString("%1 %2 on %3").arg(kAppName, kVersion, QSysInfo::prettyProductName());
request.setHeader(QNetworkRequest::UserAgentHeader, userAgent);
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);
}

View File

@ -636,7 +636,7 @@ bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath)
return false;
// 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);
@ -646,12 +646,12 @@ bool SecureSocket::verifyCertFingerprint(const QString &FingerprintDatabasePath)
const auto &path = FingerprintDatabasePath;
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;
}
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)) {

View File

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