From 8c1b48a25c84c9940a0b757775c4b80271212405 Mon Sep 17 00:00:00 2001 From: Evan Teran Date: Mon, 18 Mar 2024 20:08:33 -0400 Subject: [PATCH] more [[nodiscard]] &value[0] -> value.data() const& -> value + move --- include/GraphNode.h | 2 +- include/ISymbolManager.h | 24 +++++++++---------- include/Status.h | 4 ++-- plugins/Analyzer/Analyzer.cpp | 2 +- plugins/Analyzer/Analyzer.h | 12 +++++----- plugins/BinarySearcher/DialogAsciiString.cpp | 4 ++-- plugins/BinarySearcher/DialogBinaryString.cpp | 4 ++-- .../arch/x86-generic/Breakpoint.cpp | 4 ++-- .../arch/x86-generic/Breakpoint.h | 2 +- .../unix/linux/PlatformCommon.cpp | 2 +- plugins/InstructionInspector/Plugin.cpp | 2 +- .../ODbgRegisterView/BitFieldDescription.cpp | 4 ++-- .../ODbgRegisterView/BitFieldDescription.h | 5 +++- .../ODbgRegisterView/DialogEditSimdRegister.h | 2 +- plugins/References/DialogReferences.cpp | 8 +++---- src/ByteShiftArray.cpp | 2 +- src/CommentServer.cpp | 22 ++++++++++------- src/Configuration.cpp | 2 +- src/Debugger.h | 2 +- src/DialogBreakpoints.cpp | 8 +++---- src/FloatX.cpp | 20 +++++++++------- src/RegisterViewModelBase.cpp | 2 +- src/SymbolManager.cpp | 8 +++---- src/SymbolManager.h | 16 ++++++------- src/edb.cpp | 2 +- src/graph/GraphEdge.cpp | 3 ++- src/widgets/QDisassemblyView.cpp | 4 +--- 27 files changed, 90 insertions(+), 82 deletions(-) diff --git a/include/GraphNode.h b/include/GraphNode.h index 680724d8d..b8180bd09 100644 --- a/include/GraphNode.h +++ b/include/GraphNode.h @@ -61,7 +61,7 @@ class GraphNode final : public QGraphicsItem { public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; - QRectF boundingRect() const override; + [[nodiscard]] QRectF boundingRect() const override; protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *e) override; diff --git a/include/ISymbolManager.h b/include/ISymbolManager.h index 75c755d06..b5753782d 100644 --- a/include/ISymbolManager.h +++ b/include/ISymbolManager.h @@ -33,18 +33,18 @@ class ISymbolManager { virtual ~ISymbolManager() = default; public: - [[nodiscard]] virtual const std::shared_ptr find(const QString &name) const = 0; - [[nodiscard]] virtual const std::shared_ptr find(edb::address_t address) const = 0; - [[nodiscard]] virtual const std::shared_ptr findNearSymbol(edb::address_t address) const = 0; - [[nodiscard]] virtual const std::vector> symbols() const = 0; - [[nodiscard]] virtual QHash labels() const = 0; - [[nodiscard]] virtual QStringList files() const = 0; - virtual QString findAddressName(edb::address_t address, bool prefixed = true) = 0; - virtual void addSymbol(const std::shared_ptr &symbol) = 0; - virtual void clear() = 0; - virtual void loadSymbolFile(const QString &filename, edb::address_t base) = 0; - virtual void setLabel(edb::address_t address, const QString &label) = 0; - virtual void setSymbolGenerator(ISymbolGenerator *generator) = 0; + [[nodiscard]] virtual QHash labels() const = 0; + [[nodiscard]] virtual QString findAddressName(edb::address_t address, bool prefixed = true) = 0; + [[nodiscard]] virtual QStringList files() const = 0; + [[nodiscard]] virtual std::shared_ptr find(const QString &name) const = 0; + [[nodiscard]] virtual std::shared_ptr find(edb::address_t address) const = 0; + [[nodiscard]] virtual std::shared_ptr findNearSymbol(edb::address_t address) const = 0; + [[nodiscard]] virtual std::vector> symbols() const = 0; + virtual void addSymbol(const std::shared_ptr &symbol) = 0; + virtual void clear() = 0; + virtual void loadSymbolFile(const QString &filename, edb::address_t base) = 0; + virtual void setLabel(edb::address_t address, const QString &label) = 0; + virtual void setSymbolGenerator(ISymbolGenerator *generator) = 0; }; #endif diff --git a/include/Status.h b/include/Status.h index c5e24c00a..357c27222 100644 --- a/include/Status.h +++ b/include/Status.h @@ -32,8 +32,8 @@ class EDB_EXPORT Status { Status(OkType) { } - explicit Status(const QString &message) - : error_(message) { + explicit Status(QString message) + : error_(std::move(message)) { } Status(const Status &) = default; diff --git a/plugins/Analyzer/Analyzer.cpp b/plugins/Analyzer/Analyzer.cpp index 9e77313e5..2707d0beb 100644 --- a/plugins/Analyzer/Analyzer.cpp +++ b/plugins/Analyzer/Analyzer.cpp @@ -583,7 +583,7 @@ void Analyzer::collectFuzzyFunctions(RegionData *data) { QHash fuzzy_functions; - uint8_t *const first = &data->memory[0]; + uint8_t *const first = (data->memory).data(); uint8_t *const last = &first[data->memory.size()]; uint8_t *p = first; diff --git a/plugins/Analyzer/Analyzer.h b/plugins/Analyzer/Analyzer.h index 190dcc07c..1fa49d0f2 100644 --- a/plugins/Analyzer/Analyzer.h +++ b/plugins/Analyzer/Analyzer.h @@ -60,15 +60,15 @@ class Analyzer final : public QObject, public IAnalyzer, public IPlugin { [[nodiscard]] QWidget *optionsPage() override; public: - AddressCategory category(edb::address_t address) const override; - FunctionMap functions(const std::shared_ptr ®ion) const override; - FunctionMap functions() const override; - QSet specifiedFunctions() const override { return specifiedFunctions_; } - Result findContainingFunction(edb::address_t address) const override; + [[nodiscard]] AddressCategory category(edb::address_t address) const override; + [[nodiscard]] FunctionMap functions() const override; + [[nodiscard]] FunctionMap functions(const std::shared_ptr ®ion) const override; + [[nodiscard]] QSet specifiedFunctions() const override { return specifiedFunctions_; } + [[nodiscard]] Result findContainingFunction(edb::address_t address) const override; + bool forFuncsInRange(edb::address_t start, edb::address_t end, std::function functor) const override; void analyze(const std::shared_ptr ®ion) override; void invalidateAnalysis() override; void invalidateAnalysis(const std::shared_ptr ®ion) override; - bool forFuncsInRange(edb::address_t start, edb::address_t end, std::function functor) const override; private: [[nodiscard]] bool findContainingFunction(edb::address_t address, Function *function) const; diff --git a/plugins/BinarySearcher/DialogAsciiString.cpp b/plugins/BinarySearcher/DialogAsciiString.cpp index c83011ba4..7d5b2dce2 100644 --- a/plugins/BinarySearcher/DialogAsciiString.cpp +++ b/plugins/BinarySearcher/DialogAsciiString.cpp @@ -96,8 +96,8 @@ void DialogAsciiString::doFind() { edb::address_t stack_address; if (process->readBytes(stack_ptr, &stack_address, edb::v1::pointer_size())) { - if (process->readBytes(stack_address, &chars[0], chars.size())) { - if (std::memcmp(&chars[0], b.constData(), chars.size()) == 0) { + if (process->readBytes(stack_address, chars.data(), chars.size())) { + if (std::memcmp(chars.data(), b.constData(), chars.size()) == 0) { results->addResult(DialogResults::RegionType::Stack, stack_ptr); } } diff --git a/plugins/BinarySearcher/DialogBinaryString.cpp b/plugins/BinarySearcher/DialogBinaryString.cpp index 11a27504b..e16362acc 100644 --- a/plugins/BinarySearcher/DialogBinaryString.cpp +++ b/plugins/BinarySearcher/DialogBinaryString.cpp @@ -115,13 +115,13 @@ void DialogBinaryString::doFind() { while (p < pages_end) { // compare values.. if (std::memcmp(p, b.constData(), sz) == 0) { - const edb::address_t addr = p - &pages[0] + region->start() + (current_page * page_size); + const edb::address_t addr = p - pages.data() + region->start() + (current_page * page_size); results_->addResult(DialogResults::RegionType::Data, addr); } // update progress bar every 64KB if ((reinterpret_cast(p) & 0xFFFF) == 0) { - ui.progressBar->setValue(util::percentage(i, regions.size(), p - &pages[0], region_size)); + ui.progressBar->setValue(util::percentage(i, regions.size(), p - pages.data(), region_size)); } p += align; diff --git a/plugins/DebuggerCore/arch/x86-generic/Breakpoint.cpp b/plugins/DebuggerCore/arch/x86-generic/Breakpoint.cpp index ab4a1fb7e..553ac3442 100644 --- a/plugins/DebuggerCore/arch/x86-generic/Breakpoint.cpp +++ b/plugins/DebuggerCore/arch/x86-generic/Breakpoint.cpp @@ -114,7 +114,7 @@ bool Breakpoint::enable() { if (!enabled()) { if (IProcess *process = edb::v1::debugger_core->process()) { std::vector prev(2); - if (process->readBytes(address(), &prev[0], prev.size())) { + if (process->readBytes(address(), prev.data(), prev.size())) { originalBytes_ = prev; const std::vector *bpBytes = nullptr; @@ -178,7 +178,7 @@ bool Breakpoint::enable() { bool Breakpoint::disable() { if (enabled()) { if (IProcess *process = edb::v1::debugger_core->process()) { - if (process->writeBytes(address(), &originalBytes_[0], originalBytes_.size())) { + if (process->writeBytes(address(), originalBytes_.data(), originalBytes_.size())) { enabled_ = false; return true; } diff --git a/plugins/DebuggerCore/arch/x86-generic/Breakpoint.h b/plugins/DebuggerCore/arch/x86-generic/Breakpoint.h index 92fcd7acc..6bc41c327 100644 --- a/plugins/DebuggerCore/arch/x86-generic/Breakpoint.h +++ b/plugins/DebuggerCore/arch/x86-generic/Breakpoint.h @@ -60,7 +60,7 @@ class Breakpoint final : public IBreakpoint { [[nodiscard]] bool oneTime() const override { return oneTime_; } [[nodiscard]] bool internal() const override { return internal_; } [[nodiscard]] size_t size() const override { return originalBytes_.size(); } - [[nodiscard]] const uint8_t *originalBytes() const override { return &originalBytes_[0]; } + [[nodiscard]] const uint8_t *originalBytes() const override { return originalBytes_.data(); } [[nodiscard]] IBreakpoint::TypeId type() const override { return type_; } [[nodiscard]] static std::vector supportedTypes(); diff --git a/plugins/DebuggerCore/unix/linux/PlatformCommon.cpp b/plugins/DebuggerCore/unix/linux/PlatformCommon.cpp index ad40c6a0f..685c3a324 100644 --- a/plugins/DebuggerCore/unix/linux/PlatformCommon.cpp +++ b/plugins/DebuggerCore/unix/linux/PlatformCommon.cpp @@ -129,7 +129,7 @@ int get_user_stat(const char *path, struct user_stat *user_stat) { &user_stat->exit_code); // fill in the pid - r += sscanf(&line[0], "%d", &user_stat->pid); + r += sscanf(line.data(), "%d", &user_stat->pid); // fill in the comm field const size_t len = std::min(sizeof(user_stat->comm), (right - left) - 1); diff --git a/plugins/InstructionInspector/Plugin.cpp b/plugins/InstructionInspector/Plugin.cpp index 2d61f98dd..7df913684 100644 --- a/plugins/InstructionInspector/Plugin.cpp +++ b/plugins/InstructionInspector/Plugin.cpp @@ -1388,7 +1388,7 @@ InstructionDialog::InstructionDialog(QWidget *parent, Qt::WindowFlags f) if (!insn) { add({"Bad instruction", "Failed to disassemble instruction at address " + edb::v1::format_pointer(address_)}); - add({"Bytes", printBytes(&insnBytes_[0], insnBytes_.size()).c_str()}); + add({"Bytes", printBytes(insnBytes_.data(), insnBytes_.size()).c_str()}); } else { add({"Address", toHex(insn->address).c_str()}); add({"Bytes", printBytes(insn->bytes, insn->size).c_str()}); diff --git a/plugins/ODbgRegisterView/BitFieldDescription.cpp b/plugins/ODbgRegisterView/BitFieldDescription.cpp index 190eca537..bce317927 100644 --- a/plugins/ODbgRegisterView/BitFieldDescription.cpp +++ b/plugins/ODbgRegisterView/BitFieldDescription.cpp @@ -4,8 +4,8 @@ namespace ODbgRegisterView { -BitFieldDescription::BitFieldDescription(int textWidth, const std::vector &valueNames, const std::vector &setValueTexts, const std::function &valueEqualComparator) - : textWidth(textWidth), valueNames(valueNames), setValueTexts(setValueTexts), valueEqualComparator(valueEqualComparator) { +BitFieldDescription::BitFieldDescription(int textWidth, std::vector valueNames, std::vector setValueTexts, std::function valueEqualComparator) + : textWidth(textWidth), valueNames(std::move(valueNames)), setValueTexts(std::move(setValueTexts)), valueEqualComparator(std::move(valueEqualComparator)) { } } diff --git a/plugins/ODbgRegisterView/BitFieldDescription.h b/plugins/ODbgRegisterView/BitFieldDescription.h index e2a82904b..8d4301cf5 100644 --- a/plugins/ODbgRegisterView/BitFieldDescription.h +++ b/plugins/ODbgRegisterView/BitFieldDescription.h @@ -16,7 +16,10 @@ struct BitFieldDescription { std::function const valueEqualComparator; BitFieldDescription( - int textWidth, const std::vector &valueNames, const std::vector &setValueTexts, const std::function &valueEqualComparator = [](unsigned a, unsigned b) { return a == b; }); + int textWidth, + std::vector valueNames, + std::vector setValueTexts, + std::function valueEqualComparator = [](unsigned a, unsigned b) { return a == b; }); }; } diff --git a/plugins/ODbgRegisterView/DialogEditSimdRegister.h b/plugins/ODbgRegisterView/DialogEditSimdRegister.h index 3256ba914..929cd1f0b 100644 --- a/plugins/ODbgRegisterView/DialogEditSimdRegister.h +++ b/plugins/ODbgRegisterView/DialogEditSimdRegister.h @@ -71,7 +71,7 @@ class DialogEditSimdRegister : public QDialog { explicit DialogEditSimdRegister(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); void setValue(const Register &value); void set_current_element(RegisterViewModelBase::Model::ElementSize size, NumberDisplayMode format, int elementIndex); - Register value() const; + [[nodiscard]] Register value() const; protected: bool eventFilter(QObject *, QEvent *) override; diff --git a/plugins/References/DialogReferences.cpp b/plugins/References/DialogReferences.cpp index 3817f7c26..61d8d7cc1 100644 --- a/plugins/References/DialogReferences.cpp +++ b/plugins/References/DialogReferences.cpp @@ -91,8 +91,8 @@ void DialogReferences::doFind() { const QVector pages = edb::v1::read_pages(region->start(), page_count); if (!pages.isEmpty()) { - const uint8_t *p = &pages[0]; - const uint8_t *const pages_end = &pages[0] + region->size(); + const uint8_t *p = pages.data(); + const uint8_t *const pages_end = pages.data() + region->size(); while (p != pages_end) { @@ -100,7 +100,7 @@ void DialogReferences::doFind() { break; } - const edb::address_t addr = p - &pages[0] + region->start(); + const edb::address_t addr = p - pages.data() + region->start(); edb::address_t test_address(0); memcpy(&test_address, p, edb::v1::pointer_size()); @@ -156,7 +156,7 @@ void DialogReferences::doFind() { } } - Q_EMIT updateProgress(util::percentage(i, regions.size(), p - &pages[0], region->size())); + Q_EMIT updateProgress(util::percentage(i, regions.size(), p - pages.data(), region->size())); ++p; } } diff --git a/src/ByteShiftArray.cpp b/src/ByteShiftArray.cpp index 93ab592e0..16f656ddf 100644 --- a/src/ByteShiftArray.cpp +++ b/src/ByteShiftArray.cpp @@ -99,7 +99,7 @@ uint8_t ByteShiftArray::operator[](std::size_t i) const { // Desc: returns a read only pointer to the data this byte array holds //------------------------------------------------------------------------------ const uint8_t *ByteShiftArray::data() const { - return &data_[0]; + return data_.data(); } //------------------------------------------------------------------------------ diff --git a/src/CommentServer.cpp b/src/CommentServer.cpp index 9b620607e..b120dcfda 100644 --- a/src/CommentServer.cpp +++ b/src/CommentServer.cpp @@ -73,9 +73,9 @@ Result CommentServer::resolveFunctionCall(edb::address_t addre if (!symname.isEmpty()) { return tr("return to %1 <%2>").arg(edb::v1::format_pointer(address), symname); - } else { - return tr("return to %1").arg(edb::v1::format_pointer(address)); } + + return tr("return to %1").arg(edb::v1::format_pointer(address)); } } } @@ -99,7 +99,9 @@ Result CommentServer::resolveString(edb::address_t address) co if (edb::v1::get_ascii_string_at_address(address, temp, min_string_length, MaxStringLength, stringLen)) { return tr("ASCII \"%1\"").arg(temp); - } else if (edb::v1::get_utf16_string_at_address(address, temp, min_string_length, MaxStringLength, stringLen)) { + } + + if (edb::v1::get_utf16_string_at_address(address, temp, min_string_length, MaxStringLength, stringLen)) { return tr("UTF16 \"%1\"").arg(temp); } @@ -124,12 +126,14 @@ QString CommentServer::comment(edb::address_t address, int size) const { auto it = customComments_.find(value); if (it != customComments_.end()) { return it.value(); - } else { - if (Result ret = resolveFunctionCall(value)) { - return *ret; - } else if (Result ret = resolveString(value)) { - return *ret; - } + } + + if (Result ret = resolveFunctionCall(value)) { + return *ret; + } + + if (Result ret = resolveString(value)) { + return *ret; } } } diff --git a/src/Configuration.cpp b/src/Configuration.cpp index aeb5bec96..acbeba4ef 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -47,7 +47,7 @@ QDataStream &operator>>(QDataStream &s, IBreakpoint::TypeId &id) { // Name: getDefaultPluginPath // Desc: return default path for plugins //------------------------------------------------------------------------------ -static QString getDefaultPluginPath() { +QString getDefaultPluginPath() { #ifdef DEFAULT_PLUGIN_PATH const QString default_plugin_path = DEFAULT_PLUGIN_PATH; #else diff --git a/src/Debugger.h b/src/Debugger.h index 175547d75..a2c9369a6 100644 --- a/src/Debugger.h +++ b/src/Debugger.h @@ -180,7 +180,7 @@ private Q_SLOTS: private Q_SLOTS: // the manually connected Register slots - QList currentRegisterContextMenuItems() const; + [[nodiscard]] QList currentRegisterContextMenuItems() const; void mnuRegisterFollowInDump() { followRegisterInDump(false); } void mnuRegisterFollowInDumpNewTab() { followRegisterInDump(true); } void mnuRegisterFollowInStack(); diff --git a/src/DialogBreakpoints.cpp b/src/DialogBreakpoints.cpp index 9ddb8fa25..fdc541b36 100644 --- a/src/DialogBreakpoints.cpp +++ b/src/DialogBreakpoints.cpp @@ -23,13 +23,11 @@ along with this program. If not, see . #include "MemoryRegions.h" #include "edb.h" -#include -#include -#include - #include #include #include +#include +#include #include #include #include @@ -254,7 +252,7 @@ void DialogBreakpoints::on_btnImport_clicked() { } // Report any errors to the user - if (errors.size() > 0) { + if (!errors.empty()) { QMessageBox::warning(this, tr("Invalid Breakpoints"), tr("The following breakpoints were not made:\n%1").arg(errors.join(""))); } diff --git a/src/FloatX.cpp b/src/FloatX.cpp index acf1f99bc..acc297988 100644 --- a/src/FloatX.cpp +++ b/src/FloatX.cpp @@ -146,20 +146,24 @@ FloatValueClass ieee_classify(FloatHolder value) { if (exponent == ExpMax) { if (mantissa == 0u) { return FloatValueClass::Infinity; // |S|11..11|00..00| - } else if (mantissa & QNaN_mask) { + } + + if (mantissa & QNaN_mask) { return FloatValueClass::QNaN; // |S|11..11|1XX..XX| - } else { - return FloatValueClass::SNaN; // |S|11..11|0XX..XX| } - } else if (exponent == 0u) { + + return FloatValueClass::SNaN; // |S|11..11|0XX..XX| + } + + if (exponent == 0u) { if (mantissa == 0u) { return FloatValueClass::Zero; // |S|00..00|00..00| - } else { - return FloatValueClass::Denormal; // |S|00..00|XX..XX| } - } else { - return FloatValueClass::Normal; + + return FloatValueClass::Denormal; // |S|00..00|XX..XX| } + + return FloatValueClass::Normal; } #if defined(HAVE_GDTOA) diff --git a/src/RegisterViewModelBase.cpp b/src/RegisterViewModelBase.cpp index aaccdd75d..222f649c8 100644 --- a/src/RegisterViewModelBase.cpp +++ b/src/RegisterViewModelBase.cpp @@ -766,7 +766,7 @@ template BitFieldItem::BitFieldItem(const BitFieldDescriptionEx &descr) : RegisterViewItem(descr.name), offset_(descr.offset), length_(descr.length), explanations(descr.explanations) { Q_ASSERT(8 * sizeof(UnderlyingType) >= length_); - Q_ASSERT(explanations.size() == 0 || explanations.size() == 2u << (length_ - 1)); + Q_ASSERT(explanations.empty() || explanations.size() == 2u << (length_ - 1)); } template diff --git a/src/SymbolManager.cpp b/src/SymbolManager.cpp index d3c4af973..7d9bb9c9a 100644 --- a/src/SymbolManager.cpp +++ b/src/SymbolManager.cpp @@ -93,7 +93,7 @@ void SymbolManager::loadSymbolFile(const QString &filename, edb::address_t base) // Name: find // Desc: //------------------------------------------------------------------------------ -const std::shared_ptr SymbolManager::find(const QString &name) const { +std::shared_ptr SymbolManager::find(const QString &name) const { auto it = symbolsByName_.find(name); if (it != symbolsByName_.end()) { @@ -118,7 +118,7 @@ const std::shared_ptr SymbolManager::find(const QString &name) const { // Name: find // Desc: //------------------------------------------------------------------------------ -const std::shared_ptr SymbolManager::find(edb::address_t address) const { +std::shared_ptr SymbolManager::find(edb::address_t address) const { auto it = symbolsByAddress_.find(address); return (it != symbolsByAddress_.end()) ? it.value() : nullptr; } @@ -127,7 +127,7 @@ const std::shared_ptr SymbolManager::find(edb::address_t address) const // Name: findNearSymbol // Desc: //------------------------------------------------------------------------------ -const std::shared_ptr SymbolManager::findNearSymbol(edb::address_t address) const { +std::shared_ptr SymbolManager::findNearSymbol(edb::address_t address) const { auto it = symbolsByAddress_.lowerBound(address); if (it != symbolsByAddress_.end()) { @@ -264,7 +264,7 @@ bool SymbolManager::processSymbolFile(const QString &f, edb::address_t base, con // Name: symbols // Desc: //------------------------------------------------------------------------------ -const std::vector> SymbolManager::symbols() const { +std::vector> SymbolManager::symbols() const { return symbols_; } diff --git a/src/SymbolManager.h b/src/SymbolManager.h index 944ba939c..58fea6827 100644 --- a/src/SymbolManager.h +++ b/src/SymbolManager.h @@ -35,18 +35,18 @@ class SymbolManager final : public ISymbolManager { SymbolManager() = default; public: - const std::vector> symbols() const override; - const std::shared_ptr find(const QString &name) const override; - const std::shared_ptr find(edb::address_t address) const override; - const std::shared_ptr findNearSymbol(edb::address_t address) const override; + [[nodiscard]] QHash labels() const override; + [[nodiscard]] QString findAddressName(edb::address_t address, bool prefixed = true) override; + [[nodiscard]] QStringList files() const override; + [[nodiscard]] std::shared_ptr find(const QString &name) const override; + [[nodiscard]] std::shared_ptr find(edb::address_t address) const override; + [[nodiscard]] std::shared_ptr findNearSymbol(edb::address_t address) const override; + [[nodiscard]] std::vector> symbols() const override; void addSymbol(const std::shared_ptr &symbol) override; void clear() override; void loadSymbolFile(const QString &filename, edb::address_t base) override; - void setSymbolGenerator(ISymbolGenerator *generator) override; void setLabel(edb::address_t address, const QString &label) override; - QString findAddressName(edb::address_t address, bool prefixed = true) override; - QHash labels() const override; - QStringList files() const override; + void setSymbolGenerator(ISymbolGenerator *generator) override; private: bool processSymbolFile(const QString &f, edb::address_t base, const QString &library_filename, bool allow_retry); diff --git a/src/edb.cpp b/src/edb.cpp index 903fedc54..a94bf8a38 100644 --- a/src/edb.cpp +++ b/src/edb.cpp @@ -1117,7 +1117,7 @@ bool modify_bytes(address_t address, size_t size, QByteArray &bytes, uint8_t fil // Desc: //------------------------------------------------------------------------------ QByteArray get_md5(const QVector &bytes) { - return get_md5(&bytes[0], bytes.size()); + return get_md5(bytes.data(), bytes.size()); } //------------------------------------------------------------------------------ diff --git a/src/graph/GraphEdge.cpp b/src/graph/GraphEdge.cpp index 04fd55b2c..ec379c932 100644 --- a/src/graph/GraphEdge.cpp +++ b/src/graph/GraphEdge.cpp @@ -122,7 +122,8 @@ QLineF GraphEdge::shortenLineToNode(QLineF line) { QLineF(nodeRect.topLeft(), nodeRect.bottomLeft()), QLineF(nodeRect.topLeft(), nodeRect.topRight()), QLineF(nodeRect.topRight(), nodeRect.bottomRight()), - QLineF(nodeRect.bottomRight(), nodeRect.bottomLeft())}; + QLineF(nodeRect.bottomRight(), nodeRect.bottomLeft()), + }; // for any that intersect, shorten the line appropriately for (int i = 0; i < 4; ++i) { diff --git a/src/widgets/QDisassemblyView.cpp b/src/widgets/QDisassemblyView.cpp index 704d96b71..7b4d7c985 100644 --- a/src/widgets/QDisassemblyView.cpp +++ b/src/widgets/QDisassemblyView.cpp @@ -48,8 +48,6 @@ along with this program. If not, see . #include #include -#include - #include #include #include @@ -732,7 +730,7 @@ int QDisassemblyView::updateDisassembly(int lines_to_render) { showAddresses_.clear(); int bufsize = instructionBuffer_.size(); - uint8_t *inst_buf = &instructionBuffer_[0]; + uint8_t *inst_buf = instructionBuffer_.data(); const edb::address_t start_address = addressOffset_ + verticalScrollBar()->value(); if (!edb::v1::get_instruction_bytes(start_address, inst_buf, &bufsize)) {