From 8566e9e2b3ea3bfb5bb9eff997e1a3da6ec4e007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Fri, 6 Jul 2018 17:32:35 +0200 Subject: [PATCH] Fix VisualNavbar range --- src/Cutter.cpp | 2 -- src/widgets/VisualNavbar.cpp | 11 ++++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Cutter.cpp b/src/Cutter.cpp index 3ab38651..ee72a738 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -1546,8 +1546,6 @@ BlockStatistics CutterCore::getBlockStatistics(unsigned int blocksCount) QJsonArray blocksArray = statsObj["blocks"].toArray(); - printf("got %d blocks for requested %u\n", blocksArray.count(), blocksCount); - for (const QJsonValue &value : blocksArray) { QJsonObject blockObj = value.toObject(); BlockDescription block; diff --git a/src/widgets/VisualNavbar.cpp b/src/widgets/VisualNavbar.cpp index f632cb0c..6d328d6f 100644 --- a/src/widgets/VisualNavbar.cpp +++ b/src/widgets/VisualNavbar.cpp @@ -106,12 +106,11 @@ void VisualNavbar::fillData() int h = graphicsView->height(); RVA totalSize = stats.to - stats.from; - - printf("from: %llu, to %llu, first: %llu\n", stats.from, stats.to, stats.blocks[0].addr); + RVA beginAddr = stats.from; double widthPerByte = (double)w / (double)totalSize; - auto xFromAddr = [widthPerByte] (RVA addr) -> double { - return addr * widthPerByte; + auto xFromAddr = [widthPerByte, beginAddr] (RVA addr) -> double { + return (addr - beginAddr) * widthPerByte; }; std::array(DataType::Count)> dataTypeBrushes; @@ -133,12 +132,14 @@ void VisualNavbar::fillData() xToAddress.append(x2a); DataType dataType; - if (block.inFunctions > 0) { + if (block.functions > 0) { dataType = DataType::Code; } else if (block.strings > 0) { dataType = DataType::String; } else if (block.symbols > 0) { dataType = DataType::Symbol; + } else if (block.inFunctions > 0) { + dataType = DataType::Code; } else { lastDataType = DataType::Empty; continue;