mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
fix: Various clang / clang-tidy warnings (#764)
This commit is contained in:
@@ -107,7 +107,7 @@ namespace hex::plugin::builtin {
|
||||
const static inline auto FormattingUpperCase = hex::format("%0{}X", CharCount);
|
||||
const static inline auto FormattingLowerCase = hex::format("%0{}x", CharCount);
|
||||
|
||||
const char *getFormatString(bool upperCase) {
|
||||
static const char *getFormatString(bool upperCase) {
|
||||
if (upperCase)
|
||||
return FormattingUpperCase.c_str();
|
||||
else
|
||||
@@ -237,7 +237,7 @@ namespace hex::plugin::builtin {
|
||||
const static inline auto FormatStringUpperCase = hex::format("%{}G", CharCount);
|
||||
const static inline auto FormatStringLowerCase = hex::format("%{}g", CharCount);
|
||||
|
||||
const char *getFormatString(bool upperCase) {
|
||||
static const char *getFormatString(bool upperCase) {
|
||||
if (upperCase)
|
||||
return FormatStringUpperCase.c_str();
|
||||
else
|
||||
|
||||
@@ -430,4 +430,4 @@ namespace hex {
|
||||
auto [value, success] = this->m_displayEnd.emplace(&pattern, DisplayEndDefault);
|
||||
return value->second;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace {
|
||||
static std::vector<std::fs::path> userFolders;
|
||||
static void loadUserFoldersFromSetting(nlohmann::json &setting) {
|
||||
|
||||
std::vector<std::fs::path> userFolders;
|
||||
|
||||
void loadUserFoldersFromSetting(nlohmann::json &setting) {
|
||||
userFolders.clear();
|
||||
std::vector<std::string> paths = setting;
|
||||
for (const auto &path : paths) {
|
||||
@@ -24,7 +26,8 @@ namespace {
|
||||
userFolders.emplace_back(uString);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace hex::plugin::builtin {
|
||||
case F64: return parseNumericValue<double, double>(input);
|
||||
default: return { false, { }, 0 };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static std::string formatBytes(const std::vector<u8> &bytes) {
|
||||
|
||||
@@ -1016,13 +1016,13 @@ namespace hex::plugin::builtin {
|
||||
if ((ImGui::IsMouseDown(ImGuiMouseButton_Left) && providerData.selectionStart != providerData.selectionEnd)) {
|
||||
auto fractionPerLine = 1.0 / (this->m_visibleRowCount + 1);
|
||||
|
||||
if (y == u64(clipper.DisplayStart + 3)) {
|
||||
if (y == (u64(clipper.DisplayStart) + 3)) {
|
||||
if (i128(*providerData.selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) <= (i64(clipper.DisplayStart + 3) * this->m_bytesPerRow)) {
|
||||
this->m_shouldScrollToSelection = false;
|
||||
ImGui::SetScrollHereY(fractionPerLine * 5);
|
||||
|
||||
}
|
||||
} else if (y == u64(clipper.DisplayEnd - 3)) {
|
||||
} else if (y == (u64(clipper.DisplayStart) - 3)) {
|
||||
if (i128(*providerData.selectionEnd - provider->getBaseAddress() - provider->getCurrentPageAddress()) >= (i64(clipper.DisplayEnd - 3) * this->m_bytesPerRow)) {
|
||||
this->m_shouldScrollToSelection = false;
|
||||
ImGui::SetScrollHereY(fractionPerLine * (this->m_visibleRowCount - 1));
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
EventManager::subscribe<EventRegionSelected>(this, [this](Region region) {
|
||||
if (this->m_blockSize != 0)
|
||||
this->m_entropyHandlePosition = region.getStartAddress() / this->m_blockSize;
|
||||
this->m_entropyHandlePosition = region.getStartAddress() / double(this->m_blockSize);
|
||||
});
|
||||
|
||||
EventManager::subscribe<EventProviderDeleted>(this, [this](const auto*) {
|
||||
|
||||
@@ -642,11 +642,11 @@ namespace hex::plugin::builtin {
|
||||
ImGui::InputScalar(label.c_str(), ImGuiDataType_U64, &value);
|
||||
variable.value = u128(value);
|
||||
} else if (pl::core::Token::isFloatingPoint(variable.type)) {
|
||||
double value = hex::get_or<double>(variable.value, 0.0);
|
||||
auto value = hex::get_or<double>(variable.value, 0.0);
|
||||
ImGui::InputScalar(label.c_str(), ImGuiDataType_Double, &value);
|
||||
variable.value = value;
|
||||
} else if (variable.type == pl::core::Token::ValueType::Boolean) {
|
||||
bool value = hex::get_or<bool>(variable.value, false);
|
||||
auto value = hex::get_or<bool>(variable.value, false);
|
||||
ImGui::Checkbox(label.c_str(), &value);
|
||||
variable.value = value;
|
||||
} else if (variable.type == pl::core::Token::ValueType::Character) {
|
||||
|
||||
@@ -50,10 +50,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
for (auto &it : sortedCategories) {
|
||||
auto &[category, settings] = *it;
|
||||
if (ImGui::BeginTabItem(LangEntry(category))) {
|
||||
const std::string &categoryDesc = descriptions.count(category) ? descriptions.at(category) : category.name;
|
||||
if (ImGui::BeginTabItem(LangEntry(category.name))) {
|
||||
const std::string &categoryDesc = descriptions.contains(category.name) ? descriptions.at(category.name) : category.name;
|
||||
|
||||
LangEntry descriptionEntry{categoryDesc};
|
||||
ImGui::TextWrapped("%s", static_cast<const char*>(descriptionEntry));
|
||||
ImGui::TextFormattedWrapped("{}", descriptionEntry);
|
||||
ImGui::InfoTooltip(descriptionEntry);
|
||||
ImGui::Separator();
|
||||
|
||||
@@ -85,7 +86,7 @@ namespace hex::plugin::builtin {
|
||||
} else
|
||||
this->getWindowOpenState() = false;
|
||||
|
||||
if (this->getWindowOpenState() == false && this->m_restartRequested) {
|
||||
if (!this->getWindowOpenState() && this->m_restartRequested) {
|
||||
View::showYesNoQuestionPopup("hex.builtin.view.settings.restart_question"_lang, ImHexApi::Common::restartImHex, [] {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user