From 6843cd746501f06cd04bdfc21a7195fee7b65ae5 Mon Sep 17 00:00:00 2001 From: Integral Date: Sun, 13 Oct 2024 21:14:49 +0800 Subject: [PATCH] Use EXIT_FAILURE macro to improve code portability --- src/Cache.cpp | 8 ++++---- src/ChatPage.cpp | 4 ++-- src/main.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 5e8ba13f..16c8105c 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -658,8 +658,8 @@ fatalSecretError() "https://github.com/Nheko-Reborn/nheko/issues"), QMessageBox::StandardButton::Close); - QCoreApplication::exit(1); - exit(1); + QCoreApplication::exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } static QString @@ -2691,8 +2691,8 @@ try { "increased the capacity automatically, however you will need to " "restart to apply this change. Nheko will now close automatically."), QMessageBox::StandardButton::Close); - QCoreApplication::exit(1); - exit(1); + QCoreApplication::exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } throw; diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 3c663b94..de03c43b 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -460,8 +460,8 @@ ChatPage::dropToLoginPage(const QString &msg) QMessageBox::StandardButton::Close | QMessageBox::StandardButton::Ok, QMessageBox::StandardButton::Ok); if (btn == QMessageBox::StandardButton::Close) { - QCoreApplication::exit(1); - exit(1); + QCoreApplication::exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } resetUI(); diff --git a/src/main.cpp b/src/main.cpp index 8ce6fe5e..8099892a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -352,14 +352,14 @@ main(int argc, char *argv[]) if (!targets.isEmpty()) { std::cerr << "Invalid log type '" << targets.first().toStdString().c_str() << "'" << std::endl; - std::exit(1); + std::exit(EXIT_FAILURE); } nhlog::init(level, path, to_stderr); } catch (const spdlog::spdlog_ex &ex) { std::cerr << "Log initialization failed: " << ex.what() << std::endl; - std::exit(1); + std::exit(EXIT_FAILURE); } auto filter = new NhekoFixupPaletteEventFilter(&app);