mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
sys: Fixed many clang tidy warnings and typos
This commit is contained in:
10
README.md
10
README.md
@@ -33,7 +33,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
- Hex string
|
||||
- C, C++, C#, Rust, Python, Java & JavaScript array
|
||||
- ASCII-Art hex view
|
||||
- HTML self contained div
|
||||
- HTML self-contained div
|
||||
- String and hex search
|
||||
- Colorful highlighting
|
||||
- Goto from start, end and current cursor position
|
||||
@@ -84,7 +84,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
- Built-in Content Store
|
||||
- Download all files found in the database directly from within ImHex
|
||||
- Yara Rules support
|
||||
- Quickly scan a file for vulnearabilities with official yara rules
|
||||
- Quickly scan a file for vulnerabilities with official yara rules
|
||||
- Helpful tools
|
||||
- Itanium and MSVC demangler
|
||||
- ASCII table
|
||||
@@ -98,7 +98,7 @@ If you like my work, please consider supporting me on GitHub Sponsors, Patreon o
|
||||
- File utilities
|
||||
- File splitter
|
||||
- File combiner
|
||||
- File shredderer
|
||||
- File shredder
|
||||
- Built-in cheat sheet for pattern language and Math evaluator
|
||||
- Doesn't burn out your retinas when used in late-night sessions
|
||||
|
||||
@@ -108,7 +108,7 @@ The custom C-like Pattern Language developed and used by ImHex is easy to read,
|
||||
|
||||
## Plugin development
|
||||
|
||||
To develop plugins for ImHex, use one of the following two templates projects to get startet. You then have access to the entirety of libimhex as well as the ImHex API and the Content Registry to interact with ImHex or to add new content.
|
||||
To develop plugins for ImHex, use one of the following two templates projects to get started. You then have access to the entirety of libimhex as well as the ImHex API and the Content Registry to interact with ImHex or to add new content.
|
||||
- [C++ Plugin Template](https://github.com/WerWolv/ImHex-Cpp-Plugin-Template)
|
||||
- [Rust Plugin Template](https://github.com/WerWolv/ImHex-Rust-Plugin-Template)
|
||||
|
||||
@@ -230,7 +230,7 @@ with the environment variables `XDG_CONFIG_HOME`, `XDG_CONFIG_DIRS`,
|
||||
- [Mary](https://github.com/Thog) for her immense help porting ImHex to MacOS and help during development
|
||||
- [Roblabla](https://github.com/Roblabla) for adding MSI Installer support to ImHex
|
||||
- [jam1garner](https://github.com/jam1garner) and [raytwo](https://github.com/raytwo) for their help with adding Rust support to plugins
|
||||
- All other people that have been reporting issues on Discord or GitHub that I had great conversations with :)
|
||||
- Everybody else who has reported issues on Discord or GitHub that I had great conversations with :)
|
||||
|
||||
### Libraries
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace hex {
|
||||
public:
|
||||
LanguageDefinition(std::initializer_list<std::pair<std::string, std::string>> entries);
|
||||
|
||||
const std::map<std::string, std::string> &getEntries() const;
|
||||
[[nodiscard]] const std::map<std::string, std::string> &getEntries() const;
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> m_entries;
|
||||
@@ -20,7 +20,7 @@ namespace hex {
|
||||
class LangEntry {
|
||||
public:
|
||||
explicit LangEntry(const char *unlocalizedString);
|
||||
explicit LangEntry(const std::string &unlocalizedString);
|
||||
explicit LangEntry(std::string unlocalizedString);
|
||||
explicit LangEntry(std::string_view unlocalizedString);
|
||||
|
||||
operator std::string() const;
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace hex::dp {
|
||||
u64 getIntegerOnInput(u32 index);
|
||||
float getFloatOnInput(u32 index);
|
||||
|
||||
void setBufferOnOutput(u32 index, std::vector<u8> data);
|
||||
void setBufferOnOutput(u32 index, const std::vector<u8> &data);
|
||||
void setIntegerOnOutput(u32 index, u64 integer);
|
||||
void setFloatOnOutput(u32 index, float floatingPoint);
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace hex {
|
||||
|
||||
class Disassembler {
|
||||
public:
|
||||
static constexpr cs_arch toCapstoneArchictecture(Architecture architecture) {
|
||||
static constexpr cs_arch toCapstoneArchitecture(Architecture architecture) {
|
||||
return static_cast<cs_arch>(architecture);
|
||||
}
|
||||
|
||||
static inline bool isSupported(Architecture architecture) {
|
||||
return cs_support(toCapstoneArchictecture(architecture));
|
||||
return cs_support(toCapstoneArchitecture(architecture));
|
||||
}
|
||||
|
||||
constexpr static const char *const ArchitectureNames[] = { "ARM32", "ARM64", "MIPS", "x86", "PowerPC", "Sparc", "SystemZ", "XCore", "68K", "TMS320C64x", "680X", "Ethereum", "MOS65XX", "WebAssembly", "Berkeley Packet Filter", "RISC-V" };
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace hex::fs {
|
||||
else return size;
|
||||
}
|
||||
|
||||
bool isPathWritable(std::fs::path path);
|
||||
bool isPathWritable(const std::fs::path &path);
|
||||
|
||||
enum class DialogMode
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace hex {
|
||||
public:
|
||||
Socket() = default;
|
||||
Socket(const Socket &) = delete;
|
||||
Socket(Socket &&other);
|
||||
Socket(Socket &&other) noexcept;
|
||||
|
||||
Socket(const std::string &address, u16 port);
|
||||
~Socket();
|
||||
@@ -36,8 +36,8 @@ namespace hex {
|
||||
|
||||
[[nodiscard]] bool isConnected() const;
|
||||
|
||||
std::string readString(size_t size = 0x1000) const;
|
||||
std::vector<u8> readBytes(size_t size = 0x1000) const;
|
||||
[[nodiscard]] std::string readString(size_t size = 0x1000) const;
|
||||
[[nodiscard]] std::vector<u8> readBytes(size_t size = 0x1000) const;
|
||||
|
||||
void writeString(const std::string &string) const;
|
||||
void writeBytes(const std::vector<u8> &bytes) const;
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace hex {
|
||||
bool m_active;
|
||||
|
||||
public:
|
||||
constexpr ScopeGuard(F func) : m_func(std::move(func)), m_active(true) { }
|
||||
explicit constexpr ScopeGuard(F func) : m_func(std::move(func)), m_active(true) { }
|
||||
~ScopeGuard() {
|
||||
if (this->m_active) { this->m_func(); }
|
||||
}
|
||||
@@ -334,7 +334,7 @@ namespace hex {
|
||||
template<class F>
|
||||
class FirstTimeExecute {
|
||||
public:
|
||||
constexpr FirstTimeExecute(F func) { func(); }
|
||||
explicit constexpr FirstTimeExecute(F func) { func(); }
|
||||
|
||||
FirstTimeExecute &operator=(FirstTimeExecute &&) = delete;
|
||||
};
|
||||
@@ -359,7 +359,7 @@ namespace hex {
|
||||
F m_func;
|
||||
|
||||
public:
|
||||
constexpr FinalCleanupExecute(F func) : m_func(func) { }
|
||||
explicit constexpr FinalCleanupExecute(F func) : m_func(func) { }
|
||||
constexpr ~FinalCleanupExecute() { this->m_func(); }
|
||||
|
||||
FinalCleanupExecute &operator=(FinalCleanupExecute &&) = delete;
|
||||
|
||||
@@ -298,11 +298,11 @@ namespace hex::pl {
|
||||
}
|
||||
}
|
||||
|
||||
arrayPattern->setEntries(std::move(entries));
|
||||
|
||||
if (auto &arrayEntries = arrayPattern->getEntries(); !entries.empty())
|
||||
arrayPattern->setTypeName(arrayEntries.front()->getTypeName());
|
||||
|
||||
arrayPattern->setEntries(std::move(entries));
|
||||
arrayPattern->setSize(size);
|
||||
|
||||
return std::move(arrayPattern);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace hex::pl {
|
||||
|
||||
std::vector<std::pair<std::string, ASTNode *>> entries;
|
||||
for (const auto &[name, entry] : this->m_entries)
|
||||
entries.push_back({ name, entry.get() });
|
||||
entries.emplace_back(name, entry.get());
|
||||
|
||||
if (order == BitfieldOrder::LeftToRight)
|
||||
std::reverse(entries.begin(), entries.end());
|
||||
|
||||
@@ -22,10 +22,6 @@ namespace hex::pl {
|
||||
return std::unique_ptr<ASTNode>(new ASTNodeControlFlowStatement(*this));
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::unique_ptr<ASTNode> &getReturnValue() const {
|
||||
return this->m_rvalue;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::vector<std::unique_ptr<Pattern>> createPatterns(Evaluator *evaluator) const override {
|
||||
|
||||
this->execute(evaluator);
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace hex::pl {
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<std::shared_ptr<ASTNode>> &getMembers() const { return this->m_members; }
|
||||
void addMember(std::shared_ptr<ASTNode> &&node) { this->m_members.push_back(std::move(node)); }
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<ASTNode>> m_members;
|
||||
|
||||
@@ -77,11 +77,11 @@ namespace hex::pl {
|
||||
this->m_scopes.pop_back();
|
||||
}
|
||||
|
||||
Scope &getScope(i32 index) {
|
||||
[[nodiscard]] Scope &getScope(i32 index) {
|
||||
return this->m_scopes[this->m_scopes.size() - 1 + index];
|
||||
}
|
||||
|
||||
const Scope &getScope(i32 index) const {
|
||||
[[nodiscard]] const Scope &getScope(i32 index) const {
|
||||
return this->m_scopes[this->m_scopes.size() - 1 + index];
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ namespace hex::pl {
|
||||
this->m_patternLimit = limit;
|
||||
}
|
||||
|
||||
[[nodiscard]] u64 getPatternLimit() {
|
||||
[[nodiscard]] u64 getPatternLimit() const {
|
||||
return this->m_patternLimit;
|
||||
}
|
||||
|
||||
[[nodiscard]] u64 getPatternCount() {
|
||||
[[nodiscard]] u64 getPatternCount() const {
|
||||
return this->m_currPatternCount;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace hex::pl {
|
||||
this->m_loopLimit = limit;
|
||||
}
|
||||
|
||||
[[nodiscard]] u64 getLoopLimit() {
|
||||
[[nodiscard]] u64 getLoopLimit() const {
|
||||
return this->m_loopLimit;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace hex::pl {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormattedColored(ImColor(0xFF9BC64D), "{}", this->getTypeName().empty() ? this->getFormattedName() : this->getTypeName());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextFormatted("{}", formatDisplayValue(value, std::move(literal)));
|
||||
ImGui::TextFormatted("{}", formatDisplayValue(value, literal));
|
||||
}
|
||||
|
||||
void drawCommentTooltip() const {
|
||||
|
||||
@@ -70,10 +70,6 @@ namespace hex::pl {
|
||||
return "enum " + Pattern::getTypeName();
|
||||
}
|
||||
|
||||
[[nodiscard]] const auto &getEnumValues() const {
|
||||
return this->m_enumValues;
|
||||
}
|
||||
|
||||
void setEnumValues(const std::vector<std::pair<Token::Literal, std::string>> &enumValues) {
|
||||
this->m_enumValues = enumValues;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace hex::pl {
|
||||
|
||||
const std::optional<PatternLanguageError> &getError() { return this->m_error; }
|
||||
|
||||
bool shouldOnlyIncludeOnce() {
|
||||
[[nodiscard]] bool shouldOnlyIncludeOnce() const {
|
||||
return this->m_onlyIncludeOnce;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace hex::prv {
|
||||
|
||||
class Overlay {
|
||||
public:
|
||||
Overlay() { }
|
||||
Overlay() = default;
|
||||
|
||||
void setAddress(u64 address) { this->m_address = address; }
|
||||
[[nodiscard]] u64 getAddress() const { return this->m_address; }
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace hex {
|
||||
void add(const std::string &unlocalizedCategory, const std::string &unlocalizedName, i64 defaultValue, const Callback &callback, bool requiresRestart) {
|
||||
log::info("Registered new integer setting: [{}]: {}", unlocalizedCategory, unlocalizedName);
|
||||
|
||||
getCategoryEntry(unlocalizedCategory)->second.emplace_back(Entry { unlocalizedName.c_str(), requiresRestart, callback });
|
||||
getCategoryEntry(unlocalizedCategory)->second.emplace_back(Entry { unlocalizedName, requiresRestart, callback });
|
||||
|
||||
auto &json = getSettingsData();
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace hex {
|
||||
namespace ImHexApi::Tasks {
|
||||
|
||||
Task createTask(const std::string &unlocalizedName, u64 maxValue) {
|
||||
return Task(unlocalizedName, maxValue);
|
||||
return { unlocalizedName, maxValue };
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace hex {
|
||||
std::map<std::string, std::string> LangEntry::s_currStrings;
|
||||
|
||||
LanguageDefinition::LanguageDefinition(std::initializer_list<std::pair<std::string, std::string>> entries) {
|
||||
for (auto pair : entries)
|
||||
for (const auto &pair : entries)
|
||||
this->m_entries.insert(pair);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace hex {
|
||||
}
|
||||
|
||||
LangEntry::LangEntry(const char *unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
||||
LangEntry::LangEntry(const std::string &unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
||||
LangEntry::LangEntry(std::string unlocalizedString) : m_unlocalizedString(std::move(unlocalizedString)) { }
|
||||
LangEntry::LangEntry(std::string_view unlocalizedString) : m_unlocalizedString(unlocalizedString) { }
|
||||
|
||||
LangEntry::operator std::string() const {
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace hex::dp {
|
||||
return *reinterpret_cast<float *>(outputData->data());
|
||||
}
|
||||
|
||||
void Node::setBufferOnOutput(u32 index, std::vector<u8> data) {
|
||||
void Node::setBufferOnOutput(u32 index, const std::vector<u8> &data) {
|
||||
if (index >= this->getAttributes().size())
|
||||
throw std::runtime_error("Attribute index out of bounds!");
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace hex::fs {
|
||||
}
|
||||
|
||||
|
||||
bool isPathWritable(std::fs::path path) {
|
||||
bool isPathWritable(const std::fs::path &path) {
|
||||
constexpr static auto TestFileName = "__imhex__tmp__";
|
||||
{
|
||||
File file(path / TestFileName, File::Mode::Read);
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace hex {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *createStructureType(std::string keyword, PyObject *args) {
|
||||
static PyObject *createStructureType(const std::string &keyword, PyObject *args) {
|
||||
auto type = PyTuple_GetItem(args, 0);
|
||||
if (type == nullptr) {
|
||||
PyErr_BadArgument();
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace hex {
|
||||
ipsOffset += 1;
|
||||
}
|
||||
|
||||
if (std::memcmp(ipsPatch.data(), "EOF", 3))
|
||||
if (std::memcmp(ipsPatch.data(), "EOF", 3) == 0)
|
||||
foundEOF = true;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace hex {
|
||||
ipsOffset += 1;
|
||||
}
|
||||
|
||||
if (std::memcmp(ipsPatch.data(), "EEOF", 4))
|
||||
if (std::memcmp(ipsPatch.data(), "EEOF", 4) == 0)
|
||||
foundEEOF = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace hex {
|
||||
this->connect(address, port);
|
||||
}
|
||||
|
||||
Socket::Socket(Socket &&other) {
|
||||
Socket::Socket(Socket &&other) noexcept {
|
||||
this->m_socket = other.m_socket;
|
||||
this->m_connected = other.m_connected;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace hex {
|
||||
index--;
|
||||
}
|
||||
|
||||
return std::string(data + index + 1);
|
||||
return { data + index + 1 };
|
||||
}
|
||||
|
||||
std::string to_string(i128 value) {
|
||||
@@ -66,9 +66,9 @@ namespace hex {
|
||||
|
||||
if (value < 0) {
|
||||
data[index] = '-';
|
||||
return std::string(data + index);
|
||||
return { data + index };
|
||||
} else
|
||||
return std::string(data + index + 1);
|
||||
return { data + index + 1 };
|
||||
}
|
||||
|
||||
std::string toByteString(u64 bytes) {
|
||||
|
||||
@@ -90,8 +90,10 @@ namespace hex::pl {
|
||||
|
||||
auto preprocessedInclude = preprocessor.preprocess(file.readString(), /*initialRun =*/false);
|
||||
|
||||
if (!preprocessedInclude.has_value())
|
||||
throw *preprocessor.m_error;
|
||||
if (!preprocessedInclude.has_value()) {
|
||||
auto error = *preprocessor.m_error;
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (preprocessor.shouldOnlyIncludeOnce()) {
|
||||
auto [iter, added] = this->m_onceIncludedFiles.insert(includePath);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace hex {
|
||||
ImFontAtlas *View::s_fontAtlas;
|
||||
ImFontConfig View::s_fontConfig;
|
||||
|
||||
View::View(std::string unlocalizedName) : m_unlocalizedViewName(unlocalizedName) { }
|
||||
View::View(std::string unlocalizedName) : m_unlocalizedViewName(std::move(unlocalizedName)) { }
|
||||
|
||||
bool View::isAvailable() const {
|
||||
return ImHexApi::Provider::isValid() && ImHexApi::Provider::get()->isAvailable();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace hex::init {
|
||||
this->m_tasks.emplace_back(taskName, task);
|
||||
}
|
||||
|
||||
const std::string &getGPUVendor() const { return this->m_gpuVendor; }
|
||||
[[nodiscard]] const std::string &getGPUVendor() const { return this->m_gpuVendor; }
|
||||
|
||||
private:
|
||||
GLFWwindow *m_window;
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace hex {
|
||||
case HTCLIENT:
|
||||
g_mouseCursorIcon = ImGuiMouseCursor_None;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
|
||||
#include <romfs/romfs.hpp>
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace hex::plugin::builtin::prv {
|
||||
int m_diskHandle = -1;
|
||||
#endif
|
||||
|
||||
size_t m_diskSize;
|
||||
size_t m_sectorSize;
|
||||
size_t m_diskSize = 0;
|
||||
size_t m_sectorSize = 0;
|
||||
|
||||
u64 m_sectorBufferAddress;
|
||||
u64 m_sectorBufferAddress = 0;
|
||||
std::vector<u8> m_sectorBuffer;
|
||||
|
||||
bool m_readable = false;
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace hex::plugin::builtin::prv {
|
||||
hex::Socket m_socket;
|
||||
|
||||
std::string m_ipAddress;
|
||||
int m_port;
|
||||
int m_port = 0;
|
||||
|
||||
u64 m_size;
|
||||
u64 m_size = 0;
|
||||
|
||||
constexpr static size_t CacheLineSize = 0x1000;
|
||||
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewAbout : public View {
|
||||
public:
|
||||
ViewAbout();
|
||||
@@ -22,11 +18,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
bool isAvailable() const override { return true; }
|
||||
bool hasViewMenuItemEntry() const override { return false; }
|
||||
[[nodiscard]] bool isAvailable() const override { return true; }
|
||||
[[nodiscard]] bool hasViewMenuItemEntry() const override { return false; }
|
||||
|
||||
ImVec2 getMinSize() const override {
|
||||
return ImVec2(400, 300);
|
||||
[[nodiscard]] ImVec2 getMinSize() const override {
|
||||
return { 400, 300 };
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace hex::plugin::builtin {
|
||||
class ViewCommandPalette : public View {
|
||||
public:
|
||||
ViewCommandPalette();
|
||||
~ViewCommandPalette() override;
|
||||
~ViewCommandPalette() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace hex::plugin::builtin {
|
||||
[[nodiscard]] ImVec2 getMaxSize() const override { return { 400, 100 }; }
|
||||
|
||||
private:
|
||||
enum class MatchType {
|
||||
enum class MatchType
|
||||
{
|
||||
NoMatch,
|
||||
InfoMatch,
|
||||
PartialMatch,
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
enum class ConstantType {
|
||||
enum class ConstantType
|
||||
{
|
||||
Int10,
|
||||
Int16BigEndian,
|
||||
Int16LittleEndian
|
||||
@@ -23,7 +24,7 @@ namespace hex::plugin::builtin {
|
||||
class ViewConstants : public View {
|
||||
public:
|
||||
explicit ViewConstants();
|
||||
~ViewConstants() override;
|
||||
~ViewConstants() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewDataInspector : public View {
|
||||
public:
|
||||
explicit ViewDataInspector();
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewDataProcessor : public View {
|
||||
public:
|
||||
ViewDataProcessor();
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewDiff : public View {
|
||||
public:
|
||||
ViewDiff();
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
struct Disassembly {
|
||||
u64 address;
|
||||
u64 offset;
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewHashes : public View {
|
||||
public:
|
||||
explicit ViewHashes();
|
||||
@@ -20,7 +16,8 @@ namespace hex::plugin::builtin {
|
||||
void drawContent() override;
|
||||
|
||||
private:
|
||||
enum class HashFunctions {
|
||||
enum class HashFunctions
|
||||
{
|
||||
Crc8,
|
||||
Crc16,
|
||||
Crc32,
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
constexpr static size_t Size = 0x2000;
|
||||
|
||||
u64 base;
|
||||
u64 base = 0x00;
|
||||
std::array<Highlight, Size> highlight;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewInformation : public View {
|
||||
public:
|
||||
explicit ViewInformation();
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewPatches : public View {
|
||||
public:
|
||||
explicit ViewPatches();
|
||||
@@ -21,7 +17,7 @@ namespace hex::plugin::builtin {
|
||||
void drawContent() override;
|
||||
|
||||
private:
|
||||
u64 m_selectedPatch;
|
||||
u64 m_selectedPatch = 0x00;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace hex::plugin::builtin {
|
||||
class ViewStore : public View {
|
||||
public:
|
||||
ViewStore();
|
||||
~ViewStore() override;
|
||||
~ViewStore() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
struct FoundString {
|
||||
u64 offset;
|
||||
size_t size;
|
||||
|
||||
@@ -10,14 +10,10 @@
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewTools : public View {
|
||||
public:
|
||||
ViewTools();
|
||||
~ViewTools() override;
|
||||
~ViewTools() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
};
|
||||
|
||||
@@ -420,7 +420,7 @@ namespace hex::plugin::builtin {
|
||||
void process() override {
|
||||
auto input = this->getBufferOnInput(0);
|
||||
|
||||
if (input.size() == 0 || input.size() > sizeof(u64))
|
||||
if (input.empty() || input.size() > sizeof(u64))
|
||||
throwNodeError("Buffer is empty or bigger than 64 bits");
|
||||
|
||||
u64 output = 0;
|
||||
@@ -785,7 +785,7 @@ namespace hex::plugin::builtin {
|
||||
float xStep = (viewSize.x * 0.95F) / 0xFF;
|
||||
float yStep = (viewSize.y * 0.95F) / 0xFF;
|
||||
|
||||
for (size_t i = 0; i < ((this->m_buffer.size() == 0) ? 0 : this->m_buffer.size() - 1); i++) {
|
||||
for (size_t i = 0; i < (this->m_buffer.empty() ? 0 : this->m_buffer.size() - 1); i++) {
|
||||
const auto &[x, y] = std::pair { this->m_buffer[i] * xStep, this->m_buffer[i + 1] * yStep };
|
||||
|
||||
auto color = ImLerp(ImColor(0xFF, 0x6D, 0x01).Value, ImColor(0x01, 0x93, 0xFF).Value, float(i) / this->m_buffer.size());
|
||||
@@ -868,7 +868,7 @@ namespace hex::plugin::builtin {
|
||||
float xStep = (viewSize.x * 0.95F) / 0xFF;
|
||||
float yStep = (viewSize.y * 0.95F) / 0xFF;
|
||||
|
||||
for (size_t i = 0; i < ((this->m_buffer.size() == 0) ? 0 : this->m_buffer.size()); i++) {
|
||||
for (size_t i = 0; i < (this->m_buffer.empty() ? 0 : this->m_buffer.size()); i++) {
|
||||
const auto &[x, y] = std::pair { this->m_buffer[i] * xStep, yStep * ((float(i) / this->m_buffer.size()) * 0xFF) };
|
||||
|
||||
auto color = ImLerp(ImColor(0xFF, 0x6D, 0x01).Value, ImColor(0x01, 0x93, 0xFF).Value, float(i) / this->m_buffer.size());
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::BeginGroup();
|
||||
|
||||
if (ImGui::IconButton(ICON_VS_NEW_FOLDER, ImGui::GetCustomColorVec4(ImGuiCustomCol_DescButton), ImVec2(30, 30))) {
|
||||
fs::openFileBrowser("Select include folder", fs::DialogMode::Folder, {}, [&](std::fs::path path) {
|
||||
fs::openFileBrowser("Select include folder", fs::DialogMode::Folder, {}, [&](const std::fs::path &path) {
|
||||
auto pathStr = path.string();
|
||||
|
||||
if (std::find(folders.begin(), folders.end(), pathStr) == folders.end()) {
|
||||
|
||||
@@ -16,9 +16,6 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
}
|
||||
|
||||
ViewCommandPalette::~ViewCommandPalette() {
|
||||
}
|
||||
|
||||
void ViewCommandPalette::drawContent() {
|
||||
|
||||
if (!this->m_commandPaletteOpen) return;
|
||||
|
||||
@@ -17,9 +17,6 @@ namespace hex::plugin::builtin {
|
||||
std::memset(this->m_filter.data(), 0x00, this->m_filter.capacity());
|
||||
}
|
||||
|
||||
ViewConstants::~ViewConstants() {
|
||||
}
|
||||
|
||||
void ViewConstants::reloadConstants() {
|
||||
this->m_constants.clear();
|
||||
this->m_filterIndices.clear();
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
extern int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end);
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
using NumberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
cs_mode mode = this->m_mode;
|
||||
|
||||
if (cs_open(Disassembler::toCapstoneArchictecture(this->m_architecture), mode, &capstoneHandle) == CS_ERR_OK) {
|
||||
if (cs_open(Disassembler::toCapstoneArchitecture(this->m_architecture), mode, &capstoneHandle) == CS_ERR_OK) {
|
||||
|
||||
cs_option(capstoneHandle, CS_OPT_SKIPDATA, CS_OPT_ON);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace hex::plugin::builtin {
|
||||
this->evaluatePattern(this->m_textEditor.GetText());
|
||||
});
|
||||
|
||||
EventManager::subscribe<RequestSetPatternLanguageCode>(this, [this](std::string code) {
|
||||
EventManager::subscribe<RequestSetPatternLanguageCode>(this, [this](const std::string &code) {
|
||||
this->m_textEditor.SelectAll();
|
||||
this->m_textEditor.Delete();
|
||||
this->m_textEditor.InsertText(code);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace hex::plugin::builtin {
|
||||
std::vector<std::decay_t<decltype(entries)>::const_iterator> sortedCategories;
|
||||
|
||||
for (auto it = entries.cbegin(); it != entries.cend(); it++) {
|
||||
sortedCategories.emplace_back(std::move(it));
|
||||
sortedCategories.emplace_back(it);
|
||||
}
|
||||
|
||||
std::sort(sortedCategories.begin(), sortedCategories.end(), [](auto &item0, auto &item1) {
|
||||
|
||||
@@ -35,8 +35,6 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
}
|
||||
|
||||
ViewStore::~ViewStore() { }
|
||||
|
||||
void ViewStore::drawStore() {
|
||||
ImGui::Header("hex.builtin.view.store.desc"_lang, true);
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace hex::plugin::builtin {
|
||||
if (this->m_searching) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextSpinner("hex.builtin.view.strings.searching"_lang);
|
||||
} else if (this->m_foundStrings.size() > 0) {
|
||||
} else if (!this->m_foundStrings.empty()) {
|
||||
ImGui::SameLine();
|
||||
ImGui::TextFormatted("hex.builtin.view.strings.results"_lang, this->m_filterIndices.size());
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ViewTools::ViewTools() : View("hex.builtin.view.tools.name") { }
|
||||
|
||||
ViewTools::~ViewTools() { }
|
||||
|
||||
void ViewTools::drawContent() {
|
||||
if (ImGui::Begin(View::toWindowName("hex.builtin.view.tools.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoCollapse)) {
|
||||
for (const auto &[name, function] : ContentRegistry::Tools::getEntries()) {
|
||||
|
||||
@@ -133,14 +133,14 @@ namespace hex::plugin::builtin {
|
||||
void ViewYara::reloadRules() {
|
||||
this->m_rules.clear();
|
||||
|
||||
for (const auto path : fs::getDefaultPaths(fs::ImHexPath::Yara)) {
|
||||
for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Yara)) {
|
||||
if (!fs::exists(path))
|
||||
continue;
|
||||
|
||||
std::error_code error;
|
||||
for (const auto &entry : std::fs::recursive_directory_iterator(path, error)) {
|
||||
if (entry.is_regular_file() && entry.path().extension() == ".yar") {
|
||||
this->m_rules.push_back({ std::fs::relative(entry.path(), std::fs::path(path)).string(), entry.path().string() });
|
||||
this->m_rules.emplace_back(std::fs::relative(entry.path(), std::fs::path(path)).string(), entry.path().string());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,9 +207,9 @@ namespace hex::plugin::builtin {
|
||||
YR_MEMORY_BLOCK_ITERATOR iterator;
|
||||
|
||||
struct ScanContext {
|
||||
Task *task;
|
||||
Task *task = nullptr;
|
||||
std::vector<u8> buffer;
|
||||
YR_MEMORY_BLOCK currBlock;
|
||||
YR_MEMORY_BLOCK currBlock = {};
|
||||
};
|
||||
|
||||
ScanContext context;
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace hex {
|
||||
else if (expression.empty())
|
||||
break;
|
||||
|
||||
auto newInputQueue = parseInput(expression.c_str());
|
||||
auto newInputQueue = parseInput(expression);
|
||||
auto postfixTokens = toPostfix(newInputQueue);
|
||||
auto result = evaluate(postfixTokens);
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace hex {
|
||||
|
||||
|
||||
std::optional<long double> MathEvaluator::evaluate(const std::string &input) {
|
||||
auto inputQueue = parseInput(input.c_str());
|
||||
auto inputQueue = parseInput(input);
|
||||
|
||||
std::string resultVariable = "ans";
|
||||
|
||||
|
||||
@@ -10,14 +10,10 @@
|
||||
|
||||
namespace hex::plugin::windows {
|
||||
|
||||
namespace prv {
|
||||
class Provider;
|
||||
}
|
||||
|
||||
class ViewTTYConsole : public View {
|
||||
public:
|
||||
ViewTTYConsole();
|
||||
~ViewTTYConsole() override;
|
||||
~ViewTTYConsole() override = default;
|
||||
|
||||
void drawContent() override;
|
||||
|
||||
|
||||
@@ -13,9 +13,6 @@ namespace hex::plugin::windows {
|
||||
this->m_receiveDataBuffer.push_back(0x00);
|
||||
}
|
||||
|
||||
ViewTTYConsole::~ViewTTYConsole() {
|
||||
}
|
||||
|
||||
void ViewTTYConsole::drawContent() {
|
||||
if (ImGui::Begin(View::toWindowName("hex.windows.view.tty_console.name").c_str(), &this->getWindowOpenState())) {
|
||||
|
||||
@@ -185,7 +182,7 @@ namespace hex::plugin::windows {
|
||||
}
|
||||
|
||||
bool ViewTTYConsole::connect() {
|
||||
if (this->m_comPorts.size() == 0 || this->m_selectedPort >= this->m_comPorts.size()) {
|
||||
if (this->m_comPorts.empty() || this->m_selectedPort >= this->m_comPorts.size()) {
|
||||
View::showErrorPopup("hex.windows.view.tty_console.no_available_port"_lang);
|
||||
return true; // If false, connect_error error popup will override this error popup
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace hex::test {
|
||||
|
||||
class TestProvider : public prv::Provider {
|
||||
public:
|
||||
TestProvider(std::vector<u8> *data) : Provider() {
|
||||
explicit TestProvider(std::vector<u8> *data) : Provider() {
|
||||
this->setData(data);
|
||||
}
|
||||
~TestProvider() override = default;
|
||||
@@ -44,7 +44,7 @@ namespace hex::test {
|
||||
std::memcpy(m_data->data() + offset, buffer, size);
|
||||
}
|
||||
|
||||
size_t getActualSize() const override {
|
||||
[[nodiscard]] size_t getActualSize() const override {
|
||||
return this->m_data->size();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace hex::test {
|
||||
void close() override { }
|
||||
|
||||
private:
|
||||
std::vector<u8> *m_data;
|
||||
std::vector<u8> *m_data = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace hex::test {
|
||||
|
||||
|
||||
template<typename F>
|
||||
TestSequence<F> operator+(TestSequenceExecutor executor, F &&f) noexcept {
|
||||
TestSequence<F> operator+(const TestSequenceExecutor &executor, F &&f) noexcept {
|
||||
return TestSequence<F>(executor.getName(), std::forward<F>(f), executor.shouldFail());
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace hex::test {
|
||||
this->m_testFile.write(static_cast<const u8 *>(buffer), size);
|
||||
}
|
||||
|
||||
size_t getActualSize() const override {
|
||||
[[nodiscard]] size_t getActualSize() const override {
|
||||
return this->m_testFile.getSize();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user