From 23e72fc934eae5a5fadde21102ec342840956c1f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 24 May 2025 16:51:33 +0100 Subject: [PATCH] Convert Anope::Debug to an unsigned value. --- include/anope.h | 2 +- language/anope.en_US.po | 6 +++--- modules/operserv/os_set.cpp | 4 ++-- src/init.cpp | 7 +++---- src/main.cpp | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/anope.h b/include/anope.h index 618592090..3cc6b602d 100644 --- a/include/anope.h +++ b/include/anope.h @@ -379,7 +379,7 @@ namespace Anope /** The debug level we are running at. */ - extern CoreExport int Debug; + extern CoreExport unsigned Debug; /** Other command line options. */ diff --git a/language/anope.en_US.po b/language/anope.en_US.po index e8c67f566..0cb1c20d7 100644 --- a/language/anope.en_US.po +++ b/language/anope.en_US.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-10 14:34+0100\n" -"PO-Revision-Date: 2025-04-25 13:08+0100\n" +"POT-Creation-Date: 2025-05-24 16:43+0100\n" +"PO-Revision-Date: 2025-05-24 16:44+0100\n" "Last-Translator: Sadie Powell \n" "Language-Team: English\n" "Language: en_US\n" @@ -4555,7 +4555,7 @@ msgid "Services are now at DEFCON %d." msgstr "" #, c-format -msgid "Services are now in debug mode (level %d)." +msgid "Services are now in debug mode (level %u)." msgstr "" msgid "Services are now in debug mode." diff --git a/modules/operserv/os_set.cpp b/modules/operserv/os_set.cpp index 16d319ab9..5eefebe4d 100644 --- a/modules/operserv/os_set.cpp +++ b/modules/operserv/os_set.cpp @@ -122,12 +122,12 @@ private: } else { - auto debug = Anope::TryConvert(setting); + auto debug = Anope::TryConvert(setting); if (debug.has_value()) { Anope::Debug = debug.value(); Log(LOG_ADMIN, source, this) << "DEBUG " << Anope::Debug; - source.Reply(_("Services are now in \002debug\002 mode (level %d)."), Anope::Debug); + source.Reply(_("Services are now in \002debug\002 mode (level %u)."), Anope::Debug); return; } diff --git a/src/init.cpp b/src/init.cpp index 89a946a98..282ec8957 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -390,11 +390,10 @@ bool Anope::Init(int ac, char **av) { if (!arg.empty()) { - auto level = Anope::Convert(arg, -1); - if (level > 0) - Anope::Debug = level; - else + auto level = Anope::TryConvert(arg); + if (!level.has_value()) throw CoreException("Invalid option given to --debug"); + Anope::Debug = level.value(); } else ++Anope::Debug; diff --git a/src/main.cpp b/src/main.cpp index 283d7146e..fcb3efe89 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,7 @@ #endif /* Command-line options: */ -int Anope::Debug = 0; +unsigned Anope::Debug = 0; bool Anope::ReadOnly = false, Anope::NoFork = false, Anope::NoThird = false, Anope::NoPID = false, Anope::NoExpire = false, Anope::ProtocolDebug = false; Anope::string Anope::ServicesDir; Anope::string Anope::ServicesBin;