mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
sys: Enable -Wall, -Wextra, -Werror and fix all warnings on all Platforms (#483)
* sys: Make ImHex compile with -Wall -Wextra -Werror * sys: Fixed various build errors on Linux * sys: Explicitly ignore return value of `system` function * sys: More fixes for the warnings GitHub Actions enables somehow * sys: More fixes * sys: Remove -Werror again to see all GitHub Actions warnings * sys: Hopefully fixed all remaining warnings * sys: Added back -Werror * git: Change windows icon in GitHub Actions
This commit is contained in:
@@ -142,6 +142,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
evaluator.setFunction(
|
||||
"clear", [&](auto args) -> std::optional<long double> {
|
||||
hex::unused(args);
|
||||
|
||||
mathHistory.clear();
|
||||
lastMathError.clear();
|
||||
mathEvaluator.getVariables().clear();
|
||||
@@ -185,16 +187,16 @@ namespace hex::plugin::builtin {
|
||||
2,
|
||||
2);
|
||||
|
||||
return std::move(evaluator);
|
||||
return evaluator;
|
||||
}();
|
||||
|
||||
enum class MathDisplayType
|
||||
{
|
||||
enum class MathDisplayType : u8 {
|
||||
Standard,
|
||||
Scientific,
|
||||
Engineering,
|
||||
Programmer
|
||||
} mathDisplayType;
|
||||
} mathDisplayType = MathDisplayType::Standard;
|
||||
|
||||
if (ImGui::BeginTabBar("##mathFormatTabBar")) {
|
||||
if (ImGui::BeginTabItem("hex.builtin.tools.format.standard"_lang)) {
|
||||
mathDisplayType = MathDisplayType::Standard;
|
||||
@@ -235,8 +237,10 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::Button("CE", buttonSize)) mathInput.clear();
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_BACKSPACE, buttonSize)) mathInput.clear();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::NewLine();
|
||||
|
||||
switch (mathDisplayType) {
|
||||
case MathDisplayType::Standard:
|
||||
case MathDisplayType::Scientific:
|
||||
@@ -339,7 +343,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TableHeadersRow();
|
||||
while (clipper.Step()) {
|
||||
for (u64 i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
if (i == 0)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImU32(ImColor(0xA5, 0x45, 0x45)));
|
||||
|
||||
@@ -438,7 +442,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void drawBaseConverter() {
|
||||
static char buffer[4][0xFFF] = { { '0' }, { '0' }, { '0' }, { '0' } };
|
||||
static char buffer[4][0x1000] = { { '0' }, { '0' }, { '0' }, { '0' } };
|
||||
|
||||
static auto CharFilter = [](ImGuiInputTextCallbackData *data) -> int {
|
||||
switch (*static_cast<u32 *>(data->UserData)) {
|
||||
@@ -481,10 +485,15 @@ namespace hex::plugin::builtin {
|
||||
auto base8String = hex::format("{0:#o}", number);
|
||||
auto base2String = hex::toBinaryString(number);
|
||||
|
||||
std::strncpy(buffer[0], base10String.c_str(), sizeof(buffer[0]));
|
||||
std::strncpy(buffer[1], base16String.c_str(), sizeof(buffer[1]));
|
||||
std::strncpy(buffer[2], base8String.c_str(), sizeof(buffer[2]));
|
||||
std::strncpy(buffer[3], base2String.c_str(), sizeof(buffer[3]));
|
||||
std::strncpy(buffer[0], base10String.c_str(), sizeof(buffer[0]) - 1);
|
||||
std::strncpy(buffer[1], base16String.c_str(), sizeof(buffer[1]) - 1);
|
||||
std::strncpy(buffer[2], base8String.c_str(), sizeof(buffer[2]) - 1);
|
||||
std::strncpy(buffer[3], base2String.c_str(), sizeof(buffer[3]) - 1);
|
||||
|
||||
buffer[0][0xFFF] = '\x00';
|
||||
buffer[1][0xFFF] = '\x00';
|
||||
buffer[2][0xFFF] = '\x00';
|
||||
buffer[3][0xFFF] = '\x00';
|
||||
};
|
||||
|
||||
u8 base = 10;
|
||||
@@ -579,7 +588,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::Header("hex.builtin.tools.file_uploader.control"_lang, true);
|
||||
if (!uploading) {
|
||||
if (ImGui::Button("hex.builtin.tools.file_uploader.upload"_lang)) {
|
||||
fs::openFileBrowser("hex.builtin.tools.file_uploader.done"_lang, fs::DialogMode::Open, {}, [&](auto path) {
|
||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [&](auto path) {
|
||||
uploadProcess = net.uploadFile("https://api.anonfiles.com/upload", path);
|
||||
currFile = path;
|
||||
});
|
||||
@@ -678,7 +687,7 @@ namespace hex::plugin::builtin {
|
||||
startSearch = ImGui::InputText("##search", searchString, ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginDisabled(searchProcess.valid() && searchProcess.wait_for(0s) != std::future_status::ready || searchString.empty());
|
||||
ImGui::BeginDisabled((searchProcess.valid() && searchProcess.wait_for(0s) != std::future_status::ready) || searchString.empty());
|
||||
startSearch = ImGui::Button("hex.builtin.tools.wiki_explain.search"_lang) || startSearch;
|
||||
ImGui::EndDisabled();
|
||||
|
||||
@@ -744,7 +753,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::InputText("##path", selectedFile);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("...")) {
|
||||
fs::openFileBrowser("hex.builtin.tools.file_tools.shredder.picker"_lang, fs::DialogMode::Open, {}, [](const auto &path) {
|
||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
||||
selectedFile = path.string();
|
||||
});
|
||||
}
|
||||
@@ -886,7 +895,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::InputText("##path", selectedFile);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("...##input")) {
|
||||
fs::openFileBrowser("hex.builtin.tools.file_tools.splitter.picker.input"_lang, fs::DialogMode::Open, {}, [](const auto &path) {
|
||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
||||
selectedFile = path.string();
|
||||
});
|
||||
}
|
||||
@@ -896,7 +905,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::InputText("##base_path", baseOutputPath);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("...##output")) {
|
||||
fs::openFileBrowser("hex.builtin.tools.file_tools.splitter.picker.output"_lang, fs::DialogMode::Save, {}, [](const auto &path) {
|
||||
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
|
||||
baseOutputPath = path.string();
|
||||
});
|
||||
}
|
||||
@@ -979,7 +988,7 @@ namespace hex::plugin::builtin {
|
||||
static bool combining = false;
|
||||
static std::vector<std::string> files;
|
||||
static auto outputPath = [] { std::string s; s.reserve(0x1000); return s; }();
|
||||
static i32 selectedIndex;
|
||||
static u32 selectedIndex;
|
||||
|
||||
if (ImGui::BeginTable("files_table", 2, ImGuiTableFlags_SizingStretchProp)) {
|
||||
ImGui::TableSetupColumn("file list", ImGuiTableColumnFlags_NoHeaderLabel, 10);
|
||||
@@ -989,7 +998,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (ImGui::BeginListBox("##files", { -FLT_MIN, 10 * ImGui::GetTextLineHeightWithSpacing() })) {
|
||||
|
||||
i32 index = 0;
|
||||
u32 index = 0;
|
||||
for (auto &file : files) {
|
||||
if (ImGui::Selectable(std::fs::path(file).filename().string().c_str(), index == selectedIndex))
|
||||
selectedIndex = index;
|
||||
@@ -1025,7 +1034,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::BeginDisabled(combining);
|
||||
{
|
||||
if (ImGui::Button("hex.builtin.tools.file_tools.combiner.add"_lang)) {
|
||||
fs::openFileBrowser("hex.builtin.tools.file_tools.combiner.add.picker"_lang, fs::DialogMode::Open, {}, [](const auto &path) {
|
||||
fs::openFileBrowser(fs::DialogMode::Open, {}, [](const auto &path) {
|
||||
files.push_back(path.string());
|
||||
});
|
||||
}
|
||||
@@ -1049,7 +1058,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::InputText("##output_path", outputPath);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("...")) {
|
||||
fs::openFileBrowser("hex.builtin.tools.file_tools.combiner.output.picker"_lang, fs::DialogMode::Save, {}, [](const auto &path) {
|
||||
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
|
||||
outputPath = path.string();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user