build: Make ImHex fully compile with warnings enabled in MSVC

This commit is contained in:
WerWolv
2025-02-10 09:42:35 +01:00
parent 3a7578879f
commit e1580e51cf
26 changed files with 70 additions and 43 deletions

View File

@@ -328,7 +328,7 @@ namespace hex {
result = defaultValue;
return result.get<T>();
} catch (const nlohmann::json::exception &e) {
} catch (const nlohmann::json::exception &) {
return defaultValue;
}
}

View File

@@ -400,8 +400,8 @@ namespace hex::gl {
T Sx, Cx, Sy, Cy, Sz, Cz;
Vector<T,3> angles = ypr;
if(!radians)
angles *= std::numbers::pi / 180;
if (!radians)
angles *= std::numbers::pi_v<T> / 180;
Sx = -sin(angles[0]); Cx = cos(angles[0]);
Sy = -sin(angles[1]); Cy = cos(angles[1]);
@@ -814,11 +814,11 @@ namespace hex::gl {
template<size_t N>
void setUniform(std::string_view name, const Vector<float, N> &value) {
if (N == 2)
if constexpr (N == 2)
glUniform2f(getUniformLocation(name), value[0], value[1]);
else if (N == 3)
else if constexpr (N == 3)
glUniform3f(getUniformLocation(name), value[0], value[1], value[2]);
else if (N == 4)
else if constexpr (N == 4)
glUniform4f(getUniformLocation(name), value[0], value[1], value[2],value[3]);
}

View File

@@ -278,7 +278,7 @@ namespace hex {
std::string result;
for (i16 bit = hex::bit_width(number) - 1; bit >= 0; bit -= 1)
result += (number & (0b1 << bit)) == 0 ? '0' : '1';
result += (number & (0b1LLU << bit)) == 0 ? '0' : '1';
return result;
}

View File

@@ -15,7 +15,7 @@
#if defined(_MSC_VER)
#include <windows.h>
#define PLUGIN_ENTRY_POINT extern "C" BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fwdReason, LPVOID lpReserved) { return TRUE; }
#define PLUGIN_ENTRY_POINT extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) { return TRUE; }
#else
#define PLUGIN_ENTRY_POINT
#endif