diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2019-08-09 10:45:34 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2019-08-13 12:03:00 +0000 |
commit | 4fcd8e4fd3968b320932137aa0da2d07b6450851 (patch) | |
tree | 972eb5a50ec7e82455c61ecba78186b29da89b33 | |
parent | 9fa06beebcd695cfb18bb2a94cf7fa2f0ff33912 (diff) |
Don't warn when parsing tracing data with odd content size
If the content size is 4, we actually parse more than that.
Take this into account instead of triggering a misleading warning:
QWARN : TestPerfData::testTracingData(stream stats)
warning: PerfData::processEvents[../../../../app/perfdata.cpp:197]?[0m: Event not fully parsed 66 4 2836
QWARN : TestPerfData::testTracingData(stream stats)
warning: unknown[unknown:0]?[0m: QIODevice::skip (QFile, ":/probe.data.stream"): Called with maxSize < 0
Change-Id: I43aab019a5f34a20e890c87f5d53120e977e293f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | app/perfdata.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/perfdata.cpp b/app/perfdata.cpp index 54a9683..5b10eaf 100644 --- a/app/perfdata.cpp +++ b/app/perfdata.cpp @@ -59,6 +59,7 @@ PerfData::ReadStatus PerfData::processEvents(QDataStream &stream) } const quint16 contentSize = m_eventHeader.size - headerSize; + qint64 expectedParsedContentSize = contentSize; if (stream.device()->bytesAvailable() < contentSize) return Rerun; @@ -153,6 +154,7 @@ PerfData::ReadStatus PerfData::processEvents(QDataStream &stream) quint32 size; stream >> size; m_tracingData.setSize(size); + expectedParsedContentSize += size; } if (stream.device()->bytesAvailable() >= m_tracingData.size()) { stream >> m_tracingData; @@ -192,8 +194,8 @@ PerfData::ReadStatus PerfData::processEvents(QDataStream &stream) if (!stream.device()->isSequential()) { const auto parsedContentSize = stream.device()->pos() - oldPos; - if (parsedContentSize != contentSize) { - qWarning() << "Event not fully parsed" << m_eventHeader.type << contentSize + if (parsedContentSize != expectedParsedContentSize) { + qWarning() << "Event not fully parsed" << m_eventHeader.type << expectedParsedContentSize << parsedContentSize; stream.skipRawData(contentSize - parsedContentSize); } |