From 7e0c7ab520bcc161685c86a6a76b223a75674898 Mon Sep 17 00:00:00 2001 From: Andrew O'Doherty Date: Mon, 28 May 2018 12:34:07 +0200 Subject: SLES12 compiler warning fixes Fixed some compilation issues: 1. error: declaration of ... shadows a member of 'this' Function parameters named equally as member functions. 2. warning: missing initializer for member Change-Id: Ibe55c244cdf224f0ab6e62db0e2fde98b80ac0da Reviewed-by: Alex Blasche --- src/knx/core/qknxbytearray.cpp | 8 +++--- src/knx/core/qknxbytearray.h | 6 ++--- src/knx/knxproj/qknxgroupaddressinfos.cpp | 10 +++---- src/knx/netip/qknxnetipstruct.cpp | 20 +++++++------- src/knx/netip/qknxnetipstruct.h | 23 ++++++++-------- src/knx/netip/qknxnetipstructheader.cpp | 16 +++++------ src/knx/netip/qknxnetipstructheader.h | 44 +++++++++++++++---------------- src/knx/qknxcontrolfield.cpp | 8 +++--- src/knx/qknxcontrolfield.h | 9 ++++--- 9 files changed, 73 insertions(+), 71 deletions(-) diff --git a/src/knx/core/qknxbytearray.cpp b/src/knx/core/qknxbytearray.cpp index 6a573d6..a93e3fa 100644 --- a/src/knx/core/qknxbytearray.cpp +++ b/src/knx/core/qknxbytearray.cpp @@ -259,18 +259,18 @@ void QKnxByteArray::resize(int size) */ /*! - \fn void QKnxByteArray::set(int i, quint8 value) + \fn void QKnxByteArray::set(int i, quint8 val) - Sets the character at the index position \a i in the byte array to \a value. + Sets the character at the index position \a i in the byte array to \a val. \a i must be a valid index position in the byte array (that is, between 0 and the value returned by size()). */ /*! - \fn void QKnxByteArray::setValue(int i, quint8 value) + \fn void QKnxByteArray::setValue(int i, quint8 val) - Sets the value at the index position \a i in the byte array to \a value. + Sets the value at the index position \a i in the byte array to \a val. If the index \a i is out of bounds, the function does nothing. If you are certain that \a i is within bounds, you can use set() instead, which diff --git a/src/knx/core/qknxbytearray.h b/src/knx/core/qknxbytearray.h index 4f1fdb1..f6feba5 100644 --- a/src/knx/core/qknxbytearray.h +++ b/src/knx/core/qknxbytearray.h @@ -92,11 +92,11 @@ public: void resize(int size); inline quint8 at(int i) const { return m_bytes.at(i); } - inline void set(int i, quint8 value) { m_bytes[i] = value; } + inline void set(int i, quint8 val) { m_bytes[i] = val; } - inline void setValue(int i, quint8 value) + inline void setValue(int i, quint8 val) { - if (i >= 0 && i < m_bytes.size()) m_bytes[i] = value; + if (i >= 0 && i < m_bytes.size()) m_bytes[i] = val; } inline quint8 value(int i, quint8 defaultValue = {}) const { diff --git a/src/knx/knxproj/qknxgroupaddressinfos.cpp b/src/knx/knxproj/qknxgroupaddressinfos.cpp index 510fcab..b82c06f 100644 --- a/src/knx/knxproj/qknxgroupaddressinfos.cpp +++ b/src/knx/knxproj/qknxgroupaddressinfos.cpp @@ -142,7 +142,7 @@ bool QKnxGroupAddressInfosPrivate::readProject(const QKnxProject &project) } projects.insert(project.Id, info); } else { - projects.insert(project.Id, {}); // projects can have empty installations + projects.insert(project.Id, { QString(), {} }); // projects can have empty installations } return status == QKnxGroupAddressInfos::Status::NoError; @@ -369,7 +369,7 @@ QVector QKnxGroupAddressInfos::projectIds() const */ QString QKnxGroupAddressInfos::projectName(const QString &projectId) const { - return d_ptr->projects.value(projectId, {}).name; + return d_ptr->projects.value(projectId, { QString(), {} }).name; } /*! @@ -377,7 +377,7 @@ QString QKnxGroupAddressInfos::projectName(const QString &projectId) const */ QVector QKnxGroupAddressInfos::installations(const QString &projectId) const { - return d_ptr->projects.value(projectId, {}).installations.keys().toVector(); + return d_ptr->projects.value(projectId, { QString(), {} }).installations.keys().toVector(); } /*! @@ -386,7 +386,7 @@ QVector QKnxGroupAddressInfos::installations(const QString &projectId) */ qint32 QKnxGroupAddressInfos::infoCount(const QString &projectId, const QString &installation) const { - const auto installations = d_ptr->projects.value(projectId, {}).installations; + const auto installations = d_ptr->projects.value(projectId, { QString(), {} }).installations; if (installations.isEmpty()) return -1; @@ -404,7 +404,7 @@ QVector QKnxGroupAddressInfos::addressInfos(const QString { if (projectId.isEmpty()) return {}; - return d_ptr->projects.value(projectId, {}).installations.value(installation); + return d_ptr->projects.value(projectId, { QString(), {} }).installations.value(installation); } /*! diff --git a/src/knx/netip/qknxnetipstruct.cpp b/src/knx/netip/qknxnetipstruct.cpp index affe641..124700f 100644 --- a/src/knx/netip/qknxnetipstruct.cpp +++ b/src/knx/netip/qknxnetipstruct.cpp @@ -156,17 +156,17 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template QKnxNetIpStruct::QKnxNetIpStruct(CodeType code, const QKnxByteArray &data = {}) + \fn template QKnxNetIpStruct::QKnxNetIpStruct(CodeType codeType, const QKnxByteArray &dataField = {}) - Creates a new KNXnet/IP structure with the specified \a code and payload - \a data. + Creates a new KNXnet/IP structure with the specified \a codeType and payload + \a dataField. */ /*! - \fn template QKnxNetIpStruct::QKnxNetIpStruct(const QKnxNetIpStructHeader &header, const QKnxByteArray &data = {}) + \fn template QKnxNetIpStruct::QKnxNetIpStruct(const QKnxNetIpStructHeader &headerField, const QKnxByteArray &dataField = {}) - Creates a new KNXnet/IP structure with the specified \a header and payload - \a data. + Creates a new KNXnet/IP structure with the specified \a headerField and payload + \a dataField. The header is expected to be fully set up and all values describing the payload are expected to match the specified payload. @@ -238,16 +238,16 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template QKnxNetIpStruct::setData(const QKnxByteArray &data) + \fn template QKnxNetIpStruct::setData(const QKnxByteArray &dataField) - Sets the data stored in the KNXnet/IP structure to \a data and updates the + Sets the data stored in the KNXnet/IP structure to \a dataField and updates the data size accordingly. */ /*! - \fn template QKnxNetIpStruct::setHeader(const QKnxNetIpStructHeader &header) + \fn template QKnxNetIpStruct::setHeader(const QKnxNetIpStructHeader &headerField) - Sets the header stored in the KNXnet/IP structure to \a header. + Sets the header stored in the KNXnet/IP structure to \a headerField. */ /*! diff --git a/src/knx/netip/qknxnetipstruct.h b/src/knx/netip/qknxnetipstruct.h index 0662ef1..0e2d196 100644 --- a/src/knx/netip/qknxnetipstruct.h +++ b/src/knx/netip/qknxnetipstruct.h @@ -46,15 +46,16 @@ public: QKnxNetIpStruct() = default; ~QKnxNetIpStruct() = default; - QKnxNetIpStruct(CodeType code, const QKnxByteArray &data = {}) - : m_header(code) + QKnxNetIpStruct(CodeType codeType, const QKnxByteArray &dataField = {}) + : m_header(codeType) { - setData(data); + setData(dataField); } - QKnxNetIpStruct(const QKnxNetIpStructHeader &header, const QKnxByteArray &data = {}) - : m_header(header) - , m_data(data) + QKnxNetIpStruct(const QKnxNetIpStructHeader &headerField, + const QKnxByteArray &dataField = {}) + : m_header(headerField) + , m_data(dataField) {} bool isNull() const @@ -82,9 +83,9 @@ public: return m_header; } - void setHeader(const QKnxNetIpStructHeader &header) + void setHeader(const QKnxNetIpStructHeader &headerField) { - m_header = header; + m_header = headerField; } CodeType code() const @@ -102,10 +103,10 @@ public: return m_data; } - void setData(const QKnxByteArray &data) + void setData(const QKnxByteArray &dataField) { - m_data = data; - m_header.setDataSize(data.size()); + m_data = dataField; + m_header.setDataSize(dataField.size()); } QKnxByteArray bytes() const diff --git a/src/knx/netip/qknxnetipstructheader.cpp b/src/knx/netip/qknxnetipstructheader.cpp index 3d977f5..34f7fc2 100644 --- a/src/knx/netip/qknxnetipstructheader.cpp +++ b/src/knx/netip/qknxnetipstructheader.cpp @@ -64,19 +64,19 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType code) + \fn template QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType codeType) Constructs a valid header object and sets the KNXnet/IP structure identifier - to \a code. + to \a codeType. \sa isValid(), code(), setCode() */ /*! - \fn template QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType code, quint16 dataSize) + \fn template QKnxNetIpStructHeader::QKnxNetIpStructHeader(CodeType codeType, quint16 dataFieldSize) Constructs a valid header object and sets the KNXnet/IP structure identifier - to \a code and the data size to \a dataSize and updates the header size and + to \a codeType and the data size to \a dataFieldSize and updates the header size and total size accordingly. \sa isValid(), code(), setCode(), dataSize(), setDataSize() @@ -143,9 +143,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template void QKnxNetIpStructHeader::setDataSize(quint16 dataSize) + \fn template void QKnxNetIpStructHeader::setDataSize(quint16 dataFieldSize) - Sets the KNXnet/IP structure data size to \a dataSize and updates the + Sets the KNXnet/IP structure data size to \a dataFieldSize and updates the header and total size accordingly. */ @@ -156,9 +156,9 @@ QT_BEGIN_NAMESPACE */ /*! - \fn template void QKnxNetIpStructHeader::setCode(CodeType code) + \fn template void QKnxNetIpStructHeader::setCode(CodeType codeType) - Sets the KNXnet/IP structure's code identifier to \a code. + Sets the KNXnet/IP structure's code identifier to \a codeType. */ /*! diff --git a/src/knx/netip/qknxnetipstructheader.h b/src/knx/netip/qknxnetipstructheader.h index a808a86..e57cfe4 100644 --- a/src/knx/netip/qknxnetipstructheader.h +++ b/src/knx/netip/qknxnetipstructheader.h @@ -46,22 +46,22 @@ public: QKnxNetIpStructHeader() = default; ~QKnxNetIpStructHeader() = default; - explicit QKnxNetIpStructHeader(CodeType code) - : QKnxNetIpStructHeader(code, 0) + explicit QKnxNetIpStructHeader(CodeType c) + : QKnxNetIpStructHeader(c, 0) {} - QKnxNetIpStructHeader(CodeType code, quint16 dataSize) + QKnxNetIpStructHeader(CodeType c, quint16 dataFieldSize) { - setCode(code); - setDataSize(dataSize); + setCode(c); + setDataSize(dataFieldSize); } template ::value>::type> - QKnxNetIpStructHeader(CodeType code, quint16 dataSize, bool mandatory) + QKnxNetIpStructHeader(CodeType c, quint16 dSize, bool mandatory) { - setCode(code); - setDataSize(dataSize); + setCode(c); + setDataSize(dSize); setMandatory(mandatory); } @@ -97,21 +97,21 @@ public: return totalSize() - size(); } - void setDataSize(quint16 dataSize) + void setDataSize(quint16 dataFieldSize) { // 2.1.3 Structures: If the amount of data exceeds 252 octets, the length octet shall // be 0xff and the next two octets shall contain the length as a 16 bit value. Then the // structure data shall start at the fifth octet. const auto tmp = code(); - setSize(dataSize > 0xfc ? 4 : 2); + setSize(dataFieldSize > 0xfc ? 4 : 2); - if (dataSize > 0xfc) { + if (dataFieldSize > 0xfc) { setByte(0, 0xff); - setByte(1, quint8((dataSize + 4) >> 8)); - setByte(2, quint8(dataSize + 4)); + setByte(1, quint8((dataFieldSize + 4) >> 8)); + setByte(2, quint8(dataFieldSize + 4)); } else { - setByte(0, quint8(dataSize + 2)); + setByte(0, quint8(dataFieldSize + 2)); } setCode(tmp); } @@ -121,9 +121,9 @@ public: return codeType(); } - void setCode(CodeType code) + void setCode(CodeType c) { - setCodeType(code); + setCodeType(c); } quint8 byte(quint8 index) const @@ -197,9 +197,9 @@ public: } private: - void setSize(quint8 size) + void setSize(quint8 structSize) { - m_bytes[0] = size; + m_bytes[0] = structSize; } void setByte(quint8 index, quint8 value) @@ -227,24 +227,24 @@ private: template typename std::enable_if::value, void>::type - /* void */ setCodeType(CodeType code) + /* void */ setCodeType(CodeType c) { if (isNull()) { setSize(2); setByte(0, 2); } - setByte(size() - 1, (quint8(code) & ~(1 << 7)) | (quint8(isMandatory()) << 7)); + setByte(size() - 1, (quint8(c) & ~(1 << 7)) | (quint8(isMandatory()) << 7)); } template typename std::enable_if::value, void>::type - /* void */ setCodeType(CodeType code) + /* void */ setCodeType(CodeType c) { if (isNull()) { setSize(2); setByte(0, 2); } - setByte(size() - 1, quint8(code)); + setByte(size() - 1, quint8(c)); } template diff --git a/src/knx/qknxcontrolfield.cpp b/src/knx/qknxcontrolfield.cpp index 6a10ad3..e6f9702 100644 --- a/src/knx/qknxcontrolfield.cpp +++ b/src/knx/qknxcontrolfield.cpp @@ -198,9 +198,9 @@ const std::bitset<8> gPriorityMask = 0x0c; */ /*! - \fn QKnxControlField::setRepeat(QKnxControlField::Repeat repeat) + \fn QKnxControlField::setRepeat(QKnxControlField::Repeat rep) - Sets the repetition flag to \a repeat. + Sets the repetition flag to \a rep. */ /*! @@ -219,9 +219,9 @@ const std::bitset<8> gPriorityMask = 0x0c; */ /*! - \fn QKnxControlField::setConfirm(QKnxControlField::Confirm confirm) + \fn QKnxControlField::setConfirm(QKnxControlField::Confirm conf) - Sets the confirm flag to \a confirm. + Sets the confirm flag to \a conf. */ /*! diff --git a/src/knx/qknxcontrolfield.h b/src/knx/qknxcontrolfield.h index 02a0ddb..a418b79 100644 --- a/src/knx/qknxcontrolfield.h +++ b/src/knx/qknxcontrolfield.h @@ -77,8 +77,9 @@ public: Q_ENUM(Repeat) QKnxControlField::Repeat repeat() const // ### Qt6: Replace byte() with m_ctrl1 { return static_cast (quint8(testBit(byte(), 5))); } - void setRepeat(QKnxControlField::Repeat repeat) // ### Qt6: Replace byte() with m_ctrl1 - { m_ctrl1 = setBit(byte(), bool(static_cast (repeat)), 5); } + void setRepeat(QKnxControlField::Repeat rep) // ### Qt6: Replace byte() with m_ctrl1 + { m_ctrl1 = setBit(byte(), bool(static_cast (rep)), 5); } + enum class Broadcast : quint8 { @@ -121,8 +122,8 @@ public: Q_ENUM(Confirm) QKnxControlField::Confirm confirm() const // ### Qt6: Replace byte() with m_ctrl1 { return static_cast (quint8(testBit(byte(), 0))); } - void setConfirm(QKnxControlField::Confirm confirm) // ### Qt6: Replace byte() with m_ctrl1 - { m_ctrl1 = setBit(byte(), bool(static_cast (confirm)), 0); } + void setConfirm(QKnxControlField::Confirm conf) // ### Qt6: Replace byte() with m_ctrl1 + { m_ctrl1 = setBit(byte(), bool(static_cast (conf)), 0); } quint8 byte() const { return quint8(m_ctrl1.to_ulong()); } QKnxByteArray bytes() const { return { byte() }; } -- cgit v1.2.3