Feature (contd.): Variable Fields - fixed errors and warnings reported by gcc4 in the code added for this feature

This commit is contained in:
Srivats P. 2015-06-01 19:05:43 +05:30
parent a8069bbb39
commit 384fd6e172
3 changed files with 8 additions and 14 deletions

View File

@ -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<AbstractProtocol*>();
vf = current->data(Qt::UserRole).value<OstProto::VariableField>();
isProgLoad_ = true;

View File

@ -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;
}

View File

@ -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