]> Some of my projects - anidbudpclient.git/commitdiff
Clazy fixes master
authorAPTX <redacted>
Sat, 7 Mar 2026 05:12:03 +0000 (14:12 +0900)
committerAPTX <redacted>
Sat, 7 Mar 2026 05:12:03 +0000 (14:12 +0900)
anidbudpclient_global.h
client.cpp
client.h
clientinterface.h
episodecommand.cpp
file.cpp
file.h
hash.h
renameparser/AniAdd/lexer.cpp
updatecommand.cpp

index d1a99dc4ba3545de312eb82c0736b042feb3a2c7..a581a44d15be1b80d573b95a01898de28be5cc0d 100644 (file)
@@ -38,6 +38,7 @@ namespace AniDBUdpClient
                EncryptionError,
                UnknownError,
        };
+       Q_ENUM_NS(Error);
 
        enum IdlePolicy
        {
@@ -46,6 +47,7 @@ namespace AniDBUdpClient
                ImmediateLogoutIdlePolicy,
                KeepAliveIdlePolicy,
        };
+       Q_ENUM_NS(IdlePolicy);
 
        enum ReplyCode
        {
@@ -211,6 +213,7 @@ namespace AniDBUdpClient
 
                VERSION                                         = 998,
        };
+       Q_ENUM_NS(ReplyCode);
 
        enum State {
                StateUnknown = 0,
@@ -219,6 +222,7 @@ namespace AniDBUdpClient
                StateDeleted = 3,
                StateOnExternalStorage = 4,
        };
+       Q_ENUM_NS(State);
 
        enum FileState {
                FileStateNormal = 0,
@@ -232,8 +236,7 @@ namespace AniDBUdpClient
                FileStateStreamed = 15,
                FileStateOther = 100
        };
-
-       Q_ENUMS(Error IdlePolicy ReplyCode State FileState);
+       Q_ENUM_NS(FileState);
 
        namespace FileFlag {
                enum FileFlag : quint64
index 2c41465f6b21ed4469e66125af46e9d502d0c0f1..0a7972ed42d532c0781d23ca32e82c2c4196def6 100644 (file)
@@ -333,9 +333,9 @@ qDebug() << "Host lookup finished";
                         << "to the following addresses:";
        for (auto&& address : hostInfo.addresses())
                qDebug() << address;
-       qDebug() << "Using" << hostInfo.addresses()[0];
+       qDebug() << "Using" << hostInfo.addresses().at(0);
 
-       m_hostAddress = hostInfo.addresses()[0];
+       m_hostAddress = hostInfo.addresses().at(0);
 
        // TODO could it be nicer?
        enterConnectingState();
index 09595c903a1d2abb458188bd245832a4ee0167b5..663d26e71af52710a267eee5354cccbf86c1e88e 100644 (file)
--- a/client.h
+++ b/client.h
@@ -94,10 +94,10 @@ protected:
 
 public slots:
 
-       void send(AbstractReply *reply);
+       void send(AniDBUdpClient::AbstractReply *reply);
 
        void sendRaw(QByteArray command);
-       void cancel(AbstractReply *command);
+       void cancel(AniDBUdpClient::AbstractReply *command);
 
        void clearErrors();
 
index 9851ad4b69794c0d2859175b5e8e055964f1cf4f..21e3b900a4cb374d0b72b8337597ca31a3a0744c 100644 (file)
@@ -59,10 +59,9 @@ public slots:
        virtual void connect() = 0;
        virtual void disconnect(bool graceful = false) = 0;
 
-       virtual void send(AbstractReply *reply) = 0;
+       virtual void send(AniDBUdpClient::AbstractReply *reply) = 0;
 
-//     virtual void sendRaw(QByteArray command) = 0;
-       virtual void cancel(AbstractReply *command) = 0;
+       virtual void cancel(AniDBUdpClient::AbstractReply *command) = 0;
 
 signals:
        void connectionError();
index 0a1c2cd166687e2db5f8e9418ebec599495ba1e0..48a44dbb2695bc5b13c00e50911129d87380bef5 100644 (file)
@@ -210,7 +210,7 @@ void EpisodeReply::setRawReply(ReplyCode replyCode, const QString &reply)
                                }
                                else
                                {
-                                       m_epnoAsInt = m_epno.mid(1).toInt();
+                                       m_epnoAsInt = QStringView{m_epno}.mid(1).toInt();
                                }
                        }
                        m_titleEnglish = parts[6];
index 3ce363576666638ed0556e37e9d67f92a522ab85..30e94a62a006082831d40c3731fd38e2106331a0 100644 (file)
--- a/file.cpp
+++ b/file.cpp
@@ -291,13 +291,13 @@ qDebug() << "lid = " << m_lid;
        }
        else
        {
-               newFileName = tr("%1 - %2 - %3 - [%4](%5).%6")
-                                          .arg(name)
-                                          .arg(fileReply->value(FileAnimeFlag::EpNo).toString())
-                                          .arg(fileReply->value(FileAnimeFlag::EpName).toString())
-                                          .arg(fileReply->value(FileAnimeFlag::GroupShortName).toString())
-                                          .arg(fileReply->value(FileFlag::Crc32).toString())
-                                          .arg(fileReply->value(FileFlag::FileType).toString());
+               newFileName =
+                       tr("%1 - %2 - %3 - [%4](%5).%6")
+                               .arg(name, fileReply->value(FileAnimeFlag::EpNo).toString(),
+                                        fileReply->value(FileAnimeFlag::EpName).toString(),
+                                        fileReply->value(FileAnimeFlag::GroupShortName).toString(),
+                                        fileReply->value(FileFlag::Crc32).toString(),
+                                        fileReply->value(FileFlag::FileType).toString());
        }
        newFileName.replace('"', "'");
        static QRegularExpression rx1("[\\/]");
diff --git a/file.h b/file.h
index fc1235cfd497e9661e385855bd0f8c93161f7c2d..c698dc5cc209cbd3c941a4633ecc84ec33029d79 100644 (file)
--- a/file.h
+++ b/file.h
@@ -44,6 +44,7 @@ public:
 
                All = -1,
        };
+       Q_ENUM(Action);
 
        enum ActionState {
                NotStarted      = 0x00000001,
@@ -55,8 +56,7 @@ public:
 
                OkToContinue = NotStarted | Failure,
        };
-
-       Q_ENUMS(Action ActionState);
+       Q_ENUM(ActionState);
 
        File(QObject *parent = 0);
        File(const QFileInfo &file, QObject *parent = 0);
diff --git a/hash.h b/hash.h
index 1a0b9b8e780b9c543a4503b6ab52ae93cf532027..639da49e38d1ca32287c7eec6c655084d4ef35f3 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -32,7 +32,7 @@ public:
        static void destroy();
 
 signals:
-       void resultReady(HashResult *result);
+       void resultReady(AniDBUdpClient::HashResult *result);
        void fileProgress(int percent);
        void progress(int percent);
        void finished();
index b12a7d7e07fee713c2d174aff90fe4839ad642d1..4c23d2db111bc957e11dbff0afc560a14dd78615 100644 (file)
@@ -44,7 +44,7 @@ bool Lexer::next()
        m_column += m_last_match.capturedLength();
 
        if (m_last_match.captured() == "\n" ||
-               m_last_match.captured()[0] == QChar('#') ||
+               m_last_match.captured().at(0) == QChar('#') ||
                m_last_match.captured().left(2) == "//")
        {
                ++m_line;
@@ -57,8 +57,8 @@ bool Lexer::next()
        {
                m_type = tokenMap.value(m_last_match.captured());
        }
-       else if (m_last_match.captured()[0] == QChar('"') ||
-                        m_last_match.captured()[0] == QChar('\''))
+       else if (m_last_match.captured().at(0) == QChar('"') ||
+                        m_last_match.captured().at(0) == QChar('\''))
        {
                m_type = RenameGrammar::STRING;
        }
index 33d58d18471b86999f90535ddb31019f83ca28c8..2727f651208d5caa8cec3a3cc6d4b0b884165f58 100644 (file)
@@ -109,14 +109,14 @@ void UpdateReply::setRawReply(ReplyCode replyCode, const QString &reply)
                        m_entity = parts[0].toInt(&ok, 10);
                        m_totalCount = parts[1].toInt(&ok);
                        m_lastUpdateDate = QDateTime::fromMSecsSinceEpoch(1000 * QString(parts[2]).toLongLong(&ok));
-                       QStringList aidList = parts[3].split(',');
+                       const QStringList aidList = parts[3].split(',');
                        m_aid.clear();
                        m_aid.reserve(aidList.count());
-                       for (auto aid : aidList)
+                       for (const auto &aid : aidList)
                        {
                                m_aid << aid.toInt(&ok);
                        }
-                       replyReady(true);
+                       emit replyReady(true);
                }
                break;
                case NO_UPDATES:
@@ -124,11 +124,11 @@ void UpdateReply::setRawReply(ReplyCode replyCode, const QString &reply)
                        m_totalCount = 0;
                        m_lastUpdateDate = QDateTime{};
                        m_aid.clear();
-                       replyReady(true);
-               break;
+                       emit replyReady(true);
+                       break;
                default:
-                       replyReady(false);
-               break;
+                       emit replyReady(false);
+                       break;
        }
 }