diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-27 13:16:41 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-27 15:33:21 +0300 |
commit | 8793c8fa523c4d05962990cec1031996b8601d0a (patch) | |
tree | 5010f5e7172dc34181e1848bd62cf14a4c5b56d6 | |
parent | 77502d434fc01e2a4abbe7a177fb48527b26f458 (diff) |
Cut null characters from the end of command and file names
Some perfs add additional nulls to command and file names. We don't
want them in the output.
Change-Id: I35e0048a6ad2f89908641506289ad38fe94985bf
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r-- | app/perfdata.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/perfdata.cpp b/app/perfdata.cpp index 9e73107..87a5fed 100644 --- a/app/perfdata.cpp +++ b/app/perfdata.cpp @@ -245,6 +245,9 @@ QDataStream &PerfRecordMmap::readFilename(QDataStream &stream, quint64 filenameL } m_filename.resize(filenameLength); stream.readRawData(m_filename.data(), filenameLength); + int null = m_filename.indexOf('\0'); + if (null != -1) + m_filename.truncate(null); return stream; } @@ -312,6 +315,10 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordComm &record) } record.m_comm.resize(commLength); stream.readRawData(record.m_comm.data(), commLength); + int null = record.m_comm.indexOf('\0'); + if (null != -1) + record.m_comm.truncate(null); + stream >> record.m_sampleId; return stream; |