From d29317ecd0a661c1597514c80209a0c21765b7e4 Mon Sep 17 00:00:00 2001 From: philmoz Date: Mon, 15 May 2023 11:24:54 +1000 Subject: [PATCH] chore(cpn): Fix compiler warnings when building (#3383) * Fix build warnings. * Rename 'flags' function. --- companion/src/storage/firmwareinterface.cpp | 3 +-- companion/src/storage/rlefile.cpp | 1 - companion/src/storage/rlefile.h | 1 - companion/src/updates/repodatamodels.cpp | 2 +- companion/src/updates/repodatamodels.h | 2 +- companion/src/updates/repometadata.cpp | 2 +- companion/src/updates/reporeleases.h | 10 +++++----- companion/src/updates/updateinterface.cpp | 2 +- companion/src/updates/updatenetwork.cpp | 2 +- 9 files changed, 11 insertions(+), 14 deletions(-) diff --git a/companion/src/storage/firmwareinterface.cpp b/companion/src/storage/firmwareinterface.cpp index 8a4f69654..8a458d052 100644 --- a/companion/src/storage/firmwareinterface.cpp +++ b/companion/src/storage/firmwareinterface.cpp @@ -39,7 +39,7 @@ class RleBitmap { public: RleBitmap(const uint8_t *src, size_t offset) : - state(RLE_FIRST_BYTE), src(src), curPtr(src), byte(0), curCount(0), pos(0) + state(RLE_FIRST_BYTE), curPtr(src), byte(0), curCount(0), pos(0) { width = *curPtr++; rawRows = *curPtr++; @@ -145,7 +145,6 @@ public: private: enum State {RLE_FIRST_BYTE, RLE_SECOND_BYTE, RLE_CONTINUE} state; - const uint8_t* src; const uint8_t* curPtr; uint8_t width; diff --git a/companion/src/storage/rlefile.cpp b/companion/src/storage/rlefile.cpp index 4d38adac9..b39d3d435 100644 --- a/companion/src/storage/rlefile.cpp +++ b/companion/src/storage/rlefile.cpp @@ -29,7 +29,6 @@ RleFile::RleFile(): eeprom(NULL), eeprom_size(0), -eeFs(NULL), eeFsArm(NULL), eepromFatHeader(NULL) { diff --git a/companion/src/storage/rlefile.h b/companion/src/storage/rlefile.h index 803b3ad00..602b00502 100644 --- a/companion/src/storage/rlefile.h +++ b/companion/src/storage/rlefile.h @@ -94,7 +94,6 @@ class RleFile unsigned int version; uint8_t *eeprom; unsigned int eeprom_size; - EeFs *eeFs; EeFsArm *eeFsArm; unsigned int eeFsVersion; unsigned int eeFsBlockSize; diff --git a/companion/src/updates/repodatamodels.cpp b/companion/src/updates/repodatamodels.cpp index a8c11f760..d8e7fa2e5 100644 --- a/companion/src/updates/repodatamodels.cpp +++ b/companion/src/updates/repodatamodels.cpp @@ -138,7 +138,7 @@ bool RepoFilteredItemModel::filterAcceptsRow(int sourceRow, const QModelIndex & } } -const int RepoFilteredItemModel::flags(const int id) const +const int RepoFilteredItemModel::getFlags(const int id) const { return value(id, RIMR_Flags).toInt(); } diff --git a/companion/src/updates/repodatamodels.h b/companion/src/updates/repodatamodels.h index bf4b0d466..416313399 100644 --- a/companion/src/updates/repodatamodels.h +++ b/companion/src/updates/repodatamodels.h @@ -106,7 +106,7 @@ class RepoFilteredItemModel: public QSortFilterProxyModel, public RepoItemModelB const int count() const { return rowCount(); } const QString date(const int id) const; - const int flags(const int id) const; + const int getFlags(const int id) const; const int id(const int row) const ; const int id(const QVariant & value, const Qt::MatchFlags flags = Qt::MatchExactly, const int role = Qt::DisplayRole) const; const bool isEmpty() const { return rowCount() == 0; } diff --git a/companion/src/updates/repometadata.cpp b/companion/src/updates/repometadata.cpp index 88a01139b..0246abd62 100644 --- a/companion/src/updates/repometadata.cpp +++ b/companion/src/updates/repometadata.cpp @@ -53,7 +53,7 @@ void RepoMetaData::dumpFilteredItemModel() const const int RepoMetaData::flags() const { - return m_filteredItemModel->flags(id()); + return m_filteredItemModel->getFlags(id()); } int RepoMetaData::getSetId() diff --git a/companion/src/updates/reporeleases.h b/companion/src/updates/reporeleases.h index 5635bd5a3..a6ebd436d 100644 --- a/companion/src/updates/reporeleases.h +++ b/companion/src/updates/reporeleases.h @@ -84,10 +84,10 @@ class RepoReleases : public QObject, public RepoMetaData explicit RepoReleases(QObject * parent, UpdateStatus * status, UpdateNetwork * network); virtual ~RepoReleases() {} - virtual void init(const QString & repoPath, const QString & nightly, const int resultsPerPage); - virtual int setId(const int id) override; - virtual bool retrieveMetaDataAll(); - virtual bool retrieveMetaDataOne(const int id) { return false; } // not implemented + void init(const QString & repoPath, const QString & nightly, const int resultsPerPage) override; + int setId(const int id) override; + bool retrieveMetaDataAll() override; + bool retrieveMetaDataOne(const int id) override { return false; } // not implemented int channelLatestId(); void setChannel(const int channel); @@ -100,5 +100,5 @@ class RepoReleases : public QObject, public RepoMetaData ReleasesRawItemModel* const m_rawItemModel; ReleasesFilteredItemModel* const m_filteredItemModel; - virtual void dumpItemModel(const QString modelName, const QAbstractItemModel * itemModel) const; + void dumpItemModel(const QString modelName, const QAbstractItemModel * itemModel) const override; }; diff --git a/companion/src/updates/updateinterface.cpp b/companion/src/updates/updateinterface.cpp index e14d50512..0dcfc612c 100644 --- a/companion/src/updates/updateinterface.cpp +++ b/companion/src/updates/updateinterface.cpp @@ -560,7 +560,7 @@ const bool UpdateInterface::isReleaseLatest() const bool UpdateInterface::isSettingsIndexValid() const { - return m_id > -1 && m_id < MAX_COMPONENTS; + return (int)m_id > -1 && (int)m_id < MAX_COMPONENTS; } const bool UpdateInterface::isUpdateAvailable() diff --git a/companion/src/updates/updatenetwork.cpp b/companion/src/updates/updatenetwork.cpp index 028c7f5c5..664105b77 100644 --- a/companion/src/updates/updatenetwork.cpp +++ b/companion/src/updates/updatenetwork.cpp @@ -28,7 +28,7 @@ constexpr char GH_API_VERSION[] {"2022-11-28"}; constexpr char GH_ACCEPT_HEADER_CONTENT[] {"application/octet-stream"}; constexpr char GH_ACCEPT_HEADER_METADATA[] {"application/vnd.github+json"}; -constexpr char GH_ACCEPT_HEADER_RAW[] {"application/vnd.github.raw"}; +// constexpr char GH_ACCEPT_HEADER_RAW[] {"application/vnd.github.raw"}; UpdateNetwork::UpdateNetwork(QObject * parent, UpdateStatus * status) : QObject(parent),