Bugfix: Don't pad HexDump unless it's the last protocol

This commit is contained in:
Srivats P 2018-09-14 18:29:23 +05:30
parent 488a2ea730
commit 9c319f97e5
2 changed files with 12 additions and 3 deletions

View File

@ -110,7 +110,7 @@ QVariant HexDumpProtocol::fieldData(int index, FieldAttrib attrib,
case FieldTextValue:
case FieldFrameValue:
ba.append(data.content().c_str(), data.content().length());
if (data.pad_until_end())
if (padUntilEnd())
{
pad = QByteArray(
protocolFrameSize(streamIndex) - ba.size(), '\0');
@ -144,7 +144,7 @@ QVariant HexDumpProtocol::fieldData(int index, FieldAttrib attrib,
switch(attrib)
{
case FieldValue:
return data.pad_until_end();
return padUntilEnd();
default:
break;
}
@ -197,7 +197,7 @@ int HexDumpProtocol::protocolFrameSize(int streamIndex) const
{
int len = data.content().size();
if (data.pad_until_end())
if (padUntilEnd())
{
int pad = mpStream->frameLen(streamIndex)
- (protocolFrameOffset(streamIndex)
@ -212,3 +212,10 @@ int HexDumpProtocol::protocolFrameSize(int streamIndex) const
return len;
}
bool HexDumpProtocol::padUntilEnd() const
{
if (next)
return false; // No padding if we are not the last protocol
return data.pad_until_end();
}

View File

@ -68,6 +68,8 @@ public:
virtual int protocolFrameSize(int streamIndex = 0) const;
private:
bool padUntilEnd() const;
OstProto::HexDump data;
};
#endif