Commit 5e9afaa8 authored by Josef Weidendorfer's avatar Josef Weidendorfer

Backport "Improve format detection"

parent 2a117338
......@@ -164,13 +164,14 @@ bool CachegrindLoader::canLoad(QIODevice* file)
buf[read] = 0;
QByteArray s = QByteArray::fromRawData(buf, read+1);
if (s.indexOf("# callgrind format\n") == 0) return true;
int pos = s.indexOf("events:");
if (pos>0 && buf[pos-1] != '\n') pos = -1;
if (pos>=0) return true;
// callgrind puts a "cmd:" line before "events:", and with big command
// lines, we need another way to detect such callgrind files...
pos = s.indexOf("creator: callgrind");
pos = s.indexOf("creator:");
if (pos>0 && buf[pos-1] != '\n') pos = -1;
return (pos>=0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment