mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
chore: apply more complicated lints (#2576)
<!-- Please provide as much information as possible about what your PR aims to do. PRs with no description will most likely be closed until more information is provided. If you're planing on changing fundamental behaviour or add big new features, please open a GitHub Issue first before starting to work on it. If it's not something big and you still want to contact us about it, feel free to do so ! --> ### Problem description <!-- Describe the bug that you fixed/feature request that you implemented, or link to an existing issue describing it --> ### Implementation description <!-- Explain what you did to correct the problem --> ### Screenshots <!-- If your change is visual, take a screenshot showing it. Ideally, make before/after sceenshots --> ### Additional things <!-- Anything else you would like to say -->
This commit is contained in:
@@ -382,7 +382,7 @@ namespace hex::ui {
|
||||
|
||||
if (m_editingAddress != address || m_editingCellType != cellType) {
|
||||
if (cellType == CellType::Hex) {
|
||||
std::array<u8, 32> buffer;
|
||||
std::array<u8, 32> buffer = {};
|
||||
std::memcpy(buffer.data(), data, std::min(size, buffer.size()));
|
||||
|
||||
if (m_dataVisualizerEndianness != std::endian::native)
|
||||
|
||||
@@ -15,15 +15,15 @@
|
||||
|
||||
#include <hex/helpers/scaling.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
#include <utility>
|
||||
|
||||
#include <md4c.h>
|
||||
|
||||
namespace hex::ui {
|
||||
|
||||
Markdown::Markdown(const std::string &text) : m_text(text) {
|
||||
m_mdRenderer = MD_RENDERER();
|
||||
Markdown::Markdown(std::string text) : m_text(std::move(text)) {
|
||||
m_initialized = true;
|
||||
m_mdRenderer.flags = MD_DIALECT_GITHUB | MD_FLAG_TABLES | MD_FLAG_TASKLISTS;
|
||||
m_mdRenderer.flags = MD_DIALECT_GITHUB;
|
||||
m_mdRenderer.enter_block = [](MD_BLOCKTYPE type, void *detail, void *userdata) -> int {
|
||||
auto &self = *static_cast<Markdown*>(userdata);
|
||||
|
||||
@@ -60,11 +60,7 @@ namespace hex::ui {
|
||||
self.m_tableVisibleStack.emplace_back(open);
|
||||
break;
|
||||
}
|
||||
case MD_BLOCK_TD: {
|
||||
if (self.inTable())
|
||||
ImGui::TableNextColumn();
|
||||
break;
|
||||
}
|
||||
case MD_BLOCK_TD:
|
||||
case MD_BLOCK_TH: {
|
||||
if (self.inTable())
|
||||
ImGui::TableNextColumn();
|
||||
@@ -129,11 +125,6 @@ namespace hex::ui {
|
||||
fonts::Default().pop();
|
||||
break;
|
||||
case MD_BLOCK_CODE:
|
||||
if (self.inTable()) {
|
||||
ImGui::EndTable();
|
||||
self.m_tableVisibleStack.pop_back();
|
||||
}
|
||||
break;
|
||||
case MD_BLOCK_TABLE:
|
||||
if (self.inTable()) {
|
||||
ImGui::EndTable();
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace hex::ui {
|
||||
|
||||
filterString = wolv::util::trim(filterString);
|
||||
if (filterString.empty())
|
||||
return std::nullopt;
|
||||
return std::nullopt; //NOLINT: optimise for empty string
|
||||
else if (filterString.starts_with("===")) {
|
||||
result.operation = std::strong_ordering::equal;
|
||||
result.inverted = false;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <algorithm>
|
||||
#include <ui/text_editor.hpp>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
#include <wolv/utils/string.hpp>
|
||||
#include <popups/popup_question.hpp>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
@@ -244,7 +244,7 @@ namespace hex::ui {
|
||||
m_lines.clear();
|
||||
m_lines.resize(lineCount);
|
||||
u64 i = 0;
|
||||
for (auto line: vectorString) {
|
||||
for (const auto& line: vectorString) {
|
||||
m_lines[i].setLine(line);
|
||||
m_lines[i].m_colorized = false;
|
||||
m_lines[i].m_lineMaxColumn = -1;
|
||||
@@ -813,12 +813,12 @@ namespace hex::ui {
|
||||
}
|
||||
|
||||
TextEditor::UndoRecord::UndoRecord(
|
||||
const std::string &added,
|
||||
std::string added,
|
||||
const TextEditor::Range addedRange,
|
||||
const std::string &removed,
|
||||
std::string removed,
|
||||
const TextEditor::Range removedRange,
|
||||
TextEditor::EditorState &before,
|
||||
TextEditor::EditorState &after) : m_added(added), m_addedRange(addedRange), m_removed(removed), m_removedRange(removedRange), m_before(before), m_after(after) {}
|
||||
TextEditor::EditorState &after) : m_added(std::move(added)), m_addedRange(addedRange), m_removed(std::move(removed)), m_removedRange(removedRange), m_before(before), m_after(after) {}
|
||||
|
||||
void TextEditor::UndoRecord::undo(TextEditor *editor) {
|
||||
if (!m_added.empty()) {
|
||||
|
||||
@@ -180,7 +180,6 @@ namespace hex::ui {
|
||||
auto currentLine = endLine;
|
||||
auto commentLength = 0;
|
||||
auto matchedBracket = false;
|
||||
std::string brackets = "()[]{}<>";
|
||||
|
||||
std::vector<bool> ifDefs;
|
||||
ifDefs.push_back(true);
|
||||
@@ -347,12 +346,7 @@ namespace hex::ui {
|
||||
if (isGlobalDocComment || isBlockDocComment || isBlockComment) {
|
||||
commentStartLine = currentLine;
|
||||
commentStartIndex = currentIndex;
|
||||
if (currentIndex < line.size() - 4 && isBlockComment &&
|
||||
line.m_chars[currentIndex + 2] == '*' &&
|
||||
line.m_chars[currentIndex + 3] == '/') {
|
||||
withinBlockComment = true;
|
||||
commentLength = 2;
|
||||
} else if (isGlobalDocComment) {
|
||||
if (isGlobalDocComment) {
|
||||
withinGlobalDocComment = true;
|
||||
commentLength = 3;
|
||||
} else if (isBlockDocComment) {
|
||||
@@ -1191,8 +1185,8 @@ namespace hex::ui {
|
||||
out_begin = in_begin;
|
||||
out_end = in_begin + 1;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace hex::ui {
|
||||
if (gotoKey != Invalid) {
|
||||
std::string errorLineColumn;
|
||||
bool found = false;
|
||||
for (auto text: m_clickableText) {
|
||||
for (const auto& text: m_clickableText) {
|
||||
if (lineText.starts_with(text)) {
|
||||
errorLineColumn = lineText.substr(text.size());
|
||||
if (!errorLineColumn.empty()) {
|
||||
|
||||
@@ -148,12 +148,7 @@ namespace hex::ui {
|
||||
return iter;
|
||||
}
|
||||
|
||||
LineIterator LineIterator::operator=(const LineIterator &other) {
|
||||
m_charsIter = other.m_charsIter;
|
||||
m_colorsIter = other.m_colorsIter;
|
||||
m_flagsIter = other.m_flagsIter;
|
||||
return *this;
|
||||
}
|
||||
LineIterator& LineIterator::operator=(const LineIterator &other) = default;
|
||||
|
||||
bool LineIterator::operator!=(const LineIterator &other) const {
|
||||
return m_charsIter != other.m_charsIter || m_colorsIter != other.m_colorsIter ||
|
||||
@@ -532,7 +527,7 @@ namespace hex::ui {
|
||||
if (m_readOnly)
|
||||
return;
|
||||
|
||||
m_undoBuffer.resize((u64) (m_undoIndex + 1));
|
||||
m_undoBuffer.resize(m_undoIndex + 1);
|
||||
m_undoBuffer.back() = UndoAction(value);
|
||||
m_undoIndex++;
|
||||
}
|
||||
@@ -933,7 +928,8 @@ namespace hex::ui {
|
||||
|
||||
while (iter != end) {
|
||||
iter++;
|
||||
if (((pos = iter->position()) > byteIndex))
|
||||
pos = iter->position();
|
||||
if (pos > byteIndex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user