diff --git a/client/variablefieldswidget.cpp b/client/variablefieldswidget.cpp index 8eb06ea..fab811f 100644 --- a/client/variablefieldswidget.cpp +++ b/client/variablefieldswidget.cpp @@ -177,19 +177,14 @@ void VariableFieldsWidget::on_variableFieldList_currentItemChanged( QListWidgetItem *current, QListWidgetItem *previous) { - AbstractProtocol *proto; OstProto::VariableField vf; - QListWidgetItem *protoItem = protocolList->currentItem(); - qDebug("%s: curr = %p, prev = %p, proto = %p", - __FUNCTION__, current, previous, protoItem); + qDebug("%s: curr = %p, prev = %p", + __FUNCTION__, current, previous); if (current == NULL) goto _exit; - Q_ASSERT(protoItem); - proto = protoItem->data(Qt::UserRole).value(); - vf = current->data(Qt::UserRole).value(); isProgLoad_ = true; diff --git a/common/abstractprotocol.cpp b/common/abstractprotocol.cpp index 40d8219..15f7d15 100644 --- a/common/abstractprotocol.cpp +++ b/common/abstractprotocol.cpp @@ -373,16 +373,16 @@ int AbstractProtocol::fieldFrameBitOffset(int index, int streamIndex) const } for (int i = 0; i < index; i++) { - if (_cacheFlags.testFlag(FieldFrameBitOffsetCache) + if ((_cacheFlags & FieldFrameBitOffsetCache) && !_fieldFrameBitOffset.contains(i)) _fieldFrameBitOffset.insert(i, ofs); ofs += fieldData(i, FieldBitSize, streamIndex).toInt(); } - if (_cacheFlags.testFlag(FieldFrameBitOffsetCache)) + if ((_cacheFlags & FieldFrameBitOffsetCache)) _fieldFrameBitOffset.insert(index, ofs); -_exit: qDebug("======> ffbo index: %d, ofs: %d", index, ofs); +_exit: return ofs; } @@ -1100,6 +1100,7 @@ bool varyCounter(QString protocolName, QByteArray &buf, int frameIndex, default: qWarning("%s Unsupported varField mode %d", qPrintable(protocolName), varField.mode()); + return false; } if (sizeof(T) == sizeof(quint8)) @@ -1132,3 +1133,4 @@ void AbstractProtocol::varyProtocolFrameValue(QByteArray &buf, int frameIndex, return; } + diff --git a/common/abstractprotocol.h b/common/abstractprotocol.h index 4177e91..75713bc 100644 --- a/common/abstractprotocol.h +++ b/common/abstractprotocol.h @@ -67,8 +67,7 @@ protected: enum CacheFlag { FieldFrameBitOffsetCache = 0x1 }; - Q_DECLARE_FLAGS(CacheFlags, CacheFlag); - CacheFlags _cacheFlags; + quint32 _cacheFlags; public: //! Properties of a field, can be OR'd @@ -179,7 +178,5 @@ private: void varyProtocolFrameValue(QByteArray &buf, int frameIndex, const OstProto::VariableField &varField) const; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractProtocol::CacheFlags); Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractProtocol::FieldFlags); - #endif