mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
sys: Fixed many clang tidy warnings and typos
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user